mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
refactor: changed nav store to use nav index and selector instead of initNav action
This commit is contained in:
@@ -20,3 +20,24 @@ configure({ adapter: new Adapter() });
|
||||
|
||||
const global = <any>window;
|
||||
global.$ = global.jQuery = $;
|
||||
|
||||
const localStorageMock = (function() {
|
||||
var store = {};
|
||||
return {
|
||||
getItem: function(key) {
|
||||
return store[key];
|
||||
},
|
||||
setItem: function(key, value) {
|
||||
store[key] = value.toString();
|
||||
},
|
||||
clear: function() {
|
||||
store = {};
|
||||
},
|
||||
removeItem: function(key) {
|
||||
delete store[key];
|
||||
},
|
||||
};
|
||||
})();
|
||||
|
||||
global.localStorage = localStorageMock;
|
||||
// Object.defineProperty(window, 'localStorage', { value: localStorageMock });
|
||||
|
||||
@@ -20,7 +20,7 @@ export function createNavTree(...args) {
|
||||
return root;
|
||||
}
|
||||
|
||||
export function getNavModel(title: string, tabs: string[]): NavModel {
|
||||
export function createNavModel(title: string, ...tabs: string[]): NavModel {
|
||||
const node: NavModelItem = {
|
||||
id: title,
|
||||
text: title,
|
||||
@@ -38,9 +38,12 @@ export function getNavModel(title: string, tabs: string[]): NavModel {
|
||||
subTitle: 'subTitle',
|
||||
url: title,
|
||||
text: title,
|
||||
active: false,
|
||||
});
|
||||
}
|
||||
|
||||
node.children[0].active = true;
|
||||
|
||||
return {
|
||||
node: node,
|
||||
main: node,
|
||||
|
||||
Reference in New Issue
Block a user