Skip to content

Commit

Permalink
geosolutions-it#9250: Share plugin - Permalink functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuren1 committed Jul 18, 2023
1 parent ec69544 commit 5557e2a
Show file tree
Hide file tree
Showing 35 changed files with 1,662 additions and 26 deletions.
101 changes: 101 additions & 0 deletions docs/developer-guide/mapstore-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,107 @@ The old spring maven repositories that do not exist anymore have been removed fr
- </repository>
```

### New Permalink plugin

As part this release, permalink plugin is added to MS.

#### Add permalink to localConfig.json

- Update `localConfig.json` and add "Permalink" plugin to the "desktop", "dashboard" and "geostory" section

```json
{
"desktop": [
...
"Permalink",
...
],
"dashboard": [
...
"Permalink",
...
],
"geostory": [
...
"Permalink",
...
]
}
```

- Add new "permalink" section as shown below

```json
{
"permalink": [
"Permalink",
"FeedbackMask"
]
}
```

#### Using Permalink in new contexts

Contents of your `pluginsConfig.json` need to be reviewed to allow usage of new "Peramlink" in new contexts.
Existing contexts need to be updated separately.

- Find "Share" plugin configuration in `pluginsConfig.json` and modify as shown below:

```json
{
"name": "Share",
"glyph": "share",
"title": "plugins.Share.title",
"description": "plugins.Share.description",
"dependencies": [
"SidebarMenu"
],
"children": [
"Permalink"
],
"autoEnableChildren": [
"Permalink"
]
}
```

- Add "Permalink" plugin configuration to `pluginsConfig.json`

```json
{
"name": "Permalink",
"glyph": "link",
"title": "plugins.Permalink.title",
"description": "plugins.Permalink.description",
"denyUserSelection": true
},
```

#### Database Update

Add new category `PERMALINK` to `gs_category` table. To update your database you need to apply this SQL scripts to your database

##### PostgreSQL

```sql
-- New PERMALINK category
INSERT INTO geostore.gs_category(id, name) VALUES (nextval('geostore.hibernate_sequence'), 'PERMALINK') ON CONFLICT DO NOTHING;
```

##### H2

```sql
-- New PERMALINK category
INSERT INTO gs_category(name) VALUES ('PERMALINK');
```

##### Oracle

```sql
-- New PERMALINK category
INSERT INTO gs_category(id, name) VALUES (hibernate_sequence.nextval, ‘PERMALINK');
```
## Migration from 2022.02.02 to 2023.01.00
### Log4j update to Log4j2
Expand Down
3 changes: 3 additions & 0 deletions java/web/src/main/resources/sample_categories.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@
<Category>
<name>USERSESSION</name>
</Category>
<Category>
<name>PERMALINK</name>
</Category>
</CategoryList>
13 changes: 13 additions & 0 deletions project/standard/templates/configs/pluginsConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,21 @@
"description": "plugins.Share.description",
"dependencies": [
"SidebarMenu"
],
"children": [
"Permalink"
],
"autoEnableChildren": [
"Permalink"
]
},
{
"name": "Permalink",
"glyph": "link",
"title": "plugins.Permalink.title",
"description": "plugins.Permalink.description",
"denyUserSelection": true
},
{
"name": "BackgroundSelector",
"title": "plugins.BackgroundSelector.title",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@
<Category>
<name>USERSESSION</name>
</Category>
<Category>
<name>PERMALINK</name>
</Category>
</CategoryList>
65 changes: 65 additions & 0 deletions web/client/actions/__tests__/permalink-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright 2023, 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 {
LOAD_PERMALINK,
LOAD_PERMALINK_ERROR,
PERMALINK_LOADED,
LOADING,
RESET,
SAVE_PERMALINK,
UPDATE_SETTINGS,
loadPermalink,
loadPermalinkError,
permalinkLoaded,
permalinkLoading,
resetPermalink,
savePermalink,
updatePermalinkSettings
} from "../permalink";

describe("Test correctness of the permalink actions", () => {
it("loadPermalink", () => {
const action = loadPermalink("test");
expect(action.type).toBe(LOAD_PERMALINK);
expect(action.id).toBe("test");
});
it("loadPermalinkError", () => {
const error = {message: "error"};
const action = loadPermalinkError(error);
expect(action.type).toBe(LOAD_PERMALINK_ERROR);
expect(action.error).toEqual(error);
});
it("permalinkLoaded", () => {
const action = permalinkLoaded();
expect(action.type).toBe(PERMALINK_LOADED);
});
it("permalinkLoading", () => {
const action = permalinkLoading(true);
expect(action.type).toBe(LOADING);
expect(action.loading).toBeTruthy();
});
it("resetPermalink", () => {
const action = resetPermalink();
expect(action.type).toBe(RESET);
});
it("savePermalink", () => {
const saveObj = {name: "test"};
const action = savePermalink(saveObj);
expect(action.type).toBe(SAVE_PERMALINK);
expect(action.value).toEqual(saveObj);
});
it("updatePermalinkSettings", () => {
const settings = {title: "test"};
const action = updatePermalinkSettings(settings);
expect(action.type).toBe(UPDATE_SETTINGS);
expect(action.settings).toEqual(settings);
});
});
80 changes: 80 additions & 0 deletions web/client/actions/permalink.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* Copyright 2023, 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 LOAD_PERMALINK = "PERMALINK:LOAD";
export const PERMALINK_LOADED = "PERMALINK:LOADED";
export const LOAD_PERMALINK_ERROR = "PERMALINK:LOAD_ERROR";
export const SAVE_PERMALINK = "PERMALINK:SAVE";
export const UPDATE_SETTINGS = "PERMALINK:UPDATE_SETTINGS";
export const LOADING = "PERMALINK:LOADING";
export const RESET = "PERMALINK:RESET";

/**
* Load permalink
* @param {string} id
* @memberof actions.permalink
*/
export const loadPermalink = (id) => ({
type: LOAD_PERMALINK,
id
});

/**
* Trigger on permalink loaded
* @memberof actions.permalink
*/
export const permalinkLoaded = () => ({
type: PERMALINK_LOADED
});

/**
* Trigger on permalink load error
* @param {Object} error
* @memberof actions.permalink
*/
export const loadPermalinkError = (error) => ({
type: LOAD_PERMALINK_ERROR,
error
});

/**
* Trigger on save permalink
* @param {Object} value
* @memberof actions.permalink
*/
export const savePermalink = (value) => ({
type: SAVE_PERMALINK,
value
});

/**
* Trigger on update permalink settings
* @param {Object} settings
* @memberof actions.permalink
*/
export const updatePermalinkSettings = (settings) => ({
type: UPDATE_SETTINGS,
settings
});

/**
* Trigger on loading a permalink
* @param {boolean} loading
* @memberof actions.permalink
*/
export const permalinkLoading = (loading) => ({
type: LOADING,
loading
});

/**
* Trigger on permalink reset
* @memberof actions.permalink
*/
export const resetPermalink = () => ({
type: RESET
});
Loading

0 comments on commit 5557e2a

Please sign in to comment.