From 9146423eec495d74f1f3d77469e484231b908b75 Mon Sep 17 00:00:00 2001 From: flisowna Date: Fri, 23 Dec 2022 12:01:23 +0100 Subject: [PATCH] geo data map bug: debug via reducing complexity - step 1 --- packages/nc-gui/components/smartsheet/Map.vue | 67 ------------------- 1 file changed, 67 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/Map.vue b/packages/nc-gui/components/smartsheet/Map.vue index 6c604a8000..c95425bedb 100644 --- a/packages/nc-gui/components/smartsheet/Map.vue +++ b/packages/nc-gui/components/smartsheet/Map.vue @@ -68,24 +68,6 @@ const getMapZoomLocalStorageKey = (viewId: string) => { } const getMapCenterLocalStorageKey = (viewId: string) => `mapView.center.${viewId}` -const expandForm = (row: RowType, state?: Record) => { - const rowId = extractPkFromRow(row.row, meta.value!.columns!) - - // debugger - - if (rowId) { - router.push({ - query: { - ...route.query, - rowId, - }, - }) - } else { - expandedFormRow.value = row - expandedFormRowState.value = state - expandedFormDlg.value = true - } -} const expandedFormOnRowIdDlg = computed({ get() { @@ -112,55 +94,6 @@ reloadViewDataHook?.on(async () => { loadMapMeta() }) -function addMarker(lat: number, long: number, row: RowType) { - if (markersClusterGroupRef.value == null) { - throw new Error('Map is null') - } - const newMarker = L.marker([lat, long]).on('click', () => { - expandForm(row) - }) - markersClusterGroupRef.value?.addLayer(newMarker) - - // if (newMarker) { - // newMarker.bindPopup(popupContent) - // } -} - -watch([formattedData, mapMetaData, markersClusterGroupRef], () => { - if (markersClusterGroupRef.value == null) { - return - } - - markersClusterGroupRef.value?.clearLayers() - - formattedData.value?.forEach((row) => { - const primaryGeoDataColumnTitle = geoDataFieldColumn.value?.title - - if (primaryGeoDataColumnTitle == null) { - throw new Error('Cannot find primary geo data column title') - } - - const primaryGeoDataValue = row.row[primaryGeoDataColumnTitle] - - // const listItems = Object.entries(row) - // .map(([key, val]) => { - // const prettyVal = val !== null && (typeof val === 'object' || Array.isArray(val)) ? JSON.stringify(val) : val - - // return `
  • ${key}:
    ${prettyVal}
  • ` - // }) - // .join('') - - // const popupContent = `` - - if (primaryGeoDataValue == null) { - return - } - - const [lat, long] = primaryGeoDataValue.split(';').map(parseFloat) - - addMarker(lat, long, row) - }) -}) const resetZoomAndCenterBasedOnLocalStorage = () => { if (mapMetaData?.value?.fk_view_id == null) {