Explorar o código

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

Torkel Ödegaard %!s(int64=9) %!d(string=hai) anos
pai
achega
9f9fca1e76

+ 1 - 0
pkg/api/api.go

@@ -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)

+ 3 - 5
public/app/features/plugins/ds_edit_ctrl.ts

@@ -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];
         };
       }
     }

+ 4 - 1
public/app/features/plugins/partials/ds_http_settings.html

@@ -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'">

+ 1 - 1
public/app/plugins/datasource/elasticsearch/partials/config.html

@@ -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>

+ 3 - 1
public/app/plugins/datasource/graphite/partials/config.html

@@ -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>
 

+ 1 - 1
public/app/plugins/datasource/influxdb/partials/config.html

@@ -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>

+ 2 - 2
public/app/plugins/datasource/opentsdb/partials/config.html

@@ -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

+ 1 - 1
public/app/plugins/datasource/prometheus/partials/config.html

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