fix mat datetime picker regression

This commit is contained in:
Eugenio Romano
2018-08-09 13:35:56 +01:00
parent f5e264d0fc
commit 6b8bd4685c
8 changed files with 58 additions and 7 deletions

View File

@@ -18,3 +18,12 @@
<button mat-raised-button id="adf-search-clear" (click)="onClearSearch()" color="primary">Clear Search configuration</button>
<br>
<h2>Excluded File config editor</h2>
<ngx-monaco-editor id="adf-excluded-file" class="adf-excluded-file-editor" [options]="editorOptions" [(ngModel)]="excludedFileConf" (onInit)="onInitExcludedFile($event)" ></ngx-monaco-editor>
<button mat-raised-button id="adf-excluded-file-save" (click)="onSaveExcludedFile()" color="primary">Save excluded file configuration</button>
<button mat-raised-button id="adf-excluded-file-clear" (click)="onClearExcludedFile()" color="primary">Clear excluded file configuration</button>
<br>

View File

@@ -27,6 +27,7 @@ export class ConfigEditorComponent {
editor: any;
editorSearch: any;
editorExcludedFile: any;
editorOptions = {
theme: 'vs-dark',
@@ -38,6 +39,7 @@ export class ConfigEditorComponent {
metadataConf: string;
searchConf: string;
excludedFileConf: string;
onInitMetadata(editor) {
this.editor = editor;
@@ -53,9 +55,17 @@ export class ConfigEditorComponent {
}, 1000);
}
onInitExcludedFile(excludedFile) {
this.editorExcludedFile = excludedFile;
setTimeout(() => {
this.editorExcludedFile.getAction('editor.action.formatDocument').run();
}, 1000);
}
constructor(private appConfig: AppConfigService, private notificationService: NotificationService) {
this.metadataConf = JSON.stringify(appConfig.config['content-metadata']);
this.searchConf = JSON.stringify(appConfig.config['search']);
this.excludedFileConf = JSON.stringify(appConfig.config['files']);
}
onSaveMetadata() {
@@ -71,10 +81,21 @@ export class ConfigEditorComponent {
onSaveSearch() {
try {
this.appConfig.config['search'] = JSON.parse(this.editor.getValue());
this.appConfig.config['search'] = JSON.parse(this.editorSearch.getValue());
} catch (error) {
this.notificationService.openSnackMessage(
'Wrong sSearch configuration',
'Wrong search configuration',
4000
);
}
}
onSaveExcludedFile() {
try {
this.appConfig.config['files'] = JSON.parse(this.editorExcludedFile.getValue());
} catch (error) {
this.notificationService.openSnackMessage(
'Wrong exclude file configuration',
4000
);
}
@@ -87,4 +108,8 @@ export class ConfigEditorComponent {
onClearSearch() {
this.searchConf = '';
}
onClearExcludedFile() {
this.searchConf = '';
}
}