Files
grafana/public/app/features/dashboard/repeat_option/repeat_option.ts
Torkel Ödegaard 0c86241c5b Webpack (#9391)
* webpack poc, this is not going to work for plugins, dam

* tech: webpack and systemjs for plugins starting to work

* tech: webpack and systemjs combo starting to work

* tech: webpack + karma tests progress

* tech: webpack + karma progress

* tech: working on tests

* tech: webpack

* tech: webpack + karma, all tests pass

* tech: webpack + karma, all tests pass

* tech: webpack all tests pass

* webpack: getting closer

* tech: webpack progress

* webpack: further build refinements

* webpack: ng annotate fixes

* webpack: optimized build fix

* tech: minor fix for elasticsearch

* tech: webpack + ace editor

* tech: restored lodash move mixin compatability

* tech: added enzyme react test and upgraded to react v16

* tech: package version fix

* tech: added testdata to built in bundle

* webpack: sass progress

* tech: prod & dev build is working for the sass

* tech: clean up unused grunt stuff and moved to scripts folder

* tech: added vendor and manifest chunks, updated readme and docs

* tech: webpack finishing touches
2017-10-01 20:02:25 +02:00

37 lines
965 B
TypeScript

///<reference path="../../../headers/common.d.ts" />
import {coreModule} from 'app/core/core';
var template = `
<div class="gf-form-select-wrapper max-width-13">
<select class="gf-form-input" ng-model="model.repeat" ng-options="f.value as f.text for f in variables">
<option value=""></option>
</div>
`;
/** @ngInject **/
function dashRepeatOptionDirective(variableSrv) {
return {
restrict: 'E',
template: template,
scope: {
model: "=",
},
link: function(scope, element) {
element.css({display: 'block', width: '100%'});
scope.variables = variableSrv.variables.map(item => {
return {text: item.name, value: item.name};
});
if (scope.variables.length === 0) {
scope.variables.unshift({text: 'No template variables found', value: null});
}
scope.variables.unshift({text: 'Disabled', value: null});
}
};
}
coreModule.directive('dashRepeatOption', dashRepeatOptionDirective);