mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 23:55:47 -06:00
Fixed value dropdown not updating when it's current value updates, fixes #15566
This commit is contained in:
parent
8f62082482
commit
f768808b6e
@ -240,7 +240,7 @@ export class ValueSelectDropdownCtrl {
|
|||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
export function valueSelectDropdown($compile, $window, $timeout, $rootScope) {
|
export function valueSelectDropdown($compile, $window, $timeout, $rootScope) {
|
||||||
return {
|
return {
|
||||||
scope: { variable: '=', onUpdated: '&' },
|
scope: { dashboard: '=', variable: '=', onUpdated: '&' },
|
||||||
templateUrl: 'public/app/partials/valueSelectDropdown.html',
|
templateUrl: 'public/app/partials/valueSelectDropdown.html',
|
||||||
controller: 'ValueSelectDropdownCtrl',
|
controller: 'ValueSelectDropdownCtrl',
|
||||||
controllerAs: 'vm',
|
controllerAs: 'vm',
|
||||||
@ -288,13 +288,13 @@ export function valueSelectDropdown($compile, $window, $timeout, $rootScope) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const cleanUp = $rootScope.$on('template-variable-value-updated', () => {
|
scope.vm.dashboard.on(
|
||||||
|
'template-variable-value-updated',
|
||||||
|
() => {
|
||||||
scope.vm.updateLinkText();
|
scope.vm.updateLinkText();
|
||||||
});
|
},
|
||||||
|
scope
|
||||||
scope.$on('$destroy', () => {
|
);
|
||||||
cleanUp();
|
|
||||||
});
|
|
||||||
|
|
||||||
scope.vm.init();
|
scope.vm.init();
|
||||||
},
|
},
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<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.type !== 'textbox'" variable="variable" on-updated="ctrl.variableUpdated(variable)"></value-select-dropdown>
|
<value-select-dropdown ng-if="variable.type !== 'adhoc' && variable.type !== 'textbox'" dashboard="ctrl.dashboard" variable="variable" on-updated="ctrl.variableUpdated(variable)"></value-select-dropdown>
|
||||||
<input type="text" ng-if="variable.type === 'textbox'" ng-model="variable.query" class="gf-form-input width-12" ng-blur="variable.current.value != variable.query && variable.updateOptions() && ctrl.variableUpdated(variable);" ng-keydown="$event.keyCode === 13 && variable.current.value != variable.query && variable.updateOptions() && ctrl.variableUpdated(variable);" ></input>
|
<input type="text" ng-if="variable.type === 'textbox'" ng-model="variable.query" class="gf-form-input width-12" ng-blur="variable.current.value != variable.query && variable.updateOptions() && ctrl.variableUpdated(variable);" ng-keydown="$event.keyCode === 13 && variable.current.value != variable.query && variable.updateOptions() && ctrl.variableUpdated(variable);" ></input>
|
||||||
</div>
|
</div>
|
||||||
<ad-hoc-filters ng-if="variable.type === 'adhoc'" variable="variable" dashboard="ctrl.dashboard"></ad-hoc-filters>
|
<ad-hoc-filters ng-if="variable.type === 'adhoc'" variable="variable" dashboard="ctrl.dashboard"></ad-hoc-filters>
|
||||||
|
Loading…
Reference in New Issue
Block a user