Skip to content

Commit

Permalink
ref. GeoNode/geonode#5614 Remove Geo-EXT and Print custom GeoServer p…
Browse files Browse the repository at this point in the history
…lugin wrapper from GeoNode
  • Loading branch information
afabiani committed Mar 10, 2020
1 parent f2899fa commit e0e3424
Show file tree
Hide file tree
Showing 22 changed files with 643 additions and 607 deletions.
5 changes: 3 additions & 2 deletions geonode_mapstore_client/client/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash
set -e

npx rimraf package-lock.json npm-shrinkwrap.json node_modules
npm update
npm install
npm run compile
npm run lint
mvn clean install
npm run lint
2 changes: 1 addition & 1 deletion geonode_mapstore_client/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ms2-geonode-api",
"version": "1.4.1",
"version": "2.0.2",
"description": "MapStore 2 Api bundle specific to geonode framework",
"main": "api.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion geonode_mapstore_client/client/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ms2-geonode-api-1.4.1
ms2-geonode-api-2.0.2
81 changes: 56 additions & 25 deletions geonode_mapstore_client/hooksets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
except ImportError:
from django.utils import simplejson as json

from geonode.client.hooksets import GeoExtHookSet
from geonode.client.hooksets import BaseHookSet
from mapstore2_adapter.plugins.geonode import GeoNodeMapStore2ConfigConverter

ms2_config_converter = GeoNodeMapStore2ConfigConverter()


class MapStoreHookSet(GeoExtHookSet):
class MapStoreHookSet(BaseHookSet):

def get_request(self, context):
if context and 'request' in context:
Expand Down Expand Up @@ -74,62 +74,84 @@ def initialize_context(self, context, callback):
if len(context.dicts) > 0:
for ctx in context.dicts:
if 'preview' in ctx and (
ctx['preview'] in ('geoext', 'mapstore', 'mapstore2', 'ms2') and 'config' in ctx):
ctx['preview'] in (
'mapstore', 'mapstore2', 'ms2') and
'config' in ctx):
config = ctx['config']
except:
except Exception:
pass
ms2_config = {}
if config:
try:
ms2_config = callback(config, request)
except:
except Exception:
ms2_config = '{}'
import traceback
traceback.print_exc()
context['ms2_config'] = ms2_config

# Layers
def layer_detail_template(self, context=None):
self.initialize_context(context, callback=ms2_config_converter.convert)
self.initialize_context(
context,
callback=ms2_config_converter.convert)
return 'geonode-mapstore-client/layer_map.html'

def layer_new_template(self, context=None):
self.initialize_context(context, callback=ms2_config_converter.convert)
self.initialize_context(
context,
callback=ms2_config_converter.convert)
return 'geonode-mapstore-client/layer_map.html'

def layer_view_template(self, context=None):
self.initialize_context(context, callback=ms2_config_converter.convert)
self.initialize_context(
context,
callback=ms2_config_converter.convert)
return 'geonode-mapstore-client/layer_map.html'

# -- Not implemented yet
# def layer_edit_template(self, context=None):
# self.initialize_context(context, callback=ms2_config_converter.convert)
# return 'geonode-mapstore-client/map_new.html'
# self.initialize_context(
# context,
# callback=ms2_config_converter.convert)
# return 'geonode-mapstore-client/map_new.html'

def layer_update_template(self, context=None):
self.initialize_context(context, callback=ms2_config_converter.convert)
self.initialize_context(
context,
callback=ms2_config_converter.convert)
return 'geonode-mapstore-client/layer_map.html'

# -- Not implemented yet
# def layer_embed_template(self, context=None):
# self.initialize_context(context, callback=ms2_config_converter.convert)
# return 'geonode-mapstore-client/layer_map.html'
# self.initialize_context(
# context,
# callback=ms2_config_converter.convert)
# return 'geonode-mapstore-client/layer_map.html'

def layer_download_template(self, context=None):
self.initialize_context(context, callback=ms2_config_converter.convert)
self.initialize_context(
context,
callback=ms2_config_converter.convert)
return 'geonode-mapstore-client/layer_map.html'

def layer_style_edit_template(self, context=None):
self.initialize_context(context, callback=ms2_config_converter.convert)
self.initialize_context(
context,
callback=ms2_config_converter.convert)
return 'geonode-mapstore-client/layer_style_edit.html'

# Maps
def map_detail_template(self, context=None):
self.initialize_context(context, callback=ms2_config_converter.convert)
self.initialize_context(
context,
callback=ms2_config_converter.convert)
return 'geonode-mapstore-client/map_detail.html'

def map_new_template(self, context=None):
self.initialize_context(context, callback=ms2_config_converter.convert)
self.initialize_context(
context,
callback=ms2_config_converter.convert)
if self.isEditLayer(context):
return 'geonode-mapstore-client/layer_edit.html'
elif self.isViewLayer(context):
Expand All @@ -138,26 +160,35 @@ def map_new_template(self, context=None):
return 'geonode-mapstore-client/map_new.html'

def map_view_template(self, context=None):
self.initialize_context(context, callback=ms2_config_converter.convert)
self.initialize_context(
context,
callback=ms2_config_converter.convert)
return 'geonode-mapstore-client/map_view.html'
#

def map_edit_template(self, context=None):
self.initialize_context(context, callback=ms2_config_converter.convert)
self.initialize_context(
context,
callback=ms2_config_converter.convert)
return 'geonode-mapstore-client/edit_map.html'

# -- Not implemented yet
def map_embed_template(self, context=None):
self.initialize_context(context, callback=ms2_config_converter.convert)
self.initialize_context(
context,
callback=ms2_config_converter.convert)
return 'geonode-mapstore-client/map_embed.html'

# def map_download_template(self, context=None):
# self.initialize_context(context, callback=ms2_config_converter.convert)
# return 'geonode-mapstore-client/map_view.html'
# self.initialize_context(
# context,
# callback=ms2_config_converter.convert)
# return 'geonode-mapstore-client/map_view.html'

# Map Persisting
def viewer_json(self, conf, context=None):
context['viewer'] = conf
self.initialize_context(context, callback=ms2_config_converter.viewer_json)
self.initialize_context(
context,
callback=ms2_config_converter.viewer_json)
return context['ms2_config']

def update_from_viewer(self, conf, context=None):
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

150 changes: 77 additions & 73 deletions geonode_mapstore_client/static/mapstore/dist/ms2-geonode-api.js

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion geonode_mapstore_client/static/mapstore/dist/webpack.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e0e3424

Please sign in to comment.