Skip to content

Commit

Permalink
Merge branch 'master' into scroll_button
Browse files Browse the repository at this point in the history
  • Loading branch information
offtherailz authored Mar 29, 2017
2 parents 95f4773 + b8a360c commit 696c21d
Show file tree
Hide file tree
Showing 23 changed files with 470 additions and 971 deletions.
2 changes: 1 addition & 1 deletion docs/developer-guide/application-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ module.exports = finalCreateStore(reducers, {});
},
{
"type": "wms",
"url":"http://demo.geo-solutions.it/geoserver/wms",
"url":"https://demo.geo-solutions.it/geoserver/wms",
"visibility": true,
"opacity": 0.5,
"title": "Weather data",
Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/plugins-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ My.jsx:

// this is a dumb component
const MyComponent = require('../components/MyComponent');
const {connect} = require('react-redux');
const {connect} = require('../utils/PluginsUtils');

// let's wire it to state and actions
const MyPlugin = connect((state) => ({
Expand Down
37 changes: 37 additions & 0 deletions docs/developer-guide/plugins-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,41 @@ or fully configured:
]
}
```

## Dynamic configuration
Configuration properties of plugins can use expressions, so that they are dynamically bound to the
application state.

An expression is anything between curly brackets ({...}) that is a javascript expression,
where the **monitored state** of the application is available as a set of variables.

To define the monitored state, you have to add a **monitorState** property in **localConfig.json**.

```js
{
...
"monitorState": [{"name": "mapType", "path": "mapType.mapType"}]
...
}
```

Where:
* **name** is the name of the variable that can be used in expressions
* **path** is a javascript object path to the state fragment to be monitored (e.g. map.present.zoom)

When you have a monitored state, you can use it in configuration properties this way:

```js
"cfg": {
...
"myProp": "{mapType === 'openlayers' ? 1 : 2}"
...
}
```

Expressions are supported in **cfg** properties and in **hideFrom** and **showIn** sections.

In addition to monitored state also the **page request parameters** are available as variables to be
used in expressions.

Look at the [plugin reference page](./api/plugins) for a list of available configuration properties.
4 changes: 2 additions & 2 deletions web/client/components/plugins/PluginsContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const PluginsContainer = React.createClass({
return plugins
.filter((Plugin) => !Plugin.hide)
.map(this.getPluginDescriptor)
.filter((Plugin) => !Plugin.impl.loadPlugin)
.filter((Plugin) => Plugin && !Plugin.impl.loadPlugin)
.filter(this.filterPlugins)
.map((Plugin) => <Plugin.impl key={Plugin.id}
{...this.props.params} {...Plugin.cfg} pluginCfg={Plugin.cfg} items={Plugin.items}/>);
Expand All @@ -87,7 +87,7 @@ const PluginsContainer = React.createClass({
(this.props.pluginsConfig && this.props.pluginsConfig[this.props.mode] || [])
.map((plugin) => PluginsUtils.getPluginDescriptor(this.getState, this.props.plugins,
this.props.pluginsConfig[this.props.mode], plugin, this.state.loadedPlugins))
.filter((plugin) => plugin.impl.loadPlugin).forEach((plugin) => {
.filter((plugin) => plugin && plugin.impl.loadPlugin).forEach((plugin) => {
if (!this.state.loadedPlugins[plugin.name]) {
if (!plugin.impl.enabler || plugin.impl.enabler(state)) {
plugin.impl.loadPlugin((impl) => this.loadPlugin(plugin, impl));
Expand Down
8 changes: 4 additions & 4 deletions web/client/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
{
"type": "wms",
"url":"http://demo.geo-solutions.it/geoserver/wms",
"url":"https://demo.geo-solutions.it/geoserver/wms",
"visibility": false,
"title": "Natural Earth",
"name": "sde:NE2_HR_LC_SR_W_DR",
Expand All @@ -71,7 +71,7 @@
},
{
"type": "wms",
"url":"http://demo.geo-solutions.it/geoserver/wms",
"url":"https://demo.geo-solutions.it/geoserver/wms",
"visibility": false,
"title": "Hypsometric",
"name": "sde:HYP_HR_SR_OB_DR",
Expand All @@ -80,7 +80,7 @@
},
{
"type": "wms",
"url":"http://demo.geo-solutions.it/geoserver/wms",
"url":"https://demo.geo-solutions.it/geoserver/wms",
"visibility": false,
"title": "Gray Earth",
"name": "sde:GRAY_HR_SR_OB_DR",
Expand All @@ -89,7 +89,7 @@
},
{
"type": "wms",
"url":"http://demo.geo-solutions.it/geoserver/wms",
"url":"https://demo.geo-solutions.it/geoserver/wms",
"visibility": true,
"opacity": 0.5,
"title": "Weather data",
Expand Down
2 changes: 1 addition & 1 deletion web/client/examples/3dviewer/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"type": "wms",
"url":"http://demo.geo-solutions.it/geoserver/wms",
"url":"https://demo.geo-solutions.it/geoserver/wms",
"visibility": true,
"opacity": 0.5,
"title": "Weather data",
Expand Down
2 changes: 1 addition & 1 deletion web/client/examples/api/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
* LICENSE file in the root directory of this source tree.
*/

const MapStore2 = require('../../jsapi/MapStore2');
const MapStore2 = require('../../jsapi/MapStore2').withPlugins(require('./plugins'));
window.MapStore2 = MapStore2;
47 changes: 47 additions & 0 deletions web/client/examples/api/plugins.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Copyright 2016, 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.
*/

module.exports = {
plugins: {
MapPlugin: require('../../plugins/Map'),
ToolbarPlugin: require('../../plugins/Toolbar'),
DrawerMenuPlugin: require('../../plugins/DrawerMenu'),
ShapeFilePlugin: require('../../plugins/ShapeFile'),
SnapshotPlugin: require('../../plugins/Snapshot'),
SettingsPlugin: require('../../plugins/Settings'),
ExpanderPlugin: require('../../plugins/Expander'),
SearchPlugin: require('../../plugins/Search'),
ScaleBoxPlugin: require('../../plugins/ScaleBox'),
LocatePlugin: require('../../plugins/Locate'),
ZoomInPlugin: require('../../plugins/ZoomIn'),
ZoomOutPlugin: require('../../plugins/ZoomOut'),
ZoomAllPlugin: require('../../plugins/ZoomAll'),
MapLoadingPlugin: require('../../plugins/MapLoading'),
HelpPlugin: require('../../plugins/Help'),
HomePlugin: require('../../plugins/Home'),
MetadataExplorerPlugin: require('../../plugins/MetadataExplorer'),
LoginPlugin: require('../../plugins/Login'),
OmniBarPlugin: require('../../plugins/OmniBar'),
BurgerMenuPlugin: require('../../plugins/BurgerMenu'),
UndoPlugin: require('../../plugins/History'),
RedoPlugin: require('../../plugins/History'),
MapsPlugin: require('../../plugins/Maps'),
MapSearchPlugin: require('../../plugins/MapSearch'),
LanguagePlugin: require('../../plugins/Language'),
ManagerPlugin: require('../../plugins/manager/Manager'),
RulesManagerPlugin: require('../../plugins/manager/RulesManager'),
ManagerMenuPlugin: require('../../plugins/manager/ManagerMenu'),
SharePlugin: require('../../plugins/Share'),
SavePlugin: require('../../plugins/Save'),
SaveAsPlugin: require('../../plugins/SaveAs')
},
requires: {
ReactSwipe: require('react-swipeable-views').default,
SwipeHeader: require('../../components/data/identify/SwipeHeader')
}
};
2 changes: 1 addition & 1 deletion web/client/examples/data/mapStoreConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"url":"http://www.realvista.it/reflector/open/service?request=getCapabilities"
},
"demo":{
"url":"http://demo.geo-solutions.it/geoserver/wms"
"url":"https://demo.geo-solutions.it/geoserver/wms"
}
},
"map": {
Expand Down
2 changes: 1 addition & 1 deletion web/client/examples/login/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"type": "wms",
"url": "http://demo.geo-solutions.it/geoserver/wms",
"url": "https://demo.geo-solutions.it/geoserver/wms",
"visibility": true,
"opacity": 0.7,
"title": "Weather data",
Expand Down
2 changes: 1 addition & 1 deletion web/client/examples/myapp/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"type": "wms",
"url":"http://demo.geo-solutions.it/geoserver/wms",
"url":"https://demo.geo-solutions.it/geoserver/wms",
"visibility": true,
"opacity": 0.5,
"title": "Weather data",
Expand Down
12 changes: 6 additions & 6 deletions web/client/examples/plugins/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@
},
{
"type": "wms",
"url":"http://213.215.135.196/reflector/open/service",
"url":"http://www.realvista.it/reflector/open/service",
"visibility": false,
"title": "e-Geos Ortofoto RealVista 1.0",
"name": "rv1",
"group": "background",
"format": "image/png"
"format": "image/jpeg"
},
{
"type": "wms",
"url":"http://demo.geo-solutions.it/geoserver/wms",
"url":"https://demo.geo-solutions.it/geoserver/wms",
"visibility": false,
"title": "Natural Earth",
"name": "sde:NE2_HR_LC_SR_W_DR",
Expand All @@ -71,7 +71,7 @@
},
{
"type": "wms",
"url":"http://demo.geo-solutions.it/geoserver/wms",
"url":"https://demo.geo-solutions.it/geoserver/wms",
"visibility": false,
"title": "Hypsometric",
"name": "sde:HYP_HR_SR_OB_DR",
Expand All @@ -80,7 +80,7 @@
},
{
"type": "wms",
"url":"http://demo.geo-solutions.it/geoserver/wms",
"url":"https://demo.geo-solutions.it/geoserver/wms",
"visibility": false,
"title": "Gray Earth",
"name": "sde:GRAY_HR_SR_OB_DR",
Expand All @@ -89,7 +89,7 @@
},
{
"type": "wms",
"url":"http://demo.geo-solutions.it/geoserver/wms",
"url":"https://demo.geo-solutions.it/geoserver/wms",
"visibility": true,
"opacity": 0.5,
"title": "Weather data",
Expand Down
2 changes: 1 addition & 1 deletion web/client/examples/print/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"type": "wms",
"url": "http://demo.geo-solutions.it/geoserver/wms",
"url": "https://demo.geo-solutions.it/geoserver/wms",
"visibility": true,
"opacity": 0.7,
"title": "Weather data",
Expand Down
4 changes: 2 additions & 2 deletions web/client/examples/queryform/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const startApp = () => {

store.dispatch(changeBrowserProperties(ConfigUtils.getBrowserProperties()));

store.dispatch(describeFeatureType('http://demo.geo-solutions.it/geoserver/wfs', 'topp:states'));
store.dispatch(loadFeature('http://demo.geo-solutions.it/geoserver/wfs', 'topp:states'));
store.dispatch(describeFeatureType('https://demo.geo-solutions.it/geoserver/wfs', 'topp:states'));
store.dispatch(loadFeature('https://demo.geo-solutions.it/geoserver/wfs', 'topp:states'));

const QueryForm = require('./containers/QueryForm');

Expand Down
2 changes: 1 addition & 1 deletion web/client/examples/queryform/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"type": "wms",
"url":"http://demo.geo-solutions.it/geoserver/wms",
"url":"https://demo.geo-solutions.it/geoserver/wms",
"visibility": true,
"opacity": 0.8,
"title": "USA Population",
Expand Down
12 changes: 6 additions & 6 deletions web/client/examples/rasterstyler/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"name": "sde:NE2_HR_LC_SR_W_DR",
"title": "Natural Earth",
"type": "wms",
"url": "http://demo.geo-solutions.it/geoserver/wms",
"url": "https://demo.geo-solutions.it/geoserver/wms",
"visibility": false
},
{
Expand All @@ -72,7 +72,7 @@
"name": "sde:HYP_HR_SR_OB_DR",
"title": "Hypsometric",
"type": "wms",
"url": "http://demo.geo-solutions.it/geoserver/wms",
"url": "https://demo.geo-solutions.it/geoserver/wms",
"visibility": false
},
{
Expand All @@ -81,7 +81,7 @@
"name": "sde:GRAY_HR_SR_OB_DR",
"title": "Gray Earth",
"type": "wms",
"url": "http://demo.geo-solutions.it/geoserver/wms",
"url": "https://demo.geo-solutions.it/geoserver/wms",
"visibility": false
},
{
Expand All @@ -101,12 +101,12 @@
"opacity": 1,
"title": "Weather data",
"type": "wms",
"url": "http://demo.geo-solutions.it/geoserver/wms",
"url": "https://demo.geo-solutions.it/geoserver/wms",
"visibility": true
},
{
"type": "wms",
"url":"http://demo.geo-solutions.it/geoserver/wms",
"url":"https://demo.geo-solutions.it/geoserver/wms",
"visibility": true,
"opacity": 1,
"title": "HYP_HR_SR_OB_DR",
Expand All @@ -125,4 +125,4 @@
"units": "m",
"zoom": 4
}
}
}
Loading

0 comments on commit 696c21d

Please sign in to comment.