Browse Source

Merge "Group resource icons by project"

Zuul 8 months ago
parent
commit
25d10dd303

+ 17
- 6
heat_dashboard/content/template_generator/templates/template_generator/index.html View File

@@ -77,16 +77,27 @@
77 77
             </div>
78 78
         </div>
79 79
 
80
-        <div class="row table_action">
80
+        <div class="row">
81 81
 
82 82
             <span flex></span>
83 83
 
84 84
             <!-- Icon Drag sidebar -->
85
-            <div class="col-sm-11" style="text-align:center" ng-controller="horizon.dashboard.project.heat_dashboard.template_generator.IconController">
86
-               <div draggable ng-repeat="(reskey, resobj) in resource_types" class="os-resource" draggable="true" id="{$ reskey $}" ng-if="admin || !resource_admin[reskey]">
87
-                   <md-tooltip md-direction="top" style="font-size:12px !important;">{$ resobj.name $}</md-tooltip>
88
-                   <md-icon style="height: 36px; width: 36px;" md-svg-src="{$ basePath $}js/resources/{$ reskey|lowercase $}/{$ reskey|lowercase $}.svg"></md-icon>
89
-               </div>
85
+            <div class="col-sm-10" ng-controller="horizon.dashboard.project.heat_dashboard.template_generator.IconController" >
86
+                <md-nav-bar md-selected-nav-item="currentNavItem" nav-bar-aria-label="Icon Group Nav">
87
+                  <md-nav-item md-nav-click="showIcon()" ng-repeat="(level, level_item) in project_types" name="{$ level $}">
88
+                    {$ level $}
89
+                  </md-nav-item>
90
+                </md-nav-bar>
91
+                <div class="navbar-content">
92
+                    <div ng-repeat="(level, level_item) in project_types" >
93
+                      <div ng-show="level == currentNavItem">
94
+                        <div draggable ng-repeat="(reskey, resobj) in level_item" class="os-resource" draggable="true" id="{$ reskey $}" ng-if="admin || !resource_admin[reskey]">
95
+                            <md-tooltip md-direction="top" style="font-size:12px !important;">{$ resobj.name $}</md-tooltip>
96
+                            <md-icon style="height: 36px; width: 36px;" md-svg-src="{$ basePath $}js/resources/{$ reskey|lowercase $}/{$ reskey|lowercase $}.svg"></md-icon>
97
+                        </div>
98
+                      </div>
99
+                    </div>
100
+                </div>
90 101
             </div>
91 102
             <!-- End Drag sidebar -->
92 103
         </div>

+ 11
- 0
heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/css/hotgen.scss View File

@@ -169,3 +169,14 @@ md-icon.spinner{
169 169
     overflow: auto;
170 170
     max-height: 500px;
171 171
 }
172
+.md-nav-bar {
173
+    border-style: none;
174
+    border-width: 0 0;
175
+    position: absolute;
176
+    left: 50%;
177
+    transform: translate(-50%, -50%);
178
+}
179
+.navbar-content{
180
+    margin-top: 3%;
181
+    text-align: center;
182
+}

+ 18
- 1
heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/components/icons.controller.js View File

@@ -9,8 +9,25 @@
9 9
         $scope.resource_admin = hotgenGlobals.get_node_admin();
10 10
         $scope.admin = hotgenGlobals.get_resource_options().auth.admin;
11 11
         $scope.basePath = basePath;
12
-    }]);
13 12
 
13
+        $scope.project_types = {};
14
+        for (var idx in $scope.resource_types){
15
+            var pidx = idx.split('__');
16
+            if (!pidx || pidx.length != 3){
17
+            continue
18
+        }
19
+        var level = pidx[0]+'::'+pidx[1]
20
+        if (! (level in $scope.project_types)){
21
+            $scope.project_types[level] = {}
22
+        }
23
+        $scope.project_types[level][idx] = $scope.resource_types[idx];
24
+        }
25
+        $scope.currentNavItem = Object.keys($scope.project_types)[0];
26
+        $scope.showIcon = function(){
27
+//            console.log($scope.currentNavItem)
28
+        };
29
+
30
+    }]);
14 31
 })();
15 32
 
16 33
 

+ 3
- 0
heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/components/icons.controller.spec.js View File

@@ -9,6 +9,8 @@
9 9
 
10 10
         beforeEach(inject(function($injector){
11 11
             hotgenGlobals = $injector.get('hotgenGlobals');
12
+            hotgenGlobals.update_resource_icons('OS__Project__Resource', '');
13
+            hotgenGlobals.update_resource_icons('OS__Key', '');
12 14
         }));
13 15
 
14 16
         beforeEach(inject(function(_$controller_, $rootScope) {
@@ -33,6 +35,7 @@
33 35
             expect($scope.basePath).toBe($window.STATIC_URL + 'dashboard/project/heat_dashboard/template_generator/');
34 36
 
35 37
         }]));
38
+
36 39
     });
37 40
 
38 41
 })();

Loading…
Cancel
Save