mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 13:42:02 +00:00
Restore WebUI breadcrumbs
- Update paths to svg images - Restore sections concept - Tested with local cluster
This commit is contained in:
@@ -27,3 +27,5 @@ app.config([
|
||||
});
|
||||
}
|
||||
]);
|
||||
|
||||
app.value("sections", [{"name":"Dashboard","url":"/dashboard","type":"link","templateUrl":"/components/dashboard/pages/home.html"},{"name":"Dashboard","type":"heading","children":[{"name":"Dashboard","type":"toggle","url":"/dashboard","templateUrl":"/components/dashboard/pages/home.html","pages":[{"name":"Pods","url":"/dashboard/pods","templateUrl":"/components/dashboard/views/listPods.html","type":"link"},{"name":"Pod Visualizer","url":"/dashboard/visualpods","templateUrl":"/components/dashboard/views/listPodsVisualizer.html","type":"link"},{"name":"Services","url":"/dashboard/services","templateUrl":"/components/dashboard/views/listServices.html","type":"link"},{"name":"Replication Controllers","url":"/dashboard/replicationcontrollers","templateUrl":"/components/dashboard/views/listReplicationControllers.html","type":"link"},{"name":"Events","url":"/dashboard/events","templateUrl":"/components/dashboard/views/listEvents.html","type":"link"},{"name":"Nodes","url":"/dashboard/minions","templateUrl":"/components/dashboard/views/listMinions.html","type":"link"},{"name":"Replication Controller","url":"/dashboard/replicationcontrollers/:replicationControllerId","templateUrl":"/components/dashboard/views/replication.html","type":"link"},{"name":"Service","url":"/dashboard/services/:serviceId","templateUrl":"/components/dashboard/views/service.html","type":"link"},{"name":"Explore","url":"/dashboard/groups/:grouping*?/selector/:selector*?","templateUrl":"/components/dashboard/views/groups.html","type":"link"},{"name":"Pod","url":"/dashboard/pods/:podId","templateUrl":"/components/dashboard/views/pod.html","type":"link"}]}]},{"name":"Graph","url":"/graph","type":"link","templateUrl":"/components/graph/pages/home.html"},{"name":"Graph","url":"/graph/inspect","type":"link","templateUrl":"/components/graph/pages/inspect.html","css":"/components/graph/css/show-details-table.css"},{"name":"Graph","type":"heading","children":[{"name":"Graph","type":"toggle","url":"/graph","templateUrl":"/components/graph/pages/home.html","pages":[{"name":"Test","url":"/graph/test","type":"link","templateUrl":"/components/graph/pages/home.html"}]}]}]);
|
||||
|
@@ -14,3 +14,58 @@ var app = angular.module('kubernetesApp', [
|
||||
'kubernetesApp.services',
|
||||
'angular.filter'
|
||||
].concat(componentNamespaces));
|
||||
|
||||
app.factory('menu', [
|
||||
'$location',
|
||||
'$rootScope',
|
||||
'sections',
|
||||
function($location, $rootScope, sections) {
|
||||
|
||||
var self;
|
||||
|
||||
$rootScope.$on('$locationChangeSuccess', onLocationChange);
|
||||
|
||||
return self = {
|
||||
|
||||
sections: sections,
|
||||
|
||||
setSections: function(_sections) { this.sections = _sections; },
|
||||
selectSection: function(section) { self.openedSection = section; },
|
||||
toggleSelectSection: function(section) {
|
||||
self.openedSection = (self.openedSection === section ? null : section);
|
||||
},
|
||||
isSectionSelected: function(section) { return self.openedSection === section; },
|
||||
selectPage: function(section, page) {
|
||||
page && page.url && $location.path(page.url);
|
||||
self.currentSection = section;
|
||||
self.currentPage = page;
|
||||
},
|
||||
isPageSelected: function(page) { return self.currentPage === page; }
|
||||
};
|
||||
|
||||
function onLocationChange() {
|
||||
var path = $location.path();
|
||||
|
||||
var matchPage = function(section, page) {
|
||||
if (path === page.url) {
|
||||
self.selectSection(section);
|
||||
self.selectPage(section, page);
|
||||
}
|
||||
};
|
||||
|
||||
sections.forEach(function(section) {
|
||||
if (section.children) {
|
||||
section.children.forEach(function(childSection) {
|
||||
if (childSection.pages) {
|
||||
childSection.pages.forEach(function(page) { matchPage(childSection, page); });
|
||||
}
|
||||
});
|
||||
} else if (section.pages) {
|
||||
section.pages.forEach(function(page) { matchPage(section, page); });
|
||||
} else if (section.type === 'link') {
|
||||
matchPage(section, section);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
@@ -1 +1 @@
|
||||
app.constant("manifestRoutes", [{"description":"Dashboard visualization.","url":"/dashboard/","templateUrl":"components/dashboard/pages/home.html"},{"description":"Pods","url":"/dashboard/pods","templateUrl":"components/dashboard/views/listPods.html"},{"description":"Pod Visualizer","url":"/dashboard/visualpods","templateUrl":"components/dashboard/views/listPodsVisualizer.html"},{"description":"Services","url":"/dashboard/services","templateUrl":"components/dashboard/views/listServices.html"},{"description":"Replication Controllers","url":"/dashboard/replicationcontrollers","templateUrl":"components/dashboard/views/listReplicationControllers.html"},{"description":"Events","url":"/dashboard/events","templateUrl":"components/dashboard/views/listEvents.html"},{"description":"Minions","url":"/dashboard/minions","templateUrl":"components/dashboard/views/listMinions.html"},{"description":"Replication Controller","url":"/dashboard/replicationcontrollers/:replicationControllerId","templateUrl":"components/dashboard/views/replication.html"},{"description":"Service","url":"/dashboard/services/:serviceId","templateUrl":"components/dashboard/views/service.html"},{"description":"Explore","url":"/dashboard/groups/:grouping*?/selector/:selector*?","templateUrl":"components/dashboard/views/groups.html"},{"description":"Pod","url":"/dashboard/pods/:podId","templateUrl":"components/dashboard/views/pod.html"}]);
|
||||
app.constant("manifestRoutes", [{"description":"Dashboard visualization.","url":"/dashboard/","templateUrl":"components/dashboard/pages/home.html"},{"description":"Pods","url":"/dashboard/pods","templateUrl":"components/dashboard/views/listPods.html"},{"description":"Pod Visualizer","url":"/dashboard/visualpods","templateUrl":"components/dashboard/views/listPodsVisualizer.html"},{"description":"Services","url":"/dashboard/services","templateUrl":"components/dashboard/views/listServices.html"},{"description":"Replication Controllers","url":"/dashboard/replicationcontrollers","templateUrl":"components/dashboard/views/listReplicationControllers.html"},{"description":"Events","url":"/dashboard/events","templateUrl":"components/dashboard/views/listEvents.html"},{"description":"Nodes","url":"/dashboard/minions","templateUrl":"components/dashboard/views/listMinions.html"},{"description":"Replication Controller","url":"/dashboard/replicationcontrollers/:replicationControllerId","templateUrl":"components/dashboard/views/replication.html"},{"description":"Service","url":"/dashboard/services/:serviceId","templateUrl":"components/dashboard/views/service.html"},{"description":"Explore","url":"/dashboard/groups/:grouping*?/selector/:selector*?","templateUrl":"components/dashboard/views/groups.html"},{"description":"Pod","url":"/dashboard/pods/:podId","templateUrl":"components/dashboard/views/pod.html"}]);
|
||||
|
Reference in New Issue
Block a user