mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
query: more work on metrics tab changes
This commit is contained in:
@@ -21,7 +21,7 @@ export class QueryRowCtrl {
|
||||
this.panel = this.panelCtrl.panel;
|
||||
|
||||
if (!this.target.refId) {
|
||||
this.target.refId = this.getNextQueryLetter();
|
||||
this.target.refId = this.panelCtrl.dashboard.getNextQueryLetter(this.panel);
|
||||
}
|
||||
|
||||
this.toggleCollapse(true);
|
||||
@@ -40,16 +40,6 @@ export class QueryRowCtrl {
|
||||
this.panelCtrl.refresh();
|
||||
}
|
||||
|
||||
getNextQueryLetter() {
|
||||
var letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
|
||||
return _.find(letters, refId => {
|
||||
return _.every(this.panel.targets, function(other) {
|
||||
return other.refId !== refId;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
toggleCollapse(init) {
|
||||
if (!this.canCollapse) {
|
||||
return;
|
||||
@@ -87,19 +77,16 @@ export class QueryRowCtrl {
|
||||
delete this.panelCtrl.__collapsedQueryCache[this.target.refId];
|
||||
}
|
||||
|
||||
this.panel.targets = _.without(this.panel.targets, this.target);
|
||||
this.panelCtrl.refresh();
|
||||
this.panelCtrl.removeQuery(this.target);
|
||||
}
|
||||
|
||||
duplicateQuery() {
|
||||
var clone = angular.copy(this.target);
|
||||
clone.refId = this.getNextQueryLetter();
|
||||
this.panel.targets.push(clone);
|
||||
this.panelCtrl.addQuery(clone);
|
||||
}
|
||||
|
||||
moveQuery(direction) {
|
||||
var index = _.indexOf(this.panel.targets, this.target);
|
||||
_.move(this.panel.targets, index, index + direction);
|
||||
this.panelCtrl.moveQuery(this.target, direction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user