diff --git a/backend/src/integration/resources/SHIBUI-1335-1.side b/backend/src/integration/resources/SHIBUI-1335-1.side index d9a790f3c..f38eac2ce 100644 --- a/backend/src/integration/resources/SHIBUI-1335-1.side +++ b/backend/src/integration/resources/SHIBUI-1335-1.side @@ -118,7 +118,7 @@ ], "value": "" }, { - "id": "7d9109bb-f3b5-4d74-864e-5c647e90c9e4", + "id": "352f066f-c2af-4735-81b1-5440ba7a3432", "comment": "", "command": "waitForElementVisible", "target": "id=/xmlId", @@ -1359,14 +1359,10 @@ }, { "id": "c28d683a-552d-4752-aa89-465e33d60887", "comment": "", - "command": "waitForElementVisible", - "target": "css=tr:nth-child(2) > .td-lg:nth-child(4)", - "targets": [ - ["css=tr:nth-child(2) > .td-lg:nth-child(4)", "css:finder"], - ["xpath=//tr[2]/td[4]", "xpath:position"], - ["xpath=//td[contains(.,'NameIDFormat')]", "xpath:innerText"] - ], - "value": "10000" + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "100902ee-6d6e-4148-a69b-b37746a4ad6e", "comment": "", @@ -1388,6 +1384,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "febfcea8-8f72-4a17-b1a8-b1e323c8cced", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "c9d498da-9f59-40ae-b5d4-cae397a13766", "comment": "", @@ -1409,6 +1412,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "4fdc2334-0b93-4f4c-b44e-80656f808f6d", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "441608df-24a3-4a60-bfce-50a90ff0ee16", "comment": "", diff --git a/backend/src/integration/resources/SHIBUI-1335-2.side b/backend/src/integration/resources/SHIBUI-1335-2.side index 3a1c51b24..88ef75013 100644 --- a/backend/src/integration/resources/SHIBUI-1335-2.side +++ b/backend/src/integration/resources/SHIBUI-1335-2.side @@ -691,10 +691,10 @@ }, { "id": "eca1d3dd-9e47-49d2-b4a1-a45c2b6c8c3a", "comment": "", - "command": "waitForElementVisible", - "target": "css=tr:nth-child(1) > .td-lg:nth-child(4)", + "command": "pause", + "target": "2000", "targets": [], - "value": "10000" + "value": "" }, { "id": "d722902b-5c10-45dc-99df-d96f46e78313", "comment": "", @@ -716,6 +716,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "d25400e1-127e-4b8c-b7e2-ade937cfd5a0", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "d7909094-96ce-4532-98b4-446cc013c9c8", "comment": "", diff --git a/backend/src/integration/resources/SHIBUI-1335-3.side b/backend/src/integration/resources/SHIBUI-1335-3.side index f85088621..865b8aa0e 100644 --- a/backend/src/integration/resources/SHIBUI-1335-3.side +++ b/backend/src/integration/resources/SHIBUI-1335-3.side @@ -785,10 +785,10 @@ }, { "id": "455e24c1-5093-4da3-a62d-457bbf0cd5db", "comment": "", - "command": "waitForElementVisible", - "target": "css=tr:nth-child(2) > .td-lg:nth-child(4)", + "command": "pause", + "target": "2000", "targets": [], - "value": "10000" + "value": "" }, { "id": "9f7e95cf-4dd5-415f-8577-a6f1bc54a85d", "comment": "", @@ -810,6 +810,13 @@ ["xpath=//td[contains(.,'NameIDFormat')]", "xpath:innerText"] ], "value": "NameIDFormat" + }, { + "id": "81970d9d-2892-4b42-ba56-ba1a14f453d2", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "63ac7307-0538-4c0d-8e98-2f05c767baaf", "comment": "", diff --git a/backend/src/integration/resources/SHIBUI-1335-4.side b/backend/src/integration/resources/SHIBUI-1335-4.side index 8ffe35e98..e20483cf2 100644 --- a/backend/src/integration/resources/SHIBUI-1335-4.side +++ b/backend/src/integration/resources/SHIBUI-1335-4.side @@ -914,7 +914,7 @@ "id": "77dfeb05-38e3-4ef8-9566-06e7597d464c", "comment": "", "command": "click", - "target": "css=.btn-primary > translate-i18n", + "target": "css=.btn-primary", "targets": [ ["css=.btn-primary > translate-i18n", "css:finder"], ["xpath=//div/button/translate-i18n", "xpath:position"], @@ -924,10 +924,10 @@ }, { "id": "f79371b5-0081-45a0-bfb3-c403db903043", "comment": "", - "command": "waitForElementVisible", - "target": "css=tr:nth-child(1) > .td-lg:nth-child(4)", + "command": "pause", + "target": "2000", "targets": [], - "value": "10000" + "value": "" }, { "id": "a8ed628c-53f7-4551-9ce8-fef976cc96ce", "comment": "", @@ -938,6 +938,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "6b3ec8f1-8b9a-40f5-816f-3a1e415b9d8d", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "be805934-2692-4a1c-a28f-afb3cc4eb5f4", "comment": "", @@ -959,6 +966,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "403570ff-e1f0-4db9-925f-f90c5994b60e", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "8f2da627-e8ad-473a-a71a-bec5dd1f0999", "comment": "", diff --git a/backend/src/integration/resources/SHIBUI-1392.side b/backend/src/integration/resources/SHIBUI-1392.side index 8a2bf4d1b..a0a5b5b55 100644 --- a/backend/src/integration/resources/SHIBUI-1392.side +++ b/backend/src/integration/resources/SHIBUI-1392.side @@ -349,6 +349,13 @@ ["xpath=//a[contains(.,'Script')]", "xpath:innerText"] ], "value": "" + }, { + "id": "786cd3cb-46b2-4361-b449-8f679ff97135", + "comment": "", + "command": "waitForElementPresent", + "target": "id=/nameIdFormatFilterTarget.target", + "targets": [], + "value": "10000" }, { "id": "dcf31546-0976-44ae-9ffc-c29a5255d646", "comment": "", @@ -366,13 +373,7 @@ "comment": "", "command": "editContent", "target": "id=/nameIdFormatFilterTarget.target", - "targets": [ - ["id=/nameIdFormatFilterTarget.target", "id"], - ["css=#\\/nameIdFormatFilterTarget\\.target", "css:finder"], - ["xpath=//p[@id='/nameIdFormatFilterTarget.target']", "xpath:attributes"], - ["xpath=//p", "xpath:position"], - ["xpath=//p[contains(.,'eval(true)')]", "xpath:innerText"] - ], + "targets": [], "value": "eval(true)" }, { "id": "05870356-d3db-4540-bb3f-db34b1cf65f1", @@ -380,9 +381,19 @@ "command": "sendKeys", "target": "id=/nameIdFormatFilterTarget.target", "targets": [], - "value": ";" + "value": "${KEY_END};" }, { - "id": "b544a0b1-fc04-4dc3-8a11-5769500e5503", + "id": "d7721254-68c9-4140-af2a-1757cce99da7", + "comment": "", + "command": "click", + "target": "css=.section-body", + "targets": [ + ["css=.section-body", "css:finder"], + ["xpath=//section/div[2]", "xpath:position"] + ], + "value": "" + }, { + "id": "ed6eb266-04f0-4517-b874-ea1d0ba68441", "comment": "", "command": "click", "target": "css=#\\/filterEnabled\\.parent > .custom-control-label", @@ -436,7 +447,7 @@ }, { "id": "ad613704-0718-4b83-97f1-b49897f510eb", "comment": "", - "command": "waitForElementEditable", + "command": "waitForElementVisible", "target": "id=/nameIdFormatFilterTarget.target", "targets": [], "value": "10000" @@ -452,7 +463,7 @@ ["xpath=//p", "xpath:position"], ["xpath=//p[contains(.,'eval(true)')]", "xpath:innerText"] ], - "value": "eval(true)" + "value": "eval(true);" }] }], "suites": [{ diff --git a/ui/src/app/metadata/configuration/action/configuration.action.ts b/ui/src/app/metadata/configuration/action/configuration.action.ts index 78e834eea..8a12d47c8 100644 --- a/ui/src/app/metadata/configuration/action/configuration.action.ts +++ b/ui/src/app/metadata/configuration/action/configuration.action.ts @@ -12,10 +12,11 @@ export enum ConfigurationActionTypes { LOAD_XML_SUCCESS = '[Metadata Configuration] Load XML Success', LOAD_XML_ERROR = '[Metadata Configuration] Load XML Error', - SET_METADATA = '[Metadata Configuration] Set Metadata Model', + SET_METADATA = '[Metadata Configuration] Set Metadata Attributes', SET_DEFINITION = '[Metadata Configuration] Set Metadata Definition', SET_SCHEMA = '[Metadata Configuration] Set Metadata Schema', SET_XML = '[Metadata Configuration] Set Metadata Xml', + SET_METADATA_MODEL = '[Metadata Configuration] Set Metadata Model', DOWNLOAD_XML = '[Metadata Configuration] Download Metadata Xml', @@ -61,7 +62,13 @@ export class LoadXmlError implements Action { export class SetMetadata implements Action { readonly type = ConfigurationActionTypes.SET_METADATA; - constructor(public payload: { id: string, type: string }) { } + constructor(public payload: { id: string, type: string, version?: string }) { } +} + +export class SetMetadataModel implements Action { + readonly type = ConfigurationActionTypes.SET_METADATA_MODEL; + + constructor(public payload: Metadata) { } } export class SetDefinition implements Action { diff --git a/ui/src/app/metadata/configuration/action/restore.action.ts b/ui/src/app/metadata/configuration/action/restore.action.ts new file mode 100644 index 000000000..48861c35e --- /dev/null +++ b/ui/src/app/metadata/configuration/action/restore.action.ts @@ -0,0 +1,36 @@ +import { Action } from '@ngrx/store'; +import { Metadata } from '../../domain/domain.type'; + +export enum RestoreActionTypes { + SELECT_VERSION_SUCCESS = '[Restore Version] Select Version Success', + SELECT_VERSION_ERROR = '[Restore Version] Select Version Error', + SELECT_VERSION_REQUEST = '[Restore Version] Select Version Request', + CLEAR_VERSION = '[Restore Version] Clear Versions' +} + +export class SelectVersionRestoreRequest implements Action { + readonly type = RestoreActionTypes.SELECT_VERSION_REQUEST; + + constructor(public payload: { type: string, id: string, version: string }) { } +} + +export class SelectVersionRestoreSuccess implements Action { + readonly type = RestoreActionTypes.SELECT_VERSION_SUCCESS; + + constructor(public payload: Metadata) { } +} +export class SelectVersionRestoreError implements Action { + readonly type = RestoreActionTypes.SELECT_VERSION_ERROR; + + constructor(public payload: any) { } +} + +export class ClearVersionRestore implements Action { + readonly type = RestoreActionTypes.CLEAR_VERSION; +} + +export type RestoreActionsUnion = + | SelectVersionRestoreRequest + | SelectVersionRestoreError + | SelectVersionRestoreSuccess + | ClearVersionRestore; diff --git a/ui/src/app/metadata/configuration/component/history-list.component.html b/ui/src/app/metadata/configuration/component/history-list.component.html index db658f453..ff4599b91 100644 --- a/ui/src/app/metadata/configuration/component/history-list.component.html +++ b/ui/src/app/metadata/configuration/component/history-list.component.html @@ -5,7 +5,6 @@ Select Version - Version Save Date Changed By Actions @@ -21,12 +20,19 @@ - Current (v{{ history.length - i }}) - v{{ history.length - (i) }} - {{ version.date | date:DATE_FORMAT }} + + + + {{ version.date | date:DATE_FORMAT }}  + + (Current) + + + + {{ version.creator }} - diff --git a/ui/src/app/metadata/configuration/component/history-list.component.spec.ts b/ui/src/app/metadata/configuration/component/history-list.component.spec.ts index 3c191c300..35fcbe68d 100644 --- a/ui/src/app/metadata/configuration/component/history-list.component.spec.ts +++ b/ui/src/app/metadata/configuration/component/history-list.component.spec.ts @@ -4,6 +4,7 @@ import { MockI18nModule } from '../../../../testing/i18n.stub'; import { HistoryListComponent } from './history-list.component'; import { MetadataHistory } from '../model/history'; import { MetadataVersion } from '../model/version'; +import { RouterTestingModule } from '@angular/router/testing'; export const TestData = { versions: [ @@ -37,7 +38,8 @@ describe('Metadata History List Component', () => { TestBed.configureTestingModule({ providers: [], imports: [ - MockI18nModule + MockI18nModule, + RouterTestingModule ], declarations: [ HistoryListComponent, diff --git a/ui/src/app/metadata/configuration/configuration.module.ts b/ui/src/app/metadata/configuration/configuration.module.ts index fa395529b..c55e24051 100644 --- a/ui/src/app/metadata/configuration/configuration.module.ts +++ b/ui/src/app/metadata/configuration/configuration.module.ts @@ -30,6 +30,8 @@ import { FilterConfigurationListComponent } from './component/filter-configurati import { FilterConfigurationListItemComponent } from './component/filter-configuration-list-item.component'; import { SharedModule } from '../../shared/shared.module'; import { FilterTargetPropertyComponent } from './component/filter-target-property.component'; +import { RestoreComponent } from './container/restore.component'; +import { RestoreVersionEffects } from './effect/restore.effect'; @NgModule({ declarations: [ @@ -47,7 +49,8 @@ import { FilterTargetPropertyComponent } from './component/filter-target-propert MetadataComparisonComponent, FilterConfigurationListComponent, FilterConfigurationListItemComponent, - FilterTargetPropertyComponent + FilterTargetPropertyComponent, + RestoreComponent ], entryComponents: [], imports: [ @@ -82,7 +85,8 @@ export class MetadataConfigurationModule { [ MetadataConfigurationEffects, MetadataHistoryEffects, - CompareVersionEffects + CompareVersionEffects, + RestoreVersionEffects ]) ], providers: [] diff --git a/ui/src/app/metadata/configuration/configuration.routing.ts b/ui/src/app/metadata/configuration/configuration.routing.ts index 0a77b0c2b..dc3f5df99 100644 --- a/ui/src/app/metadata/configuration/configuration.routing.ts +++ b/ui/src/app/metadata/configuration/configuration.routing.ts @@ -4,6 +4,7 @@ import { MetadataOptionsComponent } from './container/metadata-options.component import { MetadataXmlComponent } from './container/metadata-xml.component'; import { MetadataHistoryComponent } from './container/metadata-history.component'; import { MetadataComparisonComponent } from './container/metadata-comparison.component'; +import { RestoreComponent } from './container/restore.component'; export const ConfigurationRoutes: Routes = [ { @@ -29,6 +30,10 @@ export const ConfigurationRoutes: Routes = [ { path: 'compare', component: MetadataComparisonComponent + }, + { + path: 'restore', + component: RestoreComponent } ] } diff --git a/ui/src/app/metadata/configuration/container/configuration.component.html b/ui/src/app/metadata/configuration/container/configuration.component.html index 53f8fa697..89d017139 100644 --- a/ui/src/app/metadata/configuration/container/configuration.component.html +++ b/ui/src/app/metadata/configuration/container/configuration.component.html @@ -13,11 +13,6 @@ -

- Source - Provider - Configuration -

diff --git a/ui/src/app/metadata/configuration/container/configuration.component.ts b/ui/src/app/metadata/configuration/container/configuration.component.ts index 4c06d7f9d..d8c0234c6 100644 --- a/ui/src/app/metadata/configuration/container/configuration.component.ts +++ b/ui/src/app/metadata/configuration/container/configuration.component.ts @@ -2,14 +2,13 @@ import { Component, ChangeDetectionStrategy, OnDestroy, HostListener } from '@an import { ActivatedRoute, Router, Scroll, Event } from '@angular/router'; import { takeUntil, map, withLatestFrom, filter, timeout, delay } from 'rxjs/operators'; import { Store } from '@ngrx/store'; -import { Observable, Subject, interval } from 'rxjs'; +import { Observable, Subject, interval, combineLatest } from 'rxjs'; import * as fromConfiguration from '../reducer'; import { ClearConfiguration, SetMetadata } from '../action/configuration.action'; import { LoadHistoryRequest, ClearHistory, SelectVersion } from '../action/history.action'; import * as fromReducer from '../reducer'; -import { ViewportScroller } from '@angular/common'; @Component({ selector: 'configuration-page', @@ -27,9 +26,17 @@ export class ConfigurationComponent implements OnDestroy { private store: Store, private routerState: ActivatedRoute ) { - this.routerState.params.pipe( + + combineLatest( + this.routerState.params, + this.routerState.queryParams + ).pipe( takeUntil(this.ngUnsubscribe), - map(params => new SetMetadata({id: params.id, type: params.type})) + map(([{ id, type }, { version }]) => new SetMetadata({ + id, + type, + version + })) ).subscribe(store); this.routerState.params.pipe( @@ -38,20 +45,14 @@ export class ConfigurationComponent implements OnDestroy { ).subscribe(store); this.store.select(fromReducer.getVersionCollection).pipe( + filter(collection => collection && collection.length > 0), takeUntil(this.ngUnsubscribe), withLatestFrom( this.routerState.queryParams ), - map(([collection, params]) => { - if (collection && collection.length) { - return params.version || collection[0].id; - } - return null; - }) + map(([collection, params]) => params.version || collection && collection.length ? collection[0].id : null) ).subscribe(version => { - if (version) { - this.store.dispatch(new SelectVersion(version)); - } + this.store.dispatch(new SelectVersion(version)); }); this.name$ = this.store.select(fromReducer.getConfigurationModelName); diff --git a/ui/src/app/metadata/configuration/container/metadata-comparison.component.html b/ui/src/app/metadata/configuration/container/metadata-comparison.component.html index d5b533716..7117b7bf6 100644 --- a/ui/src/app/metadata/configuration/container/metadata-comparison.component.html +++ b/ui/src/app/metadata/configuration/container/metadata-comparison.component.html @@ -1,3 +1,9 @@ +

+ Compare + Source + Provider + Configuration +

+ Version History +
+ (compare)="compareVersions($event)" + (restore)="restoreVersion($event)">
diff --git a/ui/src/app/metadata/configuration/container/metadata-history.component.ts b/ui/src/app/metadata/configuration/container/metadata-history.component.ts index c49e0c70f..17f2c3caa 100644 --- a/ui/src/app/metadata/configuration/container/metadata-history.component.ts +++ b/ui/src/app/metadata/configuration/container/metadata-history.component.ts @@ -44,4 +44,13 @@ export class MetadataHistoryComponent { } ); } + + restoreVersion(version: MetadataVersion): void { + this.router.navigate( + [ '../', 'restore' ], + { + relativeTo: this.route + } + ); + } } diff --git a/ui/src/app/metadata/configuration/container/metadata-options.component.html b/ui/src/app/metadata/configuration/container/metadata-options.component.html index 972e0e4da..ebed36bf3 100644 --- a/ui/src/app/metadata/configuration/container/metadata-options.component.html +++ b/ui/src/app/metadata/configuration/container/metadata-options.component.html @@ -1,3 +1,8 @@ +

+ Source + Provider + Configuration +