Skip to content

Commit

Permalink
geosolutions-it#9250: Error handler updated for missing category
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuren1 committed Aug 1, 2023
1 parent 2a6113c commit 0942461
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
19 changes: 19 additions & 0 deletions docs/developer-guide/mapstore-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,25 @@ Existing contexts need to be updated separately, after applying these changes
},
```

- the app pages inside a MapStore project must be updated with a new entry, only for projects using permalink feature, here an example:

```js
import Permalink from '@mapstore/product/pages/Permalink';
import productAppConfig from "@mapstore/product/appConfig";

const appConfig = {
...productAppConfig,
pages: [
// my custom pages ...,
{
name: "permalink",
path: "/permalink/:pid",
component: Permalink
}
]
};
```

#### Database Update

Add new category `PERMALINK` to `gs_category` table. To update your database you need to apply this SQL scripts to your database
Expand Down
5 changes: 2 additions & 3 deletions web/client/epics/permalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { Observable } from "rxjs";
import { push } from "connected-react-router";
import pick from "lodash/pick";
import get from "lodash/get";
import isString from "lodash/isString";
import template from "lodash/template";

import API from "../api/GeoStoreDAO";
Expand Down Expand Up @@ -73,7 +72,7 @@ const PERMALINK_RESOURCES = {

const permalinkErrorHandler = (state) =>
(e, stream$) => {
if (e.status === 404 && isString(e.data) && e.data.indexOf('Resource Category not found') > -1) {
if (e.status === 404) { // Upon saving a permalink, the only instance when a 404 can happen is in the case of missing category
if (isAdminUserSelector(state)) {
// Create category when missing and role is ADMIN
return createCategory(PERMALINK)
Expand Down Expand Up @@ -104,7 +103,7 @@ const permalinkErrorHandler = (state) =>
}
return Observable.of(
error({
title: 'notifcation.error',
title: 'notification.error',
message: 'permalink.errors.save.generic',
autoDismiss: 6,
position: "tc"
Expand Down

0 comments on commit 0942461

Please sign in to comment.