Fix: Shows SubMenu when filtering directly from table (#21017)

* Fix: Shows SubMenu when filtering from table
Fixes #20270

* Tests: Updates snapshots

* Refactor: Changes after PR comments

* Refactor: Changes template
This commit is contained in:
Hugo Häggmark
2019-12-11 14:09:57 +01:00
committed by GitHub
parent 4698cef2a2
commit 8495af4c52
6 changed files with 206 additions and 24 deletions

View File

@@ -1,16 +1,22 @@
import angular, { ILocationService } from 'angular';
import _ from 'lodash';
import { VariableSrv } from 'app/features/templating/all';
import { CoreEvents } from '../../../../types';
export class SubMenuCtrl {
annotations: any;
variables: any;
dashboard: any;
submenuEnabled: boolean;
/** @ngInject */
constructor(private variableSrv: VariableSrv, private $location: ILocationService) {
this.annotations = this.dashboard.templating.list;
this.variables = this.variableSrv.variables;
this.submenuEnabled = false;
this.dashboard.events.on(CoreEvents.submenuVisibilityChanged, (enabled: boolean) => {
this.submenuEnabled = enabled;
});
}
annotationStateChanged() {

View File

@@ -1,4 +1,4 @@
<div class="submenu-controls">
<div class="submenu-controls" ng-hide="ctrl.submenuEnabled === false">
<div ng-repeat="variable in ctrl.variables" ng-hide="variable.hide === 2" class="submenu-item gf-form-inline">
<div class="gf-form">
<label