mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
38 lines
990 B
TypeScript
38 lines
990 B
TypeScript
///<reference path="../../../headers/common.d.ts" />
|
|
|
|
export class GraphiteConfigCtrl {
|
|
static templateUrl = 'public/app/plugins/datasource/graphite/partials/config.html';
|
|
datasourceSrv: any;
|
|
current: any;
|
|
|
|
/** @ngInject */
|
|
constructor($scope, datasourceSrv) {
|
|
this.datasourceSrv = datasourceSrv;
|
|
this.current.jsonData = this.current.jsonData || {};
|
|
this.current.jsonData.graphiteVersion = this.current.jsonData.graphiteVersion || '0.9';
|
|
|
|
this.autoDetectGraphiteVersion();
|
|
}
|
|
|
|
autoDetectGraphiteVersion() {
|
|
if (!this.current.id) {
|
|
return;
|
|
}
|
|
|
|
this.datasourceSrv.loadDatasource(this.current.name)
|
|
.then((ds) => {
|
|
return ds.getVersion();
|
|
}).then((version) => {
|
|
this.graphiteVersions.push({name: version, value: version});
|
|
this.current.jsonData.graphiteVersion = version;
|
|
});
|
|
}
|
|
|
|
graphiteVersions = [
|
|
{name: '0.9.x', value: '0.9'},
|
|
{name: '1.0.x', value: '1.0'},
|
|
{name: '1.1.x', value: '1.1'},
|
|
];
|
|
}
|
|
|