diff --git a/docs/content-services/components/content-metadata-card.component.md b/docs/content-services/components/content-metadata-card.component.md index e9257a9d1e2..bf545485364 100644 --- a/docs/content-services/components/content-metadata-card.component.md +++ b/docs/content-services/components/content-metadata-card.component.md @@ -56,12 +56,6 @@ Displays and edits metadata related to a node. | editable | `boolean` | | (optional) This flag toggles editable of content. | | customPanels | [`ContentMetadataCustomPanel`](../interfaces/content-metadata-custom-panel.interface.md)`[]` | | (optional) List of custom metadata panels to be displayed as [`Dynamic components`](../../extensions/components/dynamic.component.md). | -### Events - -| Name | Type | Description | -|----------------|-----------------------------------------------------------------------|---------------------------------------------------| -| editableChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when content's editable state is changed. | - ## Details The component shows metadata related to a given node. It uses the @@ -444,3 +438,4 @@ When the list of values is too long, the options selection panel will be enhance ## Custom metadata panels If there is a need to display some custom node properties that require additional UI or data to be fetched you can define custom metadata panels for the metadata component. After creating custom component to be displayed it has to be registered in [Extension Service](../../extensions/services/extension.service.md). Both `panelTitle` and `component` properties have to be defined. +![Chips for multi value properties](../../docassets/images/adf-search-select.png) diff --git a/docs/content-services/components/tags-creator.component.md b/docs/content-services/components/tags-creator.component.md index 30d59198332..fd83ec7e61f 100644 --- a/docs/content-services/components/tags-creator.component.md +++ b/docs/content-services/components/tags-creator.component.md @@ -37,3 +37,4 @@ Allows to create multiple tags. That component contains input and two lists. Top | existingTagsPanelVisibilityChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when bottom list is showing or hiding. | | tagNameControlVisibleChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when input is showing or hiding. | | tagsChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when tags in top list are changed. | + diff --git a/docs/docassets/images/UI_property_panel.png b/docs/docassets/images/UI_property_panel.png new file mode 100644 index 00000000000..7c236b27c88 Binary files /dev/null and b/docs/docassets/images/UI_property_panel.png differ diff --git a/docs/tutorials/content-metadata-component.md b/docs/tutorials/content-metadata-component.md index 2f77230ba40..29d3a74777c 100644 --- a/docs/tutorials/content-metadata-component.md +++ b/docs/tutorials/content-metadata-component.md @@ -98,12 +98,30 @@ Now that the `my-preset` configuration is defined, let's use it in a view of the ``` +### Properties + +| Name | Type | Default value | Description | +| ---- | ---- | ------------- | ----------- | +| readOnly | `boolean` | false | (optional) This flag sets the metadata in read only mode preventing changes. | +| editable | `boolean` | | (optional) This flag toggles editable of content. | +| editableTags | `boolean` | | (optional) This flag toggles editable of tags content. | +| editableCategories | `boolean` | | (optional) This flag toggles editable of categories content. | + +### Events + +| Name | Type | Description | +|----------------|-----------------------------------------------------------------------|---------------------------------------------------| +| editableChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when content's editable state is changed. | +| editableTagsChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when content's editableTags state is changed. | +| editableCategoriesChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when content's editableCategories state is changed. | +| groupChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when content's group state is changed. | + ### Viewing the result -After saving the html file, open the ADF app in a browser and dive into the `Personal Files > Sites > swsdp` folder of the Alfresco's repository. Once there, select the `documentLibrary` folder (one click only) and click on the view details icon (the `i` on the top right). Scrolling down the metadata tab on the right, click on the `More information` item at the bottom. Once clicked, you will see two different groups: `Properties` (already there by default) and `This is my preset`. Click on `This is my preset` to show the properties related. +After saving the html file, open the ADF app in a browser and dive into the `Personal Files > Sites > swsdp` folder of the Alfresco's repository. Once there, select the `documentLibrary` folder (one click only) and click on the view details icon (the `menu_open icon` on the top right). Scrolling down the metadata tab on the right. You will see different panels: `Properties` (already there by default), `Tags`, `Categories` and `grouped properties`. In the following screenshot you can see how the result should look: -![content_metadata_preset](../docassets/images/content_metadata_preset.png) +![UI_Property_Panel](../docassets/images/UI_property_panel.png) To check it out, double click on the `documentLibrary` folder and select (with one click) the `Presentations` folder. You should see the `This is my preset` group disappear from the metadata panel, because the node doesn't have the `st:siteContainer` aspect. diff --git a/e2e/content-services/components/permissions-component.e2e.ts b/e2e/content-services/components/permissions-component.e2e.ts index 211e2d47598..99df583372b 100644 --- a/e2e/content-services/components/permissions-component.e2e.ts +++ b/e2e/content-services/components/permissions-component.e2e.ts @@ -339,8 +339,8 @@ describe('Permissions Component', () => { await BrowserActions.closeMenuAndDialogs(); await contentList.checkActionMenuIsNotDisplayed(); await contentServicesPage.metadataContent('RoleEditor' + fileModel.name); - await metadataViewPage.editIconIsDisplayed(); - await metadataViewPage.editIconClick(); + await metadataViewPage.isEditGeneralIconDisplayed(); + await metadataViewPage.clickEditIconGeneral(); await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title'); await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle1'); await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle1'); @@ -360,8 +360,8 @@ describe('Permissions Component', () => { await BrowserActions.closeMenuAndDialogs(); await contentList.checkActionMenuIsNotDisplayed(); await contentServicesPage.metadataContent('RoleCollaborator' + fileModel.name); - await metadataViewPage.editIconIsDisplayed(); - await metadataViewPage.editIconClick(); + await metadataViewPage.isEditGeneralIconDisplayed(); + await metadataViewPage.clickEditIconGeneral(); await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title'); await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle2'); await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle2'); @@ -382,8 +382,8 @@ describe('Permissions Component', () => { await viewerPage.clickCloseButton(); await contentList.waitForTableBody(); await contentServicesPage.metadataContent('RoleCoordinator' + fileModel.name); - await metadataViewPage.editIconIsDisplayed(); - await metadataViewPage.editIconClick(); + await metadataViewPage.isEditGeneralIconDisplayed(); + await metadataViewPage.clickEditIconGeneral(); await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title'); await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle3'); await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle3'); diff --git a/e2e/content-services/metadata/aspect-oriented-config.e2e.ts b/e2e/content-services/metadata/aspect-oriented-config.e2e.ts index 4b1cdc92a5a..96376d942d4 100644 --- a/e2e/content-services/metadata/aspect-oriented-config.e2e.ts +++ b/e2e/content-services/metadata/aspect-oriented-config.e2e.ts @@ -122,8 +122,6 @@ describe('Aspect oriented config', () => { await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); await metadataViewPage.clickMetadataGroup('IMAGE'); await metadataViewPage.checkPropertyIsVisible('properties.exif:pixelXDimension', 'textitem'); @@ -152,8 +150,6 @@ describe('Aspect oriented config', () => { await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); await metadataViewPage.checkMetadataGroupIsPresent('EXIF'); await metadataViewPage.checkMetadataGroupIsPresent('properties'); @@ -170,8 +166,6 @@ describe('Aspect oriented config', () => { await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); await metadataViewPage.checkMetadataGroupIsPresent('EXIF'); await metadataViewPage.checkMetadataGroupIsPresent('properties'); @@ -191,8 +185,6 @@ describe('Aspect oriented config', () => { await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); await metadataViewPage.checkMetadataGroupIsPresent('EXIF'); await metadataViewPage.checkMetadataGroupIsPresent('properties'); @@ -232,9 +224,6 @@ describe('Aspect oriented config', () => { await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); - await metadataViewPage.checkMetadataGroupIsPresent('GROUP-TITLE1-TRANSLATION-KEY'); await metadataViewPage.checkMetadataGroupIsPresent('GROUP-TITLE2-TRANSLATION-KEY'); @@ -262,10 +251,6 @@ describe('Aspect oriented config', () => { await CheckboxPage.check(metadataViewPage.presetSwitch); await metadataViewPage.enterPresetText('custom-preset'); - - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); - await metadataViewPage.checkMetadataGroupIsPresent('properties'); await metadataViewPage.checkMetadataGroupIsPresent('Versionable'); }); @@ -286,9 +271,6 @@ describe('Aspect oriented config', () => { await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); - await metadataViewPage.checkMetadataGroupIsNotPresent(emptyAspectName); }); @@ -308,11 +290,6 @@ describe('Aspect oriented config', () => { await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); - - await metadataViewPage.checkMetadataGroupIsNotPresent(aspectName); - await metadataViewPage.editIconClick(); await metadataViewPage.checkMetadataGroupIsPresent(aspectName); diff --git a/e2e/content-services/metadata/metadata-content-type.e2e.ts b/e2e/content-services/metadata/metadata-content-type.e2e.ts index c3647fc851b..f6f8ba66bea 100644 --- a/e2e/content-services/metadata/metadata-content-type.e2e.ts +++ b/e2e/content-services/metadata/metadata-content-type.e2e.ts @@ -114,16 +114,16 @@ describe('content type', () => { await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.editIconIsDisplayed(); + await metadataViewPage.isEditGeneralIconDisplayed(); await expect(await viewerPage.getActiveTab()).toEqual('PROPERTIES'); const defaultType = (await metadataViewPage.hasContentType('Content')) || (await metadataViewPage.hasContentType('cm:content')); await expect(defaultType).toBe(true, 'Content type not found'); - await metadataViewPage.editIconClick(); + await metadataViewPage.clickEditIconGeneral(); await expect(await metadataViewPage.changeContentType(type.title)).toBe(true, 'Failed to update node type.'); - await metadataViewPage.clickSaveMetadata(); + await metadataViewPage.clickSaveGeneralMetadata(); await metadataViewPage.checkConfirmDialogDisplayed(); await metadataViewPage.applyNodeProperties(); @@ -139,7 +139,7 @@ describe('content type', () => { await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.editIconIsDisplayed(); + await metadataViewPage.isEditGeneralIconDisplayed(); await expect(await viewerPage.getActiveTab()).toEqual('PROPERTIES'); const customType = (await metadataViewPage.hasContentType(type.title)) || (await metadataViewPage.hasContentType(`${model.namespacePrefix}:${type.name}`)); @@ -155,16 +155,16 @@ describe('content type', () => { await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.editIconIsDisplayed(); + await metadataViewPage.isEditGeneralIconDisplayed(); await expect(await viewerPage.getActiveTab()).toEqual('PROPERTIES'); let defaultType = (await metadataViewPage.hasContentType('Content')) || (await metadataViewPage.hasContentType('cm:content')); await expect(defaultType).toBe(true, 'Content type not found'); - await metadataViewPage.editIconClick(); + await metadataViewPage.clickEditIconGeneral(); await expect(await metadataViewPage.changeContentType(type.title)).toBe(true, 'Failed to update node type.'); - await metadataViewPage.clickSaveMetadata(); + await metadataViewPage.clickSaveGeneralMetadata(); await metadataViewPage.checkConfirmDialogDisplayed(); await metadataViewPage.cancelNodeProperties(); @@ -178,7 +178,7 @@ describe('content type', () => { await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.editIconIsDisplayed(); + await metadataViewPage.isEditGeneralIconDisplayed(); await expect(await viewerPage.getActiveTab()).toEqual('PROPERTIES'); defaultType = (await metadataViewPage.hasContentType('Content')) || (await metadataViewPage.hasContentType('cm:content')); diff --git a/e2e/content-services/metadata/metadata-permissions.e2e.ts b/e2e/content-services/metadata/metadata-permissions.e2e.ts index 6884b1b8b02..34e73c11e50 100644 --- a/e2e/content-services/metadata/metadata-permissions.e2e.ts +++ b/e2e/content-services/metadata/metadata-permissions.e2e.ts @@ -38,10 +38,6 @@ describe('permissions', () => { COMMENTS_TAB: 'COMMENTS', PROPERTY_TAB: 'PROPERTIES', DEFAULT_ASPECT: 'Properties', - MORE_INFO_BUTTON: 'More information', - LESS_INFO_BUTTON: 'Less information', - ARROW_DOWN: 'keyboard_arrow_down', - ARROW_UP: 'keyboard_arrow_up', EDIT_BUTTON_TOOLTIP: 'Edit' }; @@ -132,7 +128,6 @@ describe('permissions', () => { await expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB); - await metadataViewPage.clickOnInformationButton(); await metadataViewPage.clickMetadataGroup('EXIF'); @@ -152,7 +147,6 @@ describe('permissions', () => { await expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB); - await metadataViewPage.clickOnInformationButton(); await metadataViewPage.clickMetadataGroup('EXIF'); diff --git a/e2e/content-services/metadata/metadata-properties.e2e.ts b/e2e/content-services/metadata/metadata-properties.e2e.ts index 502e7721a8b..7a203d4dff5 100644 --- a/e2e/content-services/metadata/metadata-properties.e2e.ts +++ b/e2e/content-services/metadata/metadata-properties.e2e.ts @@ -37,10 +37,6 @@ describe('CardView Component - properties', () => { COMMENTS_TAB: 'COMMENTS', PROPERTY_TAB: 'PROPERTIES', DEFAULT_ASPECT: 'Properties', - MORE_INFO_BUTTON: 'More information', - LESS_INFO_BUTTON: 'Less information', - ARROW_DOWN: 'keyboard_arrow_down', - ARROW_UP: 'keyboard_arrow_up', EDIT_BUTTON_TOOLTIP: 'Edit' }; @@ -90,7 +86,6 @@ describe('CardView Component - properties', () => { await expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB); - await metadataViewPage.clickOnInformationButton(); await metadataViewPage.clickMetadataGroup('EXIF'); @@ -108,11 +103,9 @@ describe('CardView Component - properties', () => { await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.editIconIsDisplayed(); + await metadataViewPage.isEditGeneralIconDisplayed(); await CheckboxPage.check(metadataViewPage.readonlySwitch); - - await metadataViewPage.editIconIsNotDisplayed(); }); it('[C268965] Should multi property allow expand multi accordion at the same time when set', async () => { @@ -121,15 +114,9 @@ describe('CardView Component - properties', () => { await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.clickOnInformationButton(); - - await metadataViewPage.checkMetadataGroupIsNotExpand('EXIF'); - await metadataViewPage.checkMetadataGroupIsNotExpand('properties'); - await metadataViewPage.clickMetadataGroup('properties'); - - await metadataViewPage.checkMetadataGroupIsNotExpand('EXIF'); await metadataViewPage.checkMetadataGroupIsExpand('properties'); + await metadataViewPage.checkMetadataGroupIsNotExpand('EXIF'); await metadataViewPage.clickMetadataGroup('EXIF'); @@ -168,11 +155,7 @@ describe('CardView Component - properties', () => { await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.informationButtonIsDisplayed(); - await CheckboxPage.uncheck(metadataViewPage.defaultPropertiesSwitch); - - await metadataViewPage.informationButtonIsNotDisplayed(); }); it('[C307975] Should be able to choose which aspect to show expanded in the info-drawer', async () => { diff --git a/e2e/content-services/metadata/metadata-smoke-tests.e2e.ts b/e2e/content-services/metadata/metadata-smoke-tests.e2e.ts index 8de3740a56e..69bdd42dd73 100644 --- a/e2e/content-services/metadata/metadata-smoke-tests.e2e.ts +++ b/e2e/content-services/metadata/metadata-smoke-tests.e2e.ts @@ -39,11 +39,7 @@ describe('Metadata component', () => { TITLE: 'Details', COMMENTS_TAB: 'COMMENTS', PROPERTY_TAB: 'PROPERTIES', - DEFAULT_ASPECT: 'Properties', - MORE_INFO_BUTTON: 'More information', - LESS_INFO_BUTTON: 'Less information', - ARROW_DOWN: 'keyboard_arrow_down', - ARROW_UP: 'keyboard_arrow_up', + DEFAULT_ASPECT: 'General info', EDIT_BUTTON_TOOLTIP: 'Edit' }; @@ -120,26 +116,12 @@ describe('Metadata component', () => { await expect(await metadataViewPage.getSize()).toEqual(pngFileModel.getContent().getSizeInBytes()); await metadataViewPage.editIconIsDisplayed(); - await metadataViewPage.informationButtonIsDisplayed(); - await expect(await metadataViewPage.getInformationButtonText()).toEqual(METADATA.MORE_INFO_BUTTON); - await expect(await metadataViewPage.getInformationIconText()).toEqual(METADATA.ARROW_DOWN); - }); - - it('[C272769] Should be possible to display more details when clicking on More Information button', async () => { - await viewerPage.clickInfoButton(); - await viewerPage.checkInfoSideBarIsDisplayed(); - await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); - await expect(await metadataViewPage.getInformationButtonText()).toEqual(METADATA.LESS_INFO_BUTTON); - await expect(await metadataViewPage.getInformationIconText()).toEqual(METADATA.ARROW_UP); }); it('[C270952] Should be possible to open/close properties using info icon', async () => { await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.informationButtonIsDisplayed(); await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsNotDisplayed(); await viewerPage.clickInfoButton(); @@ -154,11 +136,11 @@ describe('Metadata component', () => { await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.editIconIsDisplayed(); + await metadataViewPage.isEditGeneralIconDisplayed(); await expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB); - await metadataViewPage.editIconClick(); + await metadataViewPage.clickEditIconGeneral(); await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:name'); await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title'); await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:description'); @@ -170,15 +152,15 @@ describe('Metadata component', () => { await metadataViewPage.enterPropertyText('properties.cm:name', 'exampleText'); await metadataViewPage.clickResetMetadata(); await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name); - + await metadataViewPage.clickEditIconGeneral(); await metadataViewPage.enterPropertyText('properties.cm:name', 'exampleText.png'); await metadataViewPage.enterPropertyText('properties.cm:title', 'example title'); await metadataViewPage.enterDescriptionText('example description'); + await metadataViewPage.clickSaveGeneralMetadata(); await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual('exampleText.png'); await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('example title'); await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('example description'); - await metadataViewPage.clickSaveMetadata(); await viewerPage.clickCloseButton(); await contentServicesPage.waitForTableBody(); @@ -187,16 +169,15 @@ describe('Metadata component', () => { await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.editIconIsDisplayed(); + await metadataViewPage.isEditGeneralIconDisplayed(); await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual('exampleText.png'); await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('example title'); - await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('example description'); - await metadataViewPage.editIconClick(); + await metadataViewPage.clickEditIconGeneral(); await metadataViewPage.enterPropertyText('properties.cm:name', browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name); await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name); - await metadataViewPage.clickSaveMetadata(); + await metadataViewPage.clickSaveGeneralMetadata(); }); it('[C260181] Should be possible edit all the metadata aspect', async () => { @@ -207,8 +188,6 @@ describe('Metadata component', () => { await expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB); - await metadataViewPage.clickOnInformationButton(); - await metadataViewPage.clickMetadataGroup('EXIF'); await metadataViewPage.editIconClick(); @@ -250,18 +229,20 @@ describe('Metadata component', () => { it('[C261158] Should be possible edit the metadata When the node is a Folder', async () => { await contentServicesPage.metadataContent(folderName); - await metadataViewPage.editIconClick(); + await metadataViewPage.clickEditIconGeneral(); await metadataViewPage.enterPropertyText('properties.cm:name', 'newnameFolder'); await metadataViewPage.clickResetButton(); await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(folderName); + await metadataViewPage.clickEditIconGeneral(); await metadataViewPage.enterPropertyText('properties.cm:name', 'newnameFolder'); - await metadataViewPage.clickSaveMetadata(); + await metadataViewPage.clickSaveGeneralMetadata(); await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual('newnameFolder'); + await metadataViewPage.clickEditIconGeneral(); await metadataViewPage.enterPropertyText('properties.cm:name', folderName); - await metadataViewPage.clickSaveMetadata(); + await metadataViewPage.clickSaveGeneralMetadata(); await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(folderName); }); }); @@ -274,14 +255,14 @@ describe('Metadata component', () => { await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.editIconIsDisplayed(); + await metadataViewPage.isEditGeneralIconDisplayed(); await expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB); - await metadataViewPage.editIconClick(); + await metadataViewPage.clickEditIconGeneral(); await metadataViewPage.enterDescriptionText('check author example description'); - await metadataViewPage.clickSaveMetadata(); + await metadataViewPage.clickSaveGeneralMetadata(); await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('check author example description'); await navigationBarPage.clickLogoutButton(); diff --git a/e2e/core/pages/metadata-view.page.ts b/e2e/core/pages/metadata-view.page.ts index c6b4bc9158e..7bfeaddaae9 100644 --- a/e2e/core/pages/metadata-view.page.ts +++ b/e2e/core/pages/metadata-view.page.ts @@ -33,9 +33,7 @@ export class MetadataViewPage { author = $(`[data-automation-id='card-textitem-value-properties.cm:author']`); titleProperty = $(`span[data-automation-id='card-textitem-value-properties.cm:title'] span`); editIcon = $(`button[data-automation-id='meta-data-card-toggle-edit']`); - informationButton = $(`button[data-automation-id='meta-data-card-toggle-expand']`); - informationSpan = $(`span[data-automation-id='meta-data-card-toggle-expand-label']`); - informationIcon = $(`span[data-automation-id='meta-data-card-toggle-expand-label'] ~ mat-icon`); + editIconGeneral = $(`button[data-automation-id='meta-data-general-info-edit']`); displayEmptySwitch = $(`#adf-metadata-empty`); readonlySwitch = $(`#adf-metadata-readonly`); multiSwitch = $(`#adf-metadata-multi`); @@ -45,6 +43,7 @@ export class MetadataViewPage { displayAspect = $(`input[data-placeholder='Display Aspect']`); applyAspect = element(by.cssContainingText(`button span.mat-button-wrapper`, 'Apply Aspect')); saveMetadataButton = $(`[data-automation-id='save-metadata']`); + saveGeneralMetadataButton = $(`[data-automation-id='save-general-info-metadata']`); resetMetadataButton = $(`[data-automation-id='reset-metadata']`); private getMetadataGroupLocator = async (groupName: string): Promise => @@ -108,28 +107,16 @@ export class MetadataViewPage { await BrowserVisibility.waitUntilElementIsNotVisible(this.editIcon); } - async editIconClick(): Promise { - await BrowserActions.clickExecuteScript('button[data-automation-id="meta-data-card-toggle-edit"]'); - } - - async informationButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsClickable(this.informationButton); + async isEditGeneralIconDisplayed(): Promise { + await BrowserVisibility.waitUntilElementIsVisible(this.editIconGeneral); } - async informationButtonIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.informationButton); - } - - async clickOnInformationButton(): Promise { - await BrowserActions.click(this.informationButton); - } - - async getInformationButtonText(): Promise { - return BrowserActions.getText(this.informationSpan); + async editIconClick(): Promise { + await BrowserActions.clickExecuteScript('button[data-automation-id="meta-data-card-toggle-edit"]'); } - async getInformationIconText(): Promise { - return BrowserActions.getText(this.informationIcon); + async clickEditIconGeneral(): Promise { + await BrowserActions.click(this.editIconGeneral); } async clickOnPropertiesTab(): Promise { @@ -211,9 +198,7 @@ export class MetadataViewPage { } async getMetadataGroupTitle(groupName: string): Promise { - const group = $( - 'mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header > span > mat-panel-title' - ); + const group = $('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header > span > div > mat-panel-title'); return BrowserActions.getText(group); } @@ -316,4 +301,8 @@ export class MetadataViewPage { async clickResetMetadata(): Promise { await BrowserActions.click(this.resetMetadataButton); } + + async clickSaveGeneralMetadata(): Promise { + await BrowserActions.click(this.saveGeneralMetadataButton); + } } diff --git a/e2e/core/viewer/viewer-content-services-component.e2e.ts b/e2e/core/viewer/viewer-content-services-component.e2e.ts index f0aadfd7fb8..05591d7009a 100644 --- a/e2e/core/viewer/viewer-content-services-component.e2e.ts +++ b/e2e/core/viewer/viewer-content-services-component.e2e.ts @@ -446,9 +446,9 @@ describe('Content Services Viewer', () => { await viewerPage.checkInfoSideBarIsDisplayed(); await viewerPage.clickOnTab('Properties'); await viewerPage.checkTabIsActive('Properties'); - await metadataViewPage.editIconClick(); + await metadataViewPage.clickEditIconGeneral(); await metadataViewPage.enterPropertyText('properties.cm:name', newName); - await metadataViewPage.clickSaveMetadata(); + await metadataViewPage.clickSaveGeneralMetadata(); await viewerPage.clickCloseButton(); } }); diff --git a/lib/content-services/src/lib/category/categories-management/categories-management.component.html b/lib/content-services/src/lib/category/categories-management/categories-management.component.html index 516f0acca93..9c51a9b8fad 100644 --- a/lib/content-services/src/lib/category/categories-management/categories-management.component.html +++ b/lib/content-services/src/lib/category/categories-management/categories-management.component.html @@ -1,10 +1,19 @@
-

- {{ noCategoriesMsg | translate }} -

-
+
+ + + {{ categoryNameErrorMessageKey | translate }} + +
+
-
- - search - - {{ 'CATEGORIES_MANAGEMENT.NAME' | translate }} - - - {{ categoryNameErrorMessageKey | translate }} - - -
+

+ {{ noCategoriesMsg | translate }} +

diff --git a/lib/content-services/src/lib/category/categories-management/categories-management.component.scss b/lib/content-services/src/lib/category/categories-management/categories-management.component.scss index 31911029be8..9cc1235d162 100644 --- a/lib/content-services/src/lib/category/categories-management/categories-management.component.scss +++ b/lib/content-services/src/lib/category/categories-management/categories-management.component.scss @@ -1,8 +1,14 @@ .adf-categories-management { + padding-top: 12px; + .adf-category-name-field { display: flex; justify-content: space-between; width: 100%; + background: var(--theme-metadata-buttons-background-color); + height: 32px; + border-radius: 12px; + align-items: center; mat-form-field { width: 100%; @@ -11,6 +17,20 @@ .adf-btn-padded { margin-right: -14px; } + + .mat-form-field-underline { + display: none; + } + + .mat-form-field-appearance-fill { + .mat-form-field-flex { + background: none; + } + + .mat-form-field-infix { + padding: 0; + } + } } .adf-assigned-categories { @@ -31,11 +51,15 @@ [hidden] { visibility: hidden; } + + .adf-no-categories-message { + margin-top: 28.5px; + margin-bottom: 0; + height: 30px; + } } .adf-categories-list { - padding-bottom: 10px; - .mat-list-base .mat-list-item, .mat-list-base .mat-list-option { display: flex; diff --git a/lib/content-services/src/lib/category/categories-management/categories-management.component.spec.ts b/lib/content-services/src/lib/category/categories-management/categories-management.component.spec.ts index d7e3801e14f..d7c1cf0aaca 100644 --- a/lib/content-services/src/lib/category/categories-management/categories-management.component.spec.ts +++ b/lib/content-services/src/lib/category/categories-management/categories-management.component.spec.ts @@ -220,44 +220,33 @@ describe('CategoriesManagementComponent', () => { component.categoryNameControlVisible = true; fixture.detectChanges(); }); - it('should be hidden initially', () => { - component.categoryNameControlVisible = false; - fixture.detectChanges(); - const categoryControl: HTMLDivElement = fixture.debugElement.query(By.css('.adf-category-name-field')).nativeElement; - expect(categoryControl.hidden).toBeTrue(); - }); it('should be visible when categoryNameControlVisible is true', () => { const categoryControl = fixture.debugElement.query(By.css('.adf-category-name-field')); expect(categoryControl).toBeTruthy(); }); - it('should have correct label and hide button', () => { - const categoryControlLabel = fixture.debugElement.query(By.css('#adf-category-name-input-label')).nativeElement; - const categoryControlHideBtn: HTMLButtonElement = fixture.debugElement.query(By.css('.adf-category-name-field button')).nativeElement; - expect(categoryControlHideBtn).toBeTruthy(); - expect(categoryControlHideBtn.attributes.getNamedItem('title').textContent.trim()).toBe('CATEGORIES_MANAGEMENT.HIDE_INPUT'); - expect(categoryControlLabel.textContent.trim()).toBe('CATEGORIES_MANAGEMENT.NAME'); + it('should return true when categoryNameControlVisible is true', () => { + component.categoryNameControlVisible = true; + const result = component.isNameCategoryVisible; + expect(result).toBeTrue(); }); - it('should hide and clear category control and existing categories panel on clicking hide button', fakeAsync(() => { - typeCategory('test'); - const categoryControlHideBtn: HTMLButtonElement = fixture.debugElement.query(By.css('.adf-category-name-field button')).nativeElement; - const controlVisibilityChangeSpy = spyOn(component.categoryNameControlVisibleChange, 'emit').and.callThrough(); - categoryControlHideBtn.click(); - fixture.detectChanges(); - - const categoryControl: HTMLDivElement = fixture.debugElement.query(By.css('.adf-category-name-field')).nativeElement; - expect(categoryControl.hidden).toBeTrue(); - expect(component.categoryNameControlVisible).toBeFalse(); - expect(component.existingCategoriesPanelVisible).toBeFalse(); - expect(controlVisibilityChangeSpy).toHaveBeenCalledOnceWith(false); + it('should return false when categoryNameControlVisible is false and categories length is 0', () => { + component.categoryNameControlVisible = false; + component.categories = []; + const result = component.isNameCategoryVisible; + expect(result).toBeFalse(); + }); + }); - component.categoryNameControlVisible = true; - fixture.detectChanges(); - tick(100); - expect(getCategoryControlInput().value).toBe(''); - })); + describe('isCategoryEmpty', () => { + it('should return true when categories empty', () => { + component.categories = []; + component.categoryNameControlVisible = false; + const result = component.isCategoryEmpty; + expect(result).toBeTrue(); + }); }); describe('Spinner', () => { @@ -476,13 +465,8 @@ describe('CategoriesManagementComponent', () => { expect(categoriesChangeSpy).toHaveBeenCalledOnceWith(component.categories); })); - it('should clear and hide input after category is created', fakeAsync(() => { - const controlVisibilityChangeSpy = spyOn(component.categoryNameControlVisibleChange, 'emit'); + it('should clear input after category is created', fakeAsync(() => { createCategory('test'); - const categoryControl: HTMLDivElement = fixture.debugElement.query(By.css('.adf-category-name-field')).nativeElement; - - expect(categoryControl.hidden).toBeTrue(); - expect(controlVisibilityChangeSpy).toHaveBeenCalledOnceWith(false); expect(getExistingCategoriesList()).toEqual([]); expect(component.categoryNameControl.value).toBe(''); expect(component.categoryNameControl.untouched).toBeTrue(); diff --git a/lib/content-services/src/lib/category/categories-management/categories-management.component.ts b/lib/content-services/src/lib/category/categories-management/categories-management.component.ts index 51d4683fe13..ac84cd907c3 100644 --- a/lib/content-services/src/lib/category/categories-management/categories-management.component.ts +++ b/lib/content-services/src/lib/category/categories-management/categories-management.component.ts @@ -177,10 +177,24 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { this.cancelExistingCategoriesLoading$.complete(); } + /* + * Returns `true` if categoryNameControlVisible is true, otherwise `false` + */ + get isNameCategoryVisible(): boolean { + return (!this.categoryNameControlVisible && this.categories?.length > 0) || this.categoryNameControlVisible; + } + get categoryNameControl(): FormControl { return this._categoryNameControl; } + /* + * Returns `true` if categories empty, otherwise `false` + */ + get isCategoryEmpty(): boolean { + return this.categories?.length === 0 && !this.categoryNameControlVisible; + } + get existingCategories(): Category[] { return this._existingCategories; } @@ -205,16 +219,6 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { return this.managementMode === CategoriesManagementMode.CRUD; } - /** - * Hides and emits categoryNameControl and hides existing categories panel. - */ - hideNameInput() { - this.categoryNameControlVisible = false; - this.categoryNameControlVisibleChange.emit(false); - this._existingCategoriesPanelVisible = false; - this.clearCategoryNameInput(); - } - /** * Adds category that has been typed to a categoryNameControl and hides it afterwards. */ @@ -223,7 +227,6 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { const newCatName = this.categoryNameControl.value.trim(); const newCat = new Category({ id: newCatName, name: newCatName }); this.categories.push(newCat); - this.hideNameInput(); this.clearCategoryNameInput(); this._existingCategories = null; this.categoriesChange.emit(this.categories); diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.html b/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.html index 3b9930e3b91..0278ba6332e 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.html +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.html @@ -24,24 +24,6 @@ data-automation-id="meta-data-card-edit-aspect"> menu -
- diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts index 8d8416f17a6..a6a3bc7e394 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts @@ -147,55 +147,6 @@ describe('ContentMetadataCardComponent', () => { expect(contentMetadataComponent).toBeNull(); }); - it('should toggle editable by clicking on the button', () => { - component.editable = true; - component.node.allowableOperations = [AllowableOperationsEnum.UPDATE]; - fixture.detectChanges(); - - getToggleEditButton().triggerEventHandler('click', {}); - fixture.detectChanges(); - - expect(component.editable).toBe(false); - }); - - it('should emit editableChange by clicking on toggle edit button', () => { - component.node.allowableOperations = [AllowableOperationsEnum.UPDATE]; - fixture.detectChanges(); - spyOn(component.editableChange, 'emit'); - - getToggleEditButton().nativeElement.click(); - expect(component.editableChange.emit).toHaveBeenCalledWith(true); - }); - - it('should toggle expanded by clicking on the button', () => { - component.expanded = true; - fixture.detectChanges(); - - const button = fixture.debugElement.query(By.css('[data-automation-id="meta-data-card-toggle-expand"]')); - button.triggerEventHandler('click', {}); - fixture.detectChanges(); - - expect(component.expanded).toBe(false); - }); - - it('should have the proper text on button while collapsed', () => { - component.expanded = false; - fixture.detectChanges(); - - const buttonLabel = fixture.debugElement.query(By.css('[data-automation-id="meta-data-card-toggle-expand-label"]')); - - expect(buttonLabel.nativeElement.innerText.trim()).toBe('ADF_VIEWER.SIDEBAR.METADATA.MORE_INFORMATION'); - }); - - it('should have the proper text on button while collapsed', () => { - component.expanded = true; - fixture.detectChanges(); - - const buttonLabel = fixture.debugElement.query(By.css('[data-automation-id="meta-data-card-toggle-expand-label"]')); - - expect(buttonLabel.nativeElement.innerText.trim()).toBe('ADF_VIEWER.SIDEBAR.METADATA.LESS_INFORMATION'); - }); - it('should hide the edit button in readOnly is true', () => { component.readOnly = true; fixture.detectChanges(); @@ -211,14 +162,6 @@ describe('ContentMetadataCardComponent', () => { expect(getToggleEditButton()).toBeNull(); }); - it('should show the edit button if node does has `update` permissions', () => { - component.readOnly = false; - component.node.allowableOperations = [AllowableOperationsEnum.UPDATE]; - fixture.detectChanges(); - - expect(getToggleEditButton()).not.toBeNull(); - }); - it('should expand the card when custom display aspect is valid', () => { expect(component.expanded).toBeFalsy(); diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.ts index 4522d57b672..6210dbb838e 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.ts +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewEncapsulation } from '@angular/core'; +import { Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core'; import { Node } from '@alfresco/js-api'; import { NodeAspectService } from '../../../aspect-list/services/node-aspect.service'; import { ContentMetadataCustomPanel, PresetConfig } from '../../interfaces/content-metadata.interfaces'; @@ -84,10 +84,6 @@ export class ContentMetadataCardComponent implements OnChanges { @Input() customPanels: ContentMetadataCustomPanel[]; - /** Emitted when content's editable state is changed. */ - @Output() - editableChange = new EventEmitter(); - private _displayDefaultProperties: boolean = true; /** @@ -125,15 +121,6 @@ export class ContentMetadataCardComponent implements OnChanges { this.expanded = !this._displayDefaultProperties; } - toggleEdit(): void { - this.editable = !this.editable; - this.editableChange.emit(this.editable); - } - - toggleExpanded(): void { - this.expanded = !this.expanded; - } - hasAllowableOperations() { return this.contentService.hasAllowableOperations(this.node, AllowableOperationsEnum.UPDATE); } diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata/button-type.enum.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata/button-type.enum.ts new file mode 100644 index 00000000000..9e2275a42eb --- /dev/null +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata/button-type.enum.ts @@ -0,0 +1,24 @@ +/*! + * @license + * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// eslint-disable-next-line no-shadow +export enum ButtonType { + GeneralInfo = 'generalInfo', + Tags = 'tags', + Categories = 'categories', + Group = 'group' +} diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.html b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.html index 783c3c60574..93ea9dfa309 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.html +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.html @@ -3,12 +3,48 @@ [multi]="multi"> + [attr.data-automation-id]="'adf-metadata-group-properties'" + hideToggle + (opened)="toggleGeneralInfoPanel()" + (closed)="toggleGeneralInfoPanel()"> - + + + + - + - {{ 'METADATA.BASIC.TAGS' | translate }} + +
+ +
+
- -
-