Browse Source

Set default access method

master
rozetko 6 years ago
parent
commit
465c71ab11
  1. 32
      src/datasource/config_ctrl.ts
  2. 31
      src/datasource/module.ts

32
src/datasource/config_ctrl.ts

@ -0,0 +1,32 @@
import { normalizeUrl } from '../utlis';
import configTemplate from './partials/config.html';
export class HasticConfigCtrl {
public static template = configTemplate;
public ACCESS_OPTIONS = [
{ key: 'proxy', value: 'Server (Default)' },
{ key: 'direct', value: 'Browser' }
];
private showAccessHelp: boolean = false;
constructor(private $scope: any) {
if(this.$scope.current === undefined) {
this.$scope.current = {
access: 'proxy'
};
}
}
normalizeUrl() {
if(this.$scope.current.url === '') {
return;
}
this.$scope.current.url = normalizeUrl(this.$scope.current.url);
}
toggleAccessHelp() {
this.showAccessHelp = !this.showAccessHelp;
}
}

31
src/datasource/module.ts

@ -1,36 +1,7 @@
import { HasticDatasource } from './datasource';
import { HasticQueryCtrl } from './query_ctrl';
import { HasticConfigCtrl } from './config_ctrl';
import { normalizeUrl } from '../utlis';
import configTemplate from './partials/config.html';
class HasticConfigCtrl {
public static template = configTemplate;
public ACCESS_OPTIONS = [
{ key: 'proxy', value: 'Server (Default)' },
{ key: 'direct', value: 'Browser'}
];
public current: any;
private showAccessHelp: boolean = false;
constructor(private $scope) {
}
normalizeUrl() {
if(this.$scope.current.url === "") {
return;
}
this.$scope.current.url = normalizeUrl(this.$scope.current.url);
}
toggleAccessHelp() {
this.showAccessHelp = !this.showAccessHelp;
}
}
export {
HasticDatasource as Datasource,

Loading…
Cancel
Save