Commit dc3b6147 by Torkel Ödegaard

fix(submenu): fixed issue with submenu and annotation display, and annotation issue in table panel

parent d0b75cdb
...@@ -29,7 +29,7 @@ export class AnnotationsSrv { ...@@ -29,7 +29,7 @@ export class AnnotationsSrv {
this.getGlobalAnnotations(options), this.getGlobalAnnotations(options),
this.getPanelAnnotations(options) this.getPanelAnnotations(options)
]).then(allResults => { ]).then(allResults => {
return _.flatten(allResults); return _.flattenDeep(allResults);
}).catch(err => { }).catch(err => {
this.$rootScope.appEvent('alert-error', ['Annotations failed', (err.message || err)]); this.$rootScope.appEvent('alert-error', ['Annotations failed', (err.message || err)]);
}); });
......
<div class="submenu-controls gf-form-query"> <div class="submenu-controls gf-form-query">
<ul ng-if="ctrl.dashboard.templating.list.length > 0"> <div ng-repeat="variable in ctrl.variables" ng-hide="variable.hide === 2" class="submenu-item gf-form-inline">
<li ng-repeat="variable in ctrl.variables" ng-hide="variable.hide === 2" class="submenu-item gf-form-inline"> <div class="gf-form">
<div class="gf-form"> <label class="gf-form-label template-variable" ng-hide="variable.hide === 1">
<label class="gf-form-label template-variable" ng-hide="variable.hide === 1"> {{variable.label || variable.name}}:
{{variable.label || variable.name}}: </label>
</label> <value-select-dropdown ng-if="variable.type !== 'adhoc'" variable="variable" on-updated="ctrl.variableUpdated(variable)" get-values-for-tag="ctrl.getValuesForTag(variable, tagKey)"></value-select-dropdown>
<value-select-dropdown ng-if="variable.type !== 'adhoc'" variable="variable" on-updated="ctrl.variableUpdated(variable)" get-values-for-tag="ctrl.getValuesForTag(variable, tagKey)"></value-select-dropdown> </div>
</div> <ad-hoc-filters ng-if="variable.type === 'adhoc'" variable="variable"></ad-hoc-filters>
<ad-hoc-filters ng-if="variable.type === 'adhoc'" variable="variable"></ad-hoc-filters> </div>
</li>
</ul>
<ul ng-if="ctrl.dashboard.annotations.list.length > 0"> <div ng-if="ctrl.dashboard.annotations.list.length > 0">
<li ng-repeat="annotation in ctrl.dashboard.annotations.list" class="submenu-item annotation-segment" ng-class="{'annotation-disabled': !annotation.enable}"> <div ng-repeat="annotation in ctrl.dashboard.annotations.list" class="submenu-item" ng-class="{'annotation-disabled': !annotation.enable}">
<a ng-click="ctrl.disableAnnotation(annotation)"> <gf-form-switch class="gf-form" label="{{annotation.name}}" checked="annotation.enable" on-change="ctrl.annotationStateChanged()"></gf-form-switch>
<i class="fa fa-bolt" style="color:{{annotation.iconColor}}"></i> </div>
{{annotation.name}} </ul>
<input class="cr1" id="hideYAxis" type="checkbox" ng-model="annotation.enable" ng-checked="annotation.enable">
<label for="hideYAxis" class="cr1"></label>
</a>
</li>
</ul>
<ul class="pull-right" ng-if="ctrl.dashboard.links.length > 0"> <ul class="pull-right" ng-if="ctrl.dashboard.links.length > 0">
<dash-links-container links="ctrl.dashboard.links"></dash-links-container> <dash-links-container links="ctrl.dashboard.links"></dash-links-container>
</ul> </ul>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
...@@ -17,8 +17,7 @@ export class SubmenuCtrl { ...@@ -17,8 +17,7 @@ export class SubmenuCtrl {
this.variables = this.variableSrv.variables; this.variables = this.variableSrv.variables;
} }
disableAnnotation(annotation) { annotationStateChanged() {
annotation.enable = !annotation.enable;
this.$rootScope.$broadcast('refresh'); this.$rootScope.$broadcast('refresh');
} }
......
...@@ -78,7 +78,8 @@ class TablePanelCtrl extends MetricsPanelCtrl { ...@@ -78,7 +78,8 @@ class TablePanelCtrl extends MetricsPanelCtrl {
if (this.panel.transform === 'annotations') { if (this.panel.transform === 'annotations') {
this.setTimeQueryStart(); this.setTimeQueryStart();
return this.annotationsSrv.getAnnotations(this.dashboard).then(annotations => { return this.annotationsSrv.getAnnotations({dashboard: this.dashboard, panel: this.panel, range: this.range})
.then(annotations => {
return {data: annotations}; return {data: annotations};
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment