mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Set default AWS region from dropdown now
This commit is contained in:
parent
fdeeb73587
commit
4de9ac133a
@ -50,16 +50,34 @@ function (angular, config, _) {
|
||||
});
|
||||
};
|
||||
|
||||
$scope.loadAWSRegions = function() {
|
||||
var options = {
|
||||
method: 'POST',
|
||||
url: '/api/datasources/proxy/' + $scope.current.id,
|
||||
data: { action: '__GetRegions' }
|
||||
};
|
||||
|
||||
return backendSrv.datasourceRequest(options).then(function(result) {
|
||||
$scope.current.jsonData.allRegions = result.data.map(function(region) {
|
||||
return region.text;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getDatasourceById = function(id) {
|
||||
backendSrv.get('/api/datasources/' + id).then(function(ds) {
|
||||
$scope.isNew = false;
|
||||
$scope.current = ds;
|
||||
console.log($scope.current);
|
||||
$scope.typeChanged();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.typeChanged = function() {
|
||||
$scope.datasourceMeta = $scope.types[$scope.current.type];
|
||||
if ($scope.current.type === 'cloudwatch') {
|
||||
$scope.loadAWSRegions();
|
||||
}
|
||||
};
|
||||
|
||||
$scope.updateFrontendSettings = function() {
|
||||
|
@ -20,7 +20,7 @@
|
||||
Default Region<tip>Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.</tip>
|
||||
</li>
|
||||
<li>
|
||||
<input type="text" class="tight-form-input input-large last" ng-model='current.jsonData.defaultRegion' placeholder="region name" required></input>
|
||||
<select class="tight-form-input input-large last" ng-model="current.jsonData.defaultRegion" ng-options="region for region in current.jsonData.allRegions"></select>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
|
Loading…
Reference in New Issue
Block a user