Browse Source

Make config work

master
rozetko 5 years ago
parent
commit
2310f512a2
  1. 3
      src/datasource/config_ctrl.ts
  2. 12
      src/datasource/partials/config.html

3
src/datasource/config_ctrl.ts

@ -9,11 +9,12 @@ export class HasticConfigCtrl {
{ key: 'direct', value: 'Browser' } { key: 'direct', value: 'Browser' }
]; ];
private showAccessHelp: boolean = false; public showAccessHelp = false;
constructor(private $scope: any) { constructor(private $scope: any) {
if(this.$scope.current === undefined) { if(this.$scope.current === undefined) {
this.$scope.current = { this.$scope.current = {
url: '',
access: 'proxy' access: 'proxy'
}; };
} }

12
src/datasource/partials/config.html

@ -7,7 +7,7 @@
<input <input
class="gf-form-input" type="text" class="gf-form-input" type="text"
placeholder="http://localhost:8000" placeholder="http://localhost:8000"
ng-model='current.url' ng-model='ctrl.current.url'
min-length="0" min-length="0"
ng-pattern="/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/" ng-pattern="/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/"
required required
@ -15,11 +15,11 @@
/> />
<info-popover mode="right-absolute"> <info-popover mode="right-absolute">
<p>Specify a complete Hastic Server HTTP URL (for example http://your_hastic_server:8000)</p> <p>Specify a complete Hastic Server HTTP URL (for example http://your_hastic_server:8000)</p>
<span ng-show="current.access === 'direct'"> <span ng-show="ctrl.current.access === 'direct'">
Your access method is <em>Browser</em>, this means the URL Your access method is <em>Browser</em>, this means the URL
needs to be accessible from the browser. needs to be accessible from the browser.
</span> </span>
<span ng-show="current.access === 'proxy'"> <span ng-show="ctrl.current.access === 'proxy'">
Your access method is <em>Server</em>, this means the URL Your access method is <em>Server</em>, this means the URL
needs to be accessible from the grafana backend/server. needs to be accessible from the grafana backend/server.
</span> </span>
@ -33,7 +33,7 @@
<div class="gf-form-select-wrapper max-width-24"> <div class="gf-form-select-wrapper max-width-24">
<select <select
class="gf-form-input" class="gf-form-input"
ng-model="current.access" ng-model="ctrl.current.access"
ng-options="f.key as f.value for f in ctrl.ACCESS_OPTIONS" ng-options="f.key as f.value for f in ctrl.ACCESS_OPTIONS"
/> />
</div> </div>
@ -67,11 +67,11 @@
</p> </p>
</div> </div>
<div class="gf-form-inline" ng-if="current.access=='proxy'"> <div class="gf-form-inline" ng-if="ctrl.current.access=='proxy'">
<div class="gf-form"> <div class="gf-form">
<span class="gf-form-label width-10">Whitelisted Cookies</span> <span class="gf-form-label width-10">Whitelisted Cookies</span>
<bootstrap-tagsinput <bootstrap-tagsinput
ng-model="current.jsonData.keepCookies" ng-model="ctrl.current.jsonData.keepCookies"
width-class="width-20" tagclass="label label-tag" width-class="width-20" tagclass="label label-tag"
placeholder="Add Name" placeholder="Add Name"
/> />

Loading…
Cancel
Save