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

This commit is contained in:
Torkel Ödegaard 2016-06-17 13:35:29 +02:00
parent fdf46c6a10
commit 9f9fca1e76
8 changed files with 16 additions and 12 deletions

View File

@ -34,6 +34,7 @@ func Register(r *macaron.Macaron) {
r.Get("/org/", reqSignedIn, Index)
r.Get("/org/new", reqSignedIn, Index)
r.Get("/datasources/", reqSignedIn, Index)
r.Get("/datasources/new", reqSignedIn, Index)
r.Get("/datasources/edit/*", reqSignedIn, Index)
r.Get("/org/users/", reqSignedIn, Index)
r.Get("/org/apikeys/", reqSignedIn, Index)

View File

@ -168,15 +168,13 @@ coreModule.directive('datasourceHttpSettings', function() {
return {
scope: {
current: "=",
defaultUrl: "="
suggestUrl: "@",
},
templateUrl: 'public/app/features/plugins/partials/ds_http_settings.html',
link: {
pre: function($scope, elem, attrs) {
$scope.suggestDefaultUrl = function() {
return [
$scope.defaultUrl
];
$scope.getSuggestUrls = function() {
return [$scope.suggestUrl];
};
}
}

View File

@ -6,7 +6,10 @@
<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" 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">
<p>Specify a complete HTTP url (for example http://your_server:8080)</p>
<span ng-show="current.access === 'direct'">

View File

@ -1,4 +1,4 @@
<datasource-http-settings current="ctrl.current">
<datasource-http-settings current="ctrl.current" suggest-url="http://localhost:9200">
</datasource-http-settings>
<h3 class="page-heading">Elasticsearch details</h3>

View File

@ -1,3 +1,5 @@
<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>

View File

@ -1,4 +1,4 @@
<datasource-http-settings current="ctrl.current">
<datasource-http-settings current="ctrl.current" suggest-url="http://localhost:8086">
</datasource-http-settings>
<h3 class="page-heading">InfluxDB Details</h3>

View File

@ -1,6 +1,6 @@
<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">
<span class="gf-form-label width-7">
Version

View File

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