Yangman - clear indetifiers, fix boolean type, fix history req sent data 60/41460/4
authorDaniel Kuzma -X (dakuzma - PANTHEON TECHNOLOGIES at Cisco) <dakuzma@cisco.com>
Thu, 7 Jul 2016 07:16:04 +0000 (09:16 +0200)
committerDaniel Malachovsky <dmalacho@cisco.com>
Thu, 21 Jul 2016 13:27:45 +0000 (15:27 +0200)
Change-Id: I7d47e21799bf3188063f90113c436840b47b8812
Signed-off-by: Daniel Kuzma -X (dakuzma - PANTHEON TECHNOLOGIES at Cisco) <dakuzma@cisco.com>
modules/common-yangutils-resources/src/main/resources/yangutils/services/path-utils.services.js
modules/yangman-resources/src/main/resources/yangman/controllers/form/type-boolean.controller.js [new file with mode: 0644]
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/yangman.services.js
modules/yangman-resources/src/main/resources/yangman/views/rightpanel/form/config/types/boolean.tpl.html

index 44068ffd2614a6a3d029e82ad389d306377ba16b..90a11e40b52805a75c9267728f6a31c34b4131d6 100644 (file)
@@ -4,6 +4,7 @@ define([], function () {
     function PathUtilsService(ArrayUtilsService){
 
         var service = {
+                clearPath: clearPath,
                 createPathElement: createPathElement,
                 getModuleNameFromPath: getModuleNameFromPath,
                 getStorageAndNormalizedPath: getStorageAndNormalizedPath,
@@ -124,7 +125,11 @@ define([], function () {
             });
         }
 
-        // TODO: add service's description
+        /**
+         * Service for filling API url object from url string data
+         * @param pathArrayIn
+         * @param pathString
+         */
         function fillPath(pathArrayIn, pathString) {
             var pathArray = trimPath(pathString).split('/'),
                 pathPosition = 0;
@@ -141,6 +146,20 @@ define([], function () {
 
         }
 
+        /**
+         * Service for clearing api path object
+         * @param pathArrayIn
+         */
+        function clearPath(pathArrayIn){
+            pathArrayIn.forEach(function (pathItem){
+                if ( pathItem.hasIdentifier() ){
+                    pathItem.identifiers.forEach(function (identifier){
+                        identifier.value = '';
+                    });
+                }
+            });
+        }
+
         // TODO: add service's description
         function getModuleNameFromPath(path){
             var pathArray = translate(trimPath(path));
diff --git a/modules/yangman-resources/src/main/resources/yangman/controllers/form/type-boolean.controller.js b/modules/yangman-resources/src/main/resources/yangman/controllers/form/type-boolean.controller.js
new file mode 100644 (file)
index 0000000..3e3c65e
--- /dev/null
@@ -0,0 +1,18 @@
+define(['app/yangman/yangman.module'], function (yangman) {
+    'use strict';
+
+    yangman.register.controller('TypeBooleanCtrl', TypeBooleanCtrl);
+
+    TypeBooleanCtrl.$inject = ['$scope'];
+
+    function TypeBooleanCtrl($scope){
+        var yangTypeBolean = this;
+
+        $scope.$watch('node.value', function(){
+            if ( typeof $scope.node.value !== 'boolean' && $scope.node.value.length) {
+                $scope.node.value = $scope.node.value === 'true';
+            }
+        });
+    }
+});
+
index 5270e7667d5973219d1de5b0da84b914ac384bc2..6871ee6fe749a1854f380980218acfccf5ac8d01 100644 (file)
@@ -106,7 +106,6 @@ define([
          * @param params
          */
         function saveBcstedHistoryRequest(broadcastEvent, params) {
-
             vm.requestList.addRequestToList(params.params);
             vm.requestList.groupListByDate();
             vm.requestList.saveToStorage();
@@ -213,6 +212,7 @@ define([
          * @param reqObj
          */
         function executeRequest(reqObj) {
+            $scope.setRightPanelSection('req-data');
             $scope.rootBroadcast(
                 'YANGMAN_HEADER_INIT',
                 { path: reqObj.path, method: reqObj.method },
index ae115b8f1e0bed5dff3ff5d04a77246def8cf4a5..8d90f9be4308c33ea3a7dd84aa25a4293d6940e4 100644 (file)
@@ -11,6 +11,7 @@ define([
     'app/yangman/controllers/form/rpc.controller',
     'app/yangman/controllers/form/type.controller',
     'app/yangman/controllers/form/type-bit.controller',
+    'app/yangman/controllers/form/type-boolean.controller',
     'app/yangman/controllers/form/type-empty.controller',
     'app/yangman/controllers/form/type-enum.controller',
     'app/yangman/directives/yang-form-menu.directive',
index 795a02fa2ff7eb251d472cfa17cd966c5d6bfd62..6648f47bdc03dbff5cf7ad72d75271a25ba34df2 100644 (file)
@@ -293,7 +293,7 @@ define([
         function setApi(api, subApi, setUrl){
             $scope.selectedApi = api;
             $scope.selectedSubApi = subApi;
-
+            PathUtilsService.clearPath($scope.selectedSubApi.pathArray);
             $scope.$broadcast('SET_SEL_OPERATIONS', subApi ? $scope.selectedSubApi.operations : [], setUrl);
         }
 
index a13ca474f1e8b0a6dca660d1f06958027813db7c..d50adce64bc1d9a956c714ec24241a9ce41cf953 100644 (file)
@@ -80,11 +80,15 @@ define([], function () {
                 default: function (){
                     var methodType = {
                         GET: function () {
-                            node.clear();
+                            if ( node ){
+                                node.clear();
+                            }
                             return rData;
                         },
                         DELETE: function () {
-                            node.clear();
+                            if ( node ) {
+                                node.clear();
+                            }
                             return {};
                         },
                         PUT: function () {
index 263ba4ca18a07bddff953f2f6b277a2f8c8c59d4..1c55da54a4864b559dd92386e0376e37088b5c8f 100644 (file)
@@ -1,5 +1,7 @@
-<md-switch ng-model="node.value"
-           id="{{ node.label + node.id }}"
-           aria-label="Boolean"
-           ng-disabled="{{ yangOutput.notEditable }}"><!--ng-change="yangType.valueChanged()"-->
-</md-switch>
\ No newline at end of file
+<section ng-controller="TypeBooleanCtrl as yangTypeBolean" flex>
+    <md-switch ng-model="node.value"
+               id="{{ node.label + node.id }}"
+               aria-label="Boolean"
+               ng-disabled="{{ yangOutput.notEditable }}">
+    </md-switch>
+</section>