Skip to content

Commit

Permalink
[issue #10] grafana 5.x.x bearer access token checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeiSporyshev committed Sep 30, 2019
1 parent ca5b728 commit f6793c5
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 12 deletions.
5 changes: 4 additions & 1 deletion dist/components/cluster-config/cluster-config.d.ts
Expand Up @@ -3,15 +3,18 @@ export declare class ClusterConfig {
private alertSrv;
private $q;
private $location;
private $window;
cluster: any;
prometheusList: Array<any>;
busy: boolean;
$scope: any;
pageReady: boolean;
version: number;
static templateUrl: string;
constructor($scope: any, $injector: any, backendSrv: any, alertSrv: any, $q: any, $location: any);
constructor($scope: any, $injector: any, backendSrv: any, alertSrv: any, $q: any, $location: any, $window: any);
getCluster(): void;
getPrometheusList(): any;
setGrafanaVersion(window: any): void;
saveCluster(): any;
check(): any;
saveDatasource(): any;
Expand Down
9 changes: 9 additions & 0 deletions dist/components/cluster-config/cluster-config.html
Expand Up @@ -23,12 +23,21 @@ <h3 class="page-heading">Bearer token access</h3>

<div class="gf-form-inline">
<gf-form-checkbox
ng-if="ctrl.version >= 6"
class="gf-form"
label="Access via token"
checked="ctrl.cluster.jsonData.access_via_token"
label-class="width-10"
switch-class="max-width-6">
</gf-form-checkbox>
<gf-form-switch
ng-if="ctrl.version < 6"
class="gf-form"
label="Access via token"
checked="ctrl.cluster.jsonData.access_via_token"
label-class="width-10"
switch-class="max-width-6">
</gf-form-switch>
</div>
<div class="gf-form-inline" ng-if="ctrl.cluster.jsonData.access_via_token">
<div class="gf-form">
Expand Down
8 changes: 7 additions & 1 deletion dist/components/cluster-config/cluster-config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/components/cluster-config/cluster-config.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions dist/components/cluster-config/cluster-config.ts
Expand Up @@ -6,15 +6,16 @@ export class ClusterConfig{
busy: boolean;
$scope: any;
pageReady: boolean;
version: number;

static templateUrl = 'components/cluster-config/cluster-config.html';

constructor($scope, $injector, private backendSrv, private alertSrv, private $q, private $location){
constructor($scope, $injector, private backendSrv, private alertSrv, private $q, private $location, private $window){
this.pageReady = false;

this.$scope = $scope;
this.busy = false;
this.getCluster();
this.setGrafanaVersion($window);

}

Expand Down Expand Up @@ -66,6 +67,11 @@ export class ClusterConfig{
})
}

setGrafanaVersion(window){
let _v = window.grafanaBootData.settings.buildInfo.version.split('.')[0];
this.version = _v;
}

saveCluster(){
if(this.busy) return;
this.busy = true;
Expand Down
5 changes: 4 additions & 1 deletion dist/datasource/config.d.ts
@@ -1,10 +1,13 @@
export declare class DOPK8SConfig {
private backendSrv;
private $window;
static templateUrl: string;
current: any;
prometheusList: Array<any>;
pageReady: boolean;
constructor($scope: any, $injector: any, backendSrv: any);
version: number;
constructor($scope: any, $injector: any, backendSrv: any, $window: any);
setGrafanaVersion(window: any): void;
setUrl(): void;
getPrometheusList(): any;
}
9 changes: 8 additions & 1 deletion dist/datasource/config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f6793c5

Please sign in to comment.