diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2017-02-14 19:41:00 -0500 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2017-02-14 19:41:32 -0500 |
commit | 91d04c64771832a0b8815ffbe1f0f9920320d94d (patch) | |
tree | fb02d5e1c84a3d91def9a7ee95bc87f9c046cc96 /ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src | |
parent | b9d4caa40ef8e3566ac475968bce17b9b64b6939 (diff) |
Initial OpenECOMP policy/engine commit
Change-Id: I7dbff37733b661643dd4d1caefa3d7dccc361b6e
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src')
25 files changed, 3307 insertions, 0 deletions
diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/css/animations.css b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/css/animations.css new file mode 100644 index 000000000..50db9b001 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/css/animations.css @@ -0,0 +1,183 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +@-webkit-keyframes fadeIn { + 0% { + opacity: 0; + } + + 100% { + opacity: 1; + }; +} + +@keyframes fadeIn { + 0% { + opacity: 0; + } + + 100% { + opacity: 1; + }; +} + +@-webkit-keyframes fadeInDown { + 0% { + opacity: 0; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } + + 100% { + opacity: 1; + -webkit-transform: none; + transform: none; + }; +} + +@keyframes fadeInDown { + 0% { + opacity: 0; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } + + 100% { + opacity: 1; + -webkit-transform: none; + transform: none; + }; +} + +@keyframes rotate { + 100% { + transform: rotate(360deg); + }; +} + +@-webkit-keyframes rotate { + 100% { + -webkit-transform: rotate(360deg); + }; +} + +@keyframes colors { + 0% { + stroke: #4285F4; + } + + 25% { + stroke: #DE3E35; + } + + 50% { + stroke: #F7C223; + } + + 75% { + stroke: #1B9A59; + } + + 100% { + stroke: #4285F4; + }; +} + +@keyframes dash { + 0% { + stroke-dasharray: 1,150; + stroke-dashoffset: 0; + stroke: red; + } + + 50% { + stroke-dasharray: 90,150; + stroke-dashoffset: -35; + stroke: yellow; + } + + 100% { + stroke-dasharray: 90,150; + stroke-dashoffset: -124; + stroke: green; + }; +} + +@-webkit-keyframes dash { + 0% { + stroke-dasharray: 1,150; + stroke-dashoffset: 0; + } + + 50% { + stroke-dasharray: 90,150; + stroke-dashoffset: -35; + } + + 100% { + stroke-dasharray: 90,150; + stroke-dashoffset: -124; + }; +} + +.animated { + -webkit-animation-duration: .7s; + animation-duration: .7s; + -webkit-animation-fill-mode: both; + animation-fill-mode: both; +} + +.modal.animated, +.animated.fast { + -webkit-animation-duration: .2s; + animation-duration: .2s; +} + +.animated.slow { + -webkit-animation-duration: 1.1s; + animation-duration: 1.1s; +} + +.animated.fadeInDown { + -webkit-animation-name: fadeInDown; + animation-name: fadeInDown; +} + +.animated.fadeIn { + -webkit-animation-name: fadeIn; + animation-name: fadeIn; +} + +.spinner-container { + -webkit-animation: rotate 2s linear infinite; + animation: rotate 2s linear infinite; + z-index: 2; + width: 65px; + height: 65px; +} + +.spinner-container .path { + stroke-dasharray: 1,150; + stroke-dashoffset: 0; + stroke: #2196F3; + stroke-linecap: round; + -webkit-animation: dash 1.5s ease-in-out infinite, colors 5.6s ease-in-out infinite; + animation: dash 1.5s ease-in-out infinite, colors 5.6s ease-in-out infinite; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/css/dialogs.css b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/css/dialogs.css new file mode 100644 index 000000000..60690c4fe --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/css/dialogs.css @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +.modal { + word-wrap: break-word; +} + +.modal .label.error-msg { + display: block; + font-size: 12px; + margin-top: 5px; + padding: 0; + padding: 5px; + margin-top: 10px; + text-align: left; +} + +.modal .label.error-msg > span { + white-space: pre-wrap; +} + +.modal .modal-header { + padding-bottom: 0; +} + +.modal .breadcrumb { + margin-bottom: 10px; +} + +.modal-fullscreen .modal-dialog, +.modal-fullscreen .modal-content { + bottom: 0; + left: 0; + position: absolute; + right: 0; + top: 0; +} + +.modal-fullscreen .modal-dialog { + margin: 0; + width: 100%; +} + +.modal-fullscreen .modal-content { + border: none; + -moz-border-radius: 0; + border-radius: 0; + -webkit-box-shadow: inherit; + -moz-box-shadow: inherit; + -o-box-shadow: inherit; + box-shadow: inherit; +} + +.modal-fullscreen textarea.code { + min-height: 450px; +} + +.modal img.preview { + max-width: 100%; + max-height: 640px; + border-radius: 3px; +} + +.modal img.preview.loading { + width: 100%; + height: 1px; + opacity: 0; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/css/main.css b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/css/main.css new file mode 100644 index 000000000..78001f400 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/css/main.css @@ -0,0 +1,336 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +body { + padding-top: 55px; + font-size: 14px; +} + +*, +*:focus { + outline: 0!important; +} + +.navbar { + min-height: 32px; +} + +.navbar .navbar-toggle { + padding: 5px 10px; +} + +.navbar .navbar-brand { + font-size: inherit; + height: 55px; + line-height: 100%; +} + +.navbar .navbar-form { + border-bottom: none; + border-top: none; + box-shadow: none; + padding: 0 10px; + margin-top: 10px; +} + +.breadcrumb { + border-radius: 0; +} + +.breadcrumb .btn { + margin-top: -5px; +} + +.btn.btn-default { + color: #444; + background-color: #FAFAFA; +} + +.btn { + box-shadow: 0 2px 5px 0 rgba(0, 0, 0, .26); + font-weight: 500; + letter-spacing: .01em; + border: none; +} + +textarea.code { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + font-size: 13px; + min-height: 250px; + resize: vertical; + color: #000; +} + +.sub-header { + padding-bottom: 10px; + border-bottom: 1px solid #eee; +} + +.navbar-fixed-top { + border: 0; +} + +.sidebar { + display: none; +} + +.btn-go-back { + margin-top: -5px; +} + +a:hover { + text-decoration: none; +} + +.nav-sidebar { + margin-right: -21px; + margin-bottom: 20px; + margin-left: -20px; +} + +.nav-sidebar > li > a { + padding-right: 20px; + padding-left: 20px; +} + +.nav-sidebar > .active > a, +.nav-sidebar > .active > a:hover, +.nav-sidebar > .active > a:focus { + color: #fff; + background-color: #2196F3; +} + +.main { + padding: 0; +} + +.main .page-header { + margin-top: 0; +} + +.file-tree ul.nav.nav-sidebar { + margin: 0; + padding: 0; + padding-left: 12px; +} + +.file-tree ul.nav.nav-sidebar > li { + border-left: 1px solid #ddd; + padding-left: 4px; +} + +.file-tree ul.nav.nav-sidebar > li > a { + padding: 2px 2px 2px 4px; +} + +.file-tree ul.nav.nav-sidebar:first-child { + padding-left: 0; +} + +.file-tree ul.nav.nav-sidebar.file-tree-root > li { + border-left: none; + padding-left: 0px; +} + +.table td { + vertical-align: middle; +} + +#context-menu { + position: absolute; + display: none; + z-index: 9999; +} + +.iconset { + padding: 10px; +} + +.col-120 { + width: 100px; + max-height: 100px; + float: left; + margin-bottom: 9px; + margin-right: 9px; +} + +.col-120:last-child { + margin-right: 0; +} + +.iconset .thumbnail { + border-radius: 0; + overflow: hidden; + margin: 0; + padding: 0; + padding: 10px 0; + border: none; +} + +.iconset .thumbnail .item-icon { + font-size: 32px; +} + +.detail-sources { + text-overflow: ellipsis; + overflow: hidden; + word-wrap: break-word; +} + +::-webkit-scrollbar { + width: 10px; + height: 10px; + background-color: #fff; + box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .1), inset -1px -1px 0 rgba(0, 0, 0, .07); +} + +::-webkit-scrollbar:hover { + background-color: #eee; +} + +::-webkit-scrollbar-thumb { + min-height: 0.8em; + min-width: 0.8em; + background-color: rgba(0, 0, 0, .2); + box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .1), inset -1px -1px 0 rgba(0, 0, 0, .07); +} + +::-webkit-scrollbar-thumb:hover { + background-color: #bbb; +} + +::-webkit-scrollbar-thumb:active { + background-color: #888; +} + +.dropdown-menu.dropdown-right-click { + display: block; + position: static; + margin-bottom: 5px; + font-size: 1em; +} + +.dropdown-menu.dropdown-right-click>li>a { + padding: 5px 12px; +} + +.dropdown-menu.dropdown-right-click>li>a>i { + font-size: .9em; + margin-right: 1px; +} + +.dropdown-menu.dropdown-right-click .divider { + margin: 3px 0; +} + +.spinner-wrapper { + margin: 0 auto; + text-align: center; + margin-top: 8%; +} + +table th > a:hover, +table th > a:active, +table th > a:focus { + text-decoration: none; +} + +.sortorder:after { + color: #2196f3; + content: '\25bc'; +} + +.sortorder.reverse:after { + color: #2196f3; + content: '\25b2'; +} + +[ng\:cloak], [ng-cloak], +[data-ng-cloak], [x-ng-cloak], +.ng-cloak, .x-ng-cloak { + display: none !important; +} + +.mr2 { + margin-right: 2px; +} + +.mr5 { + margin-right: 5px; +} + +.mt10 { + margin-top: 10px; +} + +.mb0 { + margin-bottom: 0; +} + +.pointer { + cursor: pointer; +} + +.block { + display: block; +} + +.ellipsis { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.bold { + font-weight: bold; +} + +@media (min-width: 768px) { + .main { + padding-right: 0; + padding-left: 0; + } + + .sidebar { + position: fixed; + top: 50px; + bottom: 0; + left: 0; + z-index: 1000; + display: block; + padding: 5px 0; + overflow-x: hidden; + overflow-y: auto; + background-color: #f5f5f5; + border-right: 1px solid #eee; + } +} + +@media (max-width: 768px) { + .navbar-form .btn { + margin-top: 5px; + } +} + +@media (max-width: 475px) { + .table.table-files .btn { + display: none; + } +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/app.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/app.js new file mode 100644 index 000000000..a5a8642bc --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/app.js @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +(function(window, angular, $) { + 'use strict'; + angular.module("abs", ["att.abs","modalServices","ngRoute", 'pascalprecht.translate', 'ngCookies', 'ngSanitize', 'ui-notification', + 'ui.grid','ui.grid.pagination','ui.grid.selection', 'ui.grid.exporter', 'ui.grid.edit', 'ui.grid.autoResize', + 'ui.grid.resizeColumns', 'ui.grid.treeView']); + /** + * jQuery inits + */ + $(window.document).on('shown.bs.modal', '.modal', function() { + window.setTimeout(function() { + $('[autofocus]', this).focus(); + }.bind(this), 100); + }); + + $(window.document).on('click', function() { + $('#context-menu').hide(); + }); + + $(window.document).on('contextmenu', '.main-navigation .table-files td:first-child, .iconset a.thumbnail', function(e) { + $('#context-menu').hide().css({ + left: e.pageX, + top: e.pageY + }).show(); + e.preventDefault(); + }); + +})(window, angular, jQuery); diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/controllers/main.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/controllers/main.js new file mode 100644 index 000000000..8153d679a --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/controllers/main.js @@ -0,0 +1,426 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +(function(window, angular, $) { + 'use strict'; + angular.module('abs').controller('FileManagerCtrl', [ + '$scope', '$q', '$window', '$translate', '$cookies', 'fileManagerConfig', 'item', 'fileNavigator', 'fileUploader', 'AdminTabService', 'RolesService', 'Notification', 'PolicyDictionaryService', 'PapUrlService', + function($scope, $q, $Window, $translate, $cookies, fileManagerConfig, Item, FileNavigator, FileUploader, AdminTabService, RolesService, Notification, PolicyDictionaryService, PapUrlService ) { + + $scope.isDisabled = true; + $scope.superAdminId = false; + $scope.exportPolicyId = false; + $scope.importPolicyId = false; + $scope.createScopeId = false; + $scope.deleteScopeId = false; + $scope.renameId = false; + $scope.createPolicyId = false; + $scope.cloneId = false; + $scope.editPolicyId = false; + $scope.switchVersionId = false; + $scope.describePolicyId = false; + $scope.viewPolicyId = false; + $scope.deletePolicyId = false; + AdminTabService.getData().then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.isDisabled = true; + }else{ + $scope.isDisabled = false; + } + console.log($scope.data); + },function(error){ + console.log("failed"); + }); + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + PolicyDictionaryService.getDescriptiveDictionaryData(papUrl).then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.descriptiveScopeDictionaryDatas = JSON.parse($scope.data.descriptiveScopeDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyDictionaryService.getEcompDictionaryData(papUrl).then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.ecompNameDictionaryDatas = JSON.parse($scope.data.ecompNameDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyDictionaryService.getVSCLActionDictionaryData(papUrl).then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.vsclActionDictionaryDatas = JSON.parse($scope.data.vsclActionDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyDictionaryService.getVnfTypeDictionaryData(papUrl).then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.vnfTypeDictionaryDatas = JSON.parse($scope.data.vnfTypeDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + RolesService.getRolesData().then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.userRolesDatas = JSON.parse($scope.data.userRolesDatas); + console.log($scope.userRolesDatas); + if($scope.userRolesDatas[0] == 'super-admin'){ + $scope.superAdminId = true; + $scope.exportPolicyId = true; + $scope.importPolicyId = true; + $scope.createScopeId = true; + $scope.deleteScopeId = true; + $scope.renameId = true; + $scope.createPolicyId = true; + $scope.cloneId = true; + $scope.editPolicyId = true; + $scope.switchVersionId = true; + $scope.describePolicyId = true; + $scope.viewPolicyId = true; + $scope.deletePolicyId = true; + }else if($scope.userRolesDatas[0] == 'super-editor' || $scope.userRolesDatas[0] == 'editor'){ + $scope.exportPolicyId = true; + $scope.importPolicyId = true; + $scope.cloneId = true; + $scope.editPolicyId = true; + $scope.createPolicyId = true; + $scope.cloneId = true; + $scope.editPolicyId = true; + $scope.switchVersionId = true; + $scope.describePolicyId = true; + $scope.viewPolicyId = true; + $scope.deletePolicyId = true; + }else if($scope.userRolesDatas[0] == 'super-guest' || $scope.userRolesDatas[0] == 'guest'){ + $scope.describePolicyId = true; + $scope.viewPolicyId = true; + }else if($scope.userRolesDatas[0] == 'admin'){ + $scope.exportPolicyId = true; + $scope.importPolicyId = true; + $scope.createScopeId = true; + $scope.renameId = true; + $scope.createPolicyId = true; + $scope.cloneId = true; + $scope.editPolicyId = true; + $scope.switchVersionId = true; + $scope.describePolicyId = true; + $scope.viewPolicyId = true; + $scope.deletePolicyId = true; + } + }, function (error) { + console.log("failed"); + }); + + $scope.config = fileManagerConfig; + $scope.reverse = false; + $scope.predicate = ['model.type', 'model.name']; + $scope.order = function(predicate) { + $scope.reverse = ($scope.predicate[1] === predicate) ? !$scope.reverse : false; + $scope.predicate[1] = predicate; + }; + + $scope.query = ''; + $scope.temp = new Item(); + $scope.fileNavigator = new FileNavigator(); + $scope.fileUploader = FileUploader; + $scope.uploadFileList = []; + $scope.viewTemplate = $cookies.viewTemplate || 'main-table.html'; + + $scope.setTemplate = function(name) { + $scope.viewTemplate = $cookies.viewTemplate = name; + }; + + $scope.changeLanguage = function (locale) { + if (locale) { + return $translate.use($cookies.language = locale); + } + $translate.use($cookies.language || fileManagerConfig.defaultLang); + }; + + $scope.touch = function(item) { + item = item instanceof Item ? item : new Item(); + item.revert(); + $scope.temp = item; + }; + + $scope.smartClick = function(item) { + if (item.isFolder()) { + return $scope.fileNavigator.folderClick(item); + } + if (item.isImage()) { + return $scope.openImagePreview(item); + } + if (item.isEditable()) { + return $scope.openEditItem(item); + } + }; + + $scope.openImagePreview = function(item) { + item.inprocess = true; + $scope.modal('imagepreview') + .find('#imagepreview-target') + .attr('src', item.getUrl(true)) + .unbind('load error') + .on('load error', function() { + item.inprocess = false; + $scope.$apply(); + }); + return $scope.touch(item); + }; + + $scope.openEditItem = function(item) { + item.getContent(); + $scope.modal('createNewPolicy'); + return $scope.touch(item); + }; + + $scope.modal = function(id, hide) { + return $('#' + id).modal(hide ? 'hide' : 'show'); + }; + + $scope.isInThisPath = function(path) { + var currentPath = $scope.fileNavigator.currentPath.join('/'); + return currentPath.indexOf(path) !== -1; + }; + + $scope.edit = function(item) { + item.edit().then(function() { + $scope.modal('createNewPolicy', true); + }); + }; + + $scope.createNewPolicy = function(item) { + item.createNewPolicy().then(function() { + $scope.modal('createNewPolicy', true); + }); + }; + + $scope.watch = function(item){ + var uuu = "watchPolicy"; + var data = {name : item.model.name, + path : item.model.path}; + var postData={watchData: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.watchData=data.watchData;}); + Notification.success($scope.watchData); + console.log($scope.watchData); + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.Search = function(search){ + var deferred = $q.defer(); + var uuu = "searchPolicy"; + var postData = {searchdata : search}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.searchdata=data.result;}); + if($scope.searchdata[0].error != undefined){ + Notification.info($scope.searchdata[0].error); + }else{ + var j = data; + $scope.data = JSON.stringify(data.result); + $scope.searchDatas = JSON.parse($scope.data); + var searchString = "Policies List" + "<br>"; + var i; + for(i = 0 ; i < $scope.searchDatas.length; i++){ + searchString += $scope.searchDatas[i].name + ".xml" + "<br>"; + } + var myWindow = window.open("", "MsgWindow", "width=500,height=500"); + myWindow.document.write("<p>Search List</p>"); + myWindow.document.write("<p>"+searchString+"</p>"); + } + }, + error : function(data){ + alert("Error while Searching."); + } + }); + }; + + + $scope.describePolicy = function(item){ + item.describePolicy().then(function(){ + $scope.modal('describePolicy', true); + }); + }; + + $scope.exportPolicy = function(item){ + item.exportPolicy().then(function(){ + $scope.modal('exportPolicy', true); + }); + }; + + $scope.switchVersion = function(item){ + if ($scope.fileNavigator.fileNameExists(item.tempModel.content.activeVersion)) { + item.error = $translate.instant('error_invalid_filename'); + return false; + } + item.getSwitchVersionContent().then(function(){ + $scope.fileNavigator.refresh(); + $scope.modal('switchVersion', true); + }); + }; + + + $scope.viewPolicy = function(item){ + item.viewPolicy().then(function(){ + $scope.modal('createNewPolicy', true); + }); + }; + + $scope.copy = function(item) { + var samePath = item.tempModel.path.join() === item.model.path.join(); + if (samePath && $scope.fileNavigator.fileNameExists(item.tempModel.name)) { + item.error = $translate.instant('error_invalid_filename'); + return false; + } + item.copy().then(function() { + $scope.fileNavigator.refresh(); + $scope.modal('copy', true); + }); + }; + + $scope.remove = function(item) { + item.remove().then(function() { + $scope.fileNavigator.refresh(); + $scope.modal('delete', true); + }); + }; + + $scope.removePolicy = function(item) { + item.removePolicy().then(function() { + $scope.fileNavigator.refresh(); + $scope.modal('deletePolicy', true); + }); + }; + + $scope.rename = function(item) { + var samePath = item.tempModel.path.join() === item.model.path.join(); + if (samePath && $scope.fileNavigator.fileNameExists(item.tempModel.name)) { + item.error = $translate.instant('error_invalid_filename'); + return false; + } + item.rename().then(function() { + $scope.fileNavigator.refresh(); + $scope.modal('rename', true); + }); + }; + + $scope.move = function(item) { + var samePath = item.tempModel.path.join() === item.model.path.join(); + if (samePath && $scope.fileNavigator.fileNameExists(item.tempModel.name)) { + item.error = $translate.instant('error_invalid_filename'); + return false; + } + item.move().then(function() { + $scope.fileNavigator.refresh(); + $scope.modal('move', true); + }); + }; + + $scope.createFolder = function(item) { + var name = item.tempModel.name && item.tempModel.name.trim(); + item.tempModel.type = 'dir'; + item.tempModel.path = $scope.fileNavigator.currentPath; + if (name && !$scope.fileNavigator.fileNameExists(name)) { + item.createFolder().then(function() { + $scope.fileNavigator.refresh(); + $scope.modal('newfolder', true); + }); + } else { + item.error = $translate.instant('error_invalid_filename'); + return false; + } + }; + + $scope.subScopeFolder = function(item) { + var name = item.tempModel.name +"\\" + item.tempModel.subScopename && item.tempModel.name.trim() + "\\"+item.tempModel.subScopename.trim() ; + item.tempModel.type = 'dir'; + item.tempModel.path = $scope.fileNavigator.currentPath; + if (name && !$scope.fileNavigator.fileNameExists(name)) { + item.getScopeContent().then(function() { + $scope.fileNavigator.refresh(); + $scope.modal('addSubScope', true); + }); + } else { + item.error = $translate.instant('error_invalid_filename'); + return false; + } + }; + + $scope.uploadFiles = function() { + $scope.fileUploader.upload($scope.uploadFileList, $scope.fileNavigator.currentPath).then(function() { + $scope.fileNavigator.refresh(); + $scope.modal('uploadfile', true); + }, function(data) { + var errorMsg = data.result && data.result.error || $translate.instant('error_uploading_files'); + $scope.temp.error = errorMsg; + }); + }; + + $scope.getQueryParam = function(param) { + var found; + window.location.search.substr(1).split('&').forEach(function(item) { + if (param === item.split('=')[0]) { + found = item.split('=')[1]; + return false; + } + }); + return found; + }; + + $scope.changeLanguage($scope.getQueryParam('lang')); + $scope.isWindows = $scope.getQueryParam('server') === 'Windows'; + $scope.fileNavigator.refresh(); + }]); +})(window, angular, jQuery); diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/controllers/selector-controller.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/controllers/selector-controller.js new file mode 100644 index 000000000..e775534c1 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/controllers/selector-controller.js @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +(function(angular, $) { + 'use strict'; + angular.module('abs').controller('ModalFileManagerCtrl', + ['$scope', '$rootScope', 'fileNavigator', + function($scope, $rootScope, FileNavigator) { + + $scope.reverse = false; + $scope.predicate = ['model.type', 'model.name']; + $scope.order = function(predicate) { + $scope.reverse = ($scope.predicate[1] === predicate) ? !$scope.reverse : false; + $scope.predicate[1] = predicate; + }; + + $scope.fileNavigator = new FileNavigator(); + $rootScope.select = function(item, temp) { + temp.tempModel.path = item.model.fullPath().split('/'); + $('#selector').modal('hide'); + }; + + $rootScope.openNavigator = function(item) { + $scope.fileNavigator.currentPath = item.model.path.slice(); + $scope.fileNavigator.refresh(); + $('#selector').modal('show'); + }; + + }]); +})(angular, jQuery);
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/directives/directives.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/directives/directives.js new file mode 100644 index 000000000..861f32ac5 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/directives/directives.js @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +(function(angular) { + 'use strict'; + var app = angular.module('abs'); + + app.directive('angularFilemanager', ['$parse', 'fileManagerConfig', function($parse, fileManagerConfig) { + return { + restrict: 'EA', + templateUrl: fileManagerConfig.tplPath + '/main.html' + }; + }]); + + app.directive('ngFile', ['$parse', function($parse) { + return { + restrict: 'A', + link: function(scope, element, attrs) { + var model = $parse(attrs.ngFile); + var modelSetter = model.assign; + + element.bind('change', function() { + scope.$apply(function() { + modelSetter(scope, element[0].files); + }); + }); + } + }; + }]); + + app.directive('ngRightClick', ['$parse', function($parse) { + return function(scope, element, attrs) { + var fn = $parse(attrs.ngRightClick); + element.bind('contextmenu', function(event) { + scope.$apply(function() { + event.preventDefault(); + fn(scope, {$event: event}); + }); + }); + }; + }]); + +})(angular); diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/entities/item.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/entities/item.js new file mode 100644 index 000000000..709404e8c --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/entities/item.js @@ -0,0 +1,351 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +(function(window, angular, $) { + 'use strict'; + angular.module('abs').factory('item', ['$http', '$q', '$translate', 'fileManagerConfig', function($http, $q, $translate, fileManagerConfig) { + + var Item = function(model, path) { + var rawModel = { + name: model && model.name || '', + subScopename: model && model.subScopename || '', + path: path || [], + type: model && model.type || 'file', + size: model && parseInt(model.size || 0), + date: parseMySQLDate(model && model.date), + version: model && model.version || '', + createdBy: model && model.createdBy || '', + modifiedBy: model && model.modifiedBy || '', + content: model && model.content || '', + recursive: false, + sizeKb: function() { + return Math.round(this.size / 1024, 1); + }, + fullPath: function() { + if(this.version == ""){ + return ('/' + this.path.join('/') + '/' + this.name).replace(/\/\//, '/'); + }else{ + return ('/' + this.path.join('/') + '/' + this.name + '.' + this.version + '.xml').replace(/\/\//, '/'); + } + } + }; + + this.error = ''; + this.inprocess = false; + + this.model = angular.copy(rawModel); + this.tempModel = angular.copy(rawModel); + + function parseMySQLDate(mysqlDate) { + var d = (mysqlDate || '').toString().split(/[- :]/); + return new Date(d[0], d[1] - 1, d[2], d[3], d[4], d[5]); + } + }; + + Item.prototype.update = function() { + angular.extend(this.model, angular.copy(this.tempModel)); + }; + + Item.prototype.revert = function() { + angular.extend(this.tempModel, angular.copy(this.model)); + this.error = ''; + }; + + Item.prototype.deferredHandler = function(data, deferred, defaultMsg) { + if (!data || typeof data !== 'object') { + this.error = 'Bridge response error, please check the docs'; + } + if (data.result && data.result.error) { + this.error = data.result.error; + } + if (!this.error && data.error) { + this.error = data.error.message; + } + if (!this.error && defaultMsg) { + this.error = defaultMsg; + } + if (this.error) { + return deferred.reject(data); + } + this.update(); + return deferred.resolve(data); + }; + + Item.prototype.createFolder = function() { + var self = this; + var deferred = $q.defer(); + var data = {params: { + mode: 'ADDFOLDER', + path: self.tempModel.path.join('/'), + name: self.tempModel.name + }}; + + self.inprocess = true; + self.error = ''; + $http.post(fileManagerConfig.createFolderUrl, data).success(function(data) { + self.deferredHandler(data, deferred); + }).error(function(data) { + self.deferredHandler(data, deferred, $translate.instant('error_creating_folder')); + })['finally'](function() { + self.inprocess = false; + }); + + return deferred.promise; + }; + + Item.prototype.rename = function() { + var self = this; + var deferred = $q.defer(); + var data = {params: { + mode: 'RENAME', + path: self.model.fullPath(), + newPath: self.tempModel.fullPath() + }}; + self.inprocess = true; + self.error = ''; + $http.post(fileManagerConfig.renameUrl, data).success(function(data) { + self.deferredHandler(data, deferred); + }).error(function(data) { + self.deferredHandler(data, deferred, $translate.instant('error_renaming')); + })['finally'](function() { + self.inprocess = false; + }); + return deferred.promise; + }; + + + Item.prototype.move = function() { + var self = this; + var deferred = $q.defer(); + var data = {params: { + mode: 'RENAME', + path: self.model.fullPath(), + newPath: self.tempModel.fullPath() + }}; + self.inprocess = true; + self.error = ''; + $http.post(fileManagerConfig.renameUrl, data).success(function(data) { + self.deferredHandler(data, deferred); + }).error(function(data) { + self.deferredHandler(data, deferred, $translate.instant('error_moving')); + })['finally'](function() { + self.inprocess = false; + }); + return deferred.promise; + }; + + Item.prototype.copy = function() { + var self = this; + var deferred = $q.defer(); + var data = {params: { + mode: 'COPY', + path: self.model.fullPath(), + newPath: self.tempModel.fullPath() + }}; + + self.inprocess = true; + self.error = ''; + $http.post(fileManagerConfig.copyUrl, data).success(function(data) { + self.deferredHandler(data, deferred); + }).error(function(data) { + self.deferredHandler(data, deferred, $translate.instant('error_copying')); + })['finally'](function() { + self.inprocess = false; + }); + return deferred.promise; + }; + + + Item.prototype.getContent = function() { + var self = this; + var deferred = $q.defer(); + var data = {params: { + mode: 'EDITFILE', + path: self.tempModel.fullPath() + }}; + + self.inprocess = true; + self.error = ''; + $http.post(fileManagerConfig.getContentUrl, data).success(function(data) { + self.tempModel.content = self.model.content = data.result; + var json = data.result; + var policy = JSON.parse(json); + self.policy = policy; + console.log(policy); + self.deferredHandler(data, deferred); + }).error(function(data) { + self.deferredHandler(data, deferred, $translate.instant('error_getting_content')); + })['finally'](function() { + self.inprocess = false; + }); + return deferred.promise; + }; + + Item.prototype.getViewPolicyContent = function() { + var self = this; + var deferred = $q.defer(); + var data = {params: { + mode: 'VIEWPOLICY', + path: self.tempModel.fullPath() + }}; + + self.inprocess = true; + self.error = ''; + $http.post(fileManagerConfig.viewPolicyUrl, data).success(function(data) { + self.tempModel.content = self.model.content = data.result; + var json = data.result; + var policy = JSON.parse(json); + self.policy = policy; + console.log(data.result); + console.log(policy); + self.deferredHandler(data, deferred); + }).error(function(data) { + self.deferredHandler(data, deferred, $translate.instant('error_getting_content')); + })['finally'](function() { + self.inprocess = false; + }); + return deferred.promise; + }; + + Item.prototype.getSwitchVersionContent = function() { + var self = this; + var deferred = $q.defer(); + var data = {params: { + mode: 'SWITCHVERSION', + path: self.tempModel.fullPath(), + activeVersion : self.tempModel.content.activeVersion, + highestVersion : self.tempModel.content.highestVersion + }}; + + self.inprocess = true; + self.error = ''; + $http.post(fileManagerConfig.switchVersionUrl, data).success(function(data) { + self.tempModel.content = self.model.content = data; + self.deferredHandler(data, deferred); + }).error(function(data) { + self.deferredHandler(data, deferred, $translate.instant('error_getting_content')); + })['finally'](function() { + self.inprocess = false; + }); + return deferred.promise; + }; + + Item.prototype.getDescribePolicyContent = function() { + var self = this; + var deferred = $q.defer(); + var data = {params: { + mode: 'DESCRIBEPOLICYFILE', + path: self.tempModel.fullPath() + }}; + + self.inprocess = true; + self.error = ''; + $http.post(fileManagerConfig.describePolicyUrl, data).success(function(data) { + self.tempModel.content = self.model.content = data.html; + var describeTemplate = self.tempModel.content; + + self.deferredHandler(data, deferred); + }).error(function(data) { + self.deferredHandler(data, deferred, $translate.instant('error_getting_content')); + })['finally'](function() { + self.inprocess = false; + }); + return deferred.promise; + }; + + Item.prototype.getScopeContent = function() { + var self = this; + var deferred = $q.defer(); + var data = {params: { + mode: 'ADDSUBSCOPE', + name: self.tempModel.name, + subScopename: self.tempModel.subScopename, + path: self.tempModel.fullPath() + }}; + + self.inprocess = true; + self.error = ''; + $http.post(fileManagerConfig.addSubScopeUrl, data).success(function(data) { + self.deferredHandler(data, deferred); + }).error(function(data) { + self.deferredHandler(data, deferred, $translate.instant('error_adding_Scope')); + })['finally'](function() { + self.inprocess = false; + }); + return deferred.promise; + }; + + Item.prototype.remove = function() { + var self = this; + var deferred = $q.defer(); + var data = {params: { + mode: 'DELETE', + path: self.tempModel.fullPath(), + deleteVersion : self.model.versions + }}; + + self.inprocess = true; + self.error = ''; + $http.post(fileManagerConfig.removeUrl, data).success(function(data) { + self.deferredHandler(data, deferred); + }).error(function(data) { + self.deferredHandler(data, deferred, $translate.instant('error_deleting')); + })['finally'](function() { + self.inprocess = false; + }); + return deferred.promise; + }; + + Item.prototype.removePolicy = function() { + var self = this; + var deferred = $q.defer(); + var data = {params: { + mode: 'DELETE', + path: self.tempModel.fullPath(), + deleteVersion : self.model.versions + }}; + + self.inprocess = true; + self.error = ''; + $http.post(fileManagerConfig.removeUrl, data).success(function(data) { + self.deferredHandler(data, deferred); + }).error(function(data) { + self.deferredHandler(data, deferred, $translate.instant('error_deleting')); + })['finally'](function() { + self.inprocess = false; + }); + return deferred.promise; + }; + + Item.prototype.isFolder = function() { + return this.model.type === 'dir'; + }; + + Item.prototype.isEditable = function() { + return !this.isFolder() && fileManagerConfig.isEditableFilePattern.test(this.model.name); + }; + + Item.prototype.isImage = function() { + return fileManagerConfig.isImageFilePattern.test(this.model.name); + }; + + return Item; + }]); +})(window, angular, jQuery); diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/filters/filters.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/filters/filters.js new file mode 100644 index 000000000..895b7ab5b --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/filters/filters.js @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +(function(angular) { + 'use strict'; + var app = angular.module('abs'); + + app.filter('strLimit', ['$filter', function($filter) { + return function(input, limit) { + if (input.length <= limit) { + return input; + } + return $filter('limitTo')(input, limit) + '...'; + }; + }]); + + app.filter('formatDate', ['$filter', function() { + return function(input) { + return input instanceof Date ? + input.toISOString().substring(0, 19).replace('T', ' ') : + (input.toLocaleString || input.toString).apply(input); + }; + }]); +})(angular); diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/providers/config.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/providers/config.js new file mode 100644 index 000000000..f861dd5a1 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/providers/config.js @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +(function(angular) { + 'use strict'; + + angular.module('abs').provider('fileManagerConfig', function() { + + var values = { + appName: 'Policy Editor', + defaultLang: 'en', + listUrl: 'fm/listUrl', + uploadUrl: 'fm/uploadUrl', + renameUrl: 'fm/renameUrl', + copyUrl: 'fm/copyUrl', + removeUrl: 'fm/removeUrl', + editUrl: 'fm/editUrl', + getContentUrl: 'fm/getContentUrl', + createFolderUrl: 'fm/createFolderUrl', + downloadFileUrl: 'fm/downloadFileUrl', + compressUrl: 'fm/compressUrl', + extractUrl: 'fm/extractUrl', + permissionsUrl: 'fm/permissionsUrl', + describePolicyUrl : 'fm/describePolicyUrl', + viewPolicyUrl : 'fm/viewPolicyUrl', + addSubScopeUrl : 'fm/addSubScopeUrl', + switchVersionUrl : 'fm/switchVersionUrl', + exportUrl : 'fm/exportUrl', + + sidebar: true, + breadcrumb: true, + allowedActions: { + upload: true, + rename: true, + copy: true, + edit: true, + describePolicy: true, + createNewPolicy: true, + viewPolicy: true, + changePermissions: true, + compress: true, + compressChooseName: true, + extract: true, + download: true, + preview: true, + remove: true, + addSubScope : true, + switchVersion : true, + exportPolicy : true, + removePolicy : true + }, + + enablePermissionsRecursive: true, + compressAsync: true, + extractAsync: true, + + isEditableFilePattern: /\.(txt|html?|aspx?|ini|pl|py|md|css|js|log|htaccess|htpasswd|json|sql|xml|xslt?|sh|rb|as|bat|cmd|coffee|php[3-6]?|java|c|cbl|go|h|scala|vb)$/i, + isImageFilePattern: /\.(jpe?g|gif|bmp|png|svg|tiff?)$/i, + isExtractableFilePattern: /\.(gz|tar|rar|g?zip)$/i, + tplPath: 'app/policyApp/policy-models/Editor/src/templates' + }; + + return { + $get: function() { + return values; + }, + set: function (constants) { + angular.extend(values, constants); + } + }; + + }); +})(angular); diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/providers/translations.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/providers/translations.js new file mode 100644 index 000000000..394781cd4 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/providers/translations.js @@ -0,0 +1,353 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +angular.module('abs').config(['$translateProvider', function($translateProvider) { + $translateProvider.translations('en', { + filemanager: 'File Manager', + language: 'Language', + english: 'English', + spanish: 'Spanish', + portuguese: 'Portuguese', + french: 'French', + confirm: 'Confirm', + cancel: 'Cancel', + close: 'Close', + upload_file: 'Import', + files_will_uploaded_to: 'Files will be uploaded to', + uploading: 'Uploading', + permissions: 'Permissions', + select_destination_folder: 'Select the destination folder', + source: 'Source', + destination: 'Destination', + copy_file: 'Copy file', + sure_to_delete: 'Are you sure to delete', + change_name_move: 'Change name / move', + enter_new_name_for: 'Enter new name for', + extract_item: 'Extract item', + extraction_started: 'Extraction started in a background process', + compression_started: 'Compression started in a background process', + enter_folder_name_for_extraction: 'Enter the folder name for the extraction of', + enter_folder_name_for_compression: 'Enter the folder name for the compression of', + toggle_fullscreen: 'Toggle fullscreen', + edit_file: 'Edit file', + file_content: 'File content', + loading: 'Loading', + search: 'Search', + create_folder: 'Add Scope', + create: 'Create', + folder_name: 'Folder name', + upload: 'Upload', + change_permissions: 'Change permissions', + change: 'Change', + details: 'Details', + icons: 'Icons', + list: 'List', + name: 'Name', + size: 'Size', + actions: 'Actions', + date: 'Date', + no_files_in_folder: 'No files in this folder', + no_folders_in_folder: 'This folder not contains children folders', + select_this: 'Select this', + go_back: 'Go back', + wait: 'Wait', + move: 'Move', + download: 'Download', + view_item: 'View item', + remove: 'Delete', + edit: 'Edit', + copy: 'Copy', + rename: 'Rename', + extract: 'Extract', + compress: 'Compress', + error_invalid_filename: 'Invalid filename or already exists, specify another name', + error_modifying: 'An error occurred modifying the file', + error_deleting: 'An error occurred deleting the file or folder', + error_renaming: 'An error occurred renaming the file', + error_copying: 'An error occurred copying the file', + error_compressing: 'An error occurred compressing the file or folder', + error_extracting: 'An error occurred extracting the file', + error_creating_folder: 'An error occurred creating the folder', + error_getting_content: 'An error occurred getting the content of the file', + error_changing_perms: 'An error occurred changing the permissions of the file', + error_uploading_files: 'An error occurred uploading files', + sure_to_start_compression_with: 'Are you sure to compress', + owner: 'Owner', + group: 'Group', + others: 'Others', + read: 'Read', + write: 'Write', + exec: 'Exec', + original: 'Original', + changes: 'Changes', + recursive: 'Recursive', + preview: 'Item preview', + open: 'Open' + }); + + $translateProvider.translations('pt', { + filemanager: 'Gerenciador de arquivos', + language: 'LÃngua', + english: 'Inglês', + spanish: 'Espanhol', + portuguese: 'Portugues', + french: 'Francês', + confirm: 'Confirmar', + cancel: 'Cancelar', + close: 'Fechar', + upload_file: 'Carregar arquivo', + files_will_uploaded_to: 'Os arquivos serão enviados para', + uploading: 'Carregar', + permissions: 'Autorizações', + select_destination_folder: 'Selecione a pasta de destino', + source: 'Origem', + destination: 'Destino', + copy_file: 'Copiar arquivo', + sure_to_delete: 'Tem certeza de que deseja apagar', + change_name_move: 'Renomear / mudança', + enter_new_name_for: 'Digite o novo nome para', + extract_item: 'Extrair arquivo', + extraction_started: 'A extração começou em um processo em segundo plano', + compression_started: 'A compressão começou em um processo em segundo plano', + enter_folder_name_for_extraction: 'Digite o nome da pasta para a extração de', + enter_folder_name_for_compression: 'Digite o nome da pasta para Compressão', + toggle_fullscreen: 'Ativar/desativar tela cheia', + edit_file: 'Editar arquivo', + file_content: 'Conteúdo do arquivo', + loading: 'Carregando', + search: 'Localizar', + create_folder: 'Criar Pasta', + create: 'Criar', + folder_name: 'Nome da pasta', + upload: 'Fazer', + change_permissions: 'Alterar permissões', + change: 'Alterar', + details: 'Detalhes', + icons: 'Icones', + list: 'Lista', + name: 'Nome', + size: 'Tamanho', + actions: 'Ações', + date: 'Data', + no_files_in_folder: 'Não há arquivos nesta pasta', + no_folders_in_folder: 'Esta pasta não contém subpastas', + select_this: 'Selecione esta', + go_back: 'Voltar', + wait: 'Espere', + move: 'Mover', + download: 'Baixar', + view_item: 'Veja o arquivo', + remove: 'Excluir', + edit: 'Editar', + copy: 'Copiar', + rename: 'Renomear', + extract: 'Extrair', + compress: 'Comprimir', + error_invalid_filename: 'Nome do arquivo inválido ou nome de arquivo já existe, especifique outro nome', + error_modifying: 'Ocorreu um erro ao modificar o arquivo', + error_deleting: 'Ocorreu um erro ao excluir o arquivo ou pasta', + error_renaming: 'Ocorreu um erro ao mudar o nome do arquivo', + error_copying: 'Ocorreu um erro ao copiar o arquivo', + error_compressing: 'Ocorreu um erro ao comprimir o arquivo ou pasta', + error_extracting: 'Ocorreu um erro ao extrair o arquivo', + error_creating_folder: 'Ocorreu um erro ao criar a pasta', + error_getting_content: 'Ocorreu um erro ao obter o conteúdo do arquivo', + error_changing_perms: 'Ocorreu um erro ao alterar as permissões do arquivo', + error_uploading_files: 'Ocorreu um erro upload de arquivos', + sure_to_start_compression_with: 'Tem certeza que deseja comprimir', + owner: 'Proprietário', + group: 'Grupo', + others: 'Outros', + read: 'Leitura', + write: 'Escrita ', + exec: 'Execução', + original: 'Original', + changes: 'Mudanças', + recursive: 'Recursiva', + preview: 'Visualização', + open: 'Abrir' + }); + + $translateProvider.translations('es', { + filemanager: 'Administrador de archivos', + language: 'Idioma', + english: 'Ingles', + spanish: 'Español', + portuguese: 'Portugues', + french: 'Francés', + confirm: 'Confirmar', + cancel: 'Cancelar', + close: 'Cerrar', + upload_file: 'Subir archivo', + files_will_uploaded_to: 'Los archivos seran subidos a', + uploading: 'Subiendo', + permissions: 'Permisos', + select_destination_folder: 'Seleccione la carpeta de destino', + source: 'Origen', + destination: 'Destino', + copy_file: 'Copiar archivo', + sure_to_delete: 'Esta seguro que desea eliminar', + change_name_move: 'Renombrar / mover', + enter_new_name_for: 'Ingrese el nuevo nombre para', + extract_item: 'Extraer archivo', + extraction_started: 'La extraccion ha comenzado en un proceso de segundo plano', + compression_started: 'La compresion ha comenzado en un proceso de segundo plano', + enter_folder_name_for_extraction: 'Ingrese el nombre de la carpeta para la extraccion de', + enter_folder_name_for_compression: 'Ingrese el nombre de la carpeta para la compresion de', + toggle_fullscreen: 'Activar/Desactivar pantalla completa', + edit_file: 'Editar archivo', + file_content: 'Contenido del archivo', + loading: 'Cargando', + search: 'Buscar', + create_folder: 'Crear carpeta', + create: 'Crear', + folder_name: 'Nombre de la carpeta', + upload: 'Subir', + change_permissions: 'Cambiar permisos', + change: 'Cambiar', + details: 'Detalles', + icons: 'Iconos', + list: 'Lista', + name: 'Nombre', + size: 'Tamaño', + actions: 'Acciones', + date: 'Fecha', + no_files_in_folder: 'No hay archivos en esta carpeta', + no_folders_in_folder: 'Esta carpeta no contiene sub-carpetas', + select_this: 'Seleccionar esta', + go_back: 'Volver', + wait: 'Espere', + move: 'Mover', + download: 'Descargar', + view_item: 'Ver archivo', + remove: 'Eliminar', + edit: 'Editar', + copy: 'Copiar', + rename: 'Renombrar', + extract: 'Extraer', + compress: 'Comprimir', + error_invalid_filename: 'El nombre del archivo es invalido o ya existe', + error_modifying: 'Ocurrio un error al intentar modificar el archivo', + error_deleting: 'Ocurrio un error al intentar eliminar el archivo', + error_renaming: 'Ocurrio un error al intentar renombrar el archivo', + error_copying: 'Ocurrio un error al intentar copiar el archivo', + error_compressing: 'Ocurrio un error al intentar comprimir el archivo', + error_extracting: 'Ocurrio un error al intentar extraer el archivo', + error_creating_folder: 'Ocurrio un error al intentar crear la carpeta', + error_getting_content: 'Ocurrio un error al obtener el contenido del archivo', + error_changing_perms: 'Ocurrio un error al cambiar los permisos del archivo', + error_uploading_files: 'Ocurrio un error al subir archivos', + sure_to_start_compression_with: 'Esta seguro que desea comprimir', + owner: 'Propietario', + group: 'Grupo', + others: 'Otros', + read: 'Lectura', + write: 'Escritura', + exec: 'Ejecucion', + original: 'Original', + changes: 'Cambios', + recursive: 'Recursivo', + preview: 'Vista previa', + open: 'Abrir' + }); + + $translateProvider.translations('fr', { + filemanager: 'Gestionnaire de fichier', + language: 'Langue', + english: 'Anglais', + spanish: 'Espagnol', + portuguese: 'Portugais', + french: 'Français', + confirm: 'Confirmer', + cancel: 'Annuler', + close: 'Fermer', + upload_file: 'Uploader un fichier', + files_will_uploaded_to: 'Les fichiers seront uploadé dans', + uploading: 'Upload en cours', + permissions: 'Permissions', + select_destination_folder: 'Sélectionné le dossier de destination', + source: 'Source', + destination: 'Destination', + copy_file: 'Copier le fichier', + sure_to_delete: 'Êtes-vous sûr de vouloir supprimer', + change_name_move: 'Renommer / Déplacer', + enter_new_name_for: 'Entrer le nouveau nom pour', + extract_item: 'Extraires les éléments', + extraction_started: 'L\'extraction a démarré en tâche de fond', + compression_started: 'La compression a démarré en tâche de fond', + enter_folder_name_for_extraction: 'Entrer le nom du dossier pour l\'extraction de', + enter_folder_name_for_compression: 'Entrer le nom du dossier pour la compression de', + toggle_fullscreen: 'Basculer en plein écran', + edit_file: 'Éditer le fichier', + file_content: 'Contenu du fichier', + loading: 'Chargement en cours', + search: 'Recherche', + create_folder: 'Créer un dossier', + create: 'Créer', + folder_name: 'Nom du dossier', + upload: 'Upload', + change_permissions: 'Changer les permissions', + change: 'Changer', + details: 'Details', + icons: 'Icons', + list: 'Liste', + name: 'Nom', + size: 'Taille', + actions: 'Actions', + date: 'Date', + no_files_in_folder: 'Aucun fichier dans ce dossier', + no_folders_in_folder: 'Ce dossier ne contiens pas de dossier', + select_this: 'Sélectionner', + go_back: 'Retour', + wait: 'Patienter', + move: 'Déplacer', + download: 'Télécharger', + view_item: 'Voir l\'élément', + remove: 'Supprimer', + edit: 'Éditer', + copy: 'Copier', + rename: 'Renommer', + extract: 'Extraire', + compress: 'Compresser', + error_invalid_filename: 'Nom de fichier invalide ou déjà existant, merci de spécifier un autre nom', + error_modifying: 'Une erreur est survenue pendant la modification du fichier', + error_deleting: 'Une erreur est survenue pendant la suppression du fichier ou du dossier', + error_renaming: 'Une erreur est survenue pendant le renommage du fichier', + error_copying: 'Une erreur est survenue pendant la copie du fichier', + error_compressing: 'Une erreur est survenue pendant la compression du fichier ou du dossier', + error_extracting: 'Une erreur est survenue pendant l\'extraction du fichier', + error_creating_folder: 'Une erreur est survenue pendant la création du dossier', + error_getting_content: 'Une erreur est survenue pendant la récupération du contenu du fichier', + error_changing_perms: 'Une erreur est survenue pendant le changement des permissions du fichier', + error_uploading_files: 'Une erreur est survenue pendant l\'upload des fichiers', + sure_to_start_compression_with: 'Êtes-vous sûre de vouloir compresser', + owner: 'Propriétaire', + group: 'Groupe', + others: 'Autres', + read: 'Lecture', + write: 'Écriture', + exec: 'Éxécution', + original: 'Original', + changes: 'Modifications', + recursive: 'Récursif', + preview: 'Aperçu', + open: 'Ouvrir' + }); + }]); diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/RolesService.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/RolesService.js new file mode 100644 index 000000000..f661e3796 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/RolesService.js @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + * + */ +angular.module("abs").factory('RolesService', function ($http, $q) { + return { + getRolesData: function() { + return $http.get('get_UserRolesData') + .then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject(response.data); + } + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + } + }; +});
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/filenavigator.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/filenavigator.js new file mode 100644 index 000000000..95d22bd7a --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/filenavigator.js @@ -0,0 +1,199 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +(function(angular) { + 'use strict'; + angular.module('abs').service('fileNavigator', [ + '$http', '$q', 'fileManagerConfig', 'item', function ($http, $q, fileManagerConfig, Item) { + + $http.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; + + var FileNavigator = function() { + this.requesting = false; + this.fileList = []; + this.currentPath = []; + this.history = []; + this.error = ''; + }; + + FileNavigator.prototype.deferredHandler = function(data, deferred, defaultMsg) { + if (!data || typeof data !== 'object') { + this.error = 'Bridge response error, please check the docs'; + } + if (!this.error && data.result && data.result.error) { + this.error = data.result.error; + } + if (!this.error && data.error) { + this.error = data.error.message; + } + if (!this.error && defaultMsg) { + this.error = defaultMsg; + } + if (this.error) { + return deferred.reject(data); + } + return deferred.resolve(data); + }; + + FileNavigator.prototype.deferredSearchHandler = function(data, deferred, defaultMsg) { + self.fileList = []; + self.error = ''; + if (!data || typeof data !== 'object') { + this.error = 'Bridge response error, please check the docs'; + } + if (!this.error && data.result && data.result.error) { + this.error = data.result.error; + } + if (!this.error && data.error) { + this.error = data.error.message; + } + if (!this.error && defaultMsg) { + this.error = defaultMsg; + } + if (this.error) { + return deferred.reject(data); + } + return deferred.resolve(data); + }; + + FileNavigator.prototype.list = function() { + var self = this; + var deferred = $q.defer(); + var path = self.currentPath.join('/'); + var data = {params: { + mode: 'LIST', + onlyFolders: false, + path: '/' + path + }}; + + self.requesting = true; + self.fileList = []; + self.error = ''; + + $http.post(fileManagerConfig.listUrl, data).success(function(data) { + self.deferredHandler(data, deferred); + }).error(function(data) { + self.deferredHandler(data, deferred, 'Unknown error listing, check the response'); + })['finally'](function() { + self.requesting = false; + }); + return deferred.promise; + }; + + FileNavigator.prototype.refresh = function() { + var self = this; + var path = self.currentPath.join('/'); + return self.list().then(function(data) { + self.fileList = (data.result || []).map(function(file) { + return new Item(file, self.currentPath); + }); + self.buildTree(path); + }); + }; + + FileNavigator.prototype.buildTree = function(path) { + var flatNodes = [], selectedNode = {}; + + function recursive(parent, item, path) { + var absName = path ? (path + '/' + item.model.name) : item.model.name; + if (parent.name.trim() && path.trim().indexOf(parent.name) !== 0) { + parent.nodes = []; + } + if (parent.name !== path) { + for (var i in parent.nodes) { + recursive(parent.nodes[i], item, path); + } + } else { + for (var e in parent.nodes) { + if (parent.nodes[e].name === absName) { + return; + } + } + parent.nodes.push({item: item, name: absName, nodes: []}); + } + parent.nodes = parent.nodes.sort(function(a, b) { + return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : a.name.toLowerCase() === b.name.toLowerCase() ? 0 : 1; + }); + } + + function flatten(node, array) { + array.push(node); + for (var n in node.nodes) { + flatten(node.nodes[n], array); + } + } + + function findNode(data, path) { + return data.filter(function (n) { + return n.name === path; + })[0]; + } + + !this.history.length && this.history.push({name: '', nodes: []}); + flatten(this.history[0], flatNodes); + selectedNode = findNode(flatNodes, path); + selectedNode.nodes = []; + + for (var o in this.fileList) { + var item = this.fileList[o]; + item.isFolder() && recursive(this.history[0], item, path); + } + }; + + FileNavigator.prototype.folderClick = function(item) { + this.currentPath = []; + if (item && item.isFolder()) { + this.currentPath = item.model.fullPath().split('/').splice(1); + } + this.refresh(); + }; + + FileNavigator.prototype.upDir = function() { + if (this.currentPath[0]) { + this.currentPath = this.currentPath.slice(0, -1); + this.refresh(); + } + }; + + FileNavigator.prototype.goTo = function(index) { + this.currentPath = this.currentPath.slice(0, index + 1); + this.refresh(); + }; + + FileNavigator.prototype.fileNameExists = function(fileName) { + for (var item in this.fileList) { + item = this.fileList[item]; + if (fileName.trim && item.model.name.trim() === fileName.trim()) { + return true; + } + } + }; + + FileNavigator.prototype.listHasFolders = function() { + for (var item in this.fileList) { + if (this.fileList[item].model.type === 'dir') { + return true; + } + } + }; + + return FileNavigator; + }]); +})(angular);
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/fileuploader.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/fileuploader.js new file mode 100644 index 000000000..8bf6e194f --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/fileuploader.js @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +(function(window, angular) { + 'use strict'; + angular.module('abs').service('fileUploader', ['$http', '$q', 'fileManagerConfig', function ($http, $q, fileManagerConfig) { + + function deferredHandler(data, deferred, errorMessage) { + if (!data || typeof data !== 'object') { + return deferred.reject('Bridge response error, please check the docs'); + } + if (data.result && data.result.error) { + return deferred.reject(data); + } + if (data.error) { + return deferred.reject(data); + } + if (errorMessage) { + return deferred.reject(errorMessage); + } + deferred.resolve(data); + } + + this.requesting = false; + this.upload = function(fileList, path) { + if (! window.FormData) { + throw new Error('Unsupported browser version'); + } + var self = this; + var form = new window.FormData(); + var deferred = $q.defer(); + form.append('destination', '/' + path.join('/')); + + for (var i = 0; i < fileList.length; i++) { + var fileObj = fileList.item(i); + fileObj instanceof window.File && form.append('file-' + i, fileObj); + } + + self.requesting = true; + $http.post(fileManagerConfig.uploadUrl, form, { + transformRequest: angular.identity, + headers: { + 'Content-Type': undefined + } + }).success(function(data) { + deferredHandler(data, deferred); + }).error(function(data) { + deferredHandler(data, deferred, 'Unknown error uploading files'); + })['finally'](function() { + self.requesting = false; + }); + + return deferred.promise; + }; + }]); +})(window, angular);
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/current-folder-breadcrumb.html b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/current-folder-breadcrumb.html new file mode 100644 index 000000000..b2ea4e8cd --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/current-folder-breadcrumb.html @@ -0,0 +1,34 @@ +<!-- + ============LICENSE_START======================================================= + ECOMP Policy Engine + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<ol class="breadcrumb mb0"> + <li> + <a href="" ng-click="fileNavigator.goTo(-1)"> + <i class="glyphicon glyphicon-folder-open mr2"></i> + </a> + </li> + <li ng-repeat="(key, dir) in fileNavigator.currentPath track by key" ng-class="{'active':$last}" class="animated fast fadeIn"> + <a href="" ng-show="!$last" ng-click="fileNavigator.goTo(key)"> + <i class="glyphicon glyphicon-folder-open mr2"></i> {{dir}} + </a> + <span ng-show="$last"><i class="glyphicon glyphicon-folder-open mr2"></i> {{dir}}</span> + </li> + <li><button class="btn btn-primary btn-xs" ng-click="fileNavigator.upDir()">↵</button></li> +</ol>
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/item-context-menu.html b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/item-context-menu.html new file mode 100644 index 000000000..1e93cf0a6 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/item-context-menu.html @@ -0,0 +1,102 @@ +<!-- + ============LICENSE_START======================================================= + ECOMP Policy Engine + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<div id="context-menu" class="dropdown clearfix animated fast fadeIn"> + <ul class="dropdown-menu dropdown-right-click" ng-hide="isDisabled" role="menu" aria-labelledby="dropdownMenu" style=""> + + <li ng-show="temp.isFolder()"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#addSubScope" ng-show="createScopeId" ng-click="temp.getScopeContent();"> + <i class="glyphicon glyphicon-plus"></i>Add Sub Scope + </a> + </li> + <li ng-show="config.allowedActions.createNewPolicy && temp.isFolder()"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#createNewPolicy" ng-show="createPolicyId"> + <i class="glyphicon glyphicon-plus"></i>Create Policy + </a> + </li> + <li ng-show="config.allowedActions.describePolicy && !temp.isFolder()"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#describePolicy" ng-show="describePolicyId" ng-click="temp.getDescribePolicyContent();"> + <i class="glyphicon glyphicon-picture"></i>Describe Policy + </a> + </li> + <li ng-show="config.allowedActions.viewPolicy && !temp.isFolder()"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#createNewPolicy" ng-show="viewPolicyId" ng-click="temp.getViewPolicyContent();"> + <i class="glyphicon glyphicon-picture"></i> View Policy + </a> + </li> + <li ng-show="config.allowedActions.rename && !temp.isFolder()"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#rename" ng-show="renameId"> + <i class="glyphicon glyphicon-edit"></i> Rename Policy + </a> + </li> + <li ng-show="config.allowedActions.rename && temp.isFolder()"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#move" ng-show="renameId"> + <i class="glyphicon glyphicon-edit"></i> Move Scope + </a> + </li> + <li ng-show="config.allowedActions.rename && !temp.isFolder()"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#move" ng-show="renameId"> + <i class="glyphicon glyphicon-edit"></i> Move Policy + </a> + </li> + <li ng-show="config.allowedActions.rename && temp.isFolder()" > + <a href="" tabindex="-1" data-toggle="modal" data-target="#rename" ng-show="renameId"> + <i class="glyphicon glyphicon-edit"></i> Rename Scope + </a> + </li> + <li ng-show="config.allowedActions.copy && !temp.isFolder()"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#copy" ng-show="cloneId"> + <i class="glyphicon glyphicon-log-out"></i> Clone policy + </a> + </li> + <li ng-show="config.allowedActions.edit && !temp.isFolder()"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#createNewPolicy" ng-show="editPolicyId" ng-click="temp.getContent();"> + <i class="glyphicon glyphicon-pencil"></i> Edit Policy + </a> + </li> + <li ng-show="config.allowedActions.switchVersion && !temp.isFolder()"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#switchVersion" ng-show="switchVersionId" ng-click="temp.getSwitchVersionContent();"> + <i class="glyphicon glyphicon-pencil"></i> Switch Version + </a> + </li> + <li ng-show="config.allowedActions.removePolicy && !temp.isFolder()"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#deletePolicy" ng-show="deletePolicyId"> + <i class="glyphicon glyphicon-trash"></i> Delete Policy + </a> + </li> + <li ng-show="config.allowedActions.remove && temp.isFolder()"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#delete" ng-show="deleteScopeId"> + <i class="glyphicon glyphicon-trash"></i> Delete Scope + </a> + </li> + </ul> + <ul class="dropdown-menu dropdown-right-click" ng-show="isDisabled" role="menu" aria-labelledby="dropdownMenu" style=""> + <li ng-show="config.allowedActions.describePolicy && !temp.isFolder()"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#describePolicy" ng-show="describePolicyId" ng-click="temp.getDescribePolicyContent();"> + <i class="glyphicon glyphicon-picture"></i>Describe Policy + </a> + </li> + <li ng-show="config.allowedActions.viewPolicy && !temp.isFolder()"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#createNewPolicy" ng-show="viewPolicyId" ng-click="temp.getViewPolicyContent();"> + <i class="glyphicon glyphicon-picture"></i> View Policy + </a> + </li> + </ul> +</div>
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/item-toolbar.html b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/item-toolbar.html new file mode 100644 index 000000000..1b767e3a2 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/item-toolbar.html @@ -0,0 +1,25 @@ +<!-- + ============LICENSE_START======================================================= + ECOMP Policy Engine + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<div ng-show="!item.inprocess"> + <button class="btn btn-sm btn-default" data-toggle="modal" data-target="#watch" ng-click="watch(item)" title="Watch"> + <i class="glyphicon glyphicon-eye-open"></i> + </button> +</div>
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/main-icons.html b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/main-icons.html new file mode 100644 index 000000000..8487d4838 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/main-icons.html @@ -0,0 +1,43 @@ +<!-- + ============LICENSE_START======================================================= + ECOMP Policy Engine + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<div class="iconset clearfix"> + <div class="col-120" ng-repeat="item in fileNavigator.fileList | filter: query | orderBy: orderProp" ng-show="!fileNavigator.requesting && !fileNavigator.error"> + <a href="" class="thumbnail text-center" ng-click="smartClick(item)" ng-right-click="touch(item)" title="{{item.model.name}} ({{item.model.sizeKb()}}kb)"> + <div class="item-icon"> + <i class="glyphicon glyphicon-folder-open" ng-show="item.model.type === 'dir'"></i> + <i class="glyphicon glyphicon-file" ng-show="item.model.type === 'file'"></i> + </div> + {{item.model.name | strLimit : 11 }} + </a> + </div> + + <div ng-show="fileNavigator.requesting"> + <div ng-include="config.tplPath + '/spinner.html'"></div> + </div> + + <div class="alert alert-warning" ng-show="!fileNavigator.requesting && fileNavigator.fileList.length < 1 && !fileNavigator.error"> + {{"no_files_in_folder" | translate}}... + </div> + + <div class="alert alert-danger" ng-show="!fileNavigator.requesting && fileNavigator.error"> + {{ fileNavigator.error }} + </div> +</div>
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/main-table-modal.html b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/main-table-modal.html new file mode 100644 index 000000000..12b2cf048 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/main-table-modal.html @@ -0,0 +1,66 @@ +<!-- + ============LICENSE_START======================================================= + ECOMP Policy Engine + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<table class="table table-condensed table-modal-condensed mb0"> + <thead> + <tr> + <th> + <a href="" ng-click="order('model.name')"> + {{"name" | translate}} + <span class="sortorder" ng-show="predicate[1] === 'model.name'" ng-class="{reverse:reverse}"></span> + </a> + </th> + <th class="text-right"></th> + </tr> + </thead> + <tbody class="file-item"> + <tr ng-show="fileNavigator.requesting"> + <td colspan="2"> + <div ng-include="config.tplPath + '/spinner.html'"></div> + </td> + </tr> + <tr ng-show="!fileNavigator.requesting && !fileNavigator.listHasFolders() && !fileNavigator.error"> + <td colspan="2"> + {{"no_folders_in_folder" | translate}}... + </td> + <td class="text-right"> + <button class="btn btn-sm btn-default" ng-click="fileNavigator.upDir()">{{"go_back" | translate}}</button> + </td> + </tr> + <tr ng-show="!fileNavigator.requesting && fileNavigator.error"> + <td colspan="2"> + {{ fileNavigator.error }} + </td> + </tr> + <tr ng-repeat="item in fileNavigator.fileList | orderBy:predicate:reverse" ng-show="!fileNavigator.requesting && item.model.type === 'dir'"> + <td> + <a href="" ng-click="fileNavigator.folderClick(item)" title="{{item.model.name}} ({{item.model.sizeKb()}}kb)"> + <i class="glyphicon glyphicon-folder-close"></i> + {{item.model.name | strLimit : 32}} + </a> + </td> + <td class="text-right"> + <button class="btn btn-sm btn-default" ng-click="select(item, temp)"> + <i class="glyphicon glyphicon-hand-up"></i> {{"select_this" | translate}} + </button> + </td> + </tr> + </tbody> +</table>
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/main-table.html b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/main-table.html new file mode 100644 index 000000000..6a576f2fb --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/main-table.html @@ -0,0 +1,100 @@ +<!-- + ============LICENSE_START======================================================= + ECOMP Policy Engine + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<table class="table mb0 table-files"> + <thead> + <tr> + <th> + <a href="" ng-click="order('model.name')"> + {{"name" | translate}} + <span class="sortorder" ng-show="predicate[1] === 'model.name'" ng-class="{reverse:reverse}"></span> + </a> + </th> + <th class="hidden-sm hidden-xs"> + <a href="" ng-click="order('model.version')"> + Version + <span class="sortorder" ng-show="predicate[1] === 'model.version'" ng-class="{reverse:reverse}"></span> + </a> + </th> + <th class="hidden-sm hidden-xs"> + <a href="" ng-click="order('model.date')"> + {{"date" | translate}} + <span class="sortorder" ng-show="predicate[1] === 'model.date'" ng-class="{reverse:reverse}"></span> + </a> + </th> + <th class="hidden-sm hidden-xs"> + <a href="" ng-click="order('model.createdBy')"> + Created By + <span class="sortorder" ng-show="predicate[1] === 'model.createdBy'" ng-class="{reverse:reverse}"></span> + </a> + </th> + <th class="hidden-sm hidden-xs"> + <a href="" ng-click="order('model.modifiedBy')"> + Modified By + <span class="sortorder" ng-show="predicate[1] === 'model.modifiedBy'" ng-class="{reverse:reverse}"></span> + </a> + </th> + <th class="hidden-sm hidden-xs"> + <a href="">Watch Policy <span ng-class="{reverse:reverse}"></span></a> + </th> + </tr> + </thead> + <tbody class="file-item"> + <tr ng-show="fileNavigator.requesting"> + <td colspan="5"> + <div ng-include="config.tplPath + '/spinner.html'"></div> + </td> + </tr> + <tr ng-show="!fileNavigator.requesting && fileNavigator.fileList.length < 1 && !fileNavigator.error"> + <td colspan="5"> + {{"no_files_in_folder" | translate}}... + </td> + </tr> + <tr ng-show="!fileNavigator.requesting && fileNavigator.error"> + <td colspan="5"> + {{ fileNavigator.error }} + </td> + </tr> + <tr ng-repeat="item in fileNavigator.fileList | filter: {model:{name: query}} | orderBy:predicate:reverse" ng-show="!fileNavigator.requesting"> + <td ng-right-click="touch(item)"> + <a href="" ng-click="smartClick(item)" title="{{item.model.name}} ({{item.model.sizeKb()}}kb)"> + <i class="glyphicon glyphicon-folder-close" ng-show="item.model.type === 'dir'"></i> + <i class="glyphicon glyphicon-file" ng-show="item.model.type === 'file'"></i> + {{item.model.name | strLimit : 64}} + </a> + </td> + <td class="hidden-xs"> + {{item.model.version}} + </td> + <td class="hidden-sm hidden-xs"> + {{item.model.date | formatDate }} + </td> + <td class="hidden-sm hidden-xs"> + {{item.model.createdBy}} + </td> + <td class="hidden-sm hidden-xs"> + {{item.model.modifiedBy}} + </td> + <td class="hidden-sm hidden-xs"> + <div ng-include="config.tplPath + '/item-toolbar.html'"></div> + </td> + </tr> + </tbody> +</table>
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/main.html b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/main.html new file mode 100644 index 000000000..6db7c8423 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/main.html @@ -0,0 +1,34 @@ +<!-- + ============LICENSE_START======================================================= + ECOMP Policy Engine + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<div ng-app> + <div ng-include="config.tplPath + '/navbar.html'"></div> + <div class="container-fluid"> + <div class="row"> + <div ng-include="config.tplPath + '/current-folder-breadcrumb.html'" ng-show="config.breadcrumb"></div> + <div ng-include="config.tplPath + '/' + viewTemplate" class="main-navigation clearfix"></div> + </div> + </div> + <div ng-include="config.tplPath + '/modals.html'"></div> + <div ng-include="config.tplPath + '/item-context-menu.html'"></div> + <div ng-include="'app/policyApp/policy-models/Editor/PolicyTemplates/PolicyTypeTemplate.html'"></div> + <div ng-include="'app/policyApp/policy-models/Editor/PolicyTemplates/DescribePolicyTemplate.html'"></div> + <div ng-include="'app/policyApp/policy-models/Editor/PolicyTemplates/ExportPolicyTemplate.html'"></div> +</div>
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/modals.html b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/modals.html new file mode 100644 index 000000000..0adb1c407 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/modals.html @@ -0,0 +1,385 @@ +<!-- + ============LICENSE_START======================================================= + ECOMP Policy Engine + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<div class="modal animated fadeIn" id="imagepreview" data-toggle="modal" data-backdrop="static" data-keyboard="false"> + <div class="modal-dialog"> + <div class="modal-content"> + <form ng-submit="remove(temp)"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + <span class="sr-only">{{"close" | translate}}</span> + </button> + <h4 class="modal-title">{{"preview" | translate}}</h4> + </div> + <div class="modal-body" ng-show="temp.getUrl().length > 10"> + <div class="text-center"> + <img id="imagepreview-target" class="preview" alt="{{temp.model.name}}" ng-class="{'loading': temp.inprocess}"> + <span class="label label-warning" ng-show="temp.inprocess">{{'loading' | translate}} ...</span> + </div> + <div ng-include data-src="'error-bar'" class="clearfix"></div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">{{"close" | translate}}</button> + </div> + </form> + </div> + </div> +</div> + + + +<div class="modal animated fadeIn" id="delete" data-toggle="modal" data-backdrop="static" data-keyboard="false"> + <div class="modal-dialog"> + <div class="modal-content"> + <form ng-submit="remove(temp)"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + <span class="sr-only">{{"close" | translate}}</span> + </button> + <h4 class="modal-title">{{"confirm" | translate}}</h4> + </div> + <div class="modal-body"> + {{'sure_to_delete' | translate}} <b>{{temp.model.name}}</b> ? + <div ng-include data-src="'error-bar'" class="clearfix"></div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">{{"cancel" | translate}}</button> + <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess" autofocus="autofocus">{{"remove" | translate}}</button> + </div> + </form> + </div> + </div> +</div> + +<div class="modal animated fadeIn" id="deletePolicy" data-toggle="modal" data-backdrop="static" data-keyboard="false"> + <div class="modal-dialog"> + <div class="modal-content"> + <form ng-submit="removePolicy(temp)"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + <span class="sr-only">{{"close" | translate}}</span> + </button> + <h4 class="modal-title">{{"confirm" | translate}}</h4> + </div> + <div class="modal-body">{{'sure_to_delete' | translate}} <b>{{temp.model.name}}</b> ? + <div> + <p> + <input type = "radio" ng-model ="temp.model.versions" name = "radSize" id = "sizeSmall" value = "CURRENT" checked = "checked" /><label for = "sizeSmall">Are you sure you want to delete Current Version of Policy</label> + </br> + <input type = "radio" ng-model ="temp.model.versions" name = "radSize" id = "sizeMed" value = "ALL" /><label for = "sizeMed">Are you sure you want to delete All Versions of Policy</label> + </p> + </div> + <div ng-include data-src="'error-bar'" class="clearfix"></div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">{{"cancel" | translate}}</button> + <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess" autofocus="autofocus">{{"remove" | translate}}</button> + </div> + </form> + </div> + </div> +</div> + +<div class="modal animated fadeIn" id="rename" data-toggle="modal" data-backdrop="static" data-keyboard="false"> + <div class="modal-dialog"> + <div class="modal-content"> + <form ng-submit="rename(temp)"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + <span class="sr-only">{{"close" | translate}}</span> + </button> + <h4 class="modal-title">Rename</h4> + </div> + <div class="modal-body"> + <label class="radio">{{'enter_new_name_for' | translate}} <b>{{temp.model.name}}</b></label> + <input class="form-control" ng-model="temp.tempModel.name" autofocus="autofocus"> + + <!-- <div ng-include data-src="'path-selector'" class="clearfix"></div> --> + <div ng-include data-src="'error-bar'" class="clearfix"></div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">{{"cancel" | translate}}</button> + <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">{{'rename' | translate}}</button> + </div> + </form> + </div> + </div> +</div> + +<div class="modal animated fadeIn" id="searchWindow" data-toggle="modal" data-backdrop="static" data-keyboard="false"> + <div class="modal-dialog"> + <div class="modal-content"> + <form> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + <span class="sr-only">{{"close" | translate}}</span> + </button> + <h4 class="modal-title">List of Policies</h4> + </div> + <div class="modal-body"> + <div ng-include data-src="'error-bar'" class="clearfix"></div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">{{"cancel" | translate}}</button> + </div> + </form> + </div> + </div> +</div> + +<div class="modal animated fadeIn" id="move" data-toggle="modal" data-backdrop="static" data-keyboard="false"> + <div class="modal-dialog"> + <div class="modal-content"> + <form ng-submit="move(temp)"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + <span class="sr-only">{{"close" | translate}}</span> + </button> + <h4 class="modal-title">Move Policy</h4> + </div> + <div class="modal-body"> + <div ng-include data-src="'path-selector'" class="clearfix"></div> + <div ng-include data-src="'error-bar'" class="clearfix"></div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">{{"cancel" | translate}}</button> + <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Move</button> + </div> + </form> + </div> + </div> +</div> + +<div class="modal animated fadeIn" id="switchVersion" data-toggle="modal" data-backdrop="static" data-keyboard="false"> + <div class="modal-dialog"> + <div class="modal-content"> + <form ng-submit="switchVersion(temp)"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + <span class="sr-only">{{"close" | translate}}</span> + </button> + <h4 class="modal-title">Switch Version</h4> + </div> + <div class="modal-body"> + <label class="radio">Highest Version <b></b></label> + <input class="form-control" ng-disabled="true" ng-model="temp.tempModel.content.highestVersion" autofocus="autofocus"> + </div> + <div class="modal-body"> + <label class="radio">Active Version <b></b></label> + <select class="form-control" ng-model="temp.tempModel.content.activeVersion" ng-options="option for option in temp.tempModel.content.availableVersions" autofocus="autofocus"></select> + <div ng-include data-src="'error-bar'" class="clearfix"></div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">{{"cancel" | translate}}</button> + <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Save</button> + </div> + </form> + </div> + </div> +</div> + +<div class="modal animated fadeIn" id="copy" data-toggle="modal" data-backdrop="static" data-keyboard="false"> + <div class="modal-dialog"> + <div class="modal-content"> + <form ng-submit="copy(temp)"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + <span class="sr-only">{{"close" | translate}}</span> + </button> + <h4 class="modal-title">Clone Policy</h4> + </div> + <div class="modal-body"> + <label class="radio">{{'enter_new_name_for' | translate}} <b>{{temp.model.name}}</b></label> + <input class="form-control" ng-model="temp.tempModel.name" autofocus="autofocus"> + + <!-- <div ng-include data-src="'path-selector'" class="clearfix"></div> --> + <div ng-include data-src="'error-bar'" class="clearfix"></div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">{{"cancel" | translate}}</button> + <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Clone</button> + </div> + </form> + </div> + </div> +</div> + + +<div class="modal animated fadeIn" id="edit" ng-class="{'modal-fullscreen': fullscreen}" data-toggle="modal" data-backdrop="static" data-keyboard="false"> + <div class="modal-dialog modal-lg"> + <div class="modal-content"> + <form ng-submit="edit(temp)"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + <span class="sr-only">{{"close" | translate}}</span> + </button> + <button type="button" class="close mr5" ng-click="fullscreen=!fullscreen"> + <span>◊</span> + <span class="sr-only">{{'toggle_fullscreen' | translate}}</span> + </button> + <h4 class="modal-title">{{'edit_file' | translate}}</h4> + </div> + <div class="modal-body"> + <label class="radio">{{'file_content' | translate}}</label> + <span class="label label-warning" ng-show="temp.inprocess">{{'loading' | translate}} ...</span> + <textarea class="form-control code" ng-model="temp.tempModel.content" ng-show="!temp.inprocess" autofocus="autofocus"></textarea> + <div ng-include data-src="'error-bar'" class="clearfix"></div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">{{'close' | translate}}</button> + <button type="submit" class="btn btn-primary" ng-show="config.allowedActions.edit" ng-disabled="temp.inprocess">{{'edit' | translate}}</button> + </div> + </form> + </div> + </div> +</div> + +<div class="modal animated fadeIn" id="newfolder" data-toggle="modal" data-backdrop="static" data-keyboard="false"> + <div class="modal-dialog"> + <div class="modal-content"> + <form ng-submit="createFolder(temp)"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + <span class="sr-only">{{"close" | translate}}</span> + </button> + <h4 class="modal-title">Add Scope</h4> + </div> + <div class="modal-body"> + <label class="radio">Scope Name</label> + <input class="form-control" ng-model="temp.tempModel.name" autofocus="autofocus"> + <div ng-include data-src="'error-bar'" class="clearfix"></div> + </div> + <div class="modal-footer"> + <button id = "cancel" type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">{{"cancel" | translate}}</button> + <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">{{'create' | translate}}</button> + </div> + </form> + </div> + </div> +</div> + +<div class="modal animated fadeIn" id="addSubScope" data-toggle="modal" data-backdrop="static" data-keyboard="false"> + <div class="modal-dialog"> + <div class="modal-content"> + <form ng-submit="subScopeFolder(temp)"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + <span class="sr-only">{{"close" | translate}}</span> + </button> + <h4 class="modal-title">Add Sub Scope</h4> + </div> + <div class="modal-body"> + <label class="radio">Scope Name</label> + <input class="form-control" ng-model="temp.tempModel.subScopename" autofocus="autofocus"> + <!-- <div ng-include data-src="'error-bar'" class="clearfix"></div> --> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">{{"cancel" | translate}}</button> + <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">{{'create' | translate}}</button> + </div> + </form> + </div> + </div> +</div> + +<div class="modal animated fadeIn" id="uploadfile" data-toggle="modal" data-backdrop="static" data-keyboard="false"> + <div class="modal-dialog"> + <div class="modal-content"> + <form ng-submit="uploadFiles()"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + <span class="sr-only">{{"close" | translate}}</span> + </button> + <h4 class="modal-title">{{"upload_file" | translate}}</h4> + </div> + <div class="modal-body"> + <label class="radio">{{"files_will_uploaded_to" | translate}}</label> + <input type="file" class="form-control" ng-file="$parent.uploadFileList" autofocus="autofocus" multiple="multiple"/> + <div ng-include data-src="'error-bar'" class="clearfix"></div> + </div> + <div class="modal-footer"> + <div ng-show="!fileUploader.requesting"> + <button type="button" class="btn btn-default" data-dismiss="modal">{{"cancel" | translate}}</button> + <button type="submit" class="btn btn-primary" ng-disabled="!uploadFileList.length || fileUploader.requesting">{{'upload' | translate}}</button> + </div> + <div ng-show="fileUploader.requesting"> + <span class="label label-warning">{{"uploading" | translate}} ...</span> + </div> + </div> + </form> + </div> + </div> +</div> + +<div class="modal animated fadeIn" id="selector" ng-controller="ModalFileManagerCtrl"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + <span class="sr-only">{{"close" | translate}}</span> + </button> + <h4 class="modal-title">{{"select_destination_folder" | translate}}</h4> + </div> + <div class="modal-body"> + <div> + <div ng-include="config.tplPath + '/current-folder-breadcrumb.html'"></div> + <div ng-include="config.tplPath + '/main-table-modal.html'"></div> + </div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">{{"close" | translate}}</button> + </div> + </div> + </div> +</div> + +<script type="text/ng-template" id="path-selector"> + <div class="panel panel-primary mt10 mb0"> + <div class="panel-body"> + <div class="detail-sources"> + <code class="mr5"><b>{{"source" | translate}}:</b> {{temp.model.fullPath()}}</code> + </div> + <div class="detail-sources"> + <code class="mr5"><b>{{"destination" | translate}}:</b>{{temp.tempModel.fullPath()}}</code> + <a href="" class="label label-primary" ng-click="openNavigator(temp)">{{'change' | translate}}</a> + </div> + </div> + </div> +</script> + +<script type="text/ng-template" id="error-bar"> + <div class="label label-danger error-msg pull-left animated fadeIn" ng-show="temp.error"> + <i class="glyphicon glyphicon-remove-circle"></i> + <span>{{temp.error}}</span> + </div> +</script>
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/navbar.html b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/navbar.html new file mode 100644 index 000000000..9bd272819 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/navbar.html @@ -0,0 +1,127 @@ +<!-- + ============LICENSE_START======================================================= + ECOMP Policy Engine + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + + <div class="container-fluid"> + <div class="navbar-header"> + <a class="heading1" href="" ng-click="fileNavigator.goTo(-1)">{{config.appName}}</a> + <div ng-show ="isDisabled" class="ion-locked" style="clear: left; float: left"> + </div> + </div> + <div id="navbar" class="navbar-collapse collapse"> + <div class="navbar-form navbar-right" ng-hide="isDisabled"> + <button class="btn btn-default btn-sm" ng-show="superAdminId" data-toggle="modal" data-target="#newfolder" ng-click="touch()"> + <i class="glyphicon glyphicon-plus"></i> {{"create_folder" | translate}} + </button> + <button class="btn btn-default btn-sm" ng-show="importPolicyId" data-toggle="modal" data-target="#uploadfile" ng-show="config.allowedActions.upload" ng-click="touch()"> + <i class="glyphicon glyphicon-upload"></i> {{"upload_file" | translate}} + </button> + <button class="btn btn-default btn-sm" ng-show="exportPolicyId" data-toggle="modal" data-target="#exportPolicy" ng-show="config.allowedActions.exportPolicy"> + <i class="glyphicon glyphicon-download"></i> Export + </button> + <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo">Search</button> + </div> + </div> + <div id="demo" class="collapse"> + <div class="navbar-form navbar-left"> + <input type="text" class="form-control input-lg" ng-disabled="isDisabled" style = "width:900px" placeholder="{{'search'}}..." ng-model="search.query"/> + <button type="button" class="btn btn-info" ng-click= "Search(search);"><span class="glyphicon glyphicon-search"></span> Search</button> + <button class="btn btn-default btn-sm" ng-click="search.query = null">Clear Search </button> + </div> + <br> + <div class="fn-ebz-container"> + <div class="fn-ebz-container"> + <label class="fn-ebz-text-label">Policy Type:</label><BR> + <select class="form-field" ng-model="search.policyType"> + <option>action</option> + <option>config</option> + <option>closedLoop</option> + <option>decision</option> + <option>all</option> + </select> + </div> + <div class="fn-ebz-container"> + <label class="fn-ebz-text-label">Descriptive Type:</label><BR> + <select class="form-field" ng-model="search.descriptiveScope" ng-options="option for option in descriptiveScopeDictionaryDatas track by option"></select> + </div> + <div class="fn-ebz-container" ng-if="search.policyType == 'closedLoop'"> + <div class="fn-ebz-container"> + <label class="fn-ebz-text-label">ClosedLoop Policy Type:</label><BR> + <select class="form-field" ng-model="search.closedLooppolicyType"> + <option>Config_Fault</option> + <option>Config_PM</option> + </select> + </div> + <div class="fn-ebz-container"> + <label class="fn-ebz-text-label">Ecomp Name:</label><BR> + <select class="form-field" ng-model="search.ecompName" ng-options="option for option in ecompNameDictionaryDatas track by option"></select> + </div> + <div class="fn-ebz-container"> + <label class="fn-ebz-text-label">D2 Service:</label><BR> + <select class="form-field" ng-model="search.d2Service"> + <option>Hosted Voice(Trinity)</option> + <option>vUSP</option> + <option>MCR</option> + <option>Gamma</option> + <option>vDNS</option> + </select> + </div> + <div class="fn-ebz-container" ng-if="search.closedLooppolicyType == 'Config_Fault'"> + <label class="fn-ebz-text-label">VNF Type:</label><BR> + <select class="form-field" ng-model="search.vnfType" ng-options="option for option in vnfTypeDictionaryDatas track by option"></select> + </div> + <div class="fn-ebz-container" ng-if="search.closedLooppolicyType == 'Config_Fault'"> + <label class="fn-ebz-text-label">Policy Status:</label><BR> + <select class="form-field" ng-model="search.policyStatus"> + <option>Active</option> + <option>InActive</option> + </select> + </div> + <div class="fn-ebz-container" ng-if="search.closedLooppolicyType == 'Config_Fault'"> + <label class="fn-ebz-text-label">vPRO Action:</label><BR> + <select class="form-field" ng-model="search.vproAction" ng-options="option for option in vsclActionDictionaryDatas track by option"></select> + </div> + <div class="fn-ebz-container" ng-if="search.closedLooppolicyType == 'Config_PM'"> + <label class="fn-ebz-text-label">Service Type:</label><BR> + <select class="form-field" ng-model="search.serviceType"> + <option>Registration Failure(Trinity)</option> + <option>International Fraud(Trinity)</option> + <option>No Dial Tone(Trinity)</option> + <option>Call Storm(Trinity)</option> + <option>Registration Storm(Trinity)</option> + </select> + </div> + <div class="fn-ebz-container"> + <label class="fn-ebz-text-label">Bind Text Search to:</label><BR> + <select class="form-field" ng-model="search.bindTextSearch"> + <option>Email Address</option> + <option>Trigger Signature</option> + <option>Connect All Traps</option> + <option>Verification Signature</option> + <option>Connect All Faults</option> + <option>Onset Message</option> + <option>Policy Name</option> + <option>Abatement Message</option> + <option>Geo Link</option> + </select> + </div> + </div> + </div> + </div> + </div> diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/sidebar.html b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/sidebar.html new file mode 100644 index 000000000..89c7b2f23 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/sidebar.html @@ -0,0 +1,34 @@ +<!-- + ============LICENSE_START======================================================= + ECOMP Policy Engine + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<ul class="nav nav-sidebar file-tree-root"> + <li ng-repeat="item in fileNavigator.history" ng-include="'folder-branch-item'" ng-class="{'active': item.name == fileNavigator.currentPath.join('/')}"></li> +</ul> + +<script type="text/ng-template" id="folder-branch-item"> + <a href="" ng-click="fileNavigator.folderClick(item.item)" class="animated fast fadeInDown"> + <i class="glyphicon glyphicon-folder-close mr2" ng-hide="isInThisPath(item.name)"></i> + <i class="glyphicon glyphicon-folder-open mr2" ng-show="isInThisPath(item.name)"></i> + {{ (item.name.split('/').pop() || '/') | strLimit : 24 }} + </a> + <ul class="nav nav-sidebar"> + <li ng-repeat="item in item.nodes" ng-include="'folder-branch-item'" ng-class="{'active': item.name == fileNavigator.currentPath.join('/')}"></li> + </ul> +</script>
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/spinner.html b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/spinner.html new file mode 100644 index 000000000..16f682e87 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/templates/spinner.html @@ -0,0 +1,25 @@ +<!-- + ============LICENSE_START======================================================= + ECOMP Policy Engine + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<div class="spinner-wrapper col-xs-12"> + <svg class="spinner-container" style="width:65px;height:65px" viewBox="0 0 44 44"> + <circle class="path" cx="22" cy="22" r="20" fill="none" stroke-width="4"></circle> + </svg> +</div>
\ No newline at end of file |