aboutsummaryrefslogtreecommitdiffstats
path: root/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services
diff options
context:
space:
mode:
authorITSERVICES\rb7147 <rb7147@att.com>2017-04-25 11:46:00 -0400
committerITSERVICES\rb7147 <rb7147@att.com>2017-05-03 09:58:17 -0400
commite0addf5b588a1244f9679becd90999dfcb4c3a94 (patch)
tree1212772d6366730266ff0e093c874b07aa716c29 /ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services
parent39fb0f30472777e4b60d6a7ac8aa4eb9773961ff (diff)
Policy 1707 commit to LF
Change-Id: Ibe6f01d92f9a434c040abb05d5386e89d675ae65 Signed-off-by: ITSERVICES\rb7147 <rb7147@att.com>
Diffstat (limited to 'ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services')
-rw-r--r--ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/RolesService.js41
-rw-r--r--ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/filenavigator.js199
-rw-r--r--ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/fileuploader.js73
3 files changed, 0 insertions, 313 deletions
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
deleted file mode 100644
index f661e3796..000000000
--- a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/RolesService.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * ============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
deleted file mode 100644
index 95d22bd7a..000000000
--- a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/filenavigator.js
+++ /dev/null
@@ -1,199 +0,0 @@
-/*-
- * ============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
deleted file mode 100644
index 8bf6e194f..000000000
--- a/ecomp-sdk-app/src/main/webapp/app/policyApp/policy-models/Editor/src/js/services/fileuploader.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/*-
- * ============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