-
-
Notifications
You must be signed in to change notification settings - Fork 310
/
set-variable-dialog.component.ts
66 lines (58 loc) · 1.66 KB
/
set-variable-dialog.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import {
Component,
Input,
Output,
EventEmitter,
ViewChild,
OnChanges
} from '@angular/core';
// Import the codemirror packages
import Codemirror from 'codemirror';
import 'codemirror/addon/hint/show-hint';
import 'codemirror/addon/lint/lint';
import 'codemirror/addon/fold/foldcode';
import 'codemirror/addon/fold/foldgutter';
import 'codemirror/addon/fold/brace-fold';
import 'codemirror/addon/fold/indent-fold';
import 'codemirror/addon/display/autorefresh';
import 'codemirror/mode/javascript/javascript';
@Component({
selector: 'app-set-variable-dialog',
templateUrl: './set-variable-dialog.component.html',
styleUrls: ['./set-variable-dialog.component.scss']
})
export class SetVariableDialogComponent implements OnChanges {
@Input() showVariableDialog = false;
@Input() variables = '';
@Output() toggleVariableDialog = new EventEmitter();
@Output() variablesChange = new EventEmitter();
@ViewChild('editor') editor;
variableEditorConfig = {
mode: 'javascript',
json: true,
lineWrapping: true,
lineNumbers: true,
foldGutter: true,
autoRefresh: true,
autoCloseBrackets: true,
theme: 'default variable-editor',
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter']
};
constructor() {
// this.store.changes
// .subscribe(data => {
// this.variables = data.variables;
// // this.gql.setHeaders(data.headers);
// });
}
ngOnChanges() {
// Refresh the query result editor view when there are any changes
// to fix any broken UI issues in it
if (this.editor.instance) {
this.editor.instance.refresh();
}
}
trackByFn(index, item) {
return index;
}
}