Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert "openrouteservice", "qplotly" and "qtimeseries" to standalone plugins (ie. no more build step for static plugin.js) #746

Draft
wants to merge 33 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
42ca0a1
convert to static `plugin.js`
Raruto Jan 29, 2024
26aeaa4
compute prop
Raruto Jan 29, 2024
4abb466
fix vue reactivity for computed `form`
Raruto Jan 29, 2024
45a4665
remove temp variable
Raruto Jan 29, 2024
2ca5fa4
convert qtimeseries to static `plugin.js`
Raruto Feb 1, 2024
d6ed1e6
lazy i18n
Raruto Feb 1, 2024
d7537c0
clean up httpvueloader
Raruto Feb 1, 2024
a61cf38
fix open/close on ors panel
Raruto Feb 1, 2024
28724f3
console.log
Raruto Feb 1, 2024
e7d9319
slim down i18n
Raruto Feb 1, 2024
18dd0f1
rename `panel.vue` into `plugin.vue`
Raruto Feb 1, 2024
9ca3692
remove service state
Raruto Feb 1, 2024
8a67659
add version info
Raruto Feb 1, 2024
bd946d9
prevent undefined variable
Raruto Feb 1, 2024
c89d56a
indendation
Raruto Feb 1, 2024
4a20d4e
wait 118n resolve promise to set initial translation
volterra79 Feb 1, 2024
c4600ff
Merge branch 'standalone-ors' of https://github.com/g3w-suite/g3w-adm…
volterra79 Feb 1, 2024
1ef6e9c
convert qplotly to static `plugin.js`
Raruto Feb 2, 2024
adc35b3
revert 4a20d4e2af81c1e0fa3b4c8daa0ec702354f74e7
Raruto Feb 2, 2024
32a601e
fix multiplot
Raruto Feb 2, 2024
fe651a7
missing state
Raruto Feb 2, 2024
27d549e
set version
Raruto Feb 5, 2024
cc0d2d1
simplify compaion vue components
Raruto Feb 5, 2024
28f7944
await i18n
Raruto Feb 5, 2024
6896bec
wrong variable name
Raruto Feb 5, 2024
4d2ba25
wrong condition
Raruto Feb 5, 2024
6e23b90
language + sidebar
Raruto Feb 6, 2024
7e141c3
spacing
Raruto Feb 7, 2024
e05cf7b
update receivers
Raruto Feb 9, 2024
ad76065
simplify init config
Raruto Feb 9, 2024
c865cf9
f-string
Raruto Feb 9, 2024
7712c45
Merge branch 'dev' into standalone-ors
Raruto Feb 14, 2024
0666214
remove `httpVueLoader` dependency
Raruto Feb 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
363 changes: 363 additions & 0 deletions g3w-admin/openrouteservice/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,366 @@ def get(self, request, project_id, task_id):
return Response({'result': True, 'status': 'pending'})

return Response({'result': False, 'error': _('Task not found!')}, status=status.HTTP_404_NOT_FOUND)

class OpenrouteServiceVueConfigView(G3WAPIView):

def get(self, *args, **kwargs):

return Response({
'data': { # default params
# Append to existing layer
'qgis_layer_id': None, # QGIS vector layer id, mutually exclusive with connection_id
# In case of new layer:
'connection_id': None, # mutually exclusive with layer_id
'new_layer_name': None, # mutually exclusive with layer_id
'profile': None,
'color': None , # 0-255 RGB values ['Red', 'Green', 'Blue']
'transparency': 0, # 0-1, 0: fully opaque, 1: fully transparent
'name' : '',
'stroke_width': 0.26, # float, QGIS default is 0.26
# This goes straight to ORS API
'ors': {
'locations': None, # May be null in case of `layer_id`
'range_type': 'time', # Time or distance
'range': [480],
'interval': 60,
# fixed
'location_type': 'start',
'attributes': [ 'area', 'reachfactor', 'total_pop' ]
}
},
'api': {
'urls': {
'compatible_layers': '/openrouteservice/api/compatible_layers', # TO ADD PROJECTID
'isochrone_mapcoordinates': '/openrouteservice/api/isochrone', # TO ADD PROJECTID
'isochrone_from_layer': '/openrouteservice/api/isochrone_from_layer', # TO ADD PROJECTID AND LAYER ID
'task': '/openrouteservice/api/isochrone_from_layer_result' # TO ADD PROJECTID AND TASK ID RETURNED BY ABOVE API
},
},
'form': {
'isochrones': [
{
'visible': True,
'name': 'name',
'type': 'varchar',
'i18n_label': 'openrouteservice.isochrones.label.name',
'label': '',
'editable': True,
'validate': {
'required': True,
'valid': False
},
'pk': False,
'default': '' ,
'input': {
'type': 'text',
'options': {}
},
'value': None
},
{
'visible': True,
'name': 'profile',
'type': 'varchar',
'i18n_label': 'openrouteservice.isochrones.label.profile',
'label': '',
'dropdownParent': False,
'nullOption': False,
'editable': True,
'validate': {
'required': True,
'valid': False
},
'pk': False,
'default': '',
'input': {
'type': 'select',
'options': {
'values': [],
'default': None
}
},
'value': None
},
{
'visible': True,
'name': 'range_type',
'type': 'varchar',
'i18n_label': 'openrouteservice.isochrones.label.range_type',
'label': '',
'dropdownParent': False,
'nullOption': False,
'editable': True,
'validate': {
'required': True,
'valid': True
},
'pk': False,
'default': '',
'input': {
'type': 'select',
'options': {
'values': [
{ 'key': 'Time (minutes)', 'value': 'time' },
{ 'key': 'Distance (meters)', 'value': 'distance' }
],
'value': 'time'
},
},
'value': 'time'
},
{
'visible': True,
'name': 'range',
'type': 'varchar',
'i18n_label': 'openrouteservice.isochrones.label.range',
'label': '',
'info': '[MIN: 1 - MAX: 60]',
'editable': True,
'validate': {
'required': True,
'valid': False,
'message': None
},
'pk': False,
'default': '',
'input': {
'type': 'text',
'options': {
'min': 1
}
},
'value': '1'
},
{
'visible': True,
'name': 'interval',
'type': 'float',
'i18n_label': 'openrouteservice.isochrones.label.interval',
'label': '',
'editable': False,
'validate': {},
'pk': False,
'default': '',
'input': {
'type': 'slider',
'options': {
'min': 0,
'max': 0,
'step': 1
}
},
'value': 0
},
{
'visible': True,
'name': 'stroke_width',
'type': 'float',
'i18n_label': 'openrouteservice.isochrones.label.stroke_width',
'label': '',
'editable': True,
'step': 0.01,
'validate': {
'required': True,
'valid': False
},
'pk': False,
'default': '',
'input': {
'type': 'float',
'options': {
'min':0
}
},
'value': 0.26
},
{
'visible': True,
'name': 'color',
'type': 'varchar',
'i18n_label': 'openrouteservice.isochrones.label.color',
'label': 'Color',
'editable': True,
'validate': {},
'pk': False,
'default': '' ,
'input': {
'type': 'color',
'options': {}
},
'value': '#FF0000'
},
{
'visible': True,
'name': 'transparency',
'type': 'float',
'i18n_label': 'openrouteservice.isochrones.label.transparency',
'label': '',
'editable': True,
'validate': {
'required': True,
'valid': False
},
'pk': False,
'default': '',
'input': {
'type': 'slider',
'options': {
'min': 0,
'max': 1,
'step': 0.1
}
},
'value': 0.8
},
],
'inputs': {
'mapcoordinates': [
{
'visible': True,
'name': 'locations',
'type': 'float',
'i18n_labels': {
'lon': 'openrouteservice.inputs.label.mapcoordinates.lon',
'lat': 'openrouteservice.inputs.label.mapcoordinates.lat',
},
'labels': {
'lon': '',
'lat': ''
},
'epsg': 'EPSG:4326', # SET OUTPUTEPSG
'dropdownParent': False,
'nullOption': False,
'editable': True,
'validate': {
'required': True,
'valid': True
},
'pk': False,
'default': '',
'input': {
'type': 'lonlat',
'options': {},
},
'values': {
'lon': 0,
'lat': 0
},
'value': [[0, 0]]
},
],
'from_layer': [
{
'visible': True,
'name': 'from_layer',
'type': 'varchar',
'i18n_label': 'openrouteservice.inputs.label.from_layer',
'label': 'Layer',
'dropdownParent': False,
'nullOption': False,
'editable': True,
'validate': {
'required': True,
'valid': True
},
'pk': False,
'default': '',
'input': {
'type': 'select',
'options': {
'values': [],
'value': None
},
},
'value': None
},
]
},
'outputs': {
'newlayer': [
{
'visible': True,
'name': 'new_layer_name',
'type': 'varchar',
'i18n_label': 'openrouteservice.outputs.label.new_layer_name',
'label': '',
'editable': True,
'validate': {
'required': True,
'valid': False
},
'pk': False,
'default': '' ,
'input': {
'type': 'text',
'options': {}
},
'value': None
},
{
'visible': True,
'name': 'connection_id',
'type': 'varchar',
'i18n_label': 'openrouteservice.outputs.label.connection_id',
'label': '',
'dropdownParent': False,
'nullOption': False,
'editable': True,
'validate': {
'required': True,
'valid': True
},
'pk': False,
'default': '',
'input': {
'type': 'select',
'options': {
'values': [
{
'i18n_key': 'openrouteservice.outputs.label.input.select.__shapefile__',
'key': 'New Shapefile', # //'_', '', ''
'value': '__shapefile__'
},
{
'i18n_key': 'openrouteservice.outputs.label.input.select.__spatialite__',
'key': 'New Spatialite',
'value': '__spatialite__'
},
{
'i18n_key': 'openrouteservice.outputs.label.input.select.__geopackage__',
'key': 'New Geopackage',
'value': '__geopackage__'
}
],
},
},
'value': '__shapefile_'
}
],
'existinglayer': [
{
'visible': True,
'name': 'qgis_layer_id',
'type': 'varchar',
'label': 'Existing Layer',
'dropdownParent': False,
'nullOption': False,
'editable': True,
'validate': {
'required': True,
'valid': True
},
'pk': False,
'default': '',
'input': {
'type': 'select',
'options': {
'values': [],
},
},
'value': None
}
]
}
}
})
11 changes: 9 additions & 2 deletions g3w-admin/openrouteservice/apiurls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
__copyright__ = 'Copyright 2021, ItOpen'
__license__ = "MPL 2.0"

from django.urls import re_path
from django.urls import path, re_path
from django.contrib.auth.decorators import login_required

from .api.views import (
OpenrouteserviceCompatibleLayersView,
OpenrouteServiceIsochroneView,
OpenrouteServiceIsochroneFromLayerView,
OpenrouteServiceIsochroneFromLayerResultView
OpenrouteServiceIsochroneFromLayerResultView,
OpenrouteServiceVueConfigView,
)


Expand Down Expand Up @@ -47,4 +48,10 @@
name='openrouteservice-isochrone-from-layer-result'
),

path(
'api/vueconfig',
login_required(OpenrouteServiceVueConfigView.as_view()),
name='openrouteservice-vueconfig'
),

]
Loading
Loading