mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(panel): active tab is now placed in querystring aswell
This commit is contained in:
parent
2b06ceda71
commit
617d18e587
@ -91,16 +91,24 @@ export class PanelCtrl {
|
|||||||
this.editModeInitiated = true;
|
this.editModeInitiated = true;
|
||||||
this.events.emit('init-edit-mode', null);
|
this.events.emit('init-edit-mode', null);
|
||||||
|
|
||||||
var route = this.$injector.get('$route');
|
var routeParams = this.$injector.get('$routeParams');
|
||||||
if (route.current.params.editorTab) {
|
if (routeParams.editorTab) {
|
||||||
this.editorTabs.forEach((tab, i) => {
|
this.editorTabs.forEach((tab, i) => {
|
||||||
if (tab.title === route.current.params.editorTab) {
|
if (tab.title === routeParams.editorTab) {
|
||||||
this.editorTabIndex = i;
|
this.editorTabIndex = i;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeTab(newIndex) {
|
||||||
|
this.editorTabIndex = newIndex;
|
||||||
|
var route = this.$injector.get('$route');
|
||||||
|
|
||||||
|
route.current.params.editorTab = this.editorTabs[newIndex].title;
|
||||||
|
route.updateParams();
|
||||||
|
}
|
||||||
|
|
||||||
addEditorTab(title, directiveFn, index?) {
|
addEditorTab(title, directiveFn, index?) {
|
||||||
var editorTab = {title, directiveFn};
|
var editorTab = {title, directiveFn};
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ var panelTemplate = `
|
|||||||
|
|
||||||
<ul class="gf-tabs">
|
<ul class="gf-tabs">
|
||||||
<li class="gf-tabs-item" ng-repeat="tab in ::ctrl.editorTabs">
|
<li class="gf-tabs-item" ng-repeat="tab in ::ctrl.editorTabs">
|
||||||
<a class="gf-tabs-link" ng-click="ctrl.editorTabIndex = $index" ng-class="{active: ctrl.editorTabIndex === $index}">
|
<a class="gf-tabs-link" ng-click="ctrl.changeTab($index)" ng-class="{active: ctrl.editorTabIndex === $index}">
|
||||||
{{::tab.title}}
|
{{::tab.title}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user