Commit fdf46c6a by Alexander Zobnin Committed by Torkel Ödegaard

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.
parent 305a6ae1
......@@ -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
];
};
}
}
};
});
......@@ -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>
......
<datasource-http-settings current="ctrl.current">
<datasource-http-settings current="ctrl.current" default-url="'http://localhost:8081'">
</datasource-http-settings>
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