grafana/public/app/features/datasources/list_ctrl.js

37 lines
814 B
JavaScript
Raw Normal View History

define([
'angular',
'lodash',
],
function (angular) {
'use strict';
var module = angular.module('grafana.controllers');
module.controller('DataSourcesCtrl', function($scope, $http, backendSrv, datasourceSrv) {
$scope.init = function() {
2014-12-17 10:31:57 -06:00
$scope.datasources = [];
$scope.getDatasources();
};
$scope.getDatasources = function() {
2015-01-14 07:24:54 -06:00
backendSrv.get('/api/datasources').then(function(results) {
2014-12-17 10:31:57 -06:00
$scope.datasources = results;
});
};
$scope.remove = function(ds) {
2015-01-11 05:12:12 -06:00
backendSrv.delete('/api/datasources/' + ds.id).then(function() {
2014-12-17 10:31:57 -06:00
$scope.getDatasources();
backendSrv.get('/api/frontend/settings').then(function(settings) {
datasourceSrv.init(settings.datasources);
});
2014-12-17 10:31:57 -06:00
});
};
$scope.init();
});
});