Merge "Yangman - request progress, error msg"
authorMaxime Millette-Coulombe <mmcoulombe@inocybe.com>
Thu, 11 Aug 2016 22:24:05 +0000 (22:24 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 11 Aug 2016 22:24:05 +0000 (22:24 +0000)
13 files changed:
modules/yangman-resources/src/main/resources/yangman/assets/data/locale-en_US.json
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/services/requests.services.js
modules/yangman-resources/src/main/resources/yangman/services/yangman.services.js
modules/yangman-resources/src/main/resources/yangman/views/leftpanel/history-tab.tpl.html
modules/yangman-resources/src/main/resources/yangman/views/leftpanel/modules-tab.tpl.html
modules/yangman-resources/src/main/resources/yangman/views/rightpanel/detail.tpl.html
modules/yangman-resources/src/main/resources/yangman/views/rightpanel/request-header.tpl.html
modules/yangman-resources/src/main/resources/yangman/yangman.less

index dc03707f22eb9684c60f5782fcf8dc072fb28dd4..127af17c48ee577033534923c4946def81a44ff3 100644 (file)
@@ -83,5 +83,9 @@
   "YANGMAN_SELECT_OPTIONS": "Select options",
   "YANGMAN_SELECT_ALL": "Select All",
   "YANGMAN_DESELECT_ALL": "Deselect All",
-  "YANGMAN_IS_AUGMENT": "Augment's Group"
+  "YANGMAN_IS_AUGMENT": "Augment's Group",
+  "YANGMAN_LOADING_MODULES": "Loading application modules...",
+  "YANGMAN_EXECUTING_REQUEST": "Request is beeing executed...",
+  "YANGMAN_CM_FONT_SIZE_HINT": "Use \"Alt +\" key and \"Alt -\" key in editor to enlarge or reduce json font size",
+  "YANGMAN_CM_HINT_DONT_SHOW": "Got it"
 }
index f8dd3d4d97db2201657c14a10c72095c4df4d4f6..07748346cdb6c5ac3fdbd42ecce5610242c1af47 100644 (file)
@@ -3,9 +3,9 @@ define([], function () {
 
     angular.module('app.yangman').controller('RequestDataCtrl', RequestDataCtrl);
 
-    RequestDataCtrl.$inject = ['$mdToast', '$scope', 'RequestsService'];
+    RequestDataCtrl.$inject = ['$filter', '$mdToast', '$scope', 'RequestsService'];
 
-    function RequestDataCtrl($mdToast, $scope, RequestsService) {
+    function RequestDataCtrl($filter, $mdToast, $scope, RequestsService) {
         var requestData = this;
 
         requestData.paramsArray = [];
@@ -92,15 +92,20 @@ define([], function () {
          */
         function showCMHint(type) {
 
-            if (!$scope.shownCMHint){
+            if (!localStorage.getItem('yangman_cm_hint_got_it')){
 
                 $mdToast.show(
                     $mdToast.simple()
-                        .textContent('Use "Ctrl +" key and "Ctrl -" key in editor to enlarge or reduce json font size')
+                        .textContent($filter('translate')('YANGMAN_CM_FONT_SIZE_HINT'))
+                        .action($filter('translate')('YANGMAN_CM_HINT_DONT_SHOW'))
                         .position('top right')
                         .parent(angular.element('.yangmanModule__right-panel__req-data__cm-' + type))
-                        .hideDelay(50000)
-                );
+                        .hideDelay(10000)
+                ).then(function (response){
+                    if (response === 'ok') {
+                        localStorage.setItem('yangman_cm_hint_got_it', 1);
+                    }
+                });
             }
         }
 
@@ -116,6 +121,7 @@ define([], function () {
 
             $scope.$on('YANGMAN_SET_CODEMIRROR_DATA_' + type, function (event, args){
                 requestData.data = args.params.data;
+                showCMHint(type);
             });
 
             $scope.$on('YANGMAN_GET_CODEMIRROR_DATA_' + type, function (event, args){
index 43eae57b4aca0fa389abf23111bf3c8a96595d97..6950f094e5d134cea59cdc2f4a5780df2f7525bd 100644 (file)
@@ -21,7 +21,6 @@ define([
         requestHeader.selectedPluginsButtons = [];
         requestHeader.selectedPlugin = null;
         requestHeader.statusObj = null;
-        requestHeader.executingProgress = false;
 
         // methods
         requestHeader.executeOperation = executeOperation;
@@ -268,20 +267,19 @@ define([
         }
 
         function showRequestProgress(){
-            requestHeader.executingProgress = true;
+            $scope.rootBroadcast('YANGMAN_EXECUTING_REQUEST_PROGRESS_START');
         }
 
 
         function finishRequestProgress(message){
-            requestHeader.executingProgress = false;
-
-            //$mdToast.show(
-            //    $mdToast.simple()
-            //        .textContent(message)
-            //        .position('bottom right')
-            //        .parent(angular.element('.yangmanModule__right-panel__header'))
-            //        .hideDelay(1500)
-            //);
+            $scope.rootBroadcast('YANGMAN_EXECUTING_REQUEST_PROGRESS_STOP');
+            // $mdToast.show(
+            //     $mdToast.simple()
+            //         .textContent(message)
+            //         .position('bottom right')
+            //         .parent(angular.element('.yangmanModule__right-panel__header'))
+            //         .hideDelay(1500)
+            // );
         }
 
 
@@ -324,6 +322,8 @@ define([
                     requestHeader.selectedShownDataType
                 );
 
+                finishRequestProgress();
+
                 requestHeader.statusObj = reqInfo;
 
                 sendErrorData({});
@@ -362,7 +362,6 @@ define([
                 $scope.rootBroadcast('YANGMAN_SAVE_EXECUTED_REQUEST', historyReq);
                 (executeCbk || angular.noop)(historyReq);
 
-                finishRequestProgress('dfsaf dasf adsfx');
 
             }
 
@@ -374,8 +373,11 @@ define([
             function executeReqErrCbk(reqInfo, response) {
                 requestHeader.statusObj = reqInfo;
 
+                finishRequestProgress();
+
                 historyReq.setExecutionData(
-                    reqInfo.requestSrcData, null,
+                    reqInfo.requestSrcData,
+                    response.data,
                     reqInfo.status,
                     reqInfo.status,
                     reqInfo.statusText,
@@ -392,7 +394,6 @@ define([
                 }
                 (executeCbk || angular.noop)(historyReq);
 
-                finishRequestProgress('sadfsadf adsf');
 
             }
 
index 3a5701adf1fb9fec497a81b1f09cc2f3a903ac4e..8ba6c21375b3fa9303cdd4ef76a3500fc7d6181a 100644 (file)
@@ -105,6 +105,8 @@ define([
          * @param params
          */
         function saveBcstedHistoryRequest(broadcastEvent, params) {
+            console.debug('params.params', params.params);
+
             vm.requestList.addRequestToList(params.params);
             vm.requestList.groupListByDate();
             vm.requestList.saveToStorage();
@@ -178,7 +180,7 @@ define([
         function showForm(reqObj) {
             var data = reqObj.method === 'GET' ? reqObj.receivedData : reqObj.sentData;
 
-            $scope.rootBroadcast('YANGMAN_SET_ERROR_DATA', {});
+            $scope.rootBroadcast('YANGMAN_SET_ERROR_DATA', reqObj.receivedData.hasOwnProperty('errors') ? reqObj.receivedData : {});
 
             $scope.rootBroadcast('YANGMAN_FILL_NODE_FROM_REQ', { requestUrl: reqObj.path, requestData: data },
                 function (){
@@ -246,7 +248,10 @@ define([
                 },
             });
 
-            $scope.rootBroadcast('YANGMAN_SET_ERROR_DATA', {});
+            $scope.rootBroadcast(
+                'YANGMAN_SET_ERROR_DATA',
+                reqObj.receivedData && reqObj.receivedData.hasOwnProperty('errors') ? reqObj.receivedData : {}
+            );
 
             $scope.rootBroadcast(
                 'YANGMAN_SET_CODEMIRROR_DATA_SENT',
index 8edb0b066f1383f06075c01dbad83d73f13f861d..ae115b8f1e0bed5dff3ff5d04a77246def8cf4a5 100644 (file)
@@ -41,6 +41,7 @@ define([
          * @param data
          */
         function setRcvdErrorData(event, data) {
+
             if (data.params.errors) {
                 yangForm.errorMsg = data.params.errors.error[0]['error-message'];
             }
index d6d90204fd32e9de54872af7a328a3464d764e09..795a02fa2ff7eb251d472cfa17cd966c5d6bfd62 100644 (file)
@@ -51,6 +51,7 @@ define([
             received: true,
             sent: false,
         };
+        main.executingRequestProgress = false;
 
         // methods
         main.init = init;
@@ -81,12 +82,24 @@ define([
         $scope.setCMHintShown = setCMHintShown;
 
 
+        $scope.$on('YANGMAN_EXECUTING_REQUEST_PROGRESS_START', startExecutingRequestProgress);
+        $scope.$on('YANGMAN_EXECUTING_REQUEST_PROGRESS_STOP', stopExecutingRequestProgress);
+
+
         init();
 
         function setCMHintShown(shown) {
             $scope.shownCMHint = shown;
         }
 
+        function startExecutingRequestProgress() {
+            main.executingRequestProgress = true;
+        }
+
+        function stopExecutingRequestProgress() {
+            main.executingRequestProgress = false;
+        }
+
         /**
          * Set parametersList
          * @param parametersList
index e944795aa52b1b553d59e4ea4002eeca009983af..e22a6533c7c8d1e99e7173baf20032a69c682af4 100644 (file)
@@ -127,10 +127,11 @@ define([
          */
         function createHistoryRequest(sentData, receivedData, path, operation, status, name, collection, timestamp,
                         responseStatus, responseStatusText, responseTime) {
-            var receivedDataProcessed = status === 'success' ? receivedData : null,
-                result = new HistoryRequestModel(PathUtilsService, YangUtilsService, ParsingJsonService);
+            // TODO: investigate, if this line is needed
+            // var receivedDataProcessed = status === 'success' ? receivedData : null,
+            var result = new HistoryRequestModel(PathUtilsService, YangUtilsService, ParsingJsonService);
 
-            result.setData(sentData, receivedDataProcessed, status, path, operation, name, collection, timestamp,
+            result.setData(sentData, receivedData, status, path, operation, name, collection, timestamp,
                 responseStatus, responseStatusText, responseTime);
 
             return result;
index ebd593b95adbfa6beb10469080bfbec6012779a1..a13ca474f1e8b0a6dca660d1f06958027813db7c 100644 (file)
@@ -77,7 +77,7 @@ define([], function () {
                         });
                     }
                 },
-                default: function(){
+                default: function (){
                     var methodType = {
                         GET: function () {
                             node.clear();
index 4cb5a0b43335fd64b7113c290337e20b9f85d3a1..37e2a1ea911e36dcfc0b181036899c32f216ba1b 100644 (file)
 
                 <!-- list of requests in current group -->
                 <md-list>
-                    <div ng-repeat="request in group.requests | filter: reqList.filterReq track by $index | orderBy: 'timestamp'"
+                    <div ng-repeat="request in group.requests | filter: reqList.filterReq  | orderBy: '-timestamp' track by $index"
                          layout="row"
                          ng-include src="globalViewPath + 'leftpanel/request-item.tpl.html'">
                     </div>
index 86b5fbee008eeab0012f4ee526cb334bcbe7fea1..76d731574c7250d2013365b00f74a3ccf372408c 100644 (file)
@@ -3,7 +3,7 @@
     <div class="yangmanModule__left-panel__loading-container" ng-show="modulesList.showLoadingBox">
         <md-progress-linear md-mode="query"></md-progress-linear>
         <div class="bottom-block">
-            <span>Loading application modules...</span>
+            <span>{{ 'YANGMAN_LOADING_MODULES' | translate }}</span>
         </div>
     </div>
 
index 79a89688de84102e986d4848320dcbf4c146700f..f9777bb58e5d5759225b5bae21e6812d561a98e2 100644 (file)
@@ -5,11 +5,18 @@ style="margin-bottom: 0px!important;"
          ng-include src="globalViewPath + 'rightpanel/request-header.tpl.html'"></section>
 <!-- /Header -->
 
-<section class="requestMsgs" style="height: 25px;"></section>
+<section class="yangmanModule__right-panel__request-progress">
+    <div class="yangmanModule__right-panel__request-progress__loading-container" ng-show="main.executingRequestProgress">
+        <md-progress-linear md-mode="query"></md-progress-linear>
+        <div class="bottom-block">
+            <span>{{ 'YANGMAN_EXECUTING_REQUEST' | translate }}...</span>
+        </div>
+    </div>
+</section>
 
 <!-- Form section -->
 <section class="yangmanModule__right-panel__form bottom-content"
-         ng-show="rightPanelSection === 'form'"
+         ng-show="rightPanelSection === 'form' && !main.executingRequestProgress"
          ng-if="node"
          ng-controller="YangFormCtrl as yangForm">
     <div ng-show="yangForm.errorMsg"><p class="error">{{ yangForm.errorMsg }}</p></div>
@@ -19,7 +26,7 @@ style="margin-bottom: 0px!important;"
 
 <!-- JSON section -->
 <section class="yangmanModule__right-panel__req-data bottom-content"
-         ng-show="rightPanelSection === 'req-data'">
+         ng-show="rightPanelSection === 'req-data' && !main.executingRequestProgress">
 
     <!-- Sent data -->
     <div ng-controller="RequestDataCtrl as requestData"
index f30ad70fa01b571955066d9c779233270b877777..94655fc229285d001844a8bbb0637322628af24b 100644 (file)
@@ -63,7 +63,6 @@
                        ng-click="requestHeader.prepareDataAndExecute(
                             main.modulesTreeDisplayed() ? main.leftPanelShowModule : null
                        )">
-                <md-progress-circular ng-disabled="!vm.activated" class="md-raised" md-diameter="25px" ng-show="requestHeader.executingProgress"></md-progress-circular>
                 {{'YANGMAN_SEND' | translate}}
             </md-button>
 
index ec9e15ca0fc29000b7d665b96a20a2d103faa67f..9ded3598bdeffb5231512298c4bff832a992d8e5 100644 (file)
@@ -134,32 +134,6 @@ button{
     label{
         font-weight: normal;
     }
-
-    md-progress-circular{
-        position: absolute;
-        margin-top: 5px;
-    }
-    md-progress-circular .md-inner .md-gap{
-        border-top-color: #ffffff;
-        border-bottom-color: #ffffff;
-    }
-
-    md-progress-circular .md-inner .md-left .md-half-circle{
-        border-left-color: #ffffff;
-        border-top-color: #ffffff;
-    }
-
-    md-progress-circular .md-inner .md-right .md-half-circle{
-        border-top-color: #ffffff;
-        border-right-color: #ffffff;
-    }
-}
-
-button.has-progress{
-    span{
-        margin-left: 23px;
-        margin-right: 23px;
-    }
 }
 
 .ui-resizable-e{
@@ -509,6 +483,35 @@ button.has-progress{
             }
         }
 
+        &__request-progress{
+
+            margin-top: 12px;
+            margin-bottom: 12px;
+
+            &__loading-container {
+                display: block;
+                position: relative;
+                border: 2px solid @infoBoxBorderColor;
+                transition: opacity  0.1s linear;
+                border-top: 0px;
+                margin: 0;
+
+                .bottom-block {
+                    display: block;
+                    position: relative;
+                    background-color: @infoBoxBackColor;
+                    height: 85px;
+
+                    > span {
+                        display: inline-block;
+                        margin-top: 10px;
+                        padding: 25px;
+                        font-size: 0.9em;
+                    }
+                }
+            }
+        }
+
         &__req-data{
 
             > div{