Skip to content

Commit

Permalink
geosolutions-it#10026: Interactive legend for TOC layers
Browse files Browse the repository at this point in the history
- Merge branch 'master' into feature_10026_backup
- edit in some unit tests
- remove implementation of vector layer temp.
  • Loading branch information
mahmoudadel54 committed Apr 9, 2024
2 parents 85617f2 + 1affe02 commit 5277175
Show file tree
Hide file tree
Showing 507 changed files with 13,109 additions and 10,906 deletions.
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/release_steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ This steps have to be followed always when preparing a new release.
With the following Parameters:
- [ ] Use workflow from branch `master`
- [ ] MapStore branch name to use: `YYYY.XX.xx`
- [ ] Version of *MapFish Print*, *GeoStore* and *HTTP-Proxy* accordingly to the [MapStore release calendar](https://github.com/geosolutions-it/MapStore2/wiki/MapStore-Release-Calendars)
- [ ] use the default value for the other parameters
- [ ] Wait for the process to complete. At the end:
- A Pull request will be created to the master
Expand All @@ -40,7 +39,7 @@ This steps have to be followed always when preparing a new release.

## Before the Release

- [ ] Check `pom.xml` dependencies are all in fixed stable versions ( no `-SNAPSHOT` usage release). If not, You use the action [`Update dependencies versions`](https://github.com/geosolutions-it/MapStoreExtension/actions/workflows/update_dependencies_versions.yml) to fix them, setting:
- [ ] Check `pom.xml` dependencies are all in fixed stable versions ( no `-SNAPSHOT` usage release). If not, You use the action [`Update dependencies versions`](https://github.com/geosolutions-it/MapStore2/actions/workflows/update_dependencies_versions.yml) to fix them, setting:
- [ ] the branch to `YYYY.XX.xx`
- [ ] the of geostore, http_proxy and mapfish-print versions accordingly with the [MapStore release calendar](https://github.com/geosolutions-it/MapStore2/wiki/MapStore-Release-Calendars)
- [ ] Check that [MapStoreExtension](https://github.com/geosolutions-it/MapStoreExtension) repository is aligned and working
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,13 @@ jobs:
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish maven packages
run: mvn clean install deploy -f java/pom.xml
# Here it deploys only java modules and root, needed for MS project builds.
# Product, binary modules are to big to be hosted on the repository in snapshots, so they are skipped
run: |
# deploys java packages
mvn clean install deploy -f java/pom.xml
# deploys also the root module, needed for dependencies
mvn deploy --non-recursive
env:
MAVEN_USERNAME: ${{ secrets.GS_MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.GS_MAVEN_PASSWORD }}
Expand Down
21 changes: 1 addition & 20 deletions .github/workflows/cut_major_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@ on:
release-branch:
description: MapStore branch name to use (YYYY.MM.xx). E.g. 2024.01.xx
required: true
mapfish-version:
description: Mapfish print version to use (e.g. 2.3-SNAPSHOT)
required: true
default: '2.3-SNAPSHOT'
geostore-version:
description: GeoStore version to use (e.g. 2.0.0).
required: true
default: '2.0.0'
http-proxy-version:
description: Http proxy version to use (e.g. 2.4).
required: true
default: '1.4.0'
main-branch:
description: main branch
default: master
Expand All @@ -36,15 +24,8 @@ jobs:
- name: Create release branch and generate PR body
id: create-branch
env:
MAPFISH_GROUP: org.mapfish.print
MAPFISH_VERSION: ${{ github.event.inputs.mapfish-version }}
GEOSTORE_GROUP: it.geosolutions.geostore
GEOSTORE_VERSION: ${{ github.event.inputs.geostore-version }}
HTTP_PROXY_GROUP: proxy
HTTP_PROXY_VERSION: ${{ github.event.inputs.http-proxy-version }}
RELEASE_BRANCH: ${{ github.event.inputs.release-branch }}

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCH: ${{ github.event.inputs.release-branch }}
MAIN_BRANCH: ${{ github.event.inputs.main-branch }}
PR_OPTIONS: ${{ github.event.inputs.pr-options }}
RUN_ID: ${{ github.run_id }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/update_dependencies_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ jobs:
mvn versions:set-property -Dproperty=print-lib.version -DnewVersion=$MAPFISH_VERSION -DgenerateBackupPoms=false -DautoVersionSubmodules=true -Pprinting
mvn versions:set-property -Dproperty=geostore-webapp.version -DnewVersion=$GEOSTORE_VERSION -DgenerateBackupPoms=false -DautoVersionSubmodules=true -Pprinting
mvn versions:set-property -Dproperty=http_proxy.version -DnewVersion=$HTTP_PROXY_VERSION -DgenerateBackupPoms=false -DautoVersionSubmodules=true -Pprinting
git add pom.xml
## Update the versions of the dependencies in the project templates
POM_FILES=$(git ls-files project/standard/templates/ | grep 'pom\.xml$')
for POM_FILE in $POM_FILES; do
mvn versions:set-property -Dproperty=print-lib.version -DnewVersion=$MAPFISH_VERSION -DgenerateBackupPoms=false -DautoVersionSubmodules=true -Pprinting
mvn versions:set-property -Dproperty=geostore-webapp.version -DnewVersion=$GEOSTORE_VERSION -DgenerateBackupPoms=false -DautoVersionSubmodules=true -Pprinting
mvn versions:set-property -Dproperty=http_proxy.version -DnewVersion=$HTTP_PROXY_VERSION -DgenerateBackupPoms=false -DautoVersionSubmodules=true -Pprinting
mvn versions:set-property -f $POM_FILE -Dproperty=print-lib.version -DnewVersion=$MAPFISH_VERSION -DgenerateBackupPoms=false -DautoVersionSubmodules=true -Pprinting
mvn versions:set-property -f $POM_FILE -Dproperty=geostore-webapp.version -DnewVersion=$GEOSTORE_VERSION -DgenerateBackupPoms=false -DautoVersionSubmodules=true -Pprinting
mvn versions:set-property -f $POM_FILE -Dproperty=http_proxy.version -DnewVersion=$HTTP_PROXY_VERSION -DgenerateBackupPoms=false -DautoVersionSubmodules=true -Pprinting
done
pr_branch_name="up_versions-${RUN_ID}"
echo "Creating a PR on branch: ${pr_branch_name} for ${{ github.ref_name }}"
Expand Down
1 change: 1 addition & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"code-block-style": false,
"line-length": false,
"no-inline-html": false,
"no-alt-text": false,
"no-duplicate-heading": {
"siblings_only": true
}
Expand Down
10 changes: 3 additions & 7 deletions build/docma-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@
"web/client/components/misc/ResizableModal.jsx",
"web/client/components/misc/Slider.jsx",
"web/client/components/misc/Thumbnail.jsx",
"web/client/components/TOC/FloatingLegend.jsx",
"web/client/components/TOC/TOCItemsSettings.jsx",
"web/client/components/TOC/fragments/settings/FeatureInfo.jsx",
"web/client/components/TOC/fragments/settings/FeatureInfoEditor.jsx",
Expand All @@ -154,7 +153,6 @@
"web/client/actions/controls.js",
"web/client/actions/fullscreen.js",
"web/client/actions/globeswitcher.js",
"web/client/actions/floatinglegend.js",
"web/client/actions/maplayout.js",
"web/client/actions/map.js",
"web/client/actions/maps.js",
Expand All @@ -164,7 +162,6 @@

"web/client/selectors/index.jsdoc",
"web/client/selectors/featuregrid.js",
"web/client/selectors/floatinglegend.js",
"web/client/selectors/map.js",
"web/client/selectors/mapInfo.js",
"web/client/selectors/maplayout.js",
Expand All @@ -175,7 +172,6 @@
"web/client/reducers/controls.js",
"web/client/reducers/featuregrid.js",
"web/client/reducers/globeswitcher.js",
"web/client/reducers/floatinglegend.js",
"web/client/reducers/mapInfo.js",
"web/client/reducers/maps.js",
"web/client/reducers/maptype.js",
Expand Down Expand Up @@ -244,8 +240,7 @@
"web/client/plugins/FeaturedMaps.jsx",
"web/client/plugins/FeatureEditor.jsx",
"web/client/plugins/FeedbackMask.jsx",
"web/client/plugins/FilterLayer.jsx",
"web/client/plugins/FloatingLegend.jsx",
"web/client/plugins/FilterLayer/index.jsx",
"web/client/plugins/FullScreen.jsx",
"web/client/plugins/GeoProcessing.jsx",
"web/client/plugins/GeoStory.jsx",
Expand Down Expand Up @@ -279,6 +274,7 @@
"web/client/plugins/MeasureResults.jsx",
"web/client/plugins/MediaEditor.jsx",
"web/client/plugins/MetadataExplorer.jsx",
"web/client/plugins/MetadataInfo/index.jsx",
"web/client/plugins/MousePosition.jsx",
"web/client/plugins/Notifications.jsx",
"web/client/plugins/OmniBar.jsx",
Expand All @@ -304,7 +300,7 @@
"web/client/plugins/Swipe.jsx",
"web/client/plugins/ThematicLayer.jsx",
"web/client/plugins/Timeline.jsx",
"web/client/plugins/TOC.jsx",
"web/client/plugins/TOC/index.jsx",
"web/client/plugins/TOCItemsSettings.jsx",
"web/client/plugins/Toolbar.jsx",
"web/client/plugins/Tutorial.jsx",
Expand Down
222 changes: 222 additions & 0 deletions docs/developer-guide/advanced-project-customization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
# Configure multiple installations of a single project

The MapStore2 [externalized configuration](https://docs.mapstore.geosolutionsgroup.com/en/latest/developer-guide/externalized-configuration/) allows for setting up multiple installations withing a single project. These installations may fulfill needs such as:

* Having different use case scenarios within a single platform.
* Providing different services, based on the same framework.
* Fulfilling third-party customer requirements.

This guideline assumes familiarity with the following sections of the documentation, so please read these first if you haven't done so already:

* [MapStore projects](https://docs.mapstore.geosolutionsgroup.com/en/latest/developer-guide/mapstore-projects/)
* [Working with extensions](https://docs.mapstore.geosolutionsgroup.com/en/latest/developer-guide/extensions/)
* [Externalized configuration](https://docs.mapstore.geosolutionsgroup.com/en/latest/developer-guide/externalized-configuration/)

## Basic setup requirements

First you need to [create you project](https://docs.mapstore.geosolutionsgroup.com/en/latest/developer-guide/project-creation-script/) following the steps outlined in the linked section.

Then you need to create the `datadir` folder inside root. **To use the contents of the datadir you need to set the JVM system property `datadir.location`**, like in the example below:

> java -Ddatadir.location=/etc/mapstore/datadir
This command will make the contents of the datadir available for the application **in runtime**. For further details on setting up and usage of the `datadir`, refer to the section [using a data directory](https://docs.mapstore.geosolutionsgroup.com/en/latest/developer-guide/externalized-configuration/#using-a-data-directory).

Alternatively, for development purposes only, you can set the same property by modifying the `web/pom.xml` file inside your custom project.

Find the entry for `cargo-maven3-plugin` and add the `systemProperties` tag within the `container` tag, so that your configuration looks like this:

```xml
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven3-plugin</artifactId>
<configuration>
<container>
<containerId>tomcat8x</containerId>
<systemProperties>
<datadir.location>[local_path_to_your_datadir]/datadir/[customInstallationFolder]</datadir.location>
</systemProperties>
<zipUrlInstaller>
<url>https://repo.maven.apache.org/maven2/org/apache/tomcat/tomcat/8.5.69/tomcat-8.5.69.zip</url>
</zipUrlInstaller>
</container>
<configuration>
<type>standalone</type>
<home>
${project.build.directory}/apache-tomcat-${tomcat.version}
</home>
<properties>
<cargo.servlet.port>${tomcat.port}</cargo.servlet.port>
<cargo.logging>low</cargo.logging>
</properties>
</configuration>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>war</type>
<properties>
<context>/mapstore</context>
</properties>
</deployable>
</deployables>
</configuration>
</plugin>
```

In order to setup the multiple installations we can, for example, create three folders inside our `datadir`, denoting three different installations.

```text
├── datadir
├── customA
├── customB
├── customC
```

Please note that the only requirement regarding folder structure is that the `datadir` exists, any content inside is optional and can be structured freely.

As a final step, we will re-set the `datadir.location` system property outlined above to point to a specific installation, such that:

> java -Ddatadir.location=/etc/mapstore/datadir/customA
## Customize configuration, assets and translations

Inside our example installation folder `datadir/customA` we can include customizations pertinent to this instance only and excluded from the other two instances exemplified in the section above.

For the purpose of this guideline we will adhere to the following folder structure convention, as outlined [here](https://docs.mapstore.geosolutionsgroup.com/en/latest/developer-guide/externalized-configuration/#using-a-data-directory):

```text
├── customA
├── configs
│   └── localConfig.json.patch
└── extensions
└── customizations
├── assets
│   ├── css
│   │   └── custom-style.css
│   ├── img
│   │   └── custom-logo.jpg
│   │  
│   └── js
└── customPlugin.js
├── index.js
├── index.js.LICENSE.txt
├── index.json
└── translations
├── data.en-US.json
│   ├── ...other translation files.
```

In the `customA/configs/localConfig.json.patch` file, we can patch the base configuration that is supplied by the `configs/localConfig.json` file inside root of the custom project, effectively customizing for this particular installation.

In alternative to `localConfig.json.patch`, that is applied server side, you can insert in the same directory `localConfig.patch.json` (noted the inverted suffix) in the same directory, and configure MapStore to use it by editing the `js/app.jsx` file.

```js
import { setLocalConfigurationFile} from '@mapstore/utils/ConfigUtils';
...

setLocalConfigurationFile(['configs/localConfig.json', 'configs/localConfig.patch.json']);
```

This alternative version uses [`@mapstore/patcher`](https://github.com/geosolutions-it/Patcher) and allow perform more complex overrides, even if requires this change to be applied to the code, so it will not work with the standard product.

The patch file can serve as the central hub for these customizations (see example below), essentially linking the whole content of the custom datadir folder and allowing for:

* Adding custom plugins in the application.
* Replacing default MapStore plugins.
* Initializing and overriding default application state.
* Initializing default component state of a particular plugin.
* Linking to assets, such as images and fonts.
* Including specific translations and language support.

```JSON
[
{
"op": "replace",
"path": "/initialState/defaultState/locales/supportedLocales",
"value": {
"en": {
"code": "en-US",
"description": "English"
},
"it": {
"code": "it-IT",
"description": "Italiano"
}
}
},
{
"op": "replace",
"path": "/translationsPath",
"value": [
"./MapStore2/web/client/translations",
"./extensions/customizations/translations"
]
},
{
"op": "replace",
"path": "/initialState/defaultState/theme/selectedTheme/id",
"value": "MyTheme"
},
{
"op": "add",
"path": "/plugins/desktop/-",
"value": {
"name": "Logo",
"cfg": {
"src": "./extensions/customizations/assets/img/custom-logo.jpg",
"width": 100,
"position": "topleft"
}
}
}
]
```

In the example above the following modifications are made:

* Language support is changed to English and Italian only.
* Translation files for the language support are now read from a custom directory `./extensions/customizations/translations`, instead of the default one.
* A custom theme `MyTheme` is enabled for the whole application. For details see section below.
* A custom plugin `Logo` is added to the application, specifically the homepage, while being configured with the following props:
* **src** - for the logo image, pointing to a location in our datadir where the image is located.
* **width** and **position** - which are props used by the component internally.

## Theme customizations

Custom themes can be included in the project and applied only to a specific installation as well. Follow [this guideline](https://docs.mapstore.geosolutionsgroup.com/en/latest/developer-guide/customize-theme/#custom-theme-for-project) in order to create a custom theme.

Once you have the required folder structure and the necessary imports in `theme.less`, as well as the required changes in your `webpack.config.js`, do the following steps:

Check `configs/localConfig.json`, if you override the configuration, and look for `selectedTheme` property, it should be the following path.

> /initialState/defaultState/theme/selectedTheme
If it's not configured, add the following block to `initialState.defaultState`, where `id` points to the name of the default theme (you should include one).

```JSON
"theme": {
"selectedTheme": {
"id": "default"
}
}
```

Inside the configuration patch file `datadir/[installationName]/configs/localConfig.patch.json`, modify the id we have previously set to point to the name of your custom theme, in the example below that would be `MyTheme`.

This change will effectively change the theme for that specific installation only.

```JSON
[
{
"op": "replace",
"path": "/initialState/defaultState/theme/selectedTheme/id",
"value": "MyTheme"
}
]
```

Please note that the `themes/` folder has to be placed outside of the `datadir` folder, as stated in the linked guideline above.

The reason is that css / less files are assembled and packaged into a theme at build time, while the contents of the `datadir` folder are only available at runtime.
Loading

0 comments on commit 5277175

Please sign in to comment.