Browse Source

MapView: 'Mapped by' column values should always be delivered - new approach - WIP

pull/4749/head
Daniel Spaude 2 years ago
parent
commit
e541410412
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 1
      packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue
  2. 30
      packages/nocodb/src/lib/models/MapView.ts
  3. 8
      packages/nocodb/src/lib/models/View.ts

1
packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue

@ -58,6 +58,7 @@ eventBus.on((event) => {
}
else if (event === SmartsheetStoreEvents.MAPPED_BY_COLUMN_CHANGE) {
// alert('SmartsheetStoreEvents.MAPPED_BY_COLUMN_CHANGE')
debugger
loadViewColumns()
}
})

30
packages/nocodb/src/lib/models/MapView.ts

@ -3,7 +3,9 @@ import { MapType } from 'nocodb-sdk';
import { CacheGetType, CacheScope, MetaTable } from '../utils/globals';
import View from './View';
import NocoCache from '../cache/NocoCache';
import Column from './Column';
import MapViewColumn from './MapViewColumn';
// import Column from './Column';
// import MapViewColumn from './MapViewColumn';
// import Column from './Column';
export default class MapView implements MapType {
@ -115,12 +117,30 @@ export default class MapView implements MapType {
if (body.fk_geo_data_col_id != null) {
// TODO: check, whether potentially also the 'o' object can
const FOO_EXISTING_COL = await Column.get({
colId: body.fk_geo_data_col_id,
// const FOO_MAP_VIEW_COL = await MapViewColumn.get({
// fk_col_id: body.fk_geo_data_col_id,
// });
// const FOO_MAP_VIEW_COLS = await View.getColumns(body.fk_geo_data_col_id);
// const FOO_MAP_VIEW_COL = FOO_MAP_VIEW_COLS.find((column) => column.fk_column_id === body.fk_geo_data_col_id);
const FOO_mapViewColumns = await MapViewColumn.list(mapId);
const FOO_MATCHED_mapViewColumn = FOO_mapViewColumns.find(
(mapViewColumn) =>
mapViewColumn.fk_column_id === body.fk_geo_data_col_id
);
console.log('FOO_MATCHED_mapViewColumn', FOO_MATCHED_mapViewColumn);
await View.updateColumn(body.fk_view_id, FOO_MATCHED_mapViewColumn.id, {
show: true,
});
const FOO_NEW_COL = { ...FOO_EXISTING_COL, show: true };
await Column.update(body.fk_geo_data_col_id, FOO_NEW_COL);
// MapViewColumn.
// const FOO_EXISTING_COL = await Column.get({
// colId: body.fk_geo_data_col_id,
// });
// const FOO_NEW_COL = { ...FOO_EXISTING_COL, show: true };
// await Column.update(body.fk_geo_data_col_id, FOO_NEW_COL);
}
// update meta

8
packages/nocodb/src/lib/models/View.ts

@ -17,7 +17,6 @@ import Filter from './Filter';
import {
ColumnReqType,
isSystemColumn,
MapType,
UITypes,
ViewType,
ViewTypes,
@ -1166,10 +1165,15 @@ export default class View implements ViewType {
const dataList = await NocoCache.getList(scope, [viewId]);
// (view.type !== ViewTypes.MAP || (view as MapType).fk_geo_data_col_id === o
// if(view.type === ViewTypes.MAP){
// console.log('view.type === ViewTypes.MAP');
// const mapView = (await MapView.get(viewId)).fk_geo_data_col_id;
// }
const mergedIgnoreColdIds = [
...ignoreColdIds,
...(view.type === ViewTypes.MAP
? [(view as MapType).fk_geo_data_col_id]
? [(await MapView.get(viewId)).fk_geo_data_col_id]
: []),
];

Loading…
Cancel
Save