mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
wip: restoring old angular panel tabs / edit mode
This commit is contained in:
parent
b7ba73819c
commit
2f84101fe7
@ -7,6 +7,7 @@ import { PanelCtrl } from 'app/features/panel/panel_ctrl';
|
||||
import * as rangeUtil from 'app/core/utils/rangeutil';
|
||||
import * as dateMath from 'app/core/utils/datemath';
|
||||
import { getExploreUrl } from 'app/core/utils/explore';
|
||||
import { metricsTabDirective } from './metrics_tab';
|
||||
|
||||
class MetricsPanelCtrl extends PanelCtrl {
|
||||
scope: any;
|
||||
@ -56,7 +57,8 @@ class MetricsPanelCtrl extends PanelCtrl {
|
||||
}
|
||||
|
||||
private onInitMetricsPanelEditMode() {
|
||||
// this.addCommonTab('Time range', 'public/app/features/panel/partials/panelTime.html');
|
||||
this.addEditorTab('Queries', metricsTabDirective, 1, 'fa fa-database');
|
||||
this.addEditorTab('Time range', 'public/app/features/panel/partials/panelTime.html');
|
||||
}
|
||||
|
||||
private onMetricsPanelRefresh() {
|
||||
|
@ -6,8 +6,6 @@ import { PanelModel } from 'app/features/dashboard/panel_model';
|
||||
import Remarkable from 'remarkable';
|
||||
import { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN, LS_PANEL_COPY_KEY } from 'app/core/constants';
|
||||
import store from 'app/core/store';
|
||||
import { metricsTabDirective } from './metrics_tab';
|
||||
import { vizTabDirective } from './viz_tab';
|
||||
|
||||
const TITLE_HEIGHT = 27;
|
||||
const PANEL_BORDER = 2;
|
||||
@ -22,7 +20,6 @@ export class PanelCtrl {
|
||||
pluginName: string;
|
||||
pluginId: string;
|
||||
editorTabs: any;
|
||||
optionTabs: any;
|
||||
$scope: any;
|
||||
$injector: any;
|
||||
$location: any;
|
||||
@ -97,15 +94,11 @@ export class PanelCtrl {
|
||||
|
||||
initEditMode() {
|
||||
this.editorTabs = [];
|
||||
this.optionTabs = [];
|
||||
this.addCommonTab('Queries', metricsTabDirective, 0, 'fa fa-database');
|
||||
this.addCommonTab('Visualization', vizTabDirective, 1, 'fa fa-line-chart');
|
||||
this.addEditorTab('General', 'public/app/partials/panelgeneral.html');
|
||||
|
||||
this.editModeInitiated = true;
|
||||
this.events.emit('init-edit-mode', null);
|
||||
|
||||
// this.addEditorTab('General', 'public/app/partials/panelgeneral.html');
|
||||
|
||||
const urlTab = (this.$injector.get('$routeParams').tab || '').toLowerCase();
|
||||
if (urlTab) {
|
||||
this.editorTabs.forEach((tab, i) => {
|
||||
@ -123,7 +116,7 @@ export class PanelCtrl {
|
||||
route.updateParams();
|
||||
}
|
||||
|
||||
addCommonTab(title, directiveFn, index?, icon?) {
|
||||
addEditorTab(title, directiveFn, index?, icon?) {
|
||||
const editorTab = { title, directiveFn, icon };
|
||||
|
||||
if (_.isString(directiveFn)) {
|
||||
@ -139,18 +132,6 @@ export class PanelCtrl {
|
||||
}
|
||||
}
|
||||
|
||||
addEditorTab(title, directiveFn, index?, icon?) {
|
||||
const editorTab = { title, directiveFn, icon };
|
||||
|
||||
if (_.isString(directiveFn)) {
|
||||
editorTab.directiveFn = () => {
|
||||
return { templateUrl: directiveFn };
|
||||
};
|
||||
}
|
||||
|
||||
this.optionTabs.push(editorTab);
|
||||
}
|
||||
|
||||
getMenu() {
|
||||
const menu = [];
|
||||
menu.push({
|
||||
|
@ -32,11 +32,13 @@ const panelTemplate = `
|
||||
'panel-height-helper': !ctrl.panel.isEditing}">
|
||||
<div class="tabbed-view tabbed-view--new">
|
||||
<div class="tabbed-view-header">
|
||||
<h3 class="tabbed-view-panel-title">
|
||||
{{ctrl.pluginName}}
|
||||
</h3>
|
||||
|
||||
<ul class="gf-tabs">
|
||||
<li class="gf-tabs-item" ng-repeat="tab in ::ctrl.editorTabs">
|
||||
<a class="gf-tabs-link" ng-click="ctrl.changeTab($index)" ng-class="{active: ctrl.editorTabIndex === $index}">
|
||||
<i class="{{::tab.icon}}" ng-show="tab.icon"></i>
|
||||
{{::tab.title}}
|
||||
</a>
|
||||
</li>
|
||||
|
@ -139,7 +139,7 @@ class GraphCtrl extends MetricsPanelCtrl {
|
||||
this.addEditorTab('Legend', 'public/app/plugins/panel/graph/tab_legend.html', 3);
|
||||
|
||||
if (config.alertingEnabled) {
|
||||
this.addCommonTab('Alert', alertTab, 5);
|
||||
this.addEditorTab('Alert', alertTab, 5);
|
||||
}
|
||||
|
||||
this.subTabIndex = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user