|
@@ -21,7 +21,7 @@ export class QueryRowCtrl {
|
|
|
this.panel = this.panelCtrl.panel;
|
|
this.panel = this.panelCtrl.panel;
|
|
|
|
|
|
|
|
if (!this.target.refId) {
|
|
if (!this.target.refId) {
|
|
|
- this.target.refId = this.getNextQueryLetter();
|
|
|
|
|
|
|
+ this.target.refId = this.panelCtrl.dashboard.getNextQueryLetter(this.panel);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.toggleCollapse(true);
|
|
this.toggleCollapse(true);
|
|
@@ -40,16 +40,6 @@ export class QueryRowCtrl {
|
|
|
this.panelCtrl.refresh();
|
|
this.panelCtrl.refresh();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- getNextQueryLetter() {
|
|
|
|
|
- var letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
|
|
|
-
|
|
|
|
|
- return _.find(letters, refId => {
|
|
|
|
|
- return _.every(this.panel.targets, function(other) {
|
|
|
|
|
- return other.refId !== refId;
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
toggleCollapse(init) {
|
|
toggleCollapse(init) {
|
|
|
if (!this.canCollapse) {
|
|
if (!this.canCollapse) {
|
|
|
return;
|
|
return;
|
|
@@ -87,19 +77,16 @@ export class QueryRowCtrl {
|
|
|
delete this.panelCtrl.__collapsedQueryCache[this.target.refId];
|
|
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() {
|
|
duplicateQuery() {
|
|
|
var clone = angular.copy(this.target);
|
|
var clone = angular.copy(this.target);
|
|
|
- clone.refId = this.getNextQueryLetter();
|
|
|
|
|
- this.panel.targets.push(clone);
|
|
|
|
|
|
|
+ this.panelCtrl.addQuery(clone);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
moveQuery(direction) {
|
|
moveQuery(direction) {
|
|
|
- var index = _.indexOf(this.panel.targets, this.target);
|
|
|
|
|
- _.move(this.panel.targets, index, index + direction);
|
|
|
|
|
|
|
+ this.panelCtrl.moveQuery(this.target, direction);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|