Skip to content

Commit

Permalink
Mapviewer resource (#1738)
Browse files Browse the repository at this point in the history
* Update mapstore submodule to branch 2024.01.xx (#1712)

* update mapstore submodule to branch 2024.01.xx

* fix ifc lib location

* [Backport] #1710 - Update calls with catalog_list preset (#1711) (#1716)

* #1657 - Add unadvertised identifier to the resource (#1658)

* #1657 - Add unadvertised identifier to the resource

* Code refactor

* [create-pull-request] automated change (#1659)

Co-authored-by: giohappy <giohappy@users.noreply.github.com>

* Update VERSION

* Enable group facets (#1662)

* [create-pull-request] automated change (#1663)

Co-authored-by: dsuren1 <dsuren1@users.noreply.github.com>

* [Fixes #1665] Django upgrade to 4.2 LTS (#1664)

* Upgrade Django version

* Upgrade Django version

* Upgrade Django version

* Upgrade to django 4.2

---------

Co-authored-by: mattiagiupponi <mattia.giupponi@gmail.com>

* Bump to 4.4.x dev

* #1678: Enable react-player for audio file resources (#1679)

* [create-pull-request] automated change (#1680)

Co-authored-by: giohappy <giohappy@users.noreply.github.com>

* configure REST API preset for catalog listing (#1709)

* #1710 - Update calls with catalog_list preset (#1711)

* #1710 - Update calls with catalog_list preset

* Update presets and api calls

* Add param serializer

---------

Co-authored-by: geosolutions-pr-generator[bot] <87376048+geosolutions-pr-generator[bot]@users.noreply.github.com>
Co-authored-by: giohappy <giohappy@users.noreply.github.com>
Co-authored-by: Giovanni Allegri <giovanni.allegri@gmail.com>
Co-authored-by: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com>
Co-authored-by: dsuren1 <dsuren1@users.noreply.github.com>
Co-authored-by: mattiagiupponi <mattia.giupponi@gmail.com>

* #1720: Improve layer setting visualisation (#1721)

* #1720: Improve layer setting visualisation

* pluginsconfig updated

* #1722: Fix - LayerSettings select dropdown are covered by titles (#1723)

* #1726: Fix - Tile format select input not shown (#1727)

* #1732: Fix - Chart widget header style (#1733)

* #1735: Fix - Map and other resources are loading indefinitely (#1736)

* #1728: Fix - Missing scrollbar for legend in datasets (#1729)

* #1730: Fix - Incorrect positioning of panels (#1731)

* #1730: Fix - Incorrect positioning of panels

* Unit test

---------

Co-authored-by: stefano bovio <stefano.bovio@geosolutionsgroup.com>
Co-authored-by: Suren <dsuren1@gmail.com>
Co-authored-by: geosolutions-pr-generator[bot] <87376048+geosolutions-pr-generator[bot]@users.noreply.github.com>
Co-authored-by: giohappy <giohappy@users.noreply.github.com>
Co-authored-by: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com>
Co-authored-by: dsuren1 <dsuren1@users.noreply.github.com>
Co-authored-by: mattiagiupponi <mattia.giupponi@gmail.com>
  • Loading branch information
8 people authored Apr 29, 2024
1 parent 99283fd commit 831a024
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import axios from '@mapstore/framework/libs/ajax';
import { testEpic } from '@mapstore/framework/epics/__tests__/epicTestUtils';
import {
gnViewerSetNewResourceThumbnail,
closeInfoPanelOnMapClick
closeInfoPanelOnMapClick,
closeDatasetCatalogPanel
} from '@js/epics/gnresource';
import {
setResourceThumbnail,
Expand All @@ -24,6 +25,7 @@ import { SET_CONTROL_PROPERTY } from '@mapstore/framework/actions/controls';
import {
SHOW_NOTIFICATION
} from '@mapstore/framework/actions/notifications';
import { newMapInfoRequest } from '@mapstore/framework/actions/mapInfo';

let mockAxios;

Expand Down Expand Up @@ -132,4 +134,44 @@ describe('gnresource epics', () => {
);

});
it('close dataset panels on map info panel open', (done) => {
const NUM_ACTIONS = 1;
const testState = {
context: {
currentContext: {
plugins: {
desktop: [
{name: "Identify"}
]
}
}
},
mapInfo: {
requests: ["something"]
},
controls: {
datasetsCatalog: {
enabled: true
}
}
};

testEpic(closeDatasetCatalogPanel,
NUM_ACTIONS,
newMapInfoRequest(),
(actions) => {
try {
expect(actions.length).toBe(1);
expect(actions[0].type).toBe(SET_CONTROL_PROPERTY);
expect(actions[0].control).toBe("datasetsCatalog");
expect(actions[0].value).toBe(false);
} catch (e) {
done(e);
}
done();
},
testState
);

});
});
12 changes: 10 additions & 2 deletions geonode_mapstore_client/client/js/epics/datasetscatalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { SET_CONTROL_PROPERTY } from '@mapstore/framework/actions/controls';
import { updateMapLayout, UPDATE_MAP_LAYOUT } from '@mapstore/framework/actions/maplayout';
import { mapLayoutSelector } from '@mapstore/framework/selectors/maplayout';
import { mapLayoutSelector, boundingSidebarRectSelector } from '@mapstore/framework/selectors/maplayout';
import { getConfigProp } from "@mapstore/framework/utils/ConfigUtils";
import { LayoutSections } from "@js/utils/LayoutUtils";

Expand All @@ -27,13 +27,21 @@ export const gnUpdateDatasetsCatalogMapLayout = (action$, store) =>
})
.map(({ layout }) => {
const mapLayout = getConfigProp('mapLayout') || { left: { sm: 300, md: 500, lg: 600 }, right: { md: 658 }, bottom: { sm: 30 } };
const boundingSidebarRect = boundingSidebarRectSelector(store.getState());
const left = !!store.getState()?.controls?.drawer?.enabled ? mapLayout.left.sm : null;
const action = updateMapLayout({
...mapLayoutSelector(store.getState()),
...layout,
right: mapLayout.right.md,
...(left && {left}),
boundingMapRect: {
...(layout?.boundingMapRect || {}),
right: mapLayout.right.md
right: mapLayout.right.md,
...(left && {left})
},
boundingSidebarRect: {
...boundingSidebarRect,
...layout.boundingSidebarRect
}
});
return { ...action, source: LayoutSections.PANEL }; // add an argument to avoid infinite loop.
Expand Down
22 changes: 21 additions & 1 deletion geonode_mapstore_client/client/js/epics/gnresource.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ import { STYLE_OWNER_NAME } from '@mapstore/framework/utils/StyleEditorUtils';
import { styleServiceSelector } from '@mapstore/framework/selectors/styleeditor';
import { updateStyleService } from '@mapstore/framework/api/StyleEditor';
import { CLICK_ON_MAP, resizeMap } from '@mapstore/framework/actions/map';
import { purgeMapInfoResults, closeIdentify } from '@mapstore/framework/actions/mapInfo';
import { purgeMapInfoResults, closeIdentify, NEW_MAPINFO_REQUEST } from '@mapstore/framework/actions/mapInfo';
import { saveError } from '@js/actions/gnsave';
import {
error as errorNotification,
Expand All @@ -113,6 +113,7 @@ import { setContext } from '@mapstore/framework/actions/context';
import { wrapStartStop } from '@mapstore/framework/observables/epics';
import { parseDevHostname } from '@js/utils/APIUtils';
import { ProcessTypes } from '@js/utils/ResourceServiceUtils';
import { catalogClose } from '@mapstore/framework/actions/catalog';

const resourceTypes = {
[ResourceTypes.DATASET]: {
Expand Down Expand Up @@ -579,6 +580,15 @@ export const closeOpenPanels = (action$, store) => action$.ofType(SET_CONTROL_PR
if (isMapInfoOpen(state)) {
setActions.push(purgeMapInfoResults(), closeIdentify());
}
const isDatasetCatalogPanelOpen = get(state, "controls.datasetsCatalog.enabled");
const isCatalogOpen = get(state, "controls.metadataexplorer.enabled");
const isVisualStyleEditorOpen = get(state, "controls.visualStyleEditor.enabled");
if ((isDatasetCatalogPanelOpen || isVisualStyleEditorOpen) && isCatalogOpen) {
setActions.push(catalogClose());
}
if (isDatasetCatalogPanelOpen && isVisualStyleEditorOpen) {
setActions.push(setControlProperty('datasetsCatalog', 'enabled', false));
}
const control = oneOfTheOther(action.control);
if (control?.control) {
if (state.controls?.rightOverlay?.enabled === 'DetailViewer' || state.controls?.rightOverlay?.enabled === 'Share') {
Expand All @@ -593,6 +603,15 @@ export const closeOpenPanels = (action$, store) => action$.ofType(SET_CONTROL_PR
return actions.length > 0 ? Observable.of(...actions) : Observable.empty();
});

/**
* Close dataset panels on map info panel open
*/
export const closeDatasetCatalogPanel = (action$, store) => action$.ofType(NEW_MAPINFO_REQUEST)
.filter(() => isMapInfoOpen(store.getState()) && get(store.getState(), "controls.datasetsCatalog.enabled"))
.switchMap(() => {
return Observable.of(setControlProperty('datasetsCatalog', 'enabled', false));
});

export const gnManageLinkedResource = (action$, store) =>
action$.ofType(MANAGE_LINKED_RESOURCE)
.switchMap((action) => {
Expand Down Expand Up @@ -636,5 +655,6 @@ export default {
gnViewerSetNewResourceThumbnail,
closeInfoPanelOnMapClick,
closeOpenPanels,
closeDatasetCatalogPanel,
gnManageLinkedResource
};
7 changes: 6 additions & 1 deletion geonode_mapstore_client/client/js/epics/layersettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { updateMapLayout, UPDATE_MAP_LAYOUT } from '@mapstore/framework/actions/maplayout';
import { mapLayoutSelector } from '@mapstore/framework/selectors/maplayout';
import { mapLayoutSelector, boundingSidebarRectSelector } from '@mapstore/framework/selectors/maplayout';
import { getConfigProp } from "@mapstore/framework/utils/ConfigUtils";
import { SHOW_SETTINGS } from '@mapstore/framework/actions/layers';
import { LayoutSections } from "@js/utils/LayoutUtils";
Expand All @@ -26,13 +26,18 @@ export const gnUpdateLayerSettingsMapLayout = (action$, store) =>
})
.map(({ layout }) => {
const mapLayout = getConfigProp('mapLayout') || { left: { sm: 300, md: 500, lg: 600 }, right: { md: 658 }, bottom: { sm: 30 } };
const boundingSidebarRect = boundingSidebarRectSelector(store.getState());
const action = updateMapLayout({
...mapLayoutSelector(store.getState()),
...layout,
left: mapLayout.left.sm,
boundingMapRect: {
...(layout?.boundingMapRect || {}),
left: mapLayout.left.sm
},
boundingSideBarReact: {
...boundingSidebarRect,
...layout.boundingSidebarRect
}
});
return { ...action, source: LayoutSections.PANEL }; // add an argument to avoid infinite loop.
Expand Down
7 changes: 6 additions & 1 deletion geonode_mapstore_client/client/js/epics/visualstyleeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import tinycolor from 'tinycolor2';
import { parseStyleName } from '@js/utils/ResourceUtils';
import { getStyleProperties } from '@js/api/geonode/style';
import { updateMapLayout, UPDATE_MAP_LAYOUT } from '@mapstore/framework/actions/maplayout';
import { mapLayoutSelector } from '@mapstore/framework/selectors/maplayout';
import { mapLayoutSelector, boundingSidebarRectSelector } from '@mapstore/framework/selectors/maplayout';
import { getConfigProp } from "@mapstore/framework/utils/ConfigUtils";
import { LayoutSections } from "@js/utils/LayoutUtils";

Expand Down Expand Up @@ -177,13 +177,18 @@ export const gnUpdateVisualStyleEditorMapLayout = (action$, store) =>
})
.map(({ layout }) => {
const mapLayout = getConfigProp('mapLayout') || { left: { sm: 300, md: 500, lg: 600 }, right: { md: 658 }, bottom: { sm: 30 } };
const boundingSidebarRect = boundingSidebarRectSelector(store.getState());
const action = updateMapLayout({
...mapLayoutSelector(store.getState()),
...layout,
left: mapLayout.left.md,
boundingMapRect: {
...(layout?.boundingMapRect || {}),
left: mapLayout.left.md
},
boundingSidebarRect: {
...boundingSidebarRect,
...layout.boundingSidebarRect
}
});
return { ...action, source: LayoutSections.PANEL }; // add an argument to avoid infinite loop.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,13 @@
.gn-legend-wrapper {
.ms-layers-tree {
padding-top: 0;
&.legend-tree {
.ms-node-layer {
ul {
max-height: 500px;
overflow: auto;
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
},
{
"name": "DrawerMenu",
"defaultConfig": {
"menuOptions": {
"width": 350
}
},
"hidden": true
},
{
Expand Down

0 comments on commit 831a024

Please sign in to comment.