Issue 4577 (#5379)

* Add default-url property for datasource-http-settings directive.
This will allow to set default url for datasource.

* Fixed spelling.

* Use typeahead for url suggestion.
This commit is contained in:
Alexander Zobnin 2016-06-17 14:18:00 +03:00 committed by Torkel Ödegaard
parent 305a6ae110
commit fdf46c6a10
3 changed files with 17 additions and 5 deletions

View File

@ -166,7 +166,19 @@ coreModule.controller('DataSourceEditCtrl', DataSourceEditCtrl);
coreModule.directive('datasourceHttpSettings', function() {
return {
scope: {current: "="},
templateUrl: 'public/app/features/plugins/partials/ds_http_settings.html'
scope: {
current: "=",
defaultUrl: "="
},
templateUrl: 'public/app/features/plugins/partials/ds_http_settings.html',
link: {
pre: function($scope, elem, attrs) {
$scope.suggestDefaultUrl = function() {
return [
$scope.defaultUrl
];
};
}
}
};
});

View File

@ -6,7 +6,7 @@
<div class="gf-form-inline">
<div class="gf-form max-width-30">
<span class="gf-form-label width-7">Url</span>
<input class="gf-form-input" type="text" ng-model='current.url' placeholder="for example: http://localhost:8081" ng-pattern="/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/" required></input>
<input class="gf-form-input" type="text" ng-model='current.url' placeholder="for example: http://localhost:8081" bs-typeahead="suggestDefaultUrl" ng-pattern="/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/" required></input>
<info-popover mode="right-absolute">
<p>Specify a complete HTTP url (for example http://your_server:8080)</p>
<span ng-show="current.access === 'direct'">
@ -57,7 +57,7 @@
<div class="gf-form" ng-if="current.basicAuth">
<span class="gf-form-label width-7">
Passord
Password
</span>
<input class="gf-form-input max-width-21" type="password" ng-model='current.basicAuthPassword' placeholder="password" required></input>
</div>

View File

@ -1,3 +1,3 @@
<datasource-http-settings current="ctrl.current">
<datasource-http-settings current="ctrl.current" default-url="'http://localhost:8081'">
</datasource-http-settings>