Yangman - strings to constants 74/42474/4
authormichal.kovacik <mikovaci@cisco.com>
Mon, 25 Jul 2016 12:43:56 +0000 (14:43 +0200)
committerDaniel Malachovsky <dmalacho@cisco.com>
Tue, 26 Jul 2016 08:55:26 +0000 (10:55 +0200)
+removed console statements
+handle-fileServices error fixed
+export parameters - exported JSON fixed

Change-Id: Idad8615a45d18ac221cc320d719323e3aca442f5
Signed-off-by: michal.kovacik <mikovaci@cisco.com>
30 files changed:
features/src/main/features/features.xml
modules/common-yangutils-resources/src/main/resources/yangutils/constants.js
modules/common-yangutils-resources/src/main/resources/yangutils/services/api-builder.services.js
modules/common-yangutils-resources/src/main/resources/yangutils/services/data-backup.services.js
modules/common-yangutils-resources/src/main/resources/yangutils/services/filter-node-wrapper.services.js
modules/common-yangutils-resources/src/main/resources/yangutils/services/list-filtering.services.js
modules/common-yangutils-resources/src/main/resources/yangutils/services/node-wrapper.services.js
modules/common-yangutils-resources/src/main/resources/yangutils/services/path-utils.services.js
modules/common-yangutils-resources/src/main/resources/yangutils/services/sync.services.js
modules/common-yangutils-resources/src/main/resources/yangutils/services/type-wrapper.services.js
modules/common-yangutils-resources/src/main/resources/yangutils/services/yang-utils.services.js
modules/common-yangutils-resources/src/main/resources/yangutils/services/yin-parser.services.js
modules/yangman-resources/src/main/resources/yangman/controllers/form/list.controller.js
modules/yangman-resources/src/main/resources/yangman/controllers/modules-list.controller.js
modules/yangman-resources/src/main/resources/yangman/controllers/params-admin.controller.js
modules/yangman-resources/src/main/resources/yangman/controllers/request-data.controller.js
modules/yangman-resources/src/main/resources/yangman/controllers/request-header.controller.js
modules/yangman-resources/src/main/resources/yangman/controllers/requests-list.controller.js
modules/yangman-resources/src/main/resources/yangman/controllers/yangman.controller.js
modules/yangman-resources/src/main/resources/yangman/directives/abn-tree.directive.js
modules/yangman-resources/src/main/resources/yangman/models/baselist.model.js
modules/yangman-resources/src/main/resources/yangman/services/mount-points-connector.services.js
modules/yangman-resources/src/main/resources/yangman/services/plugins-handler.services.js
modules/yangman-resources/src/main/resources/yangman/services/plugins/ymDisplayMountPoints.services.js
modules/yangman-resources/src/main/resources/yangman/services/requests.services.js
modules/yangman-resources/src/main/resources/yangman/services/yangman.services.js
modules/yangman-resources/src/main/resources/yangman/views/leftpanel/request-item.tpl.html
modules/yangman-resources/src/main/resources/yangman/views/rightpanel/detail.tpl.html
modules/yangman-resources/src/main/resources/yangman/views/rightpanel/form/list-data-top.tpl.html
modules/yangman-resources/src/main/resources/yangman/views/rightpanel/request-header.tpl.html

index 893d527a8c3ed2d73c94274142cf687a2fbae564..8ee80f59b6ee5669ccb65206196e1a1fde66a90b 100644 (file)
@@ -9,7 +9,6 @@
        <feature>odl-dlux-core</feature>
         <feature>odl-dlux-node</feature>
         <feature>odl-dlux-yangui</feature>
-        <feature>odl-dlux-yangman</feature>
         <feature>odl-dlux-yangvisualizer</feature>
     </feature>
 
index 69e4a8be982ff39333660b53a07b9944e17b1e63..b03935bb09e1c6b1f5e82393cd1e0f18f7799221 100644 (file)
@@ -23,6 +23,16 @@ function () {
         ALLOWED_LEAF_TYPES_FOR_FILTER: ['string', 'uint32', 'uint8', 'decimal64', 'int16', 'int32', 'int64', 'int8',
                                         'uint16', 'uint64', 'union', 'bits', 'leafref', 'identityref'],
         ALLOWED_NODE_TYPES_FOR_FILTER: ['case', 'choice', 'container', 'input', 'leaf', 'output', 'rpc'],
+        DISPLAY_TYPE_REQ_DATA: 'req-data',
+        DISPLAY_TYPE_FORM: 'form',
+        DATA_STORE_CONFIG: 'config',
+        DATA_STORE_OPERATIONAL: 'operational',
+        NODE_RPC: 'rpc',
+        OPERATION_GET: 'GET',
+        OPERATION_PUT: 'PUT',
+        OPERATION_DELETE: 'DELETE',
+        OPERATION_POST: 'POST',
+        REQUEST_DATA_TYPE_RECEIVED: 'RECEIVED',
     };
 
 });
index 32f47294f0b1f82fbbdc96f03b691f002c56c140..4e32ceffa5e6a549afe5ab8269538214f64f7134 100644 (file)
@@ -244,7 +244,6 @@ define([], function () {
                 });
             });
 
-            // console.info(co);
         }
 
         // TODO: add service's description
index 0a5aecf1e2c19eca943d162769ea3360e8dc1c1a..5bf489c4c13d3e070bba854d3c71f9dcbe7facb9 100644 (file)
@@ -50,7 +50,6 @@ define([], function () {
                     if (data.hasOwnProperty(k)) {
                         scope[k] = data[k];
                     } else {
-                        console.warn('storet data doesn\'t have variable', k);
                     }
                 });
             }
index 83eea95764c4dded87d831f9323f4d68539e2ab3..75d645e0172c0e65fe2816551c1d5bbe3f0f0145 100644 (file)
@@ -128,7 +128,6 @@ define([], function () {
                                 try {
                                     valueStr = string.toString();
                                 } catch (e) {
-                                    console.warn('cannot convert value', node.value);
                                 }
                                 return valueStr;
                             };
index 2fef2b843882f28d3d9c9c939873f8a2376304a3..bd8529bf57060ce2631b80558c841af7449acf57 100644 (file)
@@ -115,7 +115,6 @@ define([], function () {
             });
 
             getActElementFilter(node);
-            // console.info('applyFilter node', node, 'node.referenceNode.filterNodes',
             // node.referenceNode.filterNodes, 'node.referenceNode.filters', node.referenceNode.filters);
         }
 
index dc9d7609484b4bf0919b611e71f9ba721f0f6bdf..e28ab4038ce252b4ad95343e1961793ad5f914b2 100644 (file)
@@ -997,7 +997,6 @@ define([], function () {
             };
 
             node.getChildren('type').forEach(function (child) {
-                // console.info('child', child);
                 getTypesRecursive(child, types);
             });
 
index 4902ca9585f31305253120fc603b58d70137fbc9..7a775fb22d53a3c5f9ce06fd80c02a1494649195 100644 (file)
@@ -49,7 +49,6 @@ define([], function () {
                     return selNode;
                 }
             } else {
-                console.warn('search: cannot find element ', pathElem.name);
                 return null;
             }
         }
index 56ebe8d88c7a8a9f42cb72c63a51fbf785bfef6e..38c657f326adc3ef0e7b7bd505742ea4af2477f9 100644 (file)
@@ -24,7 +24,6 @@ define([], function () {
             this.spawnRequest = function (digest) {
                 var id = digest + (this.reqId++).toString();
                 this.runningRequests.push(id);
-                // console.debug('adding request ',id,' total running requests  = ',this.runningRequests);
                 return id;
             };
 
@@ -33,9 +32,7 @@ define([], function () {
 
                 if (index > -1) {
                     this.runningRequests.splice(index, 1);
-                    // console.debug('removing request ',id,' remaining requests = ',this.runningRequests);
                 } else {
-                    console.warn('cannot remove request', id, 'from', this.runningRequests, 'index is', index);
                 }
             };
 
@@ -45,7 +42,6 @@ define([], function () {
                     self = this;
 
                 if (processes > 0 && self.timeElapsed < timeout) {
-                    // console.debug('waitin on',processes,'processes',this.runningRequests);
                     $timeout(function () {
                         self.timeElapsed = self.timeElapsed + t;
                         self.waitFor(callback);
index 275307c5b1a07912be05648723d6ff0e8db2e002..5a243c596e121c45a99fbb5d74951832ba81bafd 100644 (file)
@@ -214,7 +214,6 @@ define([], function () {
                     try {
                         valueStr = string.toString();
                     } catch (e) {
-                        console.warn('cannot convert value', node.value);
                     }
                 }
 
index 7ed8cb9250c75b681d1e2ce353b337c86e8e4c7d..7cb89580e041ea4a240d249dff369e43cad2f87f 100644 (file)
@@ -70,8 +70,8 @@ define(['angular'], function (angular) {
 
         // TODO: add service's description
         function switchConfigOper(apiStr, swtichTo) {
-            var c = 'config',
-                o = 'operational',
+            var c = constants.DATA_STORE_CONFIG,
+                o = constants.DATA_STORE_OPERATIONAL,
                 str = apiStr;
 
             if (apiStr.indexOf(c) === 0) {
@@ -400,10 +400,10 @@ define(['angular'], function (angular) {
         function prepareRequestData(requestData, operation, reqString, subApi){
             var preparedData = requestData;
 
-            if (operation === 'GET' || operation === 'DELETE'){
+            if (operation === constants.OPERATION_GET || operation === constants.OPERATION_DELETE){
                 preparedData = null;
             }
-            else if (operation === 'POST'){
+            else if (operation === constants.OPERATION_POST){
                 return postRequestData(requestData, reqString, subApi);
             }
 
@@ -412,7 +412,7 @@ define(['angular'], function (angular) {
 
         // TODO: add service's description
         function prepareOperation(operation){
-            return operation === 'DELETE' ? 'REMOVE' : operation;
+            return operation === constants.OPERATION_DELETE ? 'REMOVE' : operation;
         }
 
         // TODO: add service's description
index c2d1210a7b8aee9300a7768fa265301678de5f53..c1f32d6c87332a32f4bfd7852379fb7702d10212 100644 (file)
@@ -81,10 +81,8 @@ define([], function () {
         function loadStaticModule(name, callback, errorCbk) {
             var yinPath = '/yang2xml/' + name + '.yang.xml';
             $http.get(path + yinPath).success(function (data) {
-                console.warn('cannot load ' + name + 'from controller, trying loading from static storage');
                 parseModule(data, callback);
             }).error(function () {
-                console.warn('cannot load file ' + yinPath + 'from static storage');
                 errorCbk();
                 return null;
             });
@@ -156,7 +154,6 @@ define([], function () {
                 });
 
                 if (duplicates && duplicates.length > 0) {
-                    console.warn('trying to add duplicate node', node, 'to module', this._statements);
                 } else {
                     this._statements[node.type].push(node);
 
@@ -181,9 +178,7 @@ define([], function () {
                 }
 
                 if (searchResults && searchResults.length === 0) {
-                    // console.warn('no nodes with type', type, 'and name', name, 'found in', this);
                 } else if (searchResults && searchResults.length > 1) {
-                    // console.warn('multiple nodes with type', type, 'and name', name, 'found in', this);
                 } else if (searchResults && searchResults.length === 1) {
                     searchedNode = searchResults[0];
                 }
@@ -347,7 +342,6 @@ define([], function () {
                         // });
                     });
                 } else {
-                    console.warn('can\'t find target node for augmentation ', this.getPathString());
                 }
             };
 
@@ -401,7 +395,7 @@ define([], function () {
             };
 
             this.config = function (xml, parent) {
-                var type = 'config',
+                var type = constants.DATA_STORE_CONFIG,
                     name = $(xml).attr('value'),
                     nodeType = constants.NODE_ALTER;
 
@@ -540,7 +534,7 @@ define([], function () {
 
 
             this.rpc = function (xml, parent) {
-                var type = 'rpc',
+                var type = constants.NODE_RPC,
                     name = $(xml).attr('name'),
                     nodeType = constants.NODE_UI_DISPLAY,
                     node = this.createNewNode(name, type, parent, nodeType);
index 28fb80c1dbf1123e1f7aaec2baf7f0d7c8cf2869..ef7e6cee631728ba3f647d3eca0415502ffb2aaf 100644 (file)
@@ -3,14 +3,15 @@ define([], function () {
 
     angular.module('app.yangman').controller('ListCtrl', ListCtrl);
 
-    ListCtrl.$inject = ['$scope', 'ListFilteringService', 'NodeWrapperService'];
+    ListCtrl.$inject = ['$scope', 'ListFilteringService', 'NodeWrapperService', 'constants'];
 
-    function ListCtrl($scope, ListFilteringService, NodeWrapperService){
+    function ListCtrl($scope, ListFilteringService, NodeWrapperService, constants){
         var yangList = this;
 
         $scope.actElement = null;
         $scope.showListFilter = false;
         $scope.filterListHover = 0;
+        yangList.constants = constants;
         yangList.currentDisplayIndex = 1;
         yangList.displayOffsets = [-1, 0, 1];
 
@@ -52,7 +53,7 @@ define([], function () {
 
             if(yangList.disableAddingListElement &&
                 !$scope.node.listData.length &&
-                $scope.selectedDatastore.label === 'config') {
+                $scope.selectedDatastore.label === constants.DATA_STORE_CONFIG) {
 
                 yangList.addListElem();
             }
@@ -193,4 +194,3 @@ define([], function () {
         }
     }
 });
-
index 10dcea72c21c6fd71b146158eab20182ddd34611..686d19e8bc5f0857b6b309fa6e53b4e5f775c6ab 100644 (file)
@@ -103,9 +103,7 @@ define([
             YangUtilsService.generateNodesToApis(function (apis, allNodes, augGroups) {
                 $scope.setGlobalParams(apis, augGroups);
                 modulesList.allNodes = allNodes;
-                // console.info('INFO :: got data', apis, modulesList.allNodes, modulesList.augmentations);
                 modulesList.treeApis = YangUtilsService.generateApiTreeData(apis);
-                 //console.info('INFO :: tree api', modulesList.treeApis);
                 // $scope.processingModulesSuccessCallback();
                 modulesList.showLoadingBox = false;
                 showToastInfoBox('YANGMAN_LOADED_MODULES');
index 108e2a4188e3355b7d21153611e70980a1f09940..c5c37f243672dba2f50c3fa264e399cba519c6f9 100644 (file)
@@ -1,12 +1,13 @@
 define([
+    'app/yangman/services/handle-file.services',
 ], function () {
     'use strict';
 
     angular.module('app.yangman').controller('ParamsAdminCtrl', ParamsAdminCtrl);
 
-    ParamsAdminCtrl.$inject = ['$mdDialog', '$scope', 'YangmanService', 'HandleFileService', 'parametersList'];
+    ParamsAdminCtrl.$inject = ['$mdDialog', '$scope', 'YangmanService', 'YMHandleFileService', 'parametersList'];
 
-    function ParamsAdminCtrl($mdDialog, $scope, YangmanService, HandleFileService, parametersList) {
+    function ParamsAdminCtrl($mdDialog, $scope, YangmanService, YMHandleFileService, parametersList) {
         var vm = this;
 
         vm.parametersList = parametersList;
@@ -72,9 +73,9 @@ define([
          */
         function exportParameters() {
 
-            HandleFileService.downloadFile(
+            YMHandleFileService.downloadFile(
                 'yangman_parameters.json',
-                JSON.stringify(vm.parametersList.toJSON()),
+                vm.parametersList.toJSON(),
                 'json',
                 'charset=utf-8',
                 function (){},
@@ -164,4 +165,3 @@ define([
     return ParamsAdminCtrl;
 
 });
-
index 70e64990c50334c82794fc2f1a3038167b9d6aff..2b21d7a15782e840e1499070db1e069d2d9bc345 100644 (file)
@@ -3,9 +3,9 @@ define([], function () {
 
     angular.module('app.yangman').controller('RequestDataCtrl', RequestDataCtrl);
 
-    RequestDataCtrl.$inject = ['$filter', '$mdToast', '$scope', 'RequestsService'];
+    RequestDataCtrl.$inject = ['$filter', '$mdToast', '$scope', 'RequestsService', 'constants'];
 
-    function RequestDataCtrl($filter, $mdToast, $scope, RequestsService) {
+    function RequestDataCtrl($filter, $mdToast, $scope, RequestsService, constants) {
         var requestData = this,
             cmData = {
                 cmInstance: null,
@@ -114,8 +114,8 @@ define([], function () {
          * Set code mirror theme and readonly property considering requestData.type
          */
         function initEditorOptions() {
-            requestData.dataEditorOptions.theme = requestData.type === 'RECEIVED' ? 'eclipse-disabled' : 'eclipse';
-            requestData.dataEditorOptions.readOnly = requestData.type === 'RECEIVED';
+            requestData.dataEditorOptions.theme = requestData.type === constants.REQUEST_DATA_TYPE_RECEIVED ? 'eclipse-disabled' : 'eclipse';
+            requestData.dataEditorOptions.readOnly = requestData.type === constants.REQUEST_DATA_TYPE_RECEIVED;
         }
 
 
@@ -138,4 +138,3 @@ define([], function () {
     }
 
 });
-
index 5c278d0fcaa0af217b257a8956ba3486e3ade24c..ba17487cf9a801edc26b12ce61d53f954c407dc6 100644 (file)
@@ -7,14 +7,15 @@ define([
 
     RequestHeaderCtrl.$inject = [
         '$mdDialog', '$mdToast', '$scope', '$rootScope', 'ENV', 'YangmanService', 'ParametersService',
-        'PathUtilsService', 'RequestsService', '$filter', 'DataBackupService',
+        'PathUtilsService', 'RequestsService', '$filter', 'DataBackupService', 'constants'
     ];
 
     function RequestHeaderCtrl($mdDialog, $mdToast, $scope, $rootScope, ENV, YangmanService, ParametersService,
-                               PathUtilsService, RequestService, $filter, DataBackupService) {
+                               PathUtilsService, RequestService, $filter, DataBackupService, constants) {
         var requestHeader = this;
 
-        requestHeader.allOperations = ['GET', 'POST', 'PUT', 'DELETE'];
+        requestHeader.allOperations = [constants.OPERATION_GET, constants.OPERATION_POST, constants.OPERATION_PUT, constants.OPERATION_DELETE];
+        requestHeader.constants = constants;
         requestHeader.selectedOperationsList = [];
         requestHeader.selectedOperation = null;
         requestHeader.requestUrl = '';
@@ -111,7 +112,7 @@ define([
          * Method for selecting correct json view by selected operation
          */
         function setJsonView(){
-            var both = ['PUT', 'POST'];
+            var both = [constants.OPERATION_PUT, constants.OPERATION_POST];
 
             if ( both.indexOf(requestHeader.selectedOperation) > -1 ){
                 $scope.setJsonView(true, true);
@@ -130,13 +131,13 @@ define([
             requestHeader.setRequestUrl();
 
             // if changing to json, fill codemirror data
-            if ( requestHeader.selectedShownDataType === 'req-data' && $scope.node ){
+            if ( requestHeader.selectedShownDataType === constants.DISPLAY_TYPE_REQ_DATA && $scope.node ){
                 setJsonView();
                 sendRequestData($scope.buildRootRequest(), 'SENT');
             }
 
             // if changing to form, try to fill node data
-            if (requestHeader.selectedShownDataType === 'form') {
+            if (requestHeader.selectedShownDataType === constants.DISPLAY_TYPE_FORM) {
                 var reqData = {};
 
                 reqData = getDataForForm();
@@ -178,7 +179,7 @@ define([
                         );
                     },
                     default: function (){
-                        var dataType = requestHeader.selectedOperation === 'GET' ? 'RECEIVED' : 'SENT';
+                        var dataType = requestHeader.selectedOperation === constants.OPERATION_GET ? constants.REQUEST_DATA_TYPE_RECEIVED : 'SENT';
 
                         $scope.rootBroadcast('YANGMAN_GET_CODEMIRROR_DATA_' + dataType, params);
                         return params.reqData ? angular.fromJson(params.reqData) : {};
@@ -295,7 +296,7 @@ define([
                 sentData = { reqData: null },
                 receivedData = { reqData: null };
 
-            if (requestHeader.selectedShownDataType === 'form') {
+            if (requestHeader.selectedShownDataType === constants.DISPLAY_TYPE_FORM) {
                 requestHeader.setRequestUrl();
             }
 
@@ -336,16 +337,16 @@ define([
          */
         function executeOperation(requestData, executeCbk){
             var allowExecuteOperation =
-                requestHeader.selectedShownDataType === 'form' && $scope.selectedSubApi ?
+                requestHeader.selectedShownDataType === constants.DISPLAY_TYPE_FORM && $scope.selectedSubApi ?
                     !PathUtilsService.checkEmptyIdentifiers($scope.selectedSubApi.pathArray) : true;
 
             if ( allowExecuteOperation ) {
 
                 showRequestProgress();
-                setRequestUrl(requestHeader.selectedShownDataType === 'req-data' ? requestHeader.requestUrl : null);
+                setRequestUrl(requestHeader.selectedShownDataType === constants.DISPLAY_TYPE_REQ_DATA ? requestHeader.requestUrl : null);
                 $scope.rootBroadcast('YANGMAN_SET_ERROR_MESSAGE', '');
 
-                if ( requestHeader.selectedShownDataType !== 'form' ){
+                if ( requestHeader.selectedShownDataType !== constants.DISPLAY_TYPE_FORM ){
                     setApiByUrl(requestHeader.requestUrl, null, true);
                 }
 
@@ -391,10 +392,10 @@ define([
 
                 sendErrorData({});
 
-                if (requestHeader.selectedShownDataType === 'req-data'){
+                if (requestHeader.selectedShownDataType === constants.DISPLAY_TYPE_REQ_DATA){
 
                     setNodeDataFromRequestData(requestHeader.requestUrl);
-                    sendRequestData(preparedReceivedData, 'RECEIVED');
+                    sendRequestData(preparedReceivedData, constants.REQUEST_DATA_TYPE_RECEIVED);
                     sendRequestData(reqInfo.requestSrcData || {}, 'SENT');
                 } else {
 
@@ -408,7 +409,7 @@ define([
 
                         $scope.rootBroadcast('YANGMAN_DISABLE_ADDING_LIST_ELEMENT');
                         preparedReceivedData = YangmanService.checkRpcReceivedData(preparedReceivedData, $scope.node);
-                        sendRequestData(preparedReceivedData, 'RECEIVED');
+                        sendRequestData(preparedReceivedData, constants.REQUEST_DATA_TYPE_RECEIVED);
                     }
                 }
 
@@ -457,7 +458,7 @@ define([
 
                 if (response.data) {
                     // try to fill code mirror editor
-                    sendRequestData(response.data, 'RECEIVED');
+                    sendRequestData(response.data, constants.REQUEST_DATA_TYPE_RECEIVED);
                     sendErrorData(response.data);
                 }
 
@@ -474,7 +475,7 @@ define([
          * @param identifier
          */
         function fillNodeData(pathElem, identifier) {
-            if ($scope.selectedSubApi && $scope.selectedSubApi.storage === 'config' &&
+            if ($scope.selectedSubApi && $scope.selectedSubApi.storage === constants.DATA_STORE_CONFIG &&
                 $scope.selectedSubApi.pathArray.indexOf(pathElem) === ($scope.selectedSubApi.pathArray.length - 1)) {
                 PathUtilsService.fillListNode($scope.node, identifier.label, identifier.value);
             }
@@ -487,7 +488,7 @@ define([
 
             if ( requestHeader.requestUrl.length ) {
 
-                if ( requestHeader.selectedShownDataType === 'req-data' ) {
+                if ( requestHeader.selectedShownDataType === constants.DISPLAY_TYPE_REQ_DATA ) {
                     // get json data
                     var params = { reqData: null };
                     $scope.rootBroadcast('YANGMAN_GET_CODEMIRROR_DATA_SENT', params);
index 6f36731890b047e82a3849dd77944f91f83416e0..ded26755576472de256e01b80231639177d9a83e 100644 (file)
@@ -9,7 +9,7 @@ define([
 
     RequestsListCtrl.$inject = [
         '$filter', '$mdDialog', '$scope', 'YMHandleFileService', 'PathUtilsService', 'RequestsService', 'YangmanService',
-        'YangmanDesignService',
+        'YangmanDesignService', 'constants',
     ];
 
     /**
@@ -25,7 +25,7 @@ define([
      * @constructor
      */
     function RequestsListCtrl($filter, $mdDialog, $scope, YMHandleFileService, PathUtilsService, RequestsService,
-                              YangmanService, YangmanDesignService) {
+                              YangmanService, YangmanDesignService, constants) {
         var vm = this;
 
         /**
@@ -34,6 +34,7 @@ define([
          * @type {*|CollectionList}
          */
         vm.collectionList = null;
+        vm.constants = constants;
 
         /**
          *
@@ -206,7 +207,7 @@ define([
             var data = reqObj.sentData;
 
             // exception for get meth
-            if ( reqObj.method === 'GET' ) {
+            if ( reqObj.method === constants.OPERATION_GET ) {
                 data = reqObj.receivedData;
             }
 
@@ -222,7 +223,7 @@ define([
 
             $scope.rootBroadcast('YANGMAN_FILL_NODE_FROM_REQ', { requestUrl: reqObj.path, requestData: data },
                 function (){
-                    $scope.setRightPanelSection('form');
+                    $scope.setRightPanelSection(constants.DISPLAY_TYPE_FORM);
                     $scope.rootBroadcast('YANGMAN_HEADER_INIT', {
                         path: reqObj.path,
                         method: reqObj.method,
@@ -235,13 +236,13 @@ define([
 
                     if ( $scope.node ) {
                         // prepare data for filling form
-                        data = $scope.node.type === 'rpc' ?
+                        data = $scope.node.type === constants.NODE_RPC ?
                                 YangmanService.prepareReceivedData(
                                     $scope.node,
                                     reqObj.method,
                                     reqObj.receivedData,
                                     reqObj.sentData,
-                                    'form'
+                                    constants.DISPLAY_TYPE_FORM
                                 ) : data;
 
                         // try to fill node
@@ -288,8 +289,8 @@ define([
                 );
             }
 
-            $scope.setRightPanelSection('req-data');
-            $scope.setJsonView(true, reqObj.method !== 'GET');
+            $scope.setRightPanelSection(constants.DISPLAY_TYPE_REQ_DATA);
+            $scope.setJsonView(true, reqObj.method !== constants.OPERATION_GET);
 
             $scope.rootBroadcast('YANGMAN_HEADER_INIT', headerObj);
             $scope.rootBroadcast('YANGMAN_FILL_NODE_FROM_REQ', { requestUrl: reqObj.path });
index 421c1e84a5c42c99b44a920cc67a1f3104f52f04..0f0c24201d83c222f348486be20d1fbb38d2c3b6 100644 (file)
@@ -37,7 +37,7 @@ define([
         $scope.selectedDatastore = null;
         $scope.apis = [];
         $scope.node = null;
-        $scope.rightPanelSection = 'req-data';
+        $scope.rightPanelSection = constants.DISPLAY_TYPE_REQ_DATA;
         $scope.augmentations = {};
         $scope.selectedApi = null;
         $scope.selectedSubApi = null;
@@ -54,6 +54,7 @@ define([
             sent: false,
         };
         main.executingRequestProgress = false;
+        main.constants = constants;
 
         // methods
         main.init = init;
@@ -232,8 +233,6 @@ define([
          * @param apis
          */
         function setGlobalParams(apis, augmentations){
-            // console.info('INFO :: apis list ', apis);
-            // console.info('INFO :: augmentations ', augmentations);
             $scope.apis = apis;
             $scope.augmentations = augmentations;
         }
@@ -249,8 +248,6 @@ define([
                 $scope.node.clear();
                 $scope.$broadcast('YANGMAN_DISABLE_ADDING_LIST_ELEMENT');
             }
-            // console.info('INFO :: selected node ', $scope.node);
-            // console.info('INFO :: selected datastore', $scope.selectedDatastore);
         }
 
         /**
index 41173cde3579fc5ff6c5bad112165591e721ee8d..1244d041b596bd4acd2742540773f2380c1760b5 100644 (file)
@@ -40,14 +40,12 @@ define(['angular'], function (angular) {
                     }
                     expandLevel = parseInt(attrs.expandLevel, 10);
                     if (!scope.treeData) {
-                        // console.warn('no treeData defined for the tree!');
                         return;
                     }
                     if (scope.treeData.length == null) {
                         if (scope.treeData.label != null) {
                             scope.treeData = [scope.treeData];
                         } else {
-                            // console.warn('treeData should be an array of root branches');
                             return;
                         }
                     }
@@ -165,7 +163,6 @@ define(['angular'], function (angular) {
                         });
 
                         scope.expandedTree = !scope.expandedTree;
-                        // console.log(scope.tree_rows);
                     };
                     scope.collapse_others = function (){
                         var parentId = null,
@@ -216,7 +213,6 @@ define(['angular'], function (angular) {
                                 return b.uid = '' + Math.random();
                             }
                         });
-                        // console.log('UIDs are set.');
                         forEachBranch(function (b) {
                             var child,
                                 _i,
@@ -328,7 +324,6 @@ define(['angular'], function (angular) {
                         });
                     }
                     n = scope.treeData.length;
-                    // console.log('num root branches = ' + n);
                     forEachBranch(function (b, level) {
                         b.level = level;
                         return b.expanded = b.level < expandLevel;
index 8337e9703a42a09ac7a4dcb6f64fb6f2878673de..b896aad87a88bf38ea0189f2ab65897d566cba8e 100644 (file)
@@ -111,7 +111,6 @@ define([], function (){
             try {
                 localStorage.setItem(self.name, JSON.stringify(self.toJSON()));
             } catch (e) {
-                // console.info('DataStorage error:', e);
             }
         }
 
index 8a5712dfee75e22846b3778f62e921f3142bfc38..e668188d7072401b441ab51445d0f8db264c9c4a 100644 (file)
@@ -172,7 +172,6 @@ define([
                             }
                         });
 
-                        console.info('loaded mount point nodes', mpNodes);
                         callback(mpNodes, augments, reqObj);
                         YangUtilsRestangularService.setFullResponse(false);
                     });
index 5ea40992b41b9b84b8685cdbf9fc1c20b5115a7e..68820b6bedcb92ff237db53d3abd0e7bb3c8c70b 100644 (file)
@@ -49,7 +49,6 @@ define([
          */
         function plugAll(apis) {
             service.plugins.forEach(function (plugin) {
-                console.info('YANGMAN :: adding plugin', plugin.label);
                 plugin.module.forEach(function (plModule, i){
                     CustomFuncService.createCustomFunctionalityApis(apis, plModule, plugin.revision,
                                                                     plugin.pathString[i], plugin.label,
index 1417e8eecb4c6e8dcc004dd31ad46d921715c6ac..048ea70f0c89502614e934033f59ed619f1feada 100644 (file)
@@ -6,10 +6,10 @@ define([
     angular.module('app.yangman').service('ymDisplayMountPoints', DisplayMountPoints);
 
     DisplayMountPoints.$inject =
-        ['MountPointsConnectorService', '$timeout', 'YangUtilsService', '$filter', 'ApiBuilderService'];
+        ['MountPointsConnectorService', '$timeout', 'YangUtilsService', '$filter', 'ApiBuilderService', 'constants'];
 
     function DisplayMountPoints(
-        MountPointsConnectorService, $timeout, YangUtilsService, $filter, ApiBuilderService) {
+        MountPointsConnectorService, $timeout, YangUtilsService, $filter, ApiBuilderService, constants) {
         var loadId = 0;
 
         return {
@@ -54,7 +54,7 @@ define([
                 var firstConfigSubApiIndex = 0;
 
                 subApis.some(function (sa, index) {
-                    var condition = sa.storage === 'config';
+                    var condition = sa.storage === constants.DATA_STORE_CONFIG;
                     if (condition) {
                         firstConfigSubApiIndex = index;
                     }
@@ -80,7 +80,7 @@ define([
                     // we need just to get operational root subApi...
                         rootApi = mountPointApis[0],
                         rootOperSubApi = rootApi.subApis.filter(function (sa) {
-                            return sa.pathTemplateString === 'yang-ext:mount/' && sa.storage === 'operational';
+                            return sa.pathTemplateString === 'yang-ext:mount/' && sa.storage === constants.DATA_STORE_OPERATIONAL;
                         })[0];
 
                     if (rootOperSubApi) {
@@ -90,8 +90,8 @@ define([
                         // subApi - because generating treeApis depends on order
 
                         // set storage to config
-                        rootConfigSubApi.storage = 'config';
-                        rootConfigSubApi.pathArray[0].name = 'config';
+                        rootConfigSubApi.storage = constants.DATA_STORE_CONFIG;
+                        rootConfigSubApi.pathArray[0].name = constants.DATA_STORE_CONFIG;
 
                         // and add it to rest of the apis
                         rootApi.subApis.splice(firstConfigSubApiIndex, 0, rootConfigSubApi);
index 64ae62d4698128671c57efe373cee101c0dd6d9e..c82bb07d36059cb646f96831e235f31688b8d5e7 100644 (file)
@@ -9,11 +9,11 @@ define([
 
         RequestsService.$inject = [
             '$filter', 'PathUtilsService', 'ParametersService', 'ParsingJsonService', 'YangUtilsService',
-            'RequestBuilderService',
+            'RequestBuilderService', 'constants',
         ];
 
         function RequestsService(
-            $filter, PathUtilsService, ParametersService, ParsingJsonService, YangUtilsService, RequestBuilderService
+            $filter, PathUtilsService, ParametersService, ParsingJsonService, YangUtilsService, RequestBuilderService, constants
         ){
 
         var service = {};
@@ -82,7 +82,7 @@ define([
                 var setDataByViewType = {
                     form: function () {
                         var data = {},
-                            emptyObject = method === 'POST' && dataType === 'received' && node.type !== 'rpc';
+                            emptyObject = method === constants.OPERATION_POST && dataType.toUpperCase() === constants.REQUEST_DATA_TYPE_RECEIVED && node.type !== constants.NODE_RPC;
 
                         if ( !emptyObject ) {
                             node.buildRequest(RequestBuilderService, data, node.module);
@@ -111,7 +111,7 @@ define([
                         setDataByNodeType = {
                             rpc: function (){
 
-                                if ( dataType === 'received' ) {
+                                if ( dataType.toUpperCase() === constants.REQUEST_DATA_TYPE_RECEIVED ) {
                                     copyData = requestData ? angular.fromJson(requestData) : {};
                                 }
 
@@ -145,7 +145,7 @@ define([
                             return {
                                 sentData: fillRequestByViewType(node, viewType, sentData.reqData, 'sent', method),
                                 receivedData: fillRequestByViewType(
-                                    node, viewType, receivedData.reqData, 'received', method
+                                    node, viewType, receivedData.reqData, constants.REQUEST_DATA_TYPE_RECEIVED, method
                                 ),
                             };
                         },
index c26ac05b718ef8f96a8ba9882d9c230fdc99806e..86d47a93ed9c44fd12fc109de721d0455765255c 100644 (file)
@@ -11,7 +11,7 @@ define([], function () {
         'ParsingJsonService',
         'RequestsService',
         'PathUtilsService',
-
+        'constants',
     ];
 
     function YangmanService(
@@ -21,7 +21,8 @@ define([], function () {
         ENV,
         ParsingJsonService,
         RequestsService,
-        PathUtilsService
+        PathUtilsService,
+        constants
     ){
         var service = {
             cutUrl: cutUrl,
@@ -62,7 +63,7 @@ define([], function () {
          * @returns {*}
          */
         function checkRpcReceivedData(data, node){
-            return node.type === 'rpc' ? cutData(data) : data;
+            return node.type === constants.NODE_RPC ? cutData(data) : data;
 
             function cutData(data){
                 return {
@@ -98,7 +99,7 @@ define([], function () {
             var prepareType = {
                 rpc: function (){
 
-                    if ( outputType === 'form' ){
+                    if ( outputType === constants.DISPLAY_TYPE_FORM ){
                         var dObj = {};
 
                         if ( !sData ) {
@@ -205,7 +206,7 @@ define([], function () {
          * @param dataType
          */
         function setSrcDataByDataType(allPreparedData, node, requestData, dataType){
-            if ( dataType === 'form' && node){
+            if ( dataType === constants.DISPLAY_TYPE_FORM && node){
                 node.buildRequest(RequestBuilderService, requestData, node.module);
                 allPreparedData.srcData = angular.copy(requestData);
             }
@@ -245,11 +246,11 @@ define([], function () {
             setParametrizedData(allPreparedData, params, selSubApiCopy, requestUrl);
 
             // prepare req data
-            if (operation === 'GET' || operation === 'DELETE'){
+            if (operation === constants.OPERATION_GET || operation === constants.OPERATION_DELETE){
                 allPreparedData.srcData = null;
                 allPreparedData.reqData = null;
             }
-            else if ( operation === 'POST' ){
+            else if ( operation === constants.OPERATION_POST ){
 
                 if ( selSubApiCopy ) {
                     allPreparedData.reqData = YangUtilsService.postRequestData(
@@ -261,7 +262,7 @@ define([], function () {
             }
 
             // set correct host into restangular based on shown data type and prepare data
-            if ( dataType === 'req-data' ){
+            if ( dataType === constants.DISPLAY_TYPE_REQ_DATA ){
                 var parser = locationHelper(allPreparedData.reqFullUrl, ['pathname', 'origin']),
                     raParam = '';
 
index 713058cef3aaf00482cfbc00d93dcc69f155d6e5..79054235b4dbb0b570ad11bbf93b721afdaa4f90 100644 (file)
@@ -6,7 +6,7 @@
               ng-click="reqList.selectRequest($event, request);">
 
     <div flex="15" class="yangmanModule__requests-list__group__item__method" layout-align="center center">
-        <p class="{{request.status === 'success' || !request.status ? request.method : 'error'}}"> {{request.method === 'DELETE' ? 'DEL' : request.method }} </p>
+        <p class="{{request.status === 'success' || !request.status ? request.method : 'error'}}"> {{request.method === vm.constants.OPERATION_DELETE ? 'DEL' : request.method }} </p>
         <md-tooltip md-direction="bottom" ng-show="request.status">{{request.status | uppercase }}</md-tooltip>
     </div>
 
index 0e03c2119649e6366fd1ec386e8eb988632e335c..519cd5e1ba66d08500193e80c64aa00828e6c6b1 100644 (file)
@@ -17,7 +17,7 @@
 
 <!-- Form section -->
 <section class="yangmanModule__right-panel__form bottom-content"
-         ng-show="rightPanelSection === 'form'"
+         ng-show="rightPanelSection === main.constants.DISPLAY_TYPE_FORM"
          ng-if="node"
          ng-controller="YangFormCtrl as yangForm">
     <div ng-show="yangForm.errorMsg"><p class="error">{{ yangForm.errorMsg }}</p></div>
@@ -28,7 +28,7 @@
 <!-- JSON section -->
 <section class="yangmanModule__right-panel__req-data bottom-content"
          ng-cloak
-         ng-show="rightPanelSection === 'req-data'">
+         ng-show="rightPanelSection === main.constants.DISPLAY_TYPE_REQ_DATA">
 
     <!-- Sent data -->
     <div ng-controller="RequestDataCtrl as requestData"
@@ -61,7 +61,7 @@
     <!-- Received data -->
     <div ng-controller="RequestDataCtrl as requestData"
          ng-show="main.jsonView.received"
-         ng-init="requestData.init('RECEIVED')"
+         ng-init="requestData.init(main.constants.REQUEST_DATA_TYPE_RECEIVED)"
          ng-class="{'half-size': main.jsonView.received && main.jsonView.sent}"
          class="yangmanModule__right-panel__req-data__cm-RECEIVED ym-resizable-s">
 
@@ -86,4 +86,3 @@
     </div>
 </section>
 <!-- /JSON section -->
-
index b5b170c44e1b6d0b9d101006e0059681a010c854..10c4b929870b23553d9764b58faeefc8109fd527 100644 (file)
@@ -28,7 +28,7 @@
     <md-icon md-font-set="material-icons"
              class="pointer"
              ng-click="yangList.removeListElem(yangList.currentDisplayIndex + offset,false)"
-             ng-if="selectedDatastore.label === 'config' && !yangList.disableAddingListElement">
+             ng-if="selectedDatastore.label === yangList.constants.DATA_STORE_CONFIG && !yangList.disableAddingListElement">
         <md-tooltip md-direction="top">{{ 'LIST_DELETE_ITEM' | translate }}</md-tooltip>
         remove_circle_outline
     </md-icon>
@@ -36,7 +36,7 @@
     <!-- duplicated key -->
     <md-icon md-font-set="material-icons"
              ng-show="node.doubleKeyIndexes.indexOf(yangList.currentDisplayIndex + offset) > -1"
-             ng-if="selectedDatastore.label === 'config'">
+             ng-if="selectedDatastore.label === yangList.constants.DATA_STORE_CONFIG">
         <md-tooltip md-direction="top">{{ 'LIST_INDEX_DUPLICATE' | translate }}</md-tooltip>
         error_outline
     </md-icon>
index b1c000f512074da8f0ea4ffb34aa0cea02a68711..4b9007773bd51527217c150a4aa40d932a386a21 100644 (file)
@@ -14,7 +14,7 @@
 
         <!-- Request url input -->
         <section flex layout="row" layout-wrap>
-            <md-input-container flex md-no-float ng-if="rightPanelSection === 'req-data'">
+            <md-input-container flex md-no-float ng-if="rightPanelSection === requestHeader.constants.DISPLAY_TYPE_REQ_DATA">
                 <input type="text"
                        ng-model="requestHeader.requestUrl"
                        placeholder="{{'YANGMAN_REQ_URL' | translate}}">
@@ -23,7 +23,7 @@
             <div ng-repeat="pathElem in selectedSubApi.pathArray"
                  flex="nogrow"
                  layout="row"
-                 ng-if="rightPanelSection === 'form'">
+                 ng-if="rightPanelSection === requestHeader.constants.DISPLAY_TYPE_FORM">
 
                 <md-input-container flex="nogrow" md-no-float class="input-span nrp" >
                     <span class="md-input" disabled>
@@ -53,7 +53,7 @@
             </div>
 
             <md-input-container flex md-no-float
-                                ng-if="rightPanelSection === 'form'"
+                                ng-if="rightPanelSection === requestHeader.constants.DISPLAY_TYPE_FORM"
                                 class="input-span">
 
                 <input type="text"