mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 04:59:15 -06:00
feat(templating): back to be able to continue work on ad hoc filters, #6048
This commit is contained in:
parent
7a6fb70026
commit
cb522d58cd
52
public/app/features/templating/adhoc_variable.ts
Normal file
52
public/app/features/templating/adhoc_variable.ts
Normal file
@ -0,0 +1,52 @@
|
||||
///<reference path="../../headers/common.d.ts" />
|
||||
|
||||
import _ from 'lodash';
|
||||
import kbn from 'app/core/utils/kbn';
|
||||
import {Variable, assignModelProperties, variableTypes} from './variable';
|
||||
import {VariableSrv} from './variable_srv';
|
||||
|
||||
export class AdhocVariable implements Variable {
|
||||
|
||||
defaults = {
|
||||
type: 'adhoc',
|
||||
name: '',
|
||||
label: '',
|
||||
hide: 0,
|
||||
datasource: null,
|
||||
options: [],
|
||||
current: {},
|
||||
tags: {},
|
||||
};
|
||||
|
||||
/** @ngInject **/
|
||||
constructor(private model, private timeSrv, private templateSrv, private variableSrv) {
|
||||
assignModelProperties(this, model, this.defaults);
|
||||
}
|
||||
|
||||
setValue(option) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
getModel() {
|
||||
assignModelProperties(this.model, this, this.defaults);
|
||||
return this.model;
|
||||
}
|
||||
|
||||
updateOptions() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
dependsOn(variable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setValueFromUrl(urlValue) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
variableTypes['adhoc'] = {
|
||||
name: 'Ad hoc',
|
||||
ctor: AdhocVariable,
|
||||
description: 'Ad hoc filters',
|
||||
};
|
@ -7,6 +7,7 @@ import {QueryVariable} from './query_variable';
|
||||
import {DatasourceVariable} from './datasource_variable';
|
||||
import {CustomVariable} from './custom_variable';
|
||||
import {ConstantVariable} from './constant_variable';
|
||||
import {AdhocVariable} from './adhoc_variable';
|
||||
|
||||
export {
|
||||
VariableSrv,
|
||||
@ -15,4 +16,5 @@ export {
|
||||
DatasourceVariable,
|
||||
CustomVariable,
|
||||
ConstantVariable,
|
||||
AdhocVariable,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user