Commit 0e970307 by Torkel Ödegaard

More datasource admin, and backendSrv work

parent adb1502e
......@@ -25,14 +25,10 @@ function (angular) {
return;
}
backendSrv.request({
method: 'POST',
url: '/api/admin/datasource/add',
data: $scope.current,
desc: 'Add data source'
}).then(function(result) {
console.log('add datasource result', result);
});
backendSrv.post('/api/admin/datasources/add', $scope.current)
.then(function(result) {
console.log('add datasource result', result);
});
};
$scope.init();
......
......@@ -26,7 +26,9 @@ function (angular, _) {
return $http(httpOptions).then(function(results) {
if (options.method !== 'GET') {
alertSrv.set(options.desc + ' OK ', '', 'success', 3000);
if (results && results.data.message) {
alertSrv.set(results.data.message, '', 'success', 3000);
}
}
return results.data;
}, function(err) {
......@@ -42,7 +44,11 @@ function (angular, _) {
data.severity = "warning";
}
alertSrv.set(options.desc + ' failed', data.message, data.severity, 10000);
if (data.message) {
alertSrv.set("Error", data.message, data.severity, 10000);
}
throw data;
});
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment