Skip to content

Commit

Permalink
Clean up of configurations and files (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
allyoucanmap authored Jul 15, 2021
1 parent 2815322 commit 358873f
Show file tree
Hide file tree
Showing 52 changed files with 288 additions and 1,119 deletions.
79 changes: 3 additions & 76 deletions geonode_mapstore_client/client/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
# GeoNode MapStore Client Project

This directory is the root folder where to initialize all the npm scripts. See the main [README.md](../../README.md) for more information about this directory.
## Configuration

This project contains following applications:

- [MapStore js API](#mapStore-js-api)
- [GeoStory](#geostory)
- [Homepage](#homepage)

## MapStore js API
Api used inside django templates to show map and layer viewers

## GeoStory
This application allow to show and edit stories with map and geospatial data
## Homepage

This single application is an alternative homepage that interact with the GeoNode API v2 and shows available resources. You can enable this app by replacing the content of the index.html of a GeoNode project with the [home.html](home.html) template.

The homepage configuration file is located in [localConfig.json](static/mapstore/configs/localConfig.json) and it exposes specific properties to customize the homepage theme and structure:
The configuration file is located in [localConfig.json](static/mapstore/configs/localConfig.json) and it exposes specific properties to customize:

### localConfig.json

| property | type | description | |
| --- | --- | --- | --- |
| `geoNodeApi` | {object} | | |
| `supportedLocales` | {object} | | |
| `geoNodeConfiguration` | {object} | contains all the configuration needed to change the theme, filters and navbar structures | [see available properties](#geonode-configuration) |

Expand All @@ -33,52 +18,19 @@ The homepage configuration file is located in [localConfig.json](static/mapstore

| property | type | description | |
| --- | --- | --- | --- |
| `theme` | {object} | general theme configuration variables | [see available properties](#theme-configuration) |
| `filters` | {object} | configuration of filter | |
| `filters.order` | {object} | configuration of order dropdown | |
| `filters.order.defaultLabelId` | {string} | label id to use for the order dropdown button | |
| `filters.order.options` | {array} | label id to use for the order dropdown button | [order object entry](#order-object) |
| `filters.extent` | {object} | configuration of extent filter | |
| `filters.extent.layers` | {array} | a list of MapStore layers object used as extent background | |
| `filters.extent.style` | {object} | a MapStore vector style object | |
| `navbar` | {object} | configuration of the brand navbar (top) | |
| `navbar.logo` | {array} | list of logo items | [logo item entry](#logo-item) |
| `navbar.items` | {array} | list of menu item objects, right placement | [menu item object entry](#menu-item-object) |
| `menu` | {object} | configuration of the main menu | |
| `menu.items` | {array} | list of menu item objects, left placement | [menu item object entry](#menu-item-object) |
| `menu.rightItems` | {array} | list of menu item objects, right placement | [menu item object entry](#menu-item-object) |
| `menu.cfg.rightContents.style.width` | {number} | value to fix width in right side of action navbar | [menu item object entry](#menu-item-object) |
| `footer` | {object} | configuration of the footer | |
| `footer.items` | {array} | list of menu item objects, left placement | [menu item object entry](#menu-item-object) |
| `cardsMenu` | {object} | configuration of the menu of resource cards | |
| `cardsMenu.items` | {array} | list of menu item objects, right placement | [menu item object entry](#menu-item-object) |
| `cardOptions` | {object} | configuration of the resource cards dropdown | |
| `cardOptions.items` | {array} | list of menu item objects, dropdown placement | [menu item object entry](#menu-item-object) |
| `filtersForm` | {object} | configuration of the resource cards dropdown | |
| `filtersForm.items` | {array} | list of filter objects, panel placement | [filter object](#filter-object) |
### Theme configuration

[geoNodeConfiguration](#geonode-configuration).theme

| property | type | description |
| --- | --- | --- |
| `variant` | {string} | "light" or "dark" |
| `color` | {string} | main theme color |
| `navbar` | {object} | navbar theme properties |
| `navbar.style` | {object} | a css style object to apply on the navbar container node |
| `hero` | {object} | hero image theme properties |
| `hero.style` | {object} | a css style object to apply on the hero image container node, use backgroundImage css property to apply a background image |
| `jumbotron` | {object} | jumbotron text content theme properties |
| `jumbotron.style` | {object} | a css style object to apply on the jumbotron container node |
| `languageSelector` | {object} | language selector theme properties |
| `languageSelector.inline` | {boolean} | shows languages as inline text if true, default false shows a dropdown |
| `footer` | {object} | footer theme properties |
| `footer.color` | {string} | footer text color (css variable --gn-footer-color) |
| `footer.bg` | {string} | footer background color (css variable --gn-footer-bg) |
| `footer.link` | {object} | theme for footer link |
| `footer.link.color` | {string} | footer link text color (css variable --gn-footer-link-color) |
| `footer.link.hoverColor` | {string} | footer link text color on hover (css variable --gn-footer-link-hover-color) |
| `footer.style` | {string} | a css style object to apply on the footer container node |

### Order Object

Expand All @@ -90,31 +42,6 @@ Order object contains properties for an entry of the order dropdown. Configurati
"value": "title" // value used in the sort filter
}
```
### Logo Item

Logo item contains properties for an image rendered in the top navbar. Configuration:

```js
{
"src": "path/to/image.png", // image source
"href": "#/", // logo href
"style": { // default css style object
"minHeight": 80
},
"sm": { // page size key small screen
"style": { // small screen css style object
"minHeight": 40
}
},
"md": { // page size key medium screen
"style": {} // medium screen css style object
},
"lg": { // page size key large screen
"style": {} // large screen css style object
}
}
```

### Menu Item Object

Menu item object contains properties for a list item rendered in a menu. Configuration:
Expand Down Expand Up @@ -214,4 +141,4 @@ Filter object contains properties for a select input rendered inside the filter
]
}
```
Filter items supports also the following types from [menu object configuration](#menu-item-object): filter, divider and link.
Filter items supports also the following types from [menu object configuration](#menu-item-object): filter, divider and link.
4 changes: 2 additions & 2 deletions geonode_mapstore_client/client/js/actions/gnresource.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ export function editAbstractResource(abstract) {
* @param {string} image resource
*/

export function editThumbnailResource(thumbnail_url) {
export function editThumbnailResource(thumbnailUrl) {

return {
type: EDIT_THUMBNAIL_RESOURCE,
thumbnail_url
thumbnailUrl
};
}

Expand Down
30 changes: 0 additions & 30 deletions geonode_mapstore_client/client/js/actions/gnsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
* LICENSE file in the root directory of this source tree.
*/

export const FETCH_SUGGESTIONS = 'GEONODE_SEARCH:FETCH_SUGGESTIONS';
export const UPDATE_SUGGESTIONS = 'GEONODE_SEARCH:UPDATE_SUGGESTIONS';
export const LOADING_SUGGESTIONS = 'GEONODE_SEARCH:LOADING_SUGGESTIONS';
export const SEARCH_RESOURCES = 'GEONODE_SEARCH:SEARCH_RESOURCES';
export const UPDATE_RESOURCES = 'GEONODE_SEARCH:UPDATE_RESOURCES';
export const LOADING_RESOURCES = 'GEONODE_SEARCH:LOADING_RESOURCES';
Expand All @@ -18,27 +15,6 @@ export const UPDATE_RESOURCES_METADATA = 'GEONODE_SEARCH:UPDATE_RESOURCES_METADA
export const SET_FEATURED_RESOURCES = 'GEONODE:SET_FEATURED_RESOURCES';
export const UPDATE_FEATURED_RESOURCES = 'GEONODE_SEARCH:UPDATE_FEATURED_RESOURCES';

export function fetchSuggestions(text) {
return {
type: FETCH_SUGGESTIONS,
text
};
}

export function updateSuggestions(suggestions) {
return {
type: UPDATE_SUGGESTIONS,
suggestions
};
}

export function loadingSuggestions(loading) {
return {
type: LOADING_SUGGESTIONS,
loading
};
}

export function searchResources(params, pathname) {
return {
type: SEARCH_RESOURCES,
Expand Down Expand Up @@ -106,12 +82,6 @@ export function loadFeaturedResources(action, pageSize = 4) {
}

export default {
FETCH_SUGGESTIONS,
fetchSuggestions,
UPDATE_SUGGESTIONS,
updateSuggestions,
LOADING_SUGGESTIONS,
loadingSuggestions,
SEARCH_RESOURCES,
searchResources,
UPDATE_RESOURCES,
Expand Down
37 changes: 0 additions & 37 deletions geonode_mapstore_client/client/js/api/geonode.js

This file was deleted.

21 changes: 21 additions & 0 deletions geonode_mapstore_client/client/js/api/geonode/user/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2020, 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 axios from '@mapstore/framework/libs/ajax';
import { getConfigProp } from '@mapstore/framework/utils/ConfigUtils';

/**
* Api for GeoNode user
* @name api.geonode.user
*/

export const getUserInfo = () => {
const { endpointV1 = '/api' } = getConfigProp('geoNodeApi') || {};
return axios.get(`${endpointV1}/o/v4/userinfo`)
.then(({ data }) => data);
};

This file was deleted.

68 changes: 0 additions & 68 deletions geonode_mapstore_client/client/js/api/geonode/v1/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion geonode_mapstore_client/client/js/api/geonode/v2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import isString from 'lodash/isString';
import isObject from 'lodash/isObject';
import castArray from 'lodash/castArray';
import get from 'lodash/get';
import { getUserInfo } from '@js/api/geonode/v1';
import { getUserInfo } from '@js/api/geonode/user';
import { setFilterById } from '@js/utils/GNSearchUtils';

let endpoints = {
Expand Down
4 changes: 1 addition & 3 deletions geonode_mapstore_client/client/js/apps/gn-catalogue.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ import {
} from '@js/epics';
import gnviewerEpics from '@js/epics/gnviewer';
import gnsearchEpics from '@js/epics/gnsearch';
import gnlocaleEpics from '@js/epics/gnlocale';
import maplayout from '@mapstore/framework/reducers/maplayout';

import pluginsDefinition from '@js/plugins/index';
Expand Down Expand Up @@ -235,8 +234,7 @@ Promise.all([
gnSetLayersPermissions,
...pluginsDefinition.epics,
...gnviewerEpics,
...gnsearchEpics,
...gnlocaleEpics
...gnsearchEpics
},
geoNodeConfiguration,
initialActions: [
Expand Down
Loading

0 comments on commit 358873f

Please sign in to comment.