Browse Source

Merge "Group resource icons by project"

changes/52/590152/4
Zuul 3 years ago
committed by Gerrit Code Review
parent
commit
25d10dd303
  1. 23
      heat_dashboard/content/template_generator/templates/template_generator/index.html
  2. 11
      heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/css/hotgen.scss
  3. 19
      heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/components/icons.controller.js
  4. 3
      heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/components/icons.controller.spec.js

23
heat_dashboard/content/template_generator/templates/template_generator/index.html

@ -77,16 +77,27 @@
</div>
</div>
<div class="row table_action">
<div class="row">
<span flex></span>
<!-- Icon Drag sidebar -->
<div class="col-sm-11" style="text-align:center" ng-controller="horizon.dashboard.project.heat_dashboard.template_generator.IconController">
<div draggable ng-repeat="(reskey, resobj) in resource_types" class="os-resource" draggable="true" id="{$ reskey $}" ng-if="admin || !resource_admin[reskey]">
<md-tooltip md-direction="top" style="font-size:12px !important;">{$ resobj.name $}</md-tooltip>
<md-icon style="height: 36px; width: 36px;" md-svg-src="{$ basePath $}js/resources/{$ reskey|lowercase $}/{$ reskey|lowercase $}.svg"></md-icon>
</div>
<div class="col-sm-10" ng-controller="horizon.dashboard.project.heat_dashboard.template_generator.IconController" >
<md-nav-bar md-selected-nav-item="currentNavItem" nav-bar-aria-label="Icon Group Nav">
<md-nav-item md-nav-click="showIcon()" ng-repeat="(level, level_item) in project_types" name="{$ level $}">
{$ level $}
</md-nav-item>
</md-nav-bar>
<div class="navbar-content">
<div ng-repeat="(level, level_item) in project_types" >
<div ng-show="level == currentNavItem">
<div draggable ng-repeat="(reskey, resobj) in level_item" class="os-resource" draggable="true" id="{$ reskey $}" ng-if="admin || !resource_admin[reskey]">
<md-tooltip md-direction="top" style="font-size:12px !important;">{$ resobj.name $}</md-tooltip>
<md-icon style="height: 36px; width: 36px;" md-svg-src="{$ basePath $}js/resources/{$ reskey|lowercase $}/{$ reskey|lowercase $}.svg"></md-icon>
</div>
</div>
</div>
</div>
</div>
<!-- End Drag sidebar -->
</div>

11
heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/css/hotgen.scss

@ -169,3 +169,14 @@ md-icon.spinner{
overflow: auto;
max-height: 500px;
}
.md-nav-bar {
border-style: none;
border-width: 0 0;
position: absolute;
left: 50%;
transform: translate(-50%, -50%);
}
.navbar-content{
margin-top: 3%;
text-align: center;
}

19
heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/components/icons.controller.js

@ -9,8 +9,25 @@
$scope.resource_admin = hotgenGlobals.get_node_admin();
$scope.admin = hotgenGlobals.get_resource_options().auth.admin;
$scope.basePath = basePath;
}]);
$scope.project_types = {};
for (var idx in $scope.resource_types){
var pidx = idx.split('__');
if (!pidx || pidx.length != 3){
continue
}
var level = pidx[0]+'::'+pidx[1]
if (! (level in $scope.project_types)){
$scope.project_types[level] = {}
}
$scope.project_types[level][idx] = $scope.resource_types[idx];
}
$scope.currentNavItem = Object.keys($scope.project_types)[0];
$scope.showIcon = function(){
// console.log($scope.currentNavItem)
};
}]);
})();

3
heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/components/icons.controller.spec.js

@ -9,6 +9,8 @@
beforeEach(inject(function($injector){
hotgenGlobals = $injector.get('hotgenGlobals');
hotgenGlobals.update_resource_icons('OS__Project__Resource', '');
hotgenGlobals.update_resource_icons('OS__Key', '');
}));
beforeEach(inject(function(_$controller_, $rootScope) {
@ -33,6 +35,7 @@
expect($scope.basePath).toBe($window.STATIC_URL + 'dashboard/project/heat_dashboard/template_generator/');
}]));
});
})();
Loading…
Cancel
Save