Forráskód Böngészése

Enable "With Credentials" for InfluxDB datasource (#6018)

Jouni Kuusisto 9 éve
szülő
commit
e53b815956

+ 5 - 0
public/app/plugins/datasource/influxdb/datasource.ts

@@ -16,6 +16,7 @@ export default class InfluxDatasource {
   name: string;
   name: string;
   database: any;
   database: any;
   basicAuth: any;
   basicAuth: any;
+  withCredentials: any;
   interval: any;
   interval: any;
   supportAnnotations: boolean;
   supportAnnotations: boolean;
   supportMetrics: boolean;
   supportMetrics: boolean;
@@ -33,6 +34,7 @@ export default class InfluxDatasource {
     this.name = instanceSettings.name;
     this.name = instanceSettings.name;
     this.database = instanceSettings.database;
     this.database = instanceSettings.database;
     this.basicAuth = instanceSettings.basicAuth;
     this.basicAuth = instanceSettings.basicAuth;
+    this.withCredentials = instanceSettings.withCredentials;
     this.interval = (instanceSettings.jsonData || {}).timeInterval;
     this.interval = (instanceSettings.jsonData || {}).timeInterval;
     this.supportAnnotations = true;
     this.supportAnnotations = true;
     this.supportMetrics = true;
     this.supportMetrics = true;
@@ -187,6 +189,9 @@ export default class InfluxDatasource {
     };
     };
 
 
     options.headers = options.headers || {};
     options.headers = options.headers || {};
+    if (this.basicAuth || this.withCredentials) {
+      options.withCredentials = true;
+    }
     if (self.basicAuth) {
     if (self.basicAuth) {
       options.headers.Authorization = self.basicAuth;
       options.headers.Authorization = self.basicAuth;
     }
     }