Browse Source

ds config page++

master
Coin de Gamma 6 years ago
parent
commit
bc05106f5b
  1. 1
      src/datasource/datasource.ts
  2. 24
      src/datasource/module.ts
  3. 25
      src/datasource/partials/config.html

1
src/datasource/datasource.ts

@ -2,6 +2,7 @@ export class HasticDatasource {
/** @ngInject */
constructor(public instanceSettings: any) {
}
async query(options: any) {

24
src/datasource/module.ts

@ -1,11 +1,35 @@
import { HasticDatasource } from './datasource';
import { HasticQueryCtrl } from './query_ctrl';
import { normalizeUrl } from '../utlis';
import configTemplate from './partials/config.html';
class HasticConfigCtrl {
public static template = configTemplate;
public accessOptions: any[];
public current: any;
constructor() {
console.log(this);
this.accessOptions = [
{ key: 'proxy', value: 'Server (Default)' },
{ key: 'direct', value: 'Browser'}
];
//this.current.access = 'proxy';
// if(this.appModel.jsonData === undefined) {
// this.appModel.jsonData = {};
// }
// this.appEditCtrl.setPreUpdateHook(this.preUpdate.bind(this));
// this.appEditCtrl.setPostUpdateHook(this.postUpdate.bind(this));
}
normalizeUrl() {
// this.appModel.jsonData.hasticServerUrl = normalizeUrl(this.appModel.jsonData.hasticServerUrl);
}
}
export {

25
src/datasource/partials/config.html

@ -3,13 +3,18 @@
<div class="gf-form-group">
<div class="gf-form-inline">
<div class="gf-form max-width-30">
<span class="gf-form-label width-10">URL</span>
<input class="gf-form-input" type="text"
ng-model='current.url' placeholder="http://localhost:8000"
bs-typeahead="getSuggestUrls" min-length="0"
ng-pattern="/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/" required></input>
<span class="gf-form-label width-10">Hastic Server URL</span>
<input
class="gf-form-input" type="text"
placeholder="http://localhost:8000"
ng-model='current.url'
bs-typeahead="getSuggestUrls"
min-length="0"
ng-pattern="/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/"
required
/>
<info-popover mode="right-absolute">
<p>Specify a complete HTTP URL (for example http://your_server:8080)</p>
<p>Specify a complete Hastic Server HTTP URL (for example http://your_hastic_server:8080)</p>
<span ng-show="current.access === 'direct'">
Your access method is <em>Browser</em>, this means the URL
needs to be accessible from the browser.
@ -22,11 +27,15 @@
</div>
</div>
<div class="gf-form-inline" ng-if="showAccessOption">
<div class="gf-form-inline">
<div class="gf-form max-width-30">
<span class="gf-form-label width-10">Access</span>
<div class="gf-form-select-wrapper max-width-24">
<select class="gf-form-input" ng-model="current.access" ng-options="f.key as f.value for f in [{key: 'proxy', value: 'Server (Default)'}, { key: 'direct', value: 'Browser'}]"></select>
<select
class="gf-form-input"
ng-model="current.access"
ng-options="f.key as f.value for f in ctrl.accessOptions"
/>
</div>
</div>
<div class="gf-form">

Loading…
Cancel
Save