From 4416dc989ad297b3baaa7516081d58392bef1651 Mon Sep 17 00:00:00 2001 From: kimura-developer <136853071+kimura-developer@users.noreply.github.com> Date: Sun, 1 Oct 2023 16:52:04 -0500 Subject: [PATCH] WIP - download layer component, html --- web-app/src/ng1/admin/layers/index.js | 4 ++- .../src/ng1/admin/layers/layer.component.js | 1 + .../admin/layers/layer.download.component.js | 29 +++++++++++++++++++ .../src/ng1/admin/layers/layer.download.html | 14 +++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 web-app/src/ng1/admin/layers/layer.download.component.js create mode 100644 web-app/src/ng1/admin/layers/layer.download.html diff --git a/web-app/src/ng1/admin/layers/index.js b/web-app/src/ng1/admin/layers/index.js index f94988735..13e695799 100644 --- a/web-app/src/ng1/admin/layers/index.js +++ b/web-app/src/ng1/admin/layers/index.js @@ -5,6 +5,7 @@ import adminLayerEdit from './layer.edit.component'; import adminLayerPreview from './layer.preview.component'; import adminLayerDelete from './layer.delete.component'; import adminLayerWmsEdit from './layer.wms.edit.component'; +import adminLayerDownload from './layer.download.component'; angular.module('mage') .component('adminLayer', adminLayer) @@ -12,4 +13,5 @@ angular.module('mage') .component('adminLayerEdit', adminLayerEdit) .component('adminLayerPreview', adminLayerPreview) .component('adminLayerDelete', adminLayerDelete) - .component('adminLayerWmsEdit',adminLayerWmsEdit); + .component('adminLayerWmsEdit', adminLayerWmsEdit) + .component('adminLayerDownload', adminLayerDownload); diff --git a/web-app/src/ng1/admin/layers/layer.component.js b/web-app/src/ng1/admin/layers/layer.component.js index 87cce1514..a3c592405 100644 --- a/web-app/src/ng1/admin/layers/layer.component.js +++ b/web-app/src/ng1/admin/layers/layer.component.js @@ -21,6 +21,7 @@ class AdminLayerController { this.hasLayerEditPermission = _.contains(UserService.myself.role.permissions, 'UPDATE_LAYER'); this.hasLayerDeletePermission = _.contains(UserService.myself.role.permissions, 'DELETE_LAYER'); + this.hasLayerDownloadPermission = _.contains(UserService.myself.role.permissions,'DOWNLOAD_LAYER'); this.fileUploadOptions = { acceptFileTypes: /(\.|\/)(kml)$/i, diff --git a/web-app/src/ng1/admin/layers/layer.download.component.js b/web-app/src/ng1/admin/layers/layer.download.component.js new file mode 100644 index 000000000..23e5293a1 --- /dev/null +++ b/web-app/src/ng1/admin/layers/layer.download.component.js @@ -0,0 +1,29 @@ +class AdminLayerDownloadController { + constructor() {} + + $onInit() { + this.layer = this.resolve.layer; + } + + downloadLayer(layer) { + // Logic to handle downloading the layer goes here + + // Once complete, close the modal. + this.modalInstance.close(layer); + } + + cancel() { + this.modalInstance.dismiss('cancel'); + } +} + +AdminLayerDownloadController.$inject = []; + +export default { + template: require('./layer.download.html'), + bindings: { + resolve: '<', + modalInstance: '<' + }, + controller: AdminLayerDownloadController +}; diff --git a/web-app/src/ng1/admin/layers/layer.download.html b/web-app/src/ng1/admin/layers/layer.download.html new file mode 100644 index 000000000..8da7e0ede --- /dev/null +++ b/web-app/src/ng1/admin/layers/layer.download.html @@ -0,0 +1,14 @@ +
Click the button to download the layer's data.
+ +