Commit 9f9fca1e by Torkel Ödegaard

feat(datasource): added suggest urls for each data source, #4577

parent fdf46c6a
...@@ -34,6 +34,7 @@ func Register(r *macaron.Macaron) { ...@@ -34,6 +34,7 @@ func Register(r *macaron.Macaron) {
r.Get("/org/", reqSignedIn, Index) r.Get("/org/", reqSignedIn, Index)
r.Get("/org/new", reqSignedIn, Index) r.Get("/org/new", reqSignedIn, Index)
r.Get("/datasources/", reqSignedIn, Index) r.Get("/datasources/", reqSignedIn, Index)
r.Get("/datasources/new", reqSignedIn, Index)
r.Get("/datasources/edit/*", reqSignedIn, Index) r.Get("/datasources/edit/*", reqSignedIn, Index)
r.Get("/org/users/", reqSignedIn, Index) r.Get("/org/users/", reqSignedIn, Index)
r.Get("/org/apikeys/", reqSignedIn, Index) r.Get("/org/apikeys/", reqSignedIn, Index)
......
...@@ -168,15 +168,13 @@ coreModule.directive('datasourceHttpSettings', function() { ...@@ -168,15 +168,13 @@ coreModule.directive('datasourceHttpSettings', function() {
return { return {
scope: { scope: {
current: "=", current: "=",
defaultUrl: "=" suggestUrl: "@",
}, },
templateUrl: 'public/app/features/plugins/partials/ds_http_settings.html', templateUrl: 'public/app/features/plugins/partials/ds_http_settings.html',
link: { link: {
pre: function($scope, elem, attrs) { pre: function($scope, elem, attrs) {
$scope.suggestDefaultUrl = function() { $scope.getSuggestUrls = function() {
return [ return [$scope.suggestUrl];
$scope.defaultUrl
];
}; };
} }
} }
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
<div class="gf-form-inline"> <div class="gf-form-inline">
<div class="gf-form max-width-30"> <div class="gf-form max-width-30">
<span class="gf-form-label width-7">Url</span> <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" bs-typeahead="suggestDefaultUrl" 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="{{suggestUrl}}"
bs-typeahead="getSuggestUrls" min-length="0"
ng-pattern="/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/" required></input>
<info-popover mode="right-absolute"> <info-popover mode="right-absolute">
<p>Specify a complete HTTP url (for example http://your_server:8080)</p> <p>Specify a complete HTTP url (for example http://your_server:8080)</p>
<span ng-show="current.access === 'direct'"> <span ng-show="current.access === 'direct'">
......
<datasource-http-settings current="ctrl.current"> <datasource-http-settings current="ctrl.current" suggest-url="http://localhost:9200">
</datasource-http-settings> </datasource-http-settings>
<h3 class="page-heading">Elasticsearch details</h3> <h3 class="page-heading">Elasticsearch details</h3>
......
<datasource-http-settings current="ctrl.current" default-url="'http://localhost:8081'"> <datasource-http-settings
current="ctrl.current"
suggest-url="http://localhost:8080">
</datasource-http-settings> </datasource-http-settings>
<datasource-http-settings current="ctrl.current"> <datasource-http-settings current="ctrl.current" suggest-url="http://localhost:8086">
</datasource-http-settings> </datasource-http-settings>
<h3 class="page-heading">InfluxDB Details</h3> <h3 class="page-heading">InfluxDB Details</h3>
......
<datasource-http-settings current="ctrl.current"></datasource-http-settings> <datasource-http-settings current="ctrl.current" suggest-url="http://localhost:4242"></datasource-http-settings>
<h5>Opentsdb settings</h5> <h5>OpenTSDB settings</h5>
<div class="gf-form"> <div class="gf-form">
<span class="gf-form-label width-7"> <span class="gf-form-label width-7">
Version Version
......
<datasource-http-settings current="ctrl.current"> <datasource-http-settings current="ctrl.current" suggest-url="http://localhost:9090">
</datasource-http-settings> </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