Yangman - module search, selected module color 86/41286/3
authorDaniel Kuzma -X (dakuzma - PANTHEON TECHNOLOGIES at Cisco) <dakuzma@cisco.com>
Mon, 4 Jul 2016 14:20:42 +0000 (16:20 +0200)
committerDaniel Malachovsky <dmalacho@cisco.com>
Thu, 21 Jul 2016 12:42:22 +0000 (14:42 +0200)
-module search
-selected module

Change-Id: Ifde1f85d5b871f9cd452b7936f6ee0967b678413
Signed-off-by: Daniel Kuzma -X (dakuzma - PANTHEON TECHNOLOGIES at Cisco) <dakuzma@cisco.com>
modules/yangman-resources/src/main/resources/yangman/assets/data/locale-en_US.json
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/requests-list.controller.js
modules/yangman-resources/src/main/resources/yangman/views/directives/ym-info-box.tpl.html
modules/yangman-resources/src/main/resources/yangman/views/index.tpl.html
modules/yangman-resources/src/main/resources/yangman/views/leftpanel/collections-tab.tpl.html
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/yangman.less

index 127af17c48ee577033534923c4946def81a44ff3..0fd2746e21f3c1df2a5e646452023ae72b0b0c50 100644 (file)
@@ -83,7 +83,7 @@
   "YANGMAN_SELECT_OPTIONS": "Select options",
   "YANGMAN_SELECT_ALL": "Select All",
   "YANGMAN_DESELECT_ALL": "Deselect All",
-  "YANGMAN_IS_AUGMENT": "Augment's Group",
+  "YANGMAN_IS_AUGMENT": "Augments",
   "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",
index 56f236261b0abb2bb1dcdce52d3b10b4b646e6f9..10dcea72c21c6fd71b146158eab20182ddd34611 100644 (file)
@@ -6,16 +6,20 @@ define([
     angular.module('app.yangman').controller('ModulesListCtrl', ModulesListCtrl);
 
     ModulesListCtrl.$inject = ['$scope', '$rootScope', '$mdToast', 'YangUtilsService', 'PluginsHandlerService',
-                                '$filter'];
+                                '$filter', '$timeout'];
 
-    function ModulesListCtrl($scope, $rootScope, $mdToast, YangUtilsService, PluginsHandlerService, $filter) {
+    function ModulesListCtrl($scope, $rootScope, $mdToast, YangUtilsService, PluginsHandlerService, $filter, $timeout) {
         var modulesList = this;
 
         modulesList.treeApis = [];
         modulesList.showLoadingBox = true;
         modulesList.moduleListTitle = '';
+        modulesList.search = '';
 
         // methods
+        modulesList.clearFilter = clearFilter;
+        modulesList.customSearch = customSearch;
+        modulesList.checkSelectedModule = checkSelectedModule;
         modulesList.setDataStore = setDataStore;
         modulesList.setModule = setModule;
 
@@ -55,6 +59,38 @@ define([
 
         init();
 
+        /**
+         * Check if module and one of it datastore is selected
+         * @param module
+         * @returns {boolean|*|Function|o}
+         */
+        function checkSelectedModule(module){
+            var haveSelectedDS = [];
+
+            if ( $scope.selectedDatastore && (module === $scope.selectedModule)) {
+                haveSelectedDS = $scope.selectedModule.children.filter(function(item){
+                   return item === $scope.selectedDatastore;
+                });
+            }
+
+            return haveSelectedDS.length;
+        }
+
+        /**
+         * Custom search function for searching by api label
+         * @param api
+         */
+        function customSearch(api){
+            return api.label.toLowerCase().indexOf(modulesList.search.toLowerCase()) > -1;
+        }
+
+        /**
+         * Clear current ctrl search value
+         */
+        function clearFilter(){
+            modulesList.search = '';
+        }
+
         /**
          * Load apis and modules
          */
@@ -88,7 +124,7 @@ define([
         function setModule(module, e){
             if ( $(e.target).hasClass('top-element') ) {
                 module.expanded = !module.expanded;
-                $scope.setModule(module);
+                //$scope.setModule(module);
             }
         }
 
@@ -107,12 +143,15 @@ define([
          * @param text
          */
         function showToastInfoBox(text){
-            $mdToast.show(
-                $mdToast.simple()
-                    .textContent($filter('translate')(text))
-                    .position('bottom left')
-                    .hideDelay(3000)
-            );
+            $timeout(function(){
+                $mdToast.show(
+                    $mdToast.simple()
+                        .textContent($filter('translate')(text))
+                        .position('bottom left')
+                        .parent(angular.element('.yangmanModule__left-panel'))
+                        .hideDelay(3000)
+                );
+            }, 500);
         }
     }
 
index 8ba6c21375b3fa9303cdd4ef76a3500fc7d6181a..68ce0051e57e7281545e0dbd02054c7746427dd8 100644 (file)
@@ -22,6 +22,7 @@ define([
         vm.requestList = RequestsService.createEmptyHistoryList('yangman_requestsList');
         vm.search = '';
 
+        // methods
         vm.clearFilter = clearFilter;
         vm.clearHistoryList = clearHistoryList;
         vm.clearCollectionList = clearCollectionList;
index 3b554cb40d0b5f2cada22d6549a881b78457f2dd..2adf38490e6a54cef931af79bb0486be62f981c6 100644 (file)
@@ -5,12 +5,12 @@
         <div class="info-box__padding">
             <!-- key -->
             <span ng-show="node.isKey()">
-                {{'Key of ' + node.parent.label + ' list'}}
+                {{'Key for "' + node.parent.label + '"'}}
                 <md-menu-divider ng-show="dividerCheck(true)"></md-menu-divider>
             </span>
             <!-- augment -->
             <span ng-show="node.augmentationId">
-                {{ 'YANGMAN_IS_AUGMENT' | translate }} "{{ node.augmentationId }}"
+                {{ 'YANGMAN_IS_AUGMENT' | translate }} <i>{{node.type}}</i> "{{ node.augmentationId }}"
                 <md-menu-divider ng-show="dividerCheck()"></md-menu-divider>
             </span>
             <!-- description -->
index 04d3ee9354308a5e562420de1eac4c2ef9ddd7c4..ab6be169eb94996adb4ac3b3de1b3e915633f7a8 100644 (file)
@@ -18,7 +18,7 @@
                     <md-tabs class="yangmanModule__mhc-tabs inline-tabs" md-no-pagination md-dynamic-height md-stretch-tabs="always">
                         <!-- Modules tab -->
                         <md-tab label="{{'YANGMAN_MODULES' | translate}}" md-on-select="main.switchedTab(0)">
-                            <div ng-include src="globalViewPath + 'leftpanel/modules-tab.tpl.html'" class="scrollableY"></div>
+                            <div ng-include src="globalViewPath + 'leftpanel/modules-tab.tpl.html'" class="h100"></div>
                         </md-tab>
                         <!-- History tab -->
                         <md-tab label="{{'YANGMAN_HISTORY' | translate}}" md-on-select="main.switchedTab(1)">
index e6633592b6e992631616e17aa4b26971b5c2816c..f05a9ee9d62d9e75008eb69a1923a233ce78ed4c 100644 (file)
@@ -1,26 +1,30 @@
 <md-list class="yangmanModule__requests-list__collections-list"
          ng-cloak
-         ng-init="reqList.init(reqList.collectionList)"
-         ng-controller="RequestsListCtrl as reqList">
-
-    <md-content class="searchBox" layout="row">
-        <!-- search icon, form, clear button -->
-        <md-icon class="material-icons">search</md-icon>
-        <input class="ng-pristine ng-valid ng-touched"
-               type="text"
-               flex
-               placeholder="{{'YANGMAN_SEARCH' | translate}}"
-               ng-model="reqList.search"
-               aria-invalid="false" />
-        <md-button aria-label="{{'YANGMAN_CLEAR_SEARCH'| translate}}"
-                    ng-click="reqList.clearFilter()"
-                    ng-if="reqList.search">
-            <md-icon class="material-icons clickable" >
-                close
-            </md-icon>
-            <md-tooltip md-direction="bottom">{{'YANGMAN_CLEAR_SEARCH'| translate}}</md-tooltip>
-        </md-button>
-        <!-- /search icon, form, clear button -->
+         ng-controller="RequestsListCtrl as reqList"
+         ng-init="reqList.init(reqList.collectionList)">
+
+    <md-content class="searchBox yangmanModule__left-panel__search" layout="row">
+
+        <!-- searching -->
+        <md-input-container layout="row" md-no-float class="modules-list-search" flex>
+            <!-- search icon, form, clear button -->
+            <md-icon class="material-icons">search</md-icon>
+            <input class="ng-pristine ng-valid ng-touched"
+                   type="text"
+                   flex
+                   placeholder="{{'YANGMAN_SEARCH' | translate}}"
+                   ng-model="reqList.search"
+                   aria-invalid="false" />
+            <md-button aria-label="{{'YANGMAN_CLEAR_SEARCH'| translate}}" flex="none"
+                       ng-click="reqList.clearFilter()"
+                       ng-if="reqList.search">
+                <md-icon class="material-icons clickable">
+                    close
+                </md-icon>
+                <md-tooltip md-direction="bottom">{{'YANGMAN_CLEAR_SEARCH'| translate}}</md-tooltip>
+            </md-button>
+            <!-- /search icon, form, clear button -->
+        </md-input-container>
 
         <!-- sorting -->
         <md-button  ng-click="reqList.toggleCollectionsSort()"
index 37e2a1ea911e36dcfc0b181036899c32f216ba1b..f1b925edf5da74de662d340fd91e35eadb155d89 100644 (file)
@@ -3,25 +3,28 @@
          ng-init="reqList.init(reqList.requestList)"
          ng-controller="RequestsListCtrl as reqList">
 
-    <md-content class="searchBox" layout="row">
+    <md-content class="searchBox yangmanModule__left-panel__search" layout="row">
 
-        <!-- search icon, form, clear button -->
-        <md-icon class="material-icons">search</md-icon>
-        <input class="ng-pristine ng-valid ng-touched"
-               type="text"
-               flex
-               placeholder="{{'YANGMAN_SEARCH' | translate}}"
-               ng-model="reqList.search"
-               aria-invalid="false" />
-        <md-button aria-label="{{'YANGMAN_CLEAR_SEARCH'| translate}}"
-                   ng-click="reqList.clearFilter()"
-                   ng-if="reqList.search">
-            <md-icon class="material-icons clickable">
-                close
-            </md-icon>
-            <md-tooltip md-direction="bottom">{{'YANGMAN_CLEAR_SEARCH'| translate}}</md-tooltip>
-        </md-button>
-        <!-- /search icon, form, clear button -->
+        <!-- searching -->
+        <md-input-container layout="row" md-no-float class="modules-list-search" flex>
+            <!-- search icon, form, clear button -->
+            <md-icon class="material-icons">search</md-icon>
+            <input class="ng-pristine ng-valid ng-touched"
+                   type="text"
+                   flex
+                   placeholder="{{'YANGMAN_SEARCH' | translate}}"
+                   ng-model="reqList.search"
+                   aria-invalid="false" />
+            <md-button aria-label="{{'YANGMAN_CLEAR_SEARCH'| translate}}" flex="none"
+                       ng-click="reqList.clearFilter()"
+                       ng-if="reqList.search">
+                <md-icon class="material-icons clickable">
+                    close
+                </md-icon>
+                <md-tooltip md-direction="bottom">{{'YANGMAN_CLEAR_SEARCH'| translate}}</md-tooltip>
+            </md-button>
+            <!-- /search icon, form, clear button -->
+        </md-input-container>
 
         <!-- save -->
         <md-button  ng-click="reqList.showDgSaveReq($event, main.currentPath)"
 
     </md-content>
 
+    <md-divider></md-divider>
+
     <!-- list of items grouped by date -->
     <md-content class="scrollableY">
         <md-list-item ng-repeat="group in reqList.mainList.dateGroups | orderBy: 'name': true"
index 76d731574c7250d2013365b00f74a3ccf372408c..0df94d4ef50d378595780fe95ff9bc2f6ee589ae 100644 (file)
@@ -1,50 +1,81 @@
-<md-list ng-controller="ModulesListCtrl as modulesList" ng-cloak class="yangmanModule__modules-list">
-    <!-- Loading box -->
-    <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>{{ 'YANGMAN_LOADING_MODULES' | translate }}</span>
-        </div>
-    </div>
+<section ng-controller="ModulesListCtrl as modulesList" class="h100">
+    <!-- searching -->
+    <section class="yangmanModule__left-panel__search" ng-hide="modulesList.showLoadingBox">
+        <md-input-container layout="row" md-no-float class="modules-list-search">
+            <md-icon class="material-icons">search</md-icon>
+            <input class="ng-pristine ng-valid ng-touched"
+                   type="text"
+                   flex
+                   placeholder="{{'YANGMAN_SEARCH' | translate}}"
+                   ng-model="modulesList.search"
+                   aria-invalid="false" />
+
+            <!-- search clear button -->
+            <md-button aria-label="{{'YANGMAN_CLEAR_SEARCH'| translate}}" flex="none"
+                       ng-click="modulesList.clearFilter()"
+                       ng-if="modulesList.search">
+                <md-icon class="material-icons clickable">
+                    close
+                </md-icon>
+                <md-tooltip md-direction="bottom">{{'YANGMAN_CLEAR_SEARCH'| translate}}</md-tooltip>
+            </md-button>
+        </md-input-container>
 
-    <!-- Mount point title -->
-    <section ng-show="modulesList.moduleListTitle.length">
-        <h4>{{ modulesList.moduleListTitle }}</h4>
-        <!-- Line -->
-        <md-divider></md-divider>
     </section>
 
-    <!-- Modules list -->
-    <md-list-item ng-repeat="module in modulesList.treeApis"
-                  class="yangmanModule__modules-list__item"
-                  ng-class="{'expanded' : module.expanded}"
-                  ng-hide="modulesList.showLoadingBox"
-                  ng-click="modulesList.setModule(module, $event)">
-        <!-- Item content -->
-        <div layout="column" flex>
-            <!-- Module title -->
-            <div layout="row" layout-align="center center"  class="pointer title">
-                <md-icon md-font-set="material-icons" class="top-icon top-element">
-                    {{module.expanded ? 'keyboard_arrow_down':'keyboard_arrow_right'}}
-                </md-icon>
-                <p flex class="top-element"> {{module.label}} </p>
-            </div>
+    <!-- divider -->
+    <md-divider ng-hide="modulesList.showLoadingBox"></md-divider>
+
+    <!-- modules list -->
+    <md-list ng-cloak class="yangmanModule__modules-list scrollableY">
 
-            <!-- Datastore && rpc -->
-            <md-list flex class="yangmanModule__datastore-list" ng-show="module.expanded">
-                <md-list-item ng-repeat="item in module.children">
-                    <div flex
-                         layout="row"
-                         layout-align="center center"
-                         class="pointer"
-                         ng-click="modulesList.setDataStore(item, module)">
-                        <md-icon md-font-set="material-icons">keyboard_arrow_right</md-icon>
-                        <p flex> {{item.label}} </p>
-                    </div>
-                </md-list-item>
-            </md-list>
+        <!-- Loading box -->
+        <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>{{ 'YANGMAN_LOADING_MODULES' | translate }}</span>
+            </div>
         </div>
-        <!-- Line -->
-        <md-divider></md-divider>
-    </md-list-item>
-</md-list>
+
+        <!-- Mount point title -->
+        <section ng-show="modulesList.moduleListTitle.length">
+            <h4>{{ modulesList.moduleListTitle }}</h4>
+            <!-- Line -->
+            <md-divider></md-divider>
+        </section>
+
+        <!-- Modules list -->
+        <md-list-item ng-repeat="module in modulesList.treeApis | filter: modulesList.customSearch"
+                      class="yangmanModule__modules-list__item"
+                      ng-class="{'expanded' : module.expanded, 'selected' : modulesList.checkSelectedModule(module)}"
+                      ng-hide="modulesList.showLoadingBox"
+                      ng-click="modulesList.setModule(module, $event)">
+            <!-- Item content -->
+            <div layout="column" flex>
+                <!-- Module title -->
+                <div layout="row" layout-align="center center"  class="pointer title">
+                    <md-icon md-font-set="material-icons" class="top-icon top-element">
+                        {{module.expanded ? 'keyboard_arrow_down':'keyboard_arrow_right'}}
+                    </md-icon>
+                    <p flex class="top-element"> {{module.label}} </p>
+                </div>
+
+                <!-- Datastore && rpc -->
+                <md-list flex class="yangmanModule__datastore-list" ng-show="module.expanded">
+                    <md-list-item ng-repeat="item in module.children">
+                        <div flex
+                             layout="row"
+                             layout-align="center center"
+                             class="pointer"
+                             ng-click="modulesList.setDataStore(item, module)">
+                            <md-icon md-font-set="material-icons">keyboard_arrow_right</md-icon>
+                            <p flex> {{item.label}} </p>
+                        </div>
+                    </md-list-item>
+                </md-list>
+            </div>
+            <!-- Line -->
+            <md-divider></md-divider>
+        </md-list-item>
+    </md-list>
+</section>
index 9ded3598bdeffb5231512298c4bff832a992d8e5..b2047636fb056c2f1d23823d7f88d3de11a89b5b 100644 (file)
@@ -212,17 +212,12 @@ button{
         margin: 8px 0;
     }
 
-    /*.md-input{
-        color: @inputColor;
-        background: transparent;
-    }*/
-
     .historyTab{
-        height: calc(~'100% - 90px');
+        height: calc(~'100% - 62px');
     }
 
     .collectionsTab{
-        height: calc(~'100% - 65px');
+        height: calc(~'100% - 62px');
     }
 
 
@@ -298,9 +293,48 @@ button{
     &__left-panel{
         overflow-x: hidden;
         background: @leftPanelBackColor;
-        //background: @listBackColor;
         position: relative;
 
+        &__search{
+            padding: 10px 13px;
+            background: @listBackColor;
+            min-height: 62px;
+
+            .md-errors-spacer{
+                display: none;
+            }
+
+            md-icon{
+                color: @dashedBorderColor;
+            }
+
+            .md-has-icon.modules-list-search{
+                padding: 2px 25px;
+                margin: 0;
+
+                .md-input{
+                    width: auto;
+                    order: 0;
+                }
+
+                button{
+                    margin: 0;
+                    padding: 0;
+                    min-width: 0;
+                    min-height: 0;
+                    line-height: normal;
+
+                    &:hover, &:focus, &:active, &:visited{
+                        background: transparent;
+                    }
+
+                    .md-ripple-container{
+                        display: none;
+                    }
+                }
+            }
+        }
+
         md-tabs,
         md-tab-content > div,
         md-content,
@@ -334,14 +368,6 @@ button{
             }
         }
 
-        /*md-list-item .md-list-item-inner > md-icon:first-child:not(.md-avatar-icon){
-            margin-right: 16px;
-        }*/
-
-        /*md-list-item > md-icon:first-child:not(.md-avatar-icon){
-            margin: 0 16px;
-        }*/
-
         &__detail-list-tabs-container{
             > md-tabs-wrapper{
                 display: none;
@@ -369,13 +395,6 @@ button{
                 cursor: pointer;
             }
 
-            input{
-                background: none;
-                border: none;
-                color: @fontColor;
-                outline: none;
-            }
-
             #importParameters{
                 display: none;
             }
@@ -685,6 +704,7 @@ button{
     &__modules-list{
         padding: 0;
         background: @listBackColor;
+        height: calc(~"100% - 62px")!important;
 
         h4{
             margin: 0;
@@ -706,6 +726,13 @@ button{
                 background: @listActiveColor;
             }
 
+            &.selected{
+                .title{
+                    background-color: @colorActive!important;
+                    color: #fff!important;
+                }
+            }
+
             md-icon{
                 margin: 12px 16px;
             }
@@ -716,10 +743,6 @@ button{
                 }
             }
         }
-
-        /*md-list-item{
-
-        }*/
     }
 
     // datastore list