From 29aa50a8cfc574992cfd367db540cca4a6bca9ab Mon Sep 17 00:00:00 2001 From: Sovas Tiwari Date: Wed, 28 Jan 2026 20:30:25 +0545 Subject: [PATCH 1/3] Remove the connections with other plugins --- web/client/epics/featuregrid.js | 79 ++------------------------------- web/client/epics/identify.js | 9 ---- web/client/epics/maplayout.js | 3 +- 3 files changed, 4 insertions(+), 87 deletions(-) diff --git a/web/client/epics/featuregrid.js b/web/client/epics/featuregrid.js index eb31092d4e..52c148a689 100644 --- a/web/client/epics/featuregrid.js +++ b/web/client/epics/featuregrid.js @@ -325,7 +325,6 @@ export const featureGridBrowseData = (action$, store) => const currentTypeName = get(store.getState(), "query.typeName"); return Rx.Observable.of( ...(currentTypeName !== layer.name ? [reset()] : []), - setControlProperty('drawer', 'enabled', false), setLayer(layer.id), openFeatureGrid() ).merge( @@ -803,24 +802,6 @@ export const resetEditingOnFeatureGridClose = (action$, store) => action$.ofType ); -/** - * close all dock panels at the right whenever feature editor is open - * @param action$ - * @param store - * @returns {Observable} - */ -export const closeRightPanelOnFeatureGridOpen = (action$, store) => - action$.ofType(OPEN_FEATURE_GRID) - .switchMap( () => { - const actions = []; - const state = store.getState(); - const rightPanels = dockPanelsSelector(state).right; - rightPanels.forEach(panel => { - if (createControlEnabledSelector(panel)(state)) actions.push(setControlProperty(panel, 'enabled', false)); - }); - return Rx.Observable.from(actions); - }); - /** * closes feature editor once another drawing tool is open * @param action$ @@ -919,10 +900,7 @@ export const resetGridOnLocationChange = action$ => action$.ofType(LOCATION_CHANGE) .take(1) .switchMap(() => - Rx.Observable.of( - toggleViewMode(), - closeFeatureGrid() - ) + Rx.Observable.of(toggleViewMode()) ) .takeUntil(action$.ofType(CLOSE_FEATURE_GRID)) ); @@ -940,7 +918,7 @@ export const autoCloseFeatureGridEpicOnDrowerOpen = (action$, store) => action$.ofType(OPEN_FEATURE_GRID).switchMap(() => action$.ofType(TOGGLE_CONTROL) .filter(action => action.control && action.control === 'drawer' && isFeatureGridOpen(store.getState())) - .switchMap(() => Rx.Observable.of(closeFeatureGrid(), selectFeatures([]))) + .switchMap(() => Rx.Observable.of(selectFeatures([]))) .takeUntil(action$.ofType(LOCATION_CHANGE)) ); export const askChangesConfirmOnFeatureGridClose = (action$, store) => action$.ofType(CLOSE_FEATURE_GRID_CONFIRM).switchMap( () => { @@ -975,59 +953,13 @@ export const removeWmsFilterOnGridClose = (action$, store) => // change are performed before it .takeUntil(action$.ofType(LOCATION_CHANGE, FEATURE_INFO_CLICK, OPEN_ADVANCED_SEARCH)) ); -/** - * re-opens the feature grid after it was closed by feature info click - */ -export const autoReopenFeatureGridOnFeatureInfoClose = (action$) => - action$.ofType(OPEN_FEATURE_GRID) - // need to finalize the flow before listen the next open event to avoid - // to catch open feature info triggered by this flow or advanced search - .switchMap(() => - Rx.Observable.race( - action$.ofType(FEATURE_INFO_CLICK).take(1), - action$.ofType(CLOSE_FEATURE_GRID).take(1) - ).exhaustMap((action) => action.type === CLOSE_FEATURE_GRID - // a close event stops the flow living it free to listen the next event - ? Rx.Observable.empty() - : action$ - // if feature info was clicked, wait for a feature info close to reopen the feature grid - .ofType(HIDE_MAPINFO_MARKER) - .switchMap(() => Rx.Observable.of(openFeatureGrid())) - - ).takeUntil( - action$.ofType(LOCATION_CHANGE, TOGGLE_CONTROL) - .filter(action => action.type === LOCATION_CHANGE || action.control && action.control === 'drawer') - .merge( - action$ - // a close feature grid event not between feature info click and hide mapinfo marker - .ofType(CLOSE_FEATURE_GRID) - .withLatestFrom( - action$ - .ofType(FEATURE_INFO_CLICK, HIDE_MAPINFO_MARKER) - .scan((acc, { type }) => { - switch (type) { - case FEATURE_INFO_CLICK: - return false; - case HIDE_MAPINFO_MARKER: - return true; - default: - return false; - } - }, true) - .startWith(true), - (a, b) => b - ).filter(e => e) - ) - ) - ); export const onOpenAdvancedSearch = (action$, store) => action$.ofType(OPEN_ADVANCED_SEARCH).switchMap(() => { return Rx.Observable.of( // hide selected features from map selectFeatures([]), loadFilter(get(store.getState(), `featuregrid.advancedFilters["${selectedLayerIdSelector(store.getState())}"]`)), - closeFeatureGrid('queryPanel'), setControlProperty('queryPanel', "enabled", true) ) .merge( @@ -1064,11 +996,6 @@ export const onFeatureGridZoomAll = (action$, store) => export const resetControlsOnEnterInEditMode = (action$) => action$.ofType(TOGGLE_MODE) .filter(a => a.mode === MODES.EDIT).map(() => resetControls(["query"])); -export const closeIdentifyWhenOpenFeatureGrid = (action$) => - action$.ofType(OPEN_FEATURE_GRID) - .switchMap(() => { - return Rx.Observable.of(closeIdentify()); - }); /** * start sync filter with wms layer * @@ -1211,7 +1138,7 @@ export const hideFeatureGridOnDrawerOpenMobile = (action$, { getState } = {}) => && getState().browser.mobile && drawerEnabledControlSelector(getState()) ) - .switchMap(() => Rx.Observable.of(hideMapinfoMarker(), closeFeatureGrid())); + .switchMap(() => Rx.Observable.of(hideMapinfoMarker())); export const hideDrawerOnFeatureGridOpenMobile = (action$, { getState } = {}) => action$ .ofType(FEATURE_INFO_CLICK) diff --git a/web/client/epics/identify.js b/web/client/epics/identify.js index 75a19af4bf..e9bd556e43 100644 --- a/web/client/epics/identify.js +++ b/web/client/epics/identify.js @@ -174,14 +174,6 @@ export const handleMapInfoMarker = (action$, {getState}) => // the visibility of the marker should manage by the identify tool .map(() => showMapinfoMarker() ); -export const closeFeatureGridFromIdentifyEpic = (action$, store) => - action$.ofType(LOAD_FEATURE_INFO) - .switchMap(() => { - if (isFeatureGridOpen(store.getState())) { - return Rx.Observable.of(closeFeatureGrid()); - } - return Rx.Observable.empty(); - }); /** * Check if something is editing in feature info. * If so, as to the proper tool to close (annotations) @@ -464,7 +456,6 @@ export const handleGetFeatureInfoForTimeParamsChange = (action$, {getState}) => export default { getFeatureInfoOnFeatureInfoClick, handleMapInfoMarker, - closeFeatureGridFromIdentifyEpic, closeFeatureAndAnnotationEditing, hideMarkerOnIdentifyCloseOrClearWarning, changeMapPointer, diff --git a/web/client/epics/maplayout.js b/web/client/epics/maplayout.js index 05b9067e44..eb3327cd1e 100644 --- a/web/client/epics/maplayout.js +++ b/web/client/epics/maplayout.js @@ -10,7 +10,7 @@ import Rx from 'rxjs'; import {UPDATE_DOCK_PANELS, updateMapLayout, FORCE_UPDATE_MAP_LAYOUT} from '../actions/maplayout'; import {TOGGLE_CONTROL, SET_CONTROL_PROPERTY, SET_CONTROL_PROPERTIES, setControlProperty} from '../actions/controls'; import { MAP_CONFIG_LOADED } from '../actions/config'; -import {SIZE_CHANGE, CLOSE_FEATURE_GRID, OPEN_FEATURE_GRID, closeFeatureGrid} from '../actions/featuregrid'; +import {SIZE_CHANGE, CLOSE_FEATURE_GRID, OPEN_FEATURE_GRID} from '../actions/featuregrid'; import { CLOSE_IDENTIFY, @@ -195,7 +195,6 @@ export const updateActiveDockEpic = (action$, store) => const dockList = dockPanelsSelector(state); const isLeft = location === 'left' || dockList.left.includes(panelName); const isRight = location === 'right' || dockList.right.includes(panelName); - (isLeft || isRight) && actions.push(closeFeatureGrid()); if (action !== 'remove') { isLeft && dockList.left.forEach(i => { if (i !== panelName && state?.controls[i]?.enabled) actions.push(setControlProperty(i, 'enabled', null)); From 2d343acc7514547d0ddd1270cc2d07b971ba67fe Mon Sep 17 00:00:00 2001 From: Sovas Tiwari Date: Wed, 28 Jan 2026 20:56:40 +0545 Subject: [PATCH 2/3] Fix the eslint issue --- .../epics/__tests__/featuregrid-test.js | 130 ------------------ web/client/epics/featuregrid.js | 5 +- web/client/epics/identify.js | 2 +- 3 files changed, 3 insertions(+), 134 deletions(-) diff --git a/web/client/epics/__tests__/featuregrid-test.js b/web/client/epics/__tests__/featuregrid-test.js index d34334f2e2..92b5e3d4cf 100644 --- a/web/client/epics/__tests__/featuregrid-test.js +++ b/web/client/epics/__tests__/featuregrid-test.js @@ -11,8 +11,6 @@ import expect from 'expect'; import { set } from '../../utils/ImmutableUtils'; import CoordinatesUtils from '../../utils/CoordinatesUtils'; import { - CLOSE_IDENTIFY, - hideMapinfoMarker, featureInfoClick, HIDE_MAPINFO_MARKER } from '../../actions/mapInfo'; @@ -95,7 +93,6 @@ import { setHighlightFeaturesPath, triggerDrawSupportOnSelectionChange, featureGridLayerSelectionInitialization, - closeRightPanelOnFeatureGridOpen, deleteGeometryFeature, onFeatureGridCreateNewFeature, resetGridOnLocationChange, @@ -106,7 +103,6 @@ import { onCloseFeatureGridConfirmed, onFeatureGridZoomAll, resetControlsOnEnterInEditMode, - closeIdentifyWhenOpenFeatureGrid, startSyncWmsFilter, stopSyncWmsFilter, handleDrawFeature, @@ -117,7 +113,6 @@ import { onOpenAdvancedSearch, virtualScrollLoadFeatures, removeWmsFilterOnGridClose, - autoReopenFeatureGridOnFeatureInfoClose, featureGridChangePage, featureGridSort, replayOnTimeDimensionChange, @@ -935,57 +930,6 @@ describe('featuregrid Epics', () => { }, {}); }); - it('test closeRightPanelOnFeatureGridOpen', (done) => { - testEpic(closeRightPanelOnFeatureGridOpen, 3, openFeatureGrid(), actions => { - expect(actions.length).toBe(3); - actions.map((action, i) => { - switch (action.type) { - case SET_CONTROL_PROPERTY: { - switch (i) { - case 0: { - expect(action.control).toBe('mapCatalog'); - expect(action.property).toBe('enabled'); - expect(action.value).toBe(false); - expect(action.toggle).toBe(undefined); - break; - } - case 1: { - expect(action.control).toBe('mapTemplates'); - expect(action.property).toBe('enabled'); - expect(action.value).toBe(false); - expect(action.toggle).toBe(undefined); - break; - } - case 2: { - expect(action.control).toBe('metadataexplorer'); - expect(action.property).toBe('enabled'); - expect(action.value).toBe(false); - expect(action.toggle).toBe(undefined); - break; - } - default: expect(true).toBe(false); - } - break; - } - default: - expect(true).toBe(false); - } - }); - done(); - }, { - maplayout: { - dockPanels: { - right: ['mapCatalog', 'mapTemplates', 'metadataexplorer', 'userExtensions', 'details'] - } - }, - controls: { - metadataexplorer: { enabled: true}, - mapCatalog: { enabled: true}, - mapTemplates: { enabled: true} - } - }); - }); - it('test closeFeatureGridOnDrawingToolOpen', (done) => { testEpic(addTimeoutEpic(closeFeatureGridOnDrawingToolOpen, 100), 1, registerEventListener("click", "anotherPlugin"), actions => { expect(actions.length).toBe(1); @@ -1217,23 +1161,6 @@ describe('featuregrid Epics', () => { }, {}); }); - it('test closeIdentifyWhenOpenFeatureGrid', (done) => { - testEpic(closeIdentifyWhenOpenFeatureGrid, 1, openFeatureGrid(), actions => { - expect(actions.length).toBe(1); - actions.map((action) => { - switch (action.type) { - case CLOSE_IDENTIFY: - expect(action.type).toBe(CLOSE_IDENTIFY); - break; - default: - expect(true).toBe(false); - } - }); - done(); - }, {}); - }); - - it('test stopSyncWmsFilter', (done) => { testEpic(stopSyncWmsFilter, 2, toggleSyncWms(), actions => { expect(actions.length).toBe(2); @@ -1723,63 +1650,6 @@ describe('featuregrid Epics', () => { featuregrid: { selectedLayer: "TEST" } }); }); - it('autoReopenFeatureGridOnFeatureInfoClose', done => { - const epicResult = actions => { - expect(actions.length).toBe(1); - actions.map((action) => { - if (action.type === OPEN_FEATURE_GRID) { - done(); - } - }); - }; - testEpic(autoReopenFeatureGridOnFeatureInfoClose, 1, [openFeatureGrid(), featureInfoClick(), hideMapinfoMarker(), closeFeatureGrid()], epicResult ); - }); - it('autoReopenFeatureGridOnFeatureInfoClose: cancel ability to reopen feature grid on drawer toggle control', done => { - const epicResult = actions => { - expect(actions.length).toBe(1); - expect(actions[0].type).toBe(TEST_TIMEOUT); - done(); - }; - testEpic(addTimeoutEpic(autoReopenFeatureGridOnFeatureInfoClose), 1, [openFeatureGrid(), featureInfoClick(), toggleControl('drawer'), hideMapinfoMarker(), closeFeatureGrid()], epicResult); - }); - it('autoReopenFeatureGridOnFeatureInfoClose flow restarts on new open feature grid ', done => { - // This prevents event loops with other epics - // that trigger feature info hideMarker - const epicResult = actions => { - expect(actions.length).toBe(1); - actions.map((action) => { - if (action.type === TEST_TIMEOUT) { - done(); - } - }); - }; - testEpic(addTimeoutEpic(autoReopenFeatureGridOnFeatureInfoClose), 1, [openFeatureGrid(), featureInfoClick(), openFeatureGrid(), hideMapinfoMarker(), closeFeatureGrid()], epicResult); - }); - it('autoReopenFeatureGridOnFeatureInfoClose: other toggle control apart from drawer cannot cancel ability to open feature grid', done => { - const epicResult = actions => { - expect(actions.length).toBe(1); - expect(actions[0].type).toBe(OPEN_FEATURE_GRID); - done(); - }; - testEpic(autoReopenFeatureGridOnFeatureInfoClose, 1, [openFeatureGrid(), featureInfoClick(), toggleControl('notdrawer'), hideMapinfoMarker(), closeFeatureGrid()], epicResult ); - }); - - it('autoReopenFeatureGridOnFeatureInfoClose: feature info doesn\'t reopen feature grid after close', done => { - const epicResult = actions => { - expect(actions.length).toBe(2); - expect(actions[0].type).toBe(OPEN_FEATURE_GRID); - expect(actions[1].type).toBe(TEST_TIMEOUT); - done(); - }; - testEpic(addTimeoutEpic(autoReopenFeatureGridOnFeatureInfoClose, 20), 2, [ - openFeatureGrid(), - featureInfoClick(), - hideMapinfoMarker(), - closeFeatureGrid(), - featureInfoClick(), - hideMapinfoMarker()], - epicResult); - }); it('featureGridChangePage', done => { const epicResult = actions => { diff --git a/web/client/epics/featuregrid.js b/web/client/epics/featuregrid.js index 52c148a689..94f24a9c9d 100644 --- a/web/client/epics/featuregrid.js +++ b/web/client/epics/featuregrid.js @@ -22,7 +22,7 @@ import { } from '../actions/draw'; import requestBuilder from '../utils/ogc/WFST/RequestBuilder'; import { findGeometryProperty } from '../utils/ogc/WFS/base'; -import { FEATURE_INFO_CLICK, HIDE_MAPINFO_MARKER, closeIdentify, hideMapinfoMarker } from '../actions/mapInfo'; +import { FEATURE_INFO_CLICK, hideMapinfoMarker } from '../actions/mapInfo'; import { query, @@ -120,7 +120,7 @@ import { import { queryPanelSelector, - drawerEnabledControlSelector, createControlEnabledSelector + drawerEnabledControlSelector } from '../selectors/controls'; import { setHighlightFeaturesPath as setHighlightFeaturesPathAction } from '../actions/highlight'; @@ -163,7 +163,6 @@ import {isSnappingActive} from "../selectors/draw"; import { composeAttributeFilters } from '../utils/FilterUtils'; import CoordinatesUtils from '../utils/CoordinatesUtils'; import MapUtils from '../utils/MapUtils'; -import {dockPanelsSelector} from "../selectors/maplayout"; import {shutdownToolOnAnotherToolDrawing} from "../utils/ControlUtils"; import {mapTypeSelector} from "../selectors/maptype"; import { MapLibraries } from '../utils/MapTypeUtils'; diff --git a/web/client/epics/identify.js b/web/client/epics/identify.js index e9bd556e43..597c42fedf 100644 --- a/web/client/epics/identify.js +++ b/web/client/epics/identify.js @@ -24,7 +24,7 @@ import { import { SET_CONTROL_PROPERTIES, SET_CONTROL_PROPERTY, TOGGLE_CONTROL } from '../actions/controls'; -import { closeFeatureGrid, updateFilter, toggleEditMode, CLOSE_FEATURE_GRID } from '../actions/featuregrid'; +import { updateFilter, toggleEditMode, CLOSE_FEATURE_GRID } from '../actions/featuregrid'; import { QUERY_CREATE } from '../actions/wfsquery'; import { CHANGE_MOUSE_POINTER, CLICK_ON_MAP, UNREGISTER_EVENT_LISTENER, CHANGE_MAP_VIEW, MOUSE_MOVE, zoomToPoint, changeMapView, registerEventListener, unRegisterEventListener, zoomToExtent} from '../actions/map'; From 9fb39c17fd95d40c7c94d6997b405568aa8e4e08 Mon Sep 17 00:00:00 2001 From: Sovas Tiwari Date: Thu, 29 Jan 2026 12:22:33 +0545 Subject: [PATCH 3/3] Fix the test case --- .../epics/__tests__/featuregrid-test.js | 38 +++++++------------ 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/web/client/epics/__tests__/featuregrid-test.js b/web/client/epics/__tests__/featuregrid-test.js index 92b5e3d4cf..6a0f055860 100644 --- a/web/client/epics/__tests__/featuregrid-test.js +++ b/web/client/epics/__tests__/featuregrid-test.js @@ -638,24 +638,19 @@ describe('featuregrid Epics', () => { const LAYER = state.layers.flat[0]; it('browseData action initializes featuregrid', done => { - testEpic(featureGridBrowseData, 5, browseData(LAYER), ([ a1, a2, a3, a4, a5 ]) => { + testEpic(featureGridBrowseData, 4, browseData(LAYER), ([ a1, a2, a3, a4 ]) => { try { expect(a1.type).toBe(QUERY_FORM_RESET); - // close TOC - expect(a2.type).toBe(SET_CONTROL_PROPERTY); - expect(a2.control).toBe('drawer'); - expect(a2.property).toBe('enabled'); - expect(a2.value).toBe(false); // set feature grid layer - expect(a3.type).toBe(SET_LAYER); - expect(a3.id).toBe(LAYER.id); + expect(a2.type).toBe(SET_LAYER); + expect(a2.id).toBe(LAYER.id); // open feature grid - expect(a4.type).toBe(OPEN_FEATURE_GRID); + expect(a3.type).toBe(OPEN_FEATURE_GRID); // sets the feature type selected for search - expect(a5.type).toBe(FEATURE_TYPE_SELECTED); + expect(a4.type).toBe(FEATURE_TYPE_SELECTED); // check fields of layer are passed if any - expect(a5.fields.length).toBe(1); - expect(a5.fields).toBe(LAYER.fields); + expect(a4.fields.length).toBe(1); + expect(a4.fields).toBe(LAYER.fields); done(); } catch (e) { done(e); @@ -1000,13 +995,10 @@ describe('featuregrid Epics', () => { }); it('test resetGridOnLocationChange', (done) => { - testEpic(resetGridOnLocationChange, 2, [openFeatureGrid(), onLocationChanged({})], actions => { - expect(actions.length).toBe(2); + testEpic(resetGridOnLocationChange, 1, [openFeatureGrid(), onLocationChanged({})], actions => { + expect(actions.length).toBe(1); actions.map((action) => { switch (action.type) { - case CLOSE_FEATURE_GRID: - expect(action.features).toBe(undefined); - break; case TOGGLE_MODE: expect(action.mode).toBe(MODES.VIEW); break; @@ -1050,13 +1042,10 @@ describe('featuregrid Epics', () => { open: true } }; - testEpic(autoCloseFeatureGridEpicOnDrowerOpen, 2, [openFeatureGrid(), toggleControl('drawer')], actions => { - expect(actions.length).toBe(2); + testEpic(autoCloseFeatureGridEpicOnDrowerOpen, 1, [openFeatureGrid(), toggleControl('drawer')], actions => { + expect(actions.length).toBe(1); actions.map((action) => { switch (action.type) { - case CLOSE_FEATURE_GRID: - expect(action.type).toBe(CLOSE_FEATURE_GRID); - break; case SELECT_FEATURES: expect(action.type).toBe(SELECT_FEATURES); break; @@ -1854,13 +1843,12 @@ describe('featuregrid Epics', () => { it('toggle featureGrid when drawer is opened - MOBILE ONLY', done => { const epicResult = actions => { - expect(actions.length).toBe(2); + expect(actions.length).toBe(1); expect(actions[0].type).toBe(HIDE_MAPINFO_MARKER); - expect(actions[1].type).toBe(CLOSE_FEATURE_GRID); done(); }; - testEpic(hideFeatureGridOnDrawerOpenMobile, 2, toggleControl('drawer', null), epicResult, TEST_STATE_BASE); + testEpic(hideFeatureGridOnDrawerOpenMobile, 1, toggleControl('drawer', null), epicResult, TEST_STATE_BASE); }); it('do not toggle featureGrid when drawer is closed - MOBILE ONLY', done => { const TEST_STATE_CLOSED_DRAWER = set('controls.drawer.enabled', false, TEST_STATE_BASE);