Skip to content

Commit

Permalink
WIP - download layer component, html
Browse files Browse the repository at this point in the history
  • Loading branch information
kimura-developer committed Oct 1, 2023
1 parent 2e2962c commit 4416dc9
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
4 changes: 3 additions & 1 deletion web-app/src/ng1/admin/layers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ 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)
.component('adminLayers', adminLayers)
.component('adminLayerEdit', adminLayerEdit)
.component('adminLayerPreview', adminLayerPreview)
.component('adminLayerDelete', adminLayerDelete)
.component('adminLayerWmsEdit',adminLayerWmsEdit);
.component('adminLayerWmsEdit', adminLayerWmsEdit)
.component('adminLayerDownload', adminLayerDownload);
1 change: 1 addition & 0 deletions web-app/src/ng1/admin/layers/layer.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
29 changes: 29 additions & 0 deletions web-app/src/ng1/admin/layers/layer.download.component.js
Original file line number Diff line number Diff line change
@@ -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
};
14 changes: 14 additions & 0 deletions web-app/src/ng1/admin/layers/layer.download.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="col-md-6">
<div class="card" ng-if="$ctrl.hasLayerDownloadPermission">
<div class="card-content">
<strong>Download Layer</strong>
<p>Click the button to download the layer's data.</p>
<button
class="btn btn-primary top-gap"
ng-click="$ctrl.downloadLayer($ctrl.layer)"
>
<i class="fa fa-download"></i> Download
</button>
</div>
</div>
</div>

0 comments on commit 4416dc9

Please sign in to comment.