Yangman - changed event strings to constants 65/44065/8
authorLubomir Balogh <lubalogh@cisco.com>
Tue, 16 Aug 2016 13:04:08 +0000 (15:04 +0200)
committerDaniel Malachovsky <dmalacho@cisco.com>
Thu, 18 Aug 2016 14:57:28 +0000 (16:57 +0200)
- Bug 6394 - Review for YangMan
- events (broadcast, on, emit) are holded inside constants

Change-Id: Id520a16f11a8f073b0f4135f6f528802a2906fc9
Signed-off-by: Lubomir Balogh <lubalogh@cisco.com>
12 files changed:
modules/common-yangutils-resources/src/main/resources/yangutils/constants.js
modules/yangman-resources/src/main/resources/yangman/controllers/form/list.controller.js
modules/yangman-resources/src/main/resources/yangman/controllers/module-detail.controller.js
modules/yangman-resources/src/main/resources/yangman/controllers/modules-list.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/yang-form.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/services/plugins-unsetter.services.js
modules/yangman-resources/src/main/resources/yangman/services/plugins/ymDisplayMountPoints.services.js

index b707c50fd1450f30427e55efc5ec7d438c727697..6c03f89d41ca4c807f07d1004768c9b4a284bf30 100644 (file)
@@ -37,6 +37,43 @@ function () {
         ICON_COLLAPSE_REMOVE: 'remove',
         ICON_KEYBOARD_ARROW_RIGHT: 'keyboard_arrow_right',
         EXPAND_LEVEL_THREE: '3',
+        COLLECTION_CHECK_ARRAY: ['sentData', 'receivedData', 'path', 'collection', 'method', 'status', 'name'],
+        EV_REFRESH_LIST_INDEX: 'EV_REFRESH_LIST_INDEX',
+        YANGMAN_DISABLE_ADDING_LIST_ELEMENT: 'YANGMAN_DISABLE_ADDING_LIST_ELEMENT',
+        YANGMAN_MODULE_D_INIT: 'YANGMAN_MODULE_D_INIT',
+        YANGMAN_GET_API_TREE_DATA: 'YANGMAN_GET_API_TREE_DATA',
+        YANGMAN_SET_API_TREE_DATA: 'YANGMAN_SET_API_TREE_DATA',
+        YANGMAN_SET_LOADING_BOX: 'YANGMAN_SET_LOADING_BOX',
+        YANGMAN_SHOW_TOAST: 'YANGMAN_SHOW_TOAST',
+        YANGMAN_SET_MODULE_LIST_TITLE: 'YANGMAN_SET_MODULE_LIST_TITLE',
+        YANGMAN_SET_CODEMIRROR_DATA: 'YANGMAN_SET_CODEMIRROR_DATA_',
+        YANGMAN_GET_CODEMIRROR_DATA: 'YANGMAN_GET_CODEMIRROR_DATA_',
+        SET_SEL_OPERATIONS: 'SET_SEL_OPERATIONS',
+        YANGMAN_HEADER_INIT: 'YANGMAN_HEADER_INIT',
+        YANGMAN_FILL_NODE_FROM_REQ: 'YANGMAN_FILL_NODE_FROM_REQ',
+        YANGMAN_EXECUTE_WITH_DATA: 'YANGMAN_EXECUTE_WITH_DATA',
+        YANGMAN_DESELECT_REQUESTS: 'YANGMAN_DESELECT_REQUESTS',
+        YANGMAN_REFRESH_COLLECTIONS: 'YANGMAN_REFRESH_COLLECTIONS',
+        YANGMAN_REFRESH_HISTORY: 'YANGMAN_REFRESH_HISTORY',
+        YANGMAN_SAVE_EXECUTED_REQUEST: 'YANGMAN_SAVE_EXECUTED_REQUEST',
+        YANGMAN_SELECT_THE_NEWEST_REQUEST: 'YANGMAN_SELECT_THE_NEWEST_REQUEST',
+        YANGMAN_SAVE_REQUEST_TO_COLLECTION: 'YANGMAN_SAVE_REQUEST_TO_COLLECTION',
+        YANGMAN_REFRESH_AND_EXPAND_COLLECTIONS: 'YANGMAN_REFRESH_AND_EXPAND_COLLECTIONS',
+        YANGMAN_SET_ERROR_DATA: 'YANGMAN_SET_ERROR_DATA',
+        YANGMAN_SET_ERROR_MESSAGE: 'YANGMAN_SET_ERROR_MESSAGE',
+        YANGMAN_EXECUTING_REQUEST_PROGRESS_START: 'YANGMAN_EXECUTING_REQUEST_PROGRESS_START',
+        YANGMAN_EXECUTING_REQUEST_PROGRESS_STOP: 'YANGMAN_EXECUTING_REQUEST_PROGRESS_STOP',
+        YANGMAN_GET_CODEMIRROR_DATA_RECEIVED: 'YANGMAN_GET_CODEMIRROR_DATA_RECEIVED',
+        YANGMAN_GET_CODEMIRROR_DATA_SENT: 'YANGMAN_GET_CODEMIRROR_DATA_SENT',
+        YANGMAN_SET_CODEMIRROR_DATA_RECEIVED: 'YANGMAN_SET_CODEMIRROR_DATA_RECEIVED',
+        YANGMAN_SET_CODEMIRROR_DATA_SENT: 'YANGMAN_SET_CODEMIRROR_DATA_SENT',
+        YANGMAN_ERROR_EMPTY_IDENTIFIERS: 'YANGMAN_ERROR_EMPTY_IDENTIFIERS',
+        YANGMAN_NO_MOUNT_POINT: 'YANGMAN_NO_MOUNT_POINT',
+        YANGMAN_CUST_MOUNT_POINTS: 'YANGMAN_CUST_MOUNT_POINTS',
+        YANGMAN_CANCEL_MP: 'YANGMAN_CANCEL_MP',
+        YANGMAN_MOUNT_POINT: 'YANGMAN_MOUNT_POINT',
+        SET_SCOPE_TREE_ROWS: 'SET_SCOPE_TREE_ROWS',
+        TREE_ROWS: 'tree_rows',
     };
 
 });
index a5bf8d37794b5efc84d7eb01aa8479a985302116..86c72001856e6c44f159a2d24d984dc7ceecb8bd 100644 (file)
@@ -37,11 +37,11 @@ define([], function () {
         yangList.toggleExpanded = toggleExpanded;
 
         // WATCHERS
-        $scope.$on('EV_REFRESH_LIST_INDEX', function () {
+        $scope.$on(constants.EV_REFRESH_LIST_INDEX, function () {
             yangList.currentDisplayIndex = 1;
         });
 
-        $scope.$on('YANGMAN_DISABLE_ADDING_LIST_ELEMENT', function() {
+        $scope.$on(constants.YANGMAN_DISABLE_ADDING_LIST_ELEMENT, function() {
             yangList.init();
         });
 
index 7d7bddc31d95038fc7ad5110f66d50e4926fd452..5c2168c544c26fb6425a2ed04ee43cfd89066022 100644 (file)
@@ -5,9 +5,9 @@ define([
 
     angular.module('app.yangman').controller('ModuleDetailCtrl', ModuleDetailCtrl);
 
-    ModuleDetailCtrl.$inject = ['$scope', '$rootScope', '$timeout', 'YangmanService'];
+    ModuleDetailCtrl.$inject = ['$scope', '$rootScope', '$timeout', 'YangmanService', 'constants'];
 
-    function ModuleDetailCtrl($scope, $rootScope, $timeout, YangmanService) {
+    function ModuleDetailCtrl($scope, $rootScope, $timeout, YangmanService, constants) {
         var moduleDetail = this;
 
         moduleDetail.treeApis = [];
@@ -18,7 +18,7 @@ define([
         moduleDetail.setDataDetailStore = setDataDetailStore;
 
         // WATCHERS
-        $scope.$on('YANGMAN_MODULE_D_INIT', function (){
+        $scope.$on(constants.YANGMAN_MODULE_D_INIT, function (){
             init();
         });
 
index 470c5c93ab0d7a8d37bad5d0bf88f4317e9704c1..c686d3459a4b3ed22854ef72ca83151daaf43f6d 100644 (file)
@@ -6,9 +6,9 @@ define([
     angular.module('app.yangman').controller('ModulesListCtrl', ModulesListCtrl);
 
     ModulesListCtrl.$inject = ['$scope', '$rootScope', '$mdToast', 'YangUtilsService', 'PluginsHandlerService',
-                                '$filter', '$timeout'];
+                                '$filter', '$timeout', 'constants'];
 
-    function ModulesListCtrl($scope, $rootScope, $mdToast, YangUtilsService, PluginsHandlerService, $filter, $timeout) {
+    function ModulesListCtrl($scope, $rootScope, $mdToast, YangUtilsService, PluginsHandlerService, $filter, $timeout, constants) {
         var modulesList = this;
 
         modulesList.treeApis = [];
@@ -24,29 +24,29 @@ define([
         modulesList.setModule = setModule;
 
         // watchers
-        $scope.$on('YANGMAN_GET_API_TREE_DATA', function (event, args) {
+        $scope.$on(constants.YANGMAN_GET_API_TREE_DATA, function (event, args) {
             (args.cbk || angular.noop)(modulesList.treeApis);
         });
 
         // set tree apis data
-        $scope.$on('YANGMAN_SET_API_TREE_DATA', function (event, args) {
+        $scope.$on(constants.YANGMAN_SET_API_TREE_DATA, function (event, args) {
             modulesList.treeApis = args.params;
             modulesList.showLoadingBox = false;
             showToastInfoBox('YANGMAN_LOADED_MODULES');
         });
 
         // show hide loading box
-        $scope.$on('YANGMAN_SET_LOADING_BOX', function (event, args){
+        $scope.$on(constants.YANGMAN_SET_LOADING_BOX, function (event, args){
             modulesList.showLoadingBox = args.params;
             (args.cbk || angular.noop)();
         });
 
         // show info box with custom title
-        $scope.$on('YANGMAN_SHOW_TOAST', function (event, args) {
+        $scope.$on(constants.YANGMAN_SHOW_TOAST, function (event, args) {
             showToastInfoBox(args.params);
         });
 
-        $scope.$on('YANGMAN_SET_MODULE_LIST_TITLE', function (event, args) {
+        $scope.$on(constants.YANGMAN_SET_MODULE_LIST_TITLE, function (event, args) {
             modulesList.moduleListTitle = args.params;
         });
 
index 2b21d7a15782e840e1499070db1e069d2d9bc345..2064d377d4570ef92e9b92a5bbfc81f78f5a7e18 100644 (file)
@@ -127,11 +127,11 @@ define([], function () {
             requestData.type = type;
             initEditorOptions();
 
-            $scope.$on('YANGMAN_SET_CODEMIRROR_DATA_' + type, function (event, args){
+            $scope.$on(constants.YANGMAN_SET_CODEMIRROR_DATA + type, function (event, args){
                 requestData.data = args.params.data;
             });
 
-            $scope.$on('YANGMAN_GET_CODEMIRROR_DATA_' + type, function (event, args){
+            $scope.$on(constants.YANGMAN_GET_CODEMIRROR_DATA + type, function (event, args){
                 args.params.reqData = requestData.data;
             });
         }
index ce0e1702a57635312c8ffacb016a885fa06567a6..ff241578203d1bafcb5f3f6dfe7a21499e4b4d4e 100644 (file)
@@ -42,7 +42,7 @@ define([
         /**
          * Set selected operations based on data store
          */
-        $scope.$on('SET_SEL_OPERATIONS', function (event, operations, setUrl) {
+        $scope.$on(constants.SET_SEL_OPERATIONS, function (event, operations, setUrl) {
             setAllowedMethods(operations);
 
             if ( setUrl ) {
@@ -53,7 +53,7 @@ define([
         /**
          * Watching for changes in shown detail data type (radio button)
          */
-        $scope.$on('YANGMAN_HEADER_INIT', function (event, args) {
+        $scope.$on(constants.YANGMAN_HEADER_INIT, function (event, args) {
             init();
             setRequestUrl(args.params.path);
             setRequestMethod(args.params.method);
@@ -62,12 +62,12 @@ define([
             (args.cbk || angular.noop)();
         });
 
-        $scope.$on('YANGMAN_FILL_NODE_FROM_REQ', function (event, args) {
+        $scope.$on(constants.YANGMAN_FILL_NODE_FROM_REQ, function (event, args) {
             setNodeDataFromRequestData(args.params.requestUrl, args.params.leftpanel);
             (args.cbk || angular.noop)();
         });
 
-        $scope.$on('YANGMAN_EXECUTE_WITH_DATA', function (event, args) {
+        $scope.$on(constants.YANGMAN_EXECUTE_WITH_DATA, function (event, args) {
             executeOperation(args.params.data ? angular.fromJson(args.params.data) : {}, args.cbk);
         });
 
@@ -168,8 +168,8 @@ define([
                         var sentData = { reqData: null },
                             allData = { sent: null, received: null };
 
-                        $scope.rootBroadcast('YANGMAN_GET_CODEMIRROR_DATA_RECEIVED', params);
-                        $scope.rootBroadcast('YANGMAN_GET_CODEMIRROR_DATA_SENT', sentData);
+                        $scope.rootBroadcast(constants.YANGMAN_GET_CODEMIRROR_DATA_RECEIVED, params);
+                        $scope.rootBroadcast(constants.YANGMAN_GET_CODEMIRROR_DATA_SENT, sentData);
 
                         allData.sent = sentData.reqData ? angular.fromJson(sentData.reqData) : {};
                         allData.received = params.reqData ? angular.fromJson(params.reqData) : {};
@@ -191,7 +191,7 @@ define([
                             dataType = requestHeader.selectedOperation === constants.OPERATION_GET ? constants.REQUEST_DATA_TYPE_RECEIVED : 'SENT';
                         }
 
-                        $scope.rootBroadcast('YANGMAN_GET_CODEMIRROR_DATA_' + dataType, params);
+                        $scope.rootBroadcast(constants.YANGMAN_GET_CODEMIRROR_DATA + dataType, params);
                         return params.reqData ? angular.fromJson(params.reqData) : {};
                     },
                 };
@@ -205,13 +205,13 @@ define([
          */
         function sendRequestData(data, type){
             $scope.rootBroadcast(
-                'YANGMAN_SET_CODEMIRROR_DATA_' + type,
+                constants.YANGMAN_SET_CODEMIRROR_DATA + type,
                 { data: data instanceof Object ? JSON.stringify(data, null, 4) : data }
             );
         }
 
         function sendErrorData(response) {
-            $scope.rootBroadcast('YANGMAN_SET_ERROR_DATA', response);
+            $scope.rootBroadcast(constants.YANGMAN_SET_ERROR_DATA, response);
         }
 
         /**
@@ -281,7 +281,7 @@ define([
         }
 
         function setApiByUrl(url, cbk, fill){
-            $scope.rootBroadcast('YANGMAN_GET_API_TREE_DATA', null, function (treeApis) {
+            $scope.rootBroadcast(constants.YANGMAN_GET_API_TREE_DATA, null, function (treeApis) {
                 var apisIndexes =
                     PathUtilsService.searchNodeByPath(url, treeApis, null, true, true);
 
@@ -317,24 +317,24 @@ define([
                 null, null, requestHeader.requestUrl, requestHeader.selectedOperation, '', '', ''
             );
 
-            $scope.rootBroadcast('YANGMAN_GET_CODEMIRROR_DATA_SENT', sentData);
-            $scope.rootBroadcast('YANGMAN_GET_CODEMIRROR_DATA_RECEIVED', receivedData);
+            $scope.rootBroadcast(constants.YANGMAN_GET_CODEMIRROR_DATA_SENT, sentData);
+            $scope.rootBroadcast(constants.YANGMAN_GET_CODEMIRROR_DATA_RECEIVED, receivedData);
 
             RequestService.fillRequestByMethod(
                 historyReq, sentData, receivedData, requestHeader.selectedOperation, $scope.node,
                 requestHeader.selectedShownDataType
             );
 
-            $scope.rootBroadcast('YANGMAN_SAVE_REQUEST_TO_COLLECTION', { event: event, reqObj: historyReq });
+            $scope.rootBroadcast(constants.YANGMAN_SAVE_REQUEST_TO_COLLECTION, { event: event, reqObj: historyReq });
         }
 
         function showRequestProgress(){
-            $scope.rootBroadcast('YANGMAN_EXECUTING_REQUEST_PROGRESS_START');
+            $scope.rootBroadcast(constants.YANGMAN_EXECUTING_REQUEST_PROGRESS_START);
         }
 
 
         function finishRequestProgress(message){
-            $scope.rootBroadcast('YANGMAN_EXECUTING_REQUEST_PROGRESS_STOP');
+            $scope.rootBroadcast(constants.YANGMAN_EXECUTING_REQUEST_PROGRESS_STOP);
         }
 
         /**
@@ -349,7 +349,7 @@ define([
 
                 showRequestProgress();
                 setRequestUrl(requestHeader.selectedShownDataType === constants.DISPLAY_TYPE_REQ_DATA ? requestHeader.requestUrl : null);
-                $scope.rootBroadcast('YANGMAN_SET_ERROR_MESSAGE', '');
+                $scope.rootBroadcast(constants.YANGMAN_SET_ERROR_MESSAGE, '');
 
                 if ( requestHeader.selectedShownDataType !== constants.DISPLAY_TYPE_FORM ){
                     setApiByUrl(requestHeader.requestUrl, null, true);
@@ -373,8 +373,8 @@ define([
                 requestHeader.executedOperation = requestHeader.selectedOperation;
             } else {
                 $scope.rootBroadcast(
-                    'YANGMAN_SET_ERROR_MESSAGE',
-                    $filter('translate')('YANGMAN_ERROR_EMPTY_IDENTIFIERS')
+                    constants.YANGMAN_SET_ERROR_MESSAGE,
+                    $filter('translate')(constants.YANGMAN_ERROR_EMPTY_IDENTIFIERS)
                 );
             }
 
@@ -413,7 +413,7 @@ define([
                         );
                         $scope.node.expanded = true;
 
-                        $scope.rootBroadcast('YANGMAN_DISABLE_ADDING_LIST_ELEMENT');
+                        $scope.rootBroadcast(constants.YANGMAN_DISABLE_ADDING_LIST_ELEMENT);
                         preparedReceivedData = YangmanService.checkRpcReceivedData(preparedReceivedData, $scope.node);
                         sendRequestData(preparedReceivedData, constants.REQUEST_DATA_TYPE_RECEIVED);
                     }
@@ -429,8 +429,8 @@ define([
                     reqInfo.time
                 );
 
-                $scope.rootBroadcast('YANGMAN_SAVE_EXECUTED_REQUEST', historyReq, function (){
-                    $scope.rootBroadcast('YANGMAN_SELECT_THE_NEWEST_REQUEST');
+                $scope.rootBroadcast(constants.YANGMAN_SAVE_EXECUTED_REQUEST, historyReq, function (){
+                    $scope.rootBroadcast(constants.YANGMAN_SELECT_THE_NEWEST_REQUEST);
                 });
 
                 (executeCbk || angular.noop)(historyReq);
@@ -456,8 +456,8 @@ define([
                     reqInfo.statusText,
                     reqInfo.time
                 );
-                $scope.rootBroadcast('YANGMAN_SAVE_EXECUTED_REQUEST', historyReq, function (){
-                    $scope.rootBroadcast('YANGMAN_SELECT_THE_NEWEST_REQUEST');
+                $scope.rootBroadcast(constants.YANGMAN_SAVE_EXECUTED_REQUEST, historyReq, function (){
+                    $scope.rootBroadcast(constants.YANGMAN_SELECT_THE_NEWEST_REQUEST);
                 });
 
                 if (response.data) {
@@ -496,7 +496,7 @@ define([
                 if ( requestHeader.selectedShownDataType === constants.DISPLAY_TYPE_REQ_DATA ) {
                     // get json data
                     var params = { reqData: null };
-                    $scope.rootBroadcast('YANGMAN_GET_CODEMIRROR_DATA_SENT', params);
+                    $scope.rootBroadcast(constants.YANGMAN_GET_CODEMIRROR_DATA_SENT, params);
                     executeOperation(params.reqData ? angular.fromJson(params.reqData) : {}, cbk);
                 } else {
                     executeOperation({}, cbk);
@@ -521,7 +521,7 @@ define([
                 'MAIN_SCOPE'
             );
 
-            $scope.rootBroadcast('YANGMAN_GET_API_TREE_DATA', null, function (treeApis) {
+            $scope.rootBroadcast(constants.YANGMAN_GET_API_TREE_DATA, null, function (treeApis) {
                 DataBackupService.storeFromScope(
                     ['treeApis'],
                     { treeApis: treeApis },
@@ -534,7 +534,7 @@ define([
             $scope.setGlobalParams(mountPointApis, augmentations);
             $scope.setDataStore(null);
             requestHeader.statusObj = reqObj;
-            $scope.rootBroadcast('YANGMAN_SET_API_TREE_DATA', mountPointTreeApis);
+            $scope.rootBroadcast(constants.YANGMAN_SET_API_TREE_DATA, mountPointTreeApis);
         }
 
         /**
index 62a35f891961f1126a63fff73e1352e5382911ff..047525a407f7dcab9fd00966741adb10fe4dcfd7 100644 (file)
@@ -123,7 +123,7 @@ define([
             $mdDialog.show(confirm).then(function (){
                 vm.collectionList.clear();
                 vm.collectionList.saveToStorage();
-                $scope.rootBroadcast('YANGMAN_REFRESH_COLLECTIONS');
+                $scope.rootBroadcast(constants.YANGMAN_REFRESH_COLLECTIONS);
                 YangmanDesignService.enableMdMenuItem(event);
             }, function () {
                 YangmanDesignService.enableMdMenuItem(event);
@@ -156,14 +156,13 @@ define([
          * @param $fileContent
          */
         function readCollectionFromFile($fileContent) {
-            var data = $fileContent,
-                checkArray = ['sentData', 'receivedData', 'path', 'collection', 'method', 'status', 'name'];
+            var data = $fileContent;
 
-            if (data && YangmanService.validateFile(data, checkArray)){
+            if (data && YangmanService.validateFile(data, constants.COLLECTION_CHECK_ARRAY)){
                 try {
                     vm.collectionList.loadListFromFile(data);
                     vm.collectionList.saveToStorage();
-                    $scope.rootBroadcast('YANGMAN_REFRESH_COLLECTIONS');
+                    $scope.rootBroadcast(constants.YANGMAN_REFRESH_COLLECTIONS);
                     clearFileInputValue();
                 }
                 catch (e) {
@@ -214,19 +213,19 @@ define([
             }
 
             $scope.rootBroadcast(
-                'YANGMAN_SET_CODEMIRROR_DATA_RECEIVED', { data: reqObj.setDataForView(reqObj.receivedData) }
+                constants.YANGMAN_SET_CODEMIRROR_DATA_RECEIVED, { data: reqObj.setDataForView(reqObj.receivedData) }
             );
             $scope.rootBroadcast(
-                'YANGMAN_SET_CODEMIRROR_DATA_SENT', { data: reqObj.setDataForView(reqObj.sentData) }
+                constants.YANGMAN_SET_CODEMIRROR_DATA_SENT, { data: reqObj.setDataForView(reqObj.sentData) }
             );
 
-            $scope.rootBroadcast('YANGMAN_SET_ERROR_DATA',
+            $scope.rootBroadcast(constants.YANGMAN_SET_ERROR_DATA,
                 reqObj.receivedData && reqObj.receivedData.hasOwnProperty('errors') ? reqObj.receivedData : {});
 
-            $scope.rootBroadcast('YANGMAN_FILL_NODE_FROM_REQ', { requestUrl: reqObj.path, requestData: data },
+            $scope.rootBroadcast(constants.YANGMAN_FILL_NODE_FROM_REQ, { requestUrl: reqObj.path, requestData: data },
                 function (){
                     $scope.setRightPanelSection(constants.DISPLAY_TYPE_FORM);
-                    $scope.rootBroadcast('YANGMAN_HEADER_INIT', {
+                    $scope.rootBroadcast(constants.YANGMAN_HEADER_INIT, {
                         path: reqObj.path,
                         method: reqObj.method,
                         statusObj: {
@@ -263,7 +262,7 @@ define([
          */
         function executeRequest(reqObj) {
             showData(reqObj);
-            $scope.rootBroadcast('YANGMAN_EXECUTE_WITH_DATA',{ data: reqObj.sentData });
+            $scope.rootBroadcast(constants.YANGMAN_EXECUTE_WITH_DATA,{ data: reqObj.sentData });
         }
 
         /**
@@ -286,7 +285,7 @@ define([
                 };
 
                 $scope.rootBroadcast(
-                    'YANGMAN_SET_ERROR_DATA',
+                    constants.YANGMAN_SET_ERROR_DATA,
                     reqObj.receivedData && reqObj.receivedData.hasOwnProperty('errors') ? reqObj.receivedData : {}
                 );
             }
@@ -294,16 +293,16 @@ define([
             $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 });
+            $scope.rootBroadcast(constants.YANGMAN_HEADER_INIT, headerObj);
+            $scope.rootBroadcast(constants.YANGMAN_FILL_NODE_FROM_REQ, { requestUrl: reqObj.path });
 
             $scope.rootBroadcast(
-                'YANGMAN_SET_CODEMIRROR_DATA_RECEIVED',
+                constants.YANGMAN_SET_CODEMIRROR_DATA_RECEIVED,
                 { data: reqObj.setDataForView(reqObj.receivedData) }
             );
 
             $scope.rootBroadcast(
-                'YANGMAN_SET_CODEMIRROR_DATA_SENT',
+                constants.YANGMAN_SET_CODEMIRROR_DATA_SENT,
                 { data: reqObj.setDataForView(reqObj.sentData) }
             );
         }
@@ -537,13 +536,13 @@ define([
 
 
             // if request was selected, deselect requests in all other instances of RequestsListCtrl
-            $scope.$on('YANGMAN_DESELECT_REQUESTS', function (event, params) {
+            $scope.$on(constants.YANGMAN_DESELECT_REQUESTS, function (event, params) {
                 if (params.params.broadcastingCtrl !== vm) {
                     deselectAllRequests();
                 }
             });
 
-            $scope.$on('YANGMAN_REFRESH_COLLECTIONS', function (event, params){
+            $scope.$on(constants.YANGMAN_REFRESH_COLLECTIONS, function (event, params){
                 loadCollectionsList();
                 (params.cbk || angular.noop)();
             });
@@ -554,20 +553,20 @@ define([
                 vm.mainList = vm.requestList;
                 loadHistoryList();
 
-                $scope.$on('YANGMAN_REFRESH_HISTORY', loadHistoryList);
+                $scope.$on(constants.YANGMAN_REFRESH_HISTORY, loadHistoryList);
                 // saving from request header after execution
-                $scope.$on('YANGMAN_SAVE_EXECUTED_REQUEST', saveBcstedHistoryRequest);
+                $scope.$on(constants.YANGMAN_SAVE_EXECUTED_REQUEST, saveBcstedHistoryRequest);
                 // select newest request
-                $scope.$on('YANGMAN_SELECT_THE_NEWEST_REQUEST', selectNewestRequest);
+                $scope.$on(constants.YANGMAN_SELECT_THE_NEWEST_REQUEST, selectNewestRequest);
             }
             else {
                 vm.mainList = vm.collectionList;
                 // saving from request header
-                $scope.$on('YANGMAN_SAVE_REQUEST_TO_COLLECTION', saveRequestFromExt);
+                $scope.$on(constants.YANGMAN_SAVE_REQUEST_TO_COLLECTION, saveRequestFromExt);
                 // saving collections expanded status on refresh
-                $scope.$on('YANGMAN_REFRESH_AND_EXPAND_COLLECTIONS', function(){
+                $scope.$on(constants.YANGMAN_REFRESH_AND_EXPAND_COLLECTIONS, function(){
                     var expandedColNames = vm.collectionList.getExpandedCollectionNames();
-                    $scope.rootBroadcast('YANGMAN_REFRESH_COLLECTIONS', {}, function (){
+                    $scope.rootBroadcast(constants.YANGMAN_REFRESH_COLLECTIONS, {}, function (){
                         vm.collectionList.expandCollectionByNames(expandedColNames);
                     });
                 });
@@ -583,7 +582,7 @@ define([
          * @param requestObj
          */
         function selectRequest(event, requestObj){
-            $scope.rootBroadcast('YANGMAN_DESELECT_REQUESTS', { broadcastingCtrl: vm });
+            $scope.rootBroadcast(constants.YANGMAN_DESELECT_REQUESTS, { broadcastingCtrl: vm });
             vm.mainList.toggleReqSelection(!event.ctrlKey, requestObj);
             if (!event.ctrlKey){
                 vm.showData(requestObj, true);
@@ -631,7 +630,7 @@ define([
          * Refresh and expand collections
          */
         function refreshCollectionsWithExpansion(){
-            $scope.rootBroadcast('YANGMAN_REFRESH_AND_EXPAND_COLLECTIONS');
+            $scope.rootBroadcast(constants.YANGMAN_REFRESH_AND_EXPAND_COLLECTIONS);
         }
 
     }
index 22f3c24998beff4f6b6792e3aeda61222ed7f7cd..f05fbaf60acdf9362a21b79cce87055b3b03f767 100644 (file)
@@ -34,9 +34,9 @@ define([
         yangForm.getNodeName = getNodeName;
 
         // watchers
-        $scope.$on('YANGMAN_SET_ERROR_DATA', setRcvdErrorData);
+        $scope.$on(constants.YANGMAN_SET_ERROR_DATA, setRcvdErrorData);
 
-        $scope.$on('YANGMAN_SET_ERROR_MESSAGE', setErrorMessage);
+        $scope.$on(constants.YANGMAN_SET_ERROR_MESSAGE, setErrorMessage);
 
         /**
          * Method for set error message in form
index 7c4a37273cda67e5d1b56bc7ccd28c8fba982a62..907b6e3393a16ec4b27f380a9c073c13f3ebc274 100644 (file)
@@ -119,8 +119,8 @@ define([
          * Initialization
          */
         function init(){
-            $scope.$on('YANGMAN_EXECUTING_REQUEST_PROGRESS_START', startExecutingRequestProgress);
-            $scope.$on('YANGMAN_EXECUTING_REQUEST_PROGRESS_STOP', stopExecutingRequestProgress);
+            $scope.$on(constants.YANGMAN_EXECUTING_REQUEST_PROGRESS_START, startExecutingRequestProgress);
+            $scope.$on(constants.YANGMAN_EXECUTING_REQUEST_PROGRESS_STOP, stopExecutingRequestProgress);
 
             YangmanDesignService.hideMainMenu();
             YangmanDesignService.setDraggableLeftPanel();
@@ -211,8 +211,8 @@ define([
          * Genereal method for clearing code mirror - sent and received data too
          */
         function clearCM(){
-            $scope.rootBroadcast('YANGMAN_SET_CODEMIRROR_DATA_RECEIVED', { data: JSON.stringify({}) });
-            $scope.rootBroadcast('YANGMAN_SET_CODEMIRROR_DATA_SENT', { data: JSON.stringify({}) });
+            $scope.rootBroadcast(constants.YANGMAN_SET_CODEMIRROR_DATA_RECEIVED, { data: JSON.stringify({}) });
+            $scope.rootBroadcast(constants.YANGMAN_SET_CODEMIRROR_DATA_SENT, { data: JSON.stringify({}) });
         }
 
 
@@ -246,7 +246,7 @@ define([
 
             if ( $scope.node ) {
                 $scope.node.clear();
-                $scope.$broadcast('YANGMAN_DISABLE_ADDING_LIST_ELEMENT');
+                $scope.$broadcast(constants.YANGMAN_DISABLE_ADDING_LIST_ELEMENT);
             }
         }
 
@@ -269,7 +269,7 @@ define([
             if ( expand ) {
                 $scope.node = null;
                 setLeftPanel(leftPanel);
-                $scope.$broadcast('YANGMAN_MODULE_D_INIT');
+                $scope.$broadcast(constants.YANGMAN_MODULE_D_INIT);
             } else {
 
                 if ( $scope.node ) {
@@ -300,7 +300,7 @@ define([
                 PathUtilsService.clearPath($scope.selectedSubApi.pathArray);
             }
 
-            $scope.$broadcast('SET_SEL_OPERATIONS', subApi ? $scope.selectedSubApi.operations : [], setUrl);
+            $scope.$broadcast(constants.SET_SEL_OPERATIONS, subApi ? $scope.selectedSubApi.operations : [], setUrl);
         }
 
         /**
index 138edb46dadf014cfbd0ec06e6766c148bc2227b..06358536e4a50c047d94a9aa0819aef005873e10 100644 (file)
@@ -194,9 +194,9 @@ define(['angular'], function (angular) {
 
                     };
 
-                    scope.$watch('tree_rows', function () {
+                    scope.$watch(constants.TREE_ROWS, function () {
                         scope.treeRows = scope.tree_rows;
-                        scope.$emit('SET_SCOPE_TREE_ROWS', scope.treeRows);
+                        scope.$emit(constants.SET_SCOPE_TREE_ROWS, scope.treeRows);
                     });
 
                     scope.tree_rows = [];
index 3a518bdb4032fd93b8747925a875cd70da3c7c08..347ae5386105a54a993d7d8341a858d28681b74b 100644 (file)
@@ -4,7 +4,9 @@ define(['angular'], function (angular) {
     angular.module('app.yangman').service('PluginsUnsetterService',
         ['PathUtilsService', 'DataBackupService', PluginsUnsetterService]);
 
-    function PluginsUnsetterService(PathUtilsService, DataBackupService){
+    PluginsUnsetterService.$inject = ['constants'];
+
+    function PluginsUnsetterService(PathUtilsService, DataBackupService, constants){
         var service = {
             'YANGMAN_CUST_MOUNT_POINTS': unsetMountPoint,
             unset: unset,
@@ -29,11 +31,11 @@ define(['angular'], function (angular) {
             );
 
             DataBackupService.getToScope(['treeApis'], modulesListObj, 'MODULES_LIST');
-            scope.$broadcast('YANGMAN_SET_API_TREE_DATA', { params: modulesListObj.treeApis });
-            scope.$broadcast('YANGMAN_SET_MODULE_LIST_TITLE', { params: '' });
+            scope.$broadcast(constants.YANGMAN_SET_API_TREE_DATA, { params: modulesListObj.treeApis });
+            scope.$broadcast(constants.YANGMAN_SET_MODULE_LIST_TITLE, { params: '' });
 
             if ( scope.selectedDatastore ){
-                scope.$broadcast('YANGMAN_MODULE_D_INIT');
+                scope.$broadcast(constants.YANGMAN_MODULE_D_INIT);
             }
         }
 
index 048ea70f0c89502614e934033f59ed619f1feada..07cafd477a73723314eba41082f029f509f7f60b 100644 (file)
@@ -29,7 +29,7 @@ define([
                 scope = args.scope,
                 path = scope.selectedSubApi.buildApiRequestString();
 
-            scope.rootBroadcast('YANGMAN_SET_LOADING_BOX', true, function () {
+            scope.rootBroadcast(constants.YANGMAN_SET_LOADING_BOX, true, function () {
                 scope.setLeftPanel(0);
                 $timeout(function () {
                     MountPointsConnectorService.discoverMountPoints(path, getNodesMPData, createMPStructure);
@@ -107,13 +107,13 @@ define([
                     controller.initMountPoint(mountPointTreeApis, mountPointApis, mpAugments, reqObj);
 
                     scope.rootBroadcast(
-                        'YANGMAN_SET_MODULE_LIST_TITLE',
-                        pathItems[pathItems.length - 1] + ' [ ' + $filter('translate')('YANGMAN_MOUNT_POINT') + ' ]'
+                        constants.YANGMAN_SET_MODULE_LIST_TITLE,
+                        pathItems[pathItems.length - 1] + ' [ ' + $filter('translate')(constants.YANGMAN_MOUNT_POINT) + ' ]'
                     );
 
                     controller.selectedPluginsButtons.push(
-                        MountPointsConnectorService.createCustomButton('YANGMAN_CANCEL_MP', function (){
-                            return controller.selectedPlugin.label === 'YANGMAN_CUST_MOUNT_POINTS';
+                        MountPointsConnectorService.createCustomButton(constants.YANGMAN_CANCEL_MP, function (){
+                            return controller.selectedPlugin.label === constants.YANGMAN_CUST_MOUNT_POINTS;
                         },
                         function (){
                             controller.unsetPluginFunctionality();
@@ -123,8 +123,8 @@ define([
                 } else {
                     $timeout(function (){
                         controller.selectedPlugin = null;
-                        scope.rootBroadcast('YANGMAN_SET_LOADING_BOX', false);
-                        scope.rootBroadcast('YANGMAN_SHOW_TOAST', 'YANGMAN_NO_MOUNT_POINT');
+                        scope.rootBroadcast(constants.YANGMAN_SET_LOADING_BOX, false);
+                        scope.rootBroadcast(constants.YANGMAN_SHOW_TOAST, constants.YANGMAN_NO_MOUNT_POINT);
                     }, 100);
                 }
             }