mirror of
https://github.com/grafana/grafana.git
synced 2025-01-24 23:37:01 -06:00
Stackdriver: Improved feedback for when a JWT is already uploaded in the ds config page
This commit is contained in:
parent
b1db6a7d1e
commit
533891c03e
@ -15,6 +15,8 @@ export class StackdriverConfigCtrl {
|
||||
this.datasourceSrv = datasourceSrv;
|
||||
this.current.jsonData = this.current.jsonData || {};
|
||||
this.current.secureJsonData = this.current.secureJsonData || {};
|
||||
this.current.secureJsonFields = this.current.secureJsonFields || {};
|
||||
console.log(this.current.secureJsonFields.privateKey);
|
||||
this.defaultProject = this.current.jsonData.defaultProject;
|
||||
this.projects = [];
|
||||
}
|
||||
@ -74,6 +76,10 @@ export class StackdriverConfigCtrl {
|
||||
this.jsonText = '';
|
||||
this.loadingProjects = false;
|
||||
this.projectsError = '';
|
||||
|
||||
this.current.jsonData = {};
|
||||
this.current.secureJsonData = {};
|
||||
this.current.secureJsonFields = {};
|
||||
}
|
||||
|
||||
async displayProjects() {
|
||||
|
@ -1,44 +1,59 @@
|
||||
<h3>Stackdriver Authentication</h3>
|
||||
<div class="gf-form-group" ng-if="!ctrl.inputDataValid">
|
||||
<div class="gf-form">
|
||||
<form>
|
||||
<dash-upload on-upload="ctrl.onUpload(dash)"></dash-upload>
|
||||
</form>
|
||||
<div ng-if="!ctrl.current.jsonData.clientEmail && !ctrl.inputDataValid">
|
||||
<div class="gf-form-group" ng-if="!ctrl.inputDataValid">
|
||||
<div class="gf-form">
|
||||
<form>
|
||||
<dash-upload on-upload="ctrl.onUpload(dash)"></dash-upload>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gf-form-group">
|
||||
<h5 class="section-heading" ng-if="!ctrl.inputDataValid">Or paste JSON</h5>
|
||||
<div class="gf-form" ng-if="!ctrl.inputDataValid">
|
||||
<textarea rows="10" data-share-panel-url="" class="gf-form-input" ng-model="ctrl.jsonText" ng-paste="ctrl.onPasteJwt($event)"></textarea>
|
||||
</div>
|
||||
<div ng-repeat="valError in ctrl.validationErrors" class="text-error p-l-1">
|
||||
<i class="fa fa-warning"></i>
|
||||
{{valError}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gf-form-group">
|
||||
<h5 class="section-heading" ng-if="!ctrl.inputDataValid">Or paste JSON</h5>
|
||||
<div class="gf-form" ng-if="!ctrl.inputDataValid">
|
||||
<textarea rows="10" data-share-panel-url="" class="gf-form-input" ng-model="ctrl.jsonText" ng-paste="ctrl.onPasteJwt($event)"></textarea>
|
||||
</div>
|
||||
<div ng-repeat="valError in ctrl.validationErrors" class="text-error p-l-1">
|
||||
<i class="fa fa-warning"></i>
|
||||
{{valError}}
|
||||
</div>
|
||||
<div ng-if="ctrl.inputDataValid">
|
||||
<div class="text-success p-l-1">
|
||||
<i class="fa fa-info"></i>
|
||||
Successfully validated input format
|
||||
|
||||
<div class="gf-form-group" ng-if="ctrl.inputDataValid || ctrl.current.jsonData.clientEmail">
|
||||
<div class="gf-form-inline">
|
||||
<div class="gf-form">
|
||||
<span class="gf-form-label width-9">Token URI</span>
|
||||
<input class="gf-form-input width-30" disabled type="text" ng-model='ctrl.current.jsonData.tokenUri' />
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
<div class="gf-form-inline">
|
||||
<div class="gf-form">
|
||||
<span class="gf-form-label width-9">Client Email</span>
|
||||
<input class="gf-form-input width-30" disabled type="text" ng-model="ctrl.current.jsonData.clientEmail" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="gf-form" ng-if="ctrl.current.secureJsonFields.privateKey">
|
||||
<span class="gf-form-label width-9">Client Secret</span>
|
||||
<input type="text" class="gf-form-input max-width-12" disabled="disabled" value="configured">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="gf-form">
|
||||
<a class="btn btn-secondary gf-form-btn" href="#" ng-click="ctrl.resetValidationMessages()">Reset form</a>
|
||||
</div>
|
||||
<br />
|
||||
<div class="gf-form-group" ng-if="ctrl.inputDataValid">
|
||||
<div class="gf-form" ng-if="ctrl.inputDataValid">
|
||||
<span class="gf-form-label width-10">Default Project</span>
|
||||
<div class="gf-form-select-wrapper max-width-23">
|
||||
<select class="gf-form-input" ng-model="ctrl.current.jsonData.defaultProject" ng-options="p.id as p.name for p in ctrl.projects"
|
||||
ng-change="ctrl.userChangedDefaultProject()"></select>
|
||||
</div>
|
||||
<div ng-if="ctrl.loadingProjects">
|
||||
<i class="fa fa-spinner fa-spin"></i>
|
||||
<em>Fetching projects...…</em>
|
||||
</div>
|
||||
<div class="gf-form">
|
||||
<span class="gf-form-label width-10">Default Project</span>
|
||||
<div class="gf-form-select-wrapper max-width-23">
|
||||
<select class="gf-form-input" ng-model="ctrl.current.jsonData.defaultProject" ng-options="p.id as p.name for p in ctrl.projects"
|
||||
ng-change="ctrl.userChangedDefaultProject()"></select>
|
||||
</div>
|
||||
<div ng-if="ctrl.projectsError" class="text-error p-l-1">
|
||||
<i class="fa fa-warning"></i>
|
||||
{{ctrl.projectsError}}
|
||||
<div ng-if="ctrl.loadingProjects">
|
||||
<i class="fa fa-spinner fa-spin"></i>
|
||||
<em>Fetching projects...…</em>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="ctrl.projectsError" class="text-error p-l-1">
|
||||
<i class="fa fa-warning"></i>
|
||||
{{ctrl.projectsError}}
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user