From 7bb53c64da2dcf88894bfd31503accdd81498f3d Mon Sep 17 00:00:00 2001 From: Thomas Duval Date: Wed, 3 Jun 2020 10:06:52 +0200 Subject: Update to new version 5.4 Signed-off-by: Thomas Duval Change-Id: Idcd868133d75928a1ffd74d749ce98503e0555ea --- moon_gui/static/app/pdp/action/pdp-add.tpl.html | 88 ------- moon_gui/static/app/pdp/action/pdp-delete.tpl.html | 35 --- .../static/app/pdp/action/pdp.controller.add.js | 108 -------- .../static/app/pdp/action/pdp.controller.delete.js | 66 ----- .../static/app/pdp/edit/pdp-edit-basic.tpl.html | 65 ----- moon_gui/static/app/pdp/edit/pdp-edit.tpl.html | 64 ----- .../static/app/pdp/edit/pdp.controller.edit.js | 50 ---- moon_gui/static/app/pdp/edit/pdp.edit.basic.dir.js | 97 ------- moon_gui/static/app/pdp/pdp-list.tpl.html | 133 ---------- moon_gui/static/app/pdp/pdp.controller.list.js | 284 --------------------- 10 files changed, 990 deletions(-) delete mode 100755 moon_gui/static/app/pdp/action/pdp-add.tpl.html delete mode 100755 moon_gui/static/app/pdp/action/pdp-delete.tpl.html delete mode 100755 moon_gui/static/app/pdp/action/pdp.controller.add.js delete mode 100755 moon_gui/static/app/pdp/action/pdp.controller.delete.js delete mode 100755 moon_gui/static/app/pdp/edit/pdp-edit-basic.tpl.html delete mode 100755 moon_gui/static/app/pdp/edit/pdp-edit.tpl.html delete mode 100755 moon_gui/static/app/pdp/edit/pdp.controller.edit.js delete mode 100755 moon_gui/static/app/pdp/edit/pdp.edit.basic.dir.js delete mode 100755 moon_gui/static/app/pdp/pdp-list.tpl.html delete mode 100755 moon_gui/static/app/pdp/pdp.controller.list.js (limited to 'moon_gui/static/app/pdp') diff --git a/moon_gui/static/app/pdp/action/pdp-add.tpl.html b/moon_gui/static/app/pdp/action/pdp-add.tpl.html deleted file mode 100755 index f83fb85c..00000000 --- a/moon_gui/static/app/pdp/action/pdp-add.tpl.html +++ /dev/null @@ -1,88 +0,0 @@ - diff --git a/moon_gui/static/app/pdp/action/pdp-delete.tpl.html b/moon_gui/static/app/pdp/action/pdp-delete.tpl.html deleted file mode 100755 index 167ba417..00000000 --- a/moon_gui/static/app/pdp/action/pdp-delete.tpl.html +++ /dev/null @@ -1,35 +0,0 @@ - diff --git a/moon_gui/static/app/pdp/action/pdp.controller.add.js b/moon_gui/static/app/pdp/action/pdp.controller.add.js deleted file mode 100755 index d1c34c79..00000000 --- a/moon_gui/static/app/pdp/action/pdp.controller.add.js +++ /dev/null @@ -1,108 +0,0 @@ -/** - * @author arnaud marhin - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('PDPAddController', PDPAddController); - - PDPAddController.$inject = ['$scope', '$translate', 'alertService', 'formService', 'pdpService', 'policyService', 'utilService']; - - function PDPAddController($scope, $translate, alertService, formService, pdpService, policyService, utilService) { - - var add = this; - - /* - * - */ - - add.form = {}; - - add.pdp = {}; - - add.policies = []; - - add.selectedPolicy = null; - - add.loading = false; - add.loadingPolicies = true; - - add.create = createPDP; - - resolvePolicies(); - - /* - * - */ - - /** - * This function return an array of all policies/template ids - */ - function resolvePolicies() { - - policyService.findAllWithCallback(function(policies){ - - add.policies = policies; - add.loadingPolicies = false; - }); - - } - - function createPDP(pdp) { - - if(formService.isInvalid(add.form)) { - - formService.checkFieldsValidity(add.form); - - } else { - - add.loading = true; - - pdpService.data.pdp.create({}, { - - name: add.pdp.name, - description: add.pdp.description, - security_pipeline: [add.selectedPolicy.id], - keystone_project_id: null - - }, createSuccess, createError); - - } - - function createSuccess(data) { - - $translate('moon.pdp.add.success', { pdpName: pdp.name }) - .then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - var createdPdp = utilService.transformOne(data, 'pdps'); - - add.loading = false; - - $scope.$emit('event:pdpCreatedSuccess', createdPdp); - - } - - function createError(reason) { - - $translate('moon.pdp.add.error', { pdpName: pdp.name }) - .then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - add.loading = false; - - $scope.$emit('event:pdpCreatedError'); - - } - - } - - } - -})(); diff --git a/moon_gui/static/app/pdp/action/pdp.controller.delete.js b/moon_gui/static/app/pdp/action/pdp.controller.delete.js deleted file mode 100755 index 62557864..00000000 --- a/moon_gui/static/app/pdp/action/pdp.controller.delete.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @author arnaud marhin - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('PDPDeleteController', PDPDeleteController); - - PDPDeleteController.$inject = ['$scope', '$translate', 'alertService', 'pdpService']; - - function PDPDeleteController($scope, $translate, alertService, pdpService) { - - var del = this; - - /* - * - */ - - del.pdp = $scope.pdp; - del.loading = false; - del.remove = deletePDP; - - /* - * - */ - - function deletePDP() { - del.loading = true; - - pdpService.data.pdp.remove({pdp_id: del.pdp.id}, deleteSuccess, deleteError); - - function deleteSuccess(data) { - - $translate('moon.pdp.remove.success', { pdpName: del.pdp.name }) - .then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - del.loading = false; - - $scope.$emit('event:pdpDeletedSuccess', del.pdp); - - } - - function deleteError(reason) { - - $translate('moon.pdp.remove.error', { pdpName: del.pdp.name }) - .then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - del.loading = false; - - $scope.$emit('event:pdpDeletedError', del.pdp); - - } - - } - - } - -})(); diff --git a/moon_gui/static/app/pdp/edit/pdp-edit-basic.tpl.html b/moon_gui/static/app/pdp/edit/pdp-edit-basic.tpl.html deleted file mode 100755 index 887d81ca..00000000 --- a/moon_gui/static/app/pdp/edit/pdp-edit-basic.tpl.html +++ /dev/null @@ -1,65 +0,0 @@ -
- -
- -
- - - -
- - - -
- -
- -
- - - -
- - - -
- Name is required -
- -
- -
- -
- - -
- -
- -
- -
- - - -
- - - - Update - - - -
- -
- -
- -
\ No newline at end of file diff --git a/moon_gui/static/app/pdp/edit/pdp-edit.tpl.html b/moon_gui/static/app/pdp/edit/pdp-edit.tpl.html deleted file mode 100755 index 1fbd555a..00000000 --- a/moon_gui/static/app/pdp/edit/pdp-edit.tpl.html +++ /dev/null @@ -1,64 +0,0 @@ -
- -
-

Edit

-
- -
-
- -
- -

- Basic Information - - Update - - -

- -
- -
- -
- -
- -
-
-
Id
-
-
Name
-
-
Description
-
-
-
- -
- -
- -
- -
- -

Policies

- -
- -
- -
- - - -
- -
- -
-
- -
diff --git a/moon_gui/static/app/pdp/edit/pdp.controller.edit.js b/moon_gui/static/app/pdp/edit/pdp.controller.edit.js deleted file mode 100755 index 41b73098..00000000 --- a/moon_gui/static/app/pdp/edit/pdp.controller.edit.js +++ /dev/null @@ -1,50 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('PDPEditController', PDPEditController); - - PDPEditController.$inject = ['$scope', '$rootScope', 'pdp', '$stateParams']; - - function PDPEditController($scope, $rootScope, pdp, $stateParams) { - - var edit = this; - - edit.pdp = pdp; - - edit.editBasic = false; - - activate(); - - function activate(){ - - } - - /* - * ---- events - */ - var rootListeners = { - - 'event:pdpUpdatedSuccess': $rootScope.$on('event:pdpUpdatedSuccess', pdpUpdatedSuccess) - - }; - - for (var unbind in rootListeners) { - $scope.$on('$destroy', rootListeners[unbind]); - } - - /** - * When the model is updated, this function refresh the current model with the new changes - * @param event - * @param pdp - */ - function pdpUpdatedSuccess(event, pdp){ - - edit.pdp = pdp; - - } - } - -})(); diff --git a/moon_gui/static/app/pdp/edit/pdp.edit.basic.dir.js b/moon_gui/static/app/pdp/edit/pdp.edit.basic.dir.js deleted file mode 100755 index 402422b6..00000000 --- a/moon_gui/static/app/pdp/edit/pdp.edit.basic.dir.js +++ /dev/null @@ -1,97 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .directive('moonPDPEditBasic', moonPDPEditBasic); - - moonPDPEditBasic.$inject = []; - - function moonPDPEditBasic() { - - return { - templateUrl : 'html/pdp/edit/pdp-edit-basic.tpl.html', - bindToController : true, - controller : moonPDPEditBasicController, - controllerAs : 'edit', - scope : { - pdp : '=' - }, - restrict : 'E', - replace : true - }; - } - - angular - .module('moon') - .controller('moonPDPEditBasicController', moonPDPEditBasicController); - - moonPDPEditBasicController.$inject = ['$scope', 'pdpService', 'formService', 'alertService', '$translate', 'utilService']; - - function moonPDPEditBasicController($scope, pdpService, formService, alertService, $translate, utilService){ - - var edit = this; - - edit.editPdp = editPdp; - edit.init = init; - - edit.form = {}; - - activate(); - - function activate(){ - - edit.pdp = $scope.edit.pdp; - - edit.pdpToEdit = angular.copy(edit.pdp); - - } - - function editPdp(){ - - if(formService.isInvalid(edit.form)) { - - formService.checkFieldsValidity(edit.form); - - }else{ - - edit.loading = true; - - pdpService.update(edit.pdpToEdit, updateSuccess, updateError); - - } - - function updateSuccess(data) { - - var updatedPdp = utilService.transformOne(data, 'pdps'); - - $translate('moon.pdp.edit.basic.success', { pdpName: updatedPdp.name }).then( function(translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - edit.loading = false; - - $scope.$emit('event:pdpUpdatedSuccess', updatedPdp); - - } - - function updateError(reason) { - - $translate('moon.pdp.edit.basic.error', { pdpName: edit.pdp.name }).then( function(translatedValue) { - alertService.alertError(translatedValue); - }); - - edit.loading = false; - - } - } - - function init(){ - - edit.pdpToEdit = angular.copy(edit.pdp); - - } - } - -})(); diff --git a/moon_gui/static/app/pdp/pdp-list.tpl.html b/moon_gui/static/app/pdp/pdp-list.tpl.html deleted file mode 100755 index 8aa4e653..00000000 --- a/moon_gui/static/app/pdp/pdp-list.tpl.html +++ /dev/null @@ -1,133 +0,0 @@ - -
- -
-
-
-
- -
-
-
-
- -
-
-
-
- -
 
-
 
-
 
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
Name
-
-
Number of Securities
-
-
Project
-
-
Actions
-
There is no PDP
-
- -
- - Loading Project -
- -
- -
- -
- -
- Is not mapped -
-
- -
- -
- - - -
-
\ No newline at end of file diff --git a/moon_gui/static/app/pdp/pdp.controller.list.js b/moon_gui/static/app/pdp/pdp.controller.list.js deleted file mode 100755 index a831cfe3..00000000 --- a/moon_gui/static/app/pdp/pdp.controller.list.js +++ /dev/null @@ -1,284 +0,0 @@ -/** - * @author arnaud marhin - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('PDPListController', PDPListController); - - PDPListController.$inject = [ - '$rootScope', - '$scope', - '$filter', - '$modal', - 'NgTableParams', - 'pdps', - 'projectService']; - - function PDPListController($rootScope, - $scope, - $filter, - $modal, - NgTableParams, - pdps, - projectService) { - - var list = this; - - list.pdps = pdps; - list.mappings = []; - - - list.getPDPs = getPDPs; - list.hasPDPs = hasPDPs; - list.getPDPName = getPDPName; - list.isMapped = isMapped; - list.getProjectFromPDP = getProjectFromPDP; - list.getidFromPDP = getidFromPDP; - - list.table = {}; - - list.addPDP = addPDP; - list.deletePDP = deletePDP; - list.refreshPDPs = refreshPDPs; - list.updatePDPs = updatePDPs; - - list.getMappedProjectName = getMappedProjectName; - list.getSecPipelineFromPdp = getSecPipelineFromPdp; - - list.search = { query: '', - find: searchPDP, - reset: searchReset }; - - list.add = { modal: $modal({ template: 'html/pdp/action/pdp-add.tpl.html', show: false }), - showModal: showAddModal }; - - list.del = { modal: $modal({ template: 'html/pdp/action/pdp-delete.tpl.html', show: false }), - showModal: showDeleteModal }; - - activate(); - - function activate(){ - newPDPsTable(); - } - - /* - * ---- events - */ - - var rootListeners = { - - 'event:pdpCreatedSuccess': $rootScope.$on('event:pdpCreatedSuccess', pdpCreatedSuccess), - 'event:pdpCreatedError': $rootScope.$on('event:pdpCreatedError', pdpCreatedError), - - 'event:pdpDeletedSuccess': $rootScope.$on('event:pdpDeletedSuccess', pdpDeletedSuccess), - 'event:pdpDeletedError': $rootScope.$on('event:pdpDeletedError', pdpDeletedError), - - }; - - _.each(rootListeners, function(unbind){ - $scope.$on('$destroy', rootListeners[unbind]); - }); - - /* - * - */ - - /** - * Function getting an array of PDP JSON - * @return An array of valid pdp. - */ - function getPDPs() { - return (list.pdps) ? list.pdps : []; - } - - function hasPDPs() { - return list.getPDPs().length > 0; - } - - function addPDP(pdp) { - list.pdps.push(pdp); - } - - function deletePDP(pdp) { - - list.pdps = _.chain(list.pdps).reject({id: pdp.id}).value(); - - } - - function refreshPDPs() { - - list.table.total(list.pdps.length); - list.table.reload(); - - } - - function updatePDPs(pdp) { - - _(_.values(list.getPDPs())).each(function(anPDP) { - if(anPDP.id === pdp.id) { - //@todo: Determine what this code should have been designed to do - anPDP = _.clone(pdp); - } - }); - - return list.pdps; - - } - - /** - * Get the id from an PDP - * @param pdp The inspected pdp - * @returns {*} Its UUID - */ - function getidFromPDP(pdp) { - return pdp.id; - } - - function getMappedProjectName(pdp) { - return pdp.tenant.name; - } - - /** - * Get the name of the PDP - * @param pdp The PDP to inspect - * @returns {*} Its name. - */ - function getPDPName(pdp) { - return (pdp) ? pdp.name : ''; - } - - function isMapped(pdp) { - return !_.isNull(pdp.keystone_project_id); - } - - /** - * Prerequisite : before calling this method, isMapped should return true before - * @param pdp - * @returns false or {*}, false if the project is currently loading - */ - function getProjectFromPDP(pdp) { - - if(_.has(pdp, 'project')){ - return pdp.project; - } - - // if the call has not been made - if(!_.has(pdp, 'callPdpInProgress')){ - - pdp.callPdpInProgress = true; - - projectService.findOne(pdp.keystone_project_id, function(project){ - pdp.callPdpInProgress = false; - pdp.project = project; - return pdp.project; - }); - } - - // if the call is in progress return false - return false; - } - - /** - * Generate a table item, directly usable by the rendering engine - * @returns {{}|*} the table - */ - function newPDPsTable() { - - list.table = new NgTableParams({ - - page: 1, // show first page - count: 10, // count per page - - }, { - - total: function () { return list.getPDPs().length; }, // length of data - getData: function($defer, params) { - - var orderedData = params.sorting() ? $filter('orderBy')(list.getPDPs(), params.orderBy()) : list.getPDPs(); - $defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count())); - - }, - $scope: { $data: {} } - - }); - - return list.table; - - } - - - /* - * --- search - */ - - /** - * Indicate if an pdp having a specified name exists - * @param pdp Searched name - * @returns {boolean} True if a corresponding pdp is found, false otherwise - */ - function searchPDP(pdp){ - return list.getPDPName(pdp).indexOf(list.search.query) !== -1 || list.getSecPipelineFromPdp(pdp).indexOf(list.search.query) !== -1 ; - } - - function getSecPipelineFromPdp(pdp){ - return (pdp.security_pipeline) ? pdp.security_pipeline : []; - } - - /** - * Blank the search field - */ - function searchReset() { - list.search.query = ''; - } - - /* - * ---- add - */ - - function showAddModal() { - list.add.modal.$promise.then(list.add.modal.show); - } - - function pdpCreatedSuccess(event, pdp) { - - list.addPDP(pdp); - list.refreshPDPs(); - - list.add.modal.hide(); - - } - - function pdpCreatedError(event, pdp) { - list.add.modal.hide(); - } - - /* - * ---- delete - */ - - function showDeleteModal(pdp) { - list.del.modal.$scope.pdp = pdp; - list.del.modal.$promise.then(list.del.modal.show); - } - - function pdpDeletedSuccess(event, pdp) { - - list.deletePDP(pdp); - list.refreshPDPs(); - - list.del.modal.hide(); - - } - - function pdpDeletedError() { - list.del.modal.hide(); - } - - } - -})(); -- cgit 1.2.3-korg