From 7bc99d492afa017f58733c7424bde14cb2bae898 Mon Sep 17 00:00:00 2001 From: davidcanonieto Date: Tue, 7 May 2019 17:34:59 +0100 Subject: [PATCH] [ADF-4442] Show whole app config in config editor (#4700) --- .../config-editor.component.html | 73 +---------------- .../config-editor/config-editor.component.ts | 81 ++----------------- .../upload/excluded-file.e2e.ts | 63 ++++++--------- 3 files changed, 32 insertions(+), 185 deletions(-) diff --git a/demo-shell/src/app/components/config-editor/config-editor.component.html b/demo-shell/src/app/components/config-editor/config-editor.component.html index 613d80404b..facbb68c94 100644 --- a/demo-shell/src/app/components/config-editor/config-editor.component.html +++ b/demo-shell/src/app/components/config-editor/config-editor.component.html @@ -1,77 +1,8 @@
- - Metadata App config editor - - - - Search App config editor - - - - - Excluded config file - - - - - Task header - - - - - Process instance Header - - - - - Start process - - - - - Application List Cloud - - - - - Task List Cloud - - - - - Edit process filter - - - - - Process List Cloud - - - - - Edit task filter + + App Config Editor diff --git a/demo-shell/src/app/components/config-editor/config-editor.component.ts b/demo-shell/src/app/components/config-editor/config-editor.component.ts index e83410d3c6..d133897b49 100644 --- a/demo-shell/src/app/components/config-editor/config-editor.component.ts +++ b/demo-shell/src/app/components/config-editor/config-editor.component.ts @@ -32,7 +32,7 @@ export class ConfigEditorComponent { editor: any; code: any; - field = 'content-metadata'; + field: string; invalidJson = false; isUserPreference = false; userPreferenceProperty: string; @@ -53,7 +53,7 @@ export class ConfigEditorComponent { constructor(private appConfig: AppConfigService, private userPreferencesService: UserPreferencesService, private notificationService: NotificationService) { - this.code = JSON.stringify(appConfig.config['content-metadata']); + this.code = JSON.stringify(appConfig.config); } onSave() { @@ -61,7 +61,7 @@ export class ConfigEditorComponent { if (this.isUserPreference) { this.userPreferencesService.set(this.userPreferenceProperty, JSON.parse(this.editor.getValue())); } else { - this.appConfig.config[this.field] = JSON.parse(this.editor.getValue()); + this.appConfig.config = JSON.parse(this.editor.getValue()); } } catch (error) { this.invalidJson = true; @@ -77,10 +77,9 @@ export class ConfigEditorComponent { this.code = ''; } - fileConfClick() { + appConfigClick() { this.isUserPreference = false; - this.code = JSON.stringify(this.appConfig.config['files']); - this.field = 'files'; + this.code = JSON.stringify(this.appConfig.config); this.indentCode(); } @@ -97,69 +96,6 @@ export class ConfigEditorComponent { this.indentCode(); } - searchConfClick() { - this.isUserPreference = false; - this.code = JSON.stringify(this.appConfig.config['search']); - this.field = 'search'; - this.indentCode(); - } - - metadataConfClick() { - this.isUserPreference = false; - this.code = JSON.stringify(this.appConfig.config['content-metadata']); - this.field = 'content-metadata'; - this.indentCode(); - } - - taskHeaderConfClick() { - this.isUserPreference = false; - this.code = JSON.stringify(this.appConfig.config['adf-task-header']); - this.field = 'adf-task-header'; - this.indentCode(); - } - - processInstanceHeaderConfClick() { - this.isUserPreference = false; - this.code = JSON.stringify(this.appConfig.config['adf-process-instance-header']); - this.field = 'adf-process-instance-header'; - this.indentCode(); - } - - startProcessConfClick() { - this.isUserPreference = false; - this.code = JSON.stringify(this.appConfig.config['adf-start-process']); - this.field = 'adf-start-process'; - this.indentCode(); - } - - taskListCloudConfClick() { - this.isUserPreference = false; - this.code = JSON.stringify(this.appConfig.config['adf-cloud-task-list']); - this.field = 'adf-cloud-task-list'; - this.indentCode(); - } - - editProcessFilterConfClick() { - this.isUserPreference = false; - this.code = JSON.stringify(this.appConfig.config['adf-edit-process-filter']); - this.field = 'adf-edit-process-filter'; - this.indentCode(); - } - - editTaskFilterConfClick() { - this.isUserPreference = false; - this.code = JSON.stringify(this.appConfig.config['adf-edit-task-filter']); - this.field = 'adf-edit-task-filter'; - this.indentCode(); - } - - processListCloudConfClick() { - this.isUserPreference = false; - this.code = JSON.stringify(this.appConfig.config['adf-cloud-process-list']); - this.field = 'adf-cloud-process-list'; - this.indentCode(); - } - infinitePaginationConfClick() { this.isUserPreference = true; this.userPreferenceProperty = UserPreferenceValues.PaginationSize; @@ -180,13 +116,6 @@ export class ConfigEditorComponent { }); } - applicationListCloudConfClick() { - this.isUserPreference = false; - this.code = JSON.stringify(this.appConfig.config['alfresco-deployed-apps']); - this.field = 'alfresco-deployed-apps'; - this.indentCode(); - } - indentCode() { setTimeout(() => { this.editor.getAction('editor.action.formatDocument').run(); diff --git a/e2e/content-services/upload/excluded-file.e2e.ts b/e2e/content-services/upload/excluded-file.e2e.ts index 7e12c348ce..cd591346ad 100644 --- a/e2e/content-services/upload/excluded-file.e2e.ts +++ b/e2e/content-services/upload/excluded-file.e2e.ts @@ -17,11 +17,10 @@ import { element, by, browser } from 'protractor'; -import { LoginPage } from '@alfresco/adf-testing'; +import { LoginPage, LocalStorageUtil } from '@alfresco/adf-testing'; import { ContentServicesPage } from '../../pages/adf/contentServicesPage'; import { UploadDialog } from '../../pages/adf/dialog/uploadDialog'; import { UploadToggles } from '../../pages/adf/dialog/uploadToggles'; -import { NavigationBarPage } from '../../pages/adf/navigationBarPage'; import { AcsUserModel } from '../../models/ACS/acsUserModel'; import { FileModel } from '../../models/ACS/fileModel'; @@ -32,7 +31,6 @@ import resources = require('../../util/resources'); import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api'; import { DropActions } from '../../actions/drop.actions'; -import { ConfigEditorPage } from '../../pages/adf/configEditorPage'; describe('Upload component - Excluded Files', () => { @@ -41,8 +39,6 @@ describe('Upload component - Excluded Files', () => { const uploadToggles = new UploadToggles(); const loginPage = new LoginPage(); const acsUser = new AcsUserModel(); - const navigationBarPage = new NavigationBarPage(); - const configEditorPage = new ConfigEditorPage(); const iniExcludedFile = new FileModel({ 'name': resources.Files.ADF_DOCUMENTS.INI.file_name, @@ -122,24 +118,20 @@ describe('Upload component - Excluded Files', () => { }); }); - it('[C212862] Should not allow upload file excluded in the files extension of app.config.json', () => { + it('[C212862] Should not allow upload file excluded in the files extension of app.config.json', async () => { - navigationBarPage.clickConfigEditorButton(); - configEditorPage.clickFileConfiguration(); + const filesConfig = { + 'excluded': [ + '.DS_Store', + 'desktop.ini', + '*.txt' + ], + 'match-options': { + 'nocase': true + } + }; - configEditorPage.clickClearButton(); - - configEditorPage.enterConfiguration('{' + - '"excluded": [' + - '".DS_Store",' + - '"desktop.ini",' + - '"*.txt"' + - '],' + - '"match-options": {' + - '"nocase": true' + - '}}'); - - configEditorPage.clickSaveButton(); + await LocalStorageUtil.setConfigField('files', JSON.stringify(filesConfig)); contentServicesPage.goToDocumentList(); @@ -148,27 +140,22 @@ describe('Upload component - Excluded Files', () => { .checkContentIsNotDisplayed(txtFileModel.name); }); - it('[C274688] Should extension type added as excluded and accepted not be uploaded', () => { + it('[C274688] Should extension type added as excluded and accepted not be uploaded', async () => { browser.refresh(); - navigationBarPage.clickConfigEditorButton(); + const filesConfig = { + 'excluded': [ + '.DS_Store', + 'desktop.ini', + '*.png' + ], + 'match-options': { + 'nocase': true + } + }; - configEditorPage.clickFileConfiguration(); - - configEditorPage.clickClearButton(); - - configEditorPage.enterConfiguration('{' + - '"excluded": [' + - '".DS_Store",' + - '"desktop.ini",' + - '"*.png"' + - '],' + - '"match-options": {' + - '"nocase": true' + - '}}'); - - configEditorPage.clickSaveButton(); + await LocalStorageUtil.setConfigField('files', JSON.stringify(filesConfig)); contentServicesPage.goToDocumentList();