This repository contains an example plugin for the SHOGun GIS client. In this example an additional button is rendered to the footer bar of the client.
Checkout the repository and install all required dependencies via
npm i
While it's absolutely possible to run the client via
npm run start
to have the plugin available at https://localhost:4000 you usually want to start the full SHOGun stack for development. Please refer to the SHOGun Docker repository for a complete example.
If you want to add the plugin to an existing setup, please ensure the following steps:
- Ensure you have added the following sequence to your
./shogun-client/config/gis-client-config.js
:
plugins: [{
name: 'ExamplePlugin',
resourcePath: '/client-plugins/index.js',
exposedPaths: [
'./FooterLinks'
]
}]
- Expose the plugin in your nginx config (e.g.
./shogun-nginx/dev/default.conf
) as follows:
location /client-plugins/ {
proxy_pass http://shogun-client-plugins:8080/;
# WebSocket support (nginx 1.4)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
}
- Finally add a compose service for the plugin in your
docker-compose.yml
:
shogun-client-plugins:
extends:
file: ./common-services.yml
service: shogun-client-plugins
build:
context: ${SHOGUN_CLIENT_PLUGINS_DIR}
dockerfile: Dockerfile.dev
volumes:
- ${SHOGUN_CLIENT_PLUGINS_DIR}:/app
And common-services.yml
if present:
shogun-client-plugins:
container_name: ${CONTAINER_NAME_PREFIX}-gis-client-plugins
Since we make use of variables within the docker-compose.yml
and the common-services.yml
we would
need to add the variable to your .env
as follows:
SHOGUN_CLIENT_PLUGINS_DIR=../shogun-gis-client-plugins
Further information for the plugin development can also be found in the SHOGun GIS client repository.