Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2022.01.xx-georchestra] #8086 Layout changes and other improvements (#8085) #8175

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions docs/developer-guide/mapstore-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,90 @@ This is a list of things to check if you want to update from a previous version
- Follow the instructions below, in order, from your version to the one you want to update to.


### Replacing BurgerMenu with SidebarMenu
There were several changes applied to the application layout, one of them is the Sidebar Menu that comes to replace Burger menu on map viewer and in contexts.
Following actions need to be applied to make a switch:
- Update localConfig.json and add "SidebarMenu" entry to the "desktop" section:
```json
{
"desktop": [
...
"SidebarMenu",
...
]
}
```
- Remove "BurgerMenu" entry from "desktop" section.

#### Updating contexts to use Sidebar Menu

Contents of your `pluginsConfig.json` need to be reviewed to allow usage of new "SidebarMenu" in contexts.

- Find "BurgerMenu" plugin confuguration in `pluginsConfig.json` and remove `"hidden": true` line from it:

```json
{
"name": "BurgerMenu",
"glyph": "menu-hamburger",
"title": "plugins.BurgerMenu.title",
"description": "plugins.BurgerMenu.description",
"dependencies": [
"OmniBar"
]
}
```

- Add `SidebarMenu` entry to the "plugins" array:

```json
{
"plugins": [
...
{
"name": "SidebarMenu",
"hidden": true
}
...
]
}
```

- Go through all plugins definitions and replace `BurgerMenu` dependency with `SidebarMenu`, e.g.:

```json
{
"name": "MapExport",
"glyph": "download",
"title": "plugins.MapExport.title",
"description": "plugins.MapExport.description",
"dependencies": [
"SidebarMenu"
]
}
```

- Also the `StreetView` plugin needs to depend from `SidebarMenu`.

```json
{
"name": "StreetView",
"glyph": "road",
"title": "plugins.StreetView.title",
"description": "plugins.StreetView.description",
"dependencies": [
"SidebarMenu"
]
}
```


## Migration from 2022.01.00 to 2022.01.01

### MailingLists plugin has been removed

`MailingLists` plugin has ben removed from the core of MapStore. This means you can remove it from your `localConfig.json` (if present, it will be anyway ignored by the plugin system).


## Migration from 2021.02.02 to 2022.01.00

This release includes several libraries upgrade on the backend side,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
"react-codemirror2": "4.0.0",
"react-color": "2.17.0",
"react-confirm-button": "0.0.2",
"react-container-dimensions": "1.3.2",
"react-container-dimensions": "1.4.1",
"react-contenteditable": "3.3.2",
"react-copy-to-clipboard": "5.0.0",
"react-data-grid": "5.0.4",
Expand Down
19 changes: 19 additions & 0 deletions web/client/actions/__tests__/sidebarmenu-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Copyright 2022, GeoSolutions Sas.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/

import expect from 'expect';
import {SET_LAST_ACTIVE_ITEM, setLastActiveItem} from "../sidebarmenu";

describe('Test correctness of the sidebar actions', () => {

it('test setLastActiveItem', () => {
const action = setLastActiveItem("annotations");
expect(action.type).toBe(SET_LAST_ACTIVE_ITEM);
expect(action.value).toBe("annotations");
});
});
16 changes: 16 additions & 0 deletions web/client/actions/sidebarmenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright 2022, GeoSolutions Sas.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/

export const SET_LAST_ACTIVE_ITEM = 'SIDEBARMENU:SET_LAST_ACTIVE_ITEM';

export function setLastActiveItem(value) {
return {
type: SET_LAST_ACTIVE_ITEM,
value
};
}
2 changes: 2 additions & 0 deletions web/client/components/TOC/Toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Toolbar extends React.Component {
static propTypes = {
groups: PropTypes.array,
items: PropTypes.array,
layers: PropTypes.array,
selectedLayers: PropTypes.array,
generalInfoFormat: PropTypes.string,
selectedGroups: PropTypes.array,
Expand All @@ -41,6 +42,7 @@ class Toolbar extends React.Component {
static defaultProps = {
groups: [],
items: [],
layers: [],
selectedLayers: [],
selectedGroups: [],
onToolsActions: {
Expand Down
22 changes: 13 additions & 9 deletions web/client/components/contextcreator/ContextCreator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import ConfigureMap from './ConfigureMapStep';
import ConfigureThemes from './ConfigureThemes';
import {CONTEXT_TUTORIALS} from '../../actions/contextcreator';
/**
* Filters plugins and applies overrides.
* The resulting array will filter the pluginsConfig returning only the ones present in viewerPlugins.
* Merges plugins "cfg" from pluginsConfigs and applies "overrides" from viewerPlugins.
* The resulting array will return viewerPlugins with "cfg" applied directly from the pluginsConfigs and optionally overridden
* with "overrides" from viewerPlugins.
* If some viewerPlugin is an object, it can contain a special entry "overrides". If so, the configuration here
* will override the ones in the original plugin config.
* Actually overrides are supported only for "cfg" values.
Expand Down Expand Up @@ -46,17 +47,20 @@ import {CONTEXT_TUTORIALS} from '../../actions/contextcreator';
* "cfg": { activateQueryTool: false, otherOptions: true }
* },
* ```
* NOTE: Logic has changed to support custom list of plugins to be active on the map configuration step of context wizard.
* The final result will match previous implementation except that it will also contain plugins that are missing
* in "viewer"/"desktop" array inside localConfig.json -> plugins
* @param {array} pluginsConfigs array of plugins (Strings or objects) to override
* @param {array} viewerPlugins list of plugins to use
*/
export const pluginsFilterOverride = (pluginsConfigs, viewerPlugins) => {
return pluginsConfigs.map(p => {
const pName = isObject(p) ? p.name : p;
return viewerPlugins.map((viewerPlugin) => {
const pName = isObject(viewerPlugin) ? viewerPlugin.name : viewerPlugin;
// find out
const viewerPlugin = find(viewerPlugins, vp => {
return pName === (isObject(vp) ? vp.name : vp);
const p = find(pluginsConfigs, plugin => {
return pName === (isObject(plugin) ? plugin.name : plugin);
});
if (viewerPlugin) {
if (p) {
if (isObject(viewerPlugin) && viewerPlugin.overrides) {
const newP = isObject(p) ? p : { name: p };
const cfg = {
Expand All @@ -70,8 +74,8 @@ export const pluginsFilterOverride = (pluginsConfigs, viewerPlugins) => {
}
return p;
}
return null;
}).filter(p => p); // remove plugins not found
return viewerPlugin;
});
};

export default class ContextCreator extends React.Component {
Expand Down
Loading