From 4a7bd22a6d7dddd91087022357380fb590b5db9e Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Mon, 27 Aug 2018 22:50:57 +0000 Subject: [PATCH] Merged in feature/SHIBUI-797 (pull request #181) SHIBUI-797 Fixed backup file init configuration Approved-by: Shibui Jenkins Approved-by: Ryan Mathis --- .../provider/action/collection.action.ts | 8 ++++ .../provider/effect/collection.effect.ts | 5 ++- .../filebacked-http-common.editor.schema.json | 25 +++-------- .../filebacked-http-common.schema.json | 41 +------------------ 4 files changed, 18 insertions(+), 61 deletions(-) diff --git a/ui/src/app/metadata/provider/action/collection.action.ts b/ui/src/app/metadata/provider/action/collection.action.ts index a58164407..375b851a2 100644 --- a/ui/src/app/metadata/provider/action/collection.action.ts +++ b/ui/src/app/metadata/provider/action/collection.action.ts @@ -6,6 +6,7 @@ export enum ProviderCollectionActionTypes { UPDATE_PROVIDER_REQUEST = '[Metadata Provider] Update Request', UPDATE_PROVIDER_SUCCESS = '[Metadata Provider] Update Success', UPDATE_PROVIDER_FAIL = '[Metadata Provider] Update Fail', + UPDATE_PROVIDER_CONFLICT = '[Metadata Provider] Update Conflict', LOAD_PROVIDER_REQUEST = '[Metadata Provider Collection] Provider Load REQUEST', LOAD_PROVIDER_SUCCESS = '[Metadata Provider Collection] Provider Load SUCCESS', @@ -91,6 +92,12 @@ export class UpdateProviderFail implements Action { constructor(public payload: MetadataProvider) { } } +export class UpdateProviderConflict implements Action { + readonly type = ProviderCollectionActionTypes.UPDATE_PROVIDER_FAIL; + + constructor(public payload: MetadataProvider) { } +} + export class AddProviderRequest implements Action { readonly type = ProviderCollectionActionTypes.ADD_PROVIDER_REQUEST; @@ -195,6 +202,7 @@ export type ProviderCollectionActionsUnion = | UpdateProviderRequest | UpdateProviderSuccess | UpdateProviderFail + | UpdateProviderConflict | SetOrderProviderRequest | SetOrderProviderSuccess | SetOrderProviderFail diff --git a/ui/src/app/metadata/provider/effect/collection.effect.ts b/ui/src/app/metadata/provider/effect/collection.effect.ts index eb6b0af4b..73ce52ea5 100644 --- a/ui/src/app/metadata/provider/effect/collection.effect.ts +++ b/ui/src/app/metadata/provider/effect/collection.effect.ts @@ -19,6 +19,7 @@ import { UpdateProviderRequest, UpdateProviderSuccess, UpdateProviderFail, + UpdateProviderConflict, GetOrderProviderRequest, GetOrderProviderSuccess, GetOrderProviderFail, @@ -44,7 +45,7 @@ export class CollectionEffects { @Effect() openContention$ = this.actions$.pipe( - ofType(ProviderCollectionActionTypes.UPDATE_PROVIDER_FAIL), + ofType(ProviderCollectionActionTypes.UPDATE_PROVIDER_CONFLICT), map(action => action.payload), withLatestFrom(this.store.select(fromProvider.getSelectedProvider)), switchMap(([changes, current]) => @@ -118,7 +119,7 @@ export class CollectionEffects { .update(provider) .pipe( map(p => new UpdateProviderSuccess({id: p.id, changes: p})), - catchError((e) => of(new UpdateProviderFail(provider))) + catchError((e) => e.status === 409 ? of(new UpdateProviderConflict(provider)) : of(new UpdateProviderFail(provider))) ) ) ); diff --git a/ui/src/assets/schema/provider/filebacked-http-common.editor.schema.json b/ui/src/assets/schema/provider/filebacked-http-common.editor.schema.json index ca8ea2646..684a1c13c 100644 --- a/ui/src/assets/schema/provider/filebacked-http-common.editor.schema.json +++ b/ui/src/assets/schema/provider/filebacked-http-common.editor.schema.json @@ -16,11 +16,10 @@ "required": [ "name", "xmlId", - "metadataURL" + "metadataURL", + "backingFile", + "backupFileInitNextRefreshDelay" ], - "dependencies": { - "initializeFromBackupFile": {"required": ["backingFile", "backupFileInitNextRefreshDelay"]} - }, "anyOf": [ { "properties": { @@ -29,11 +28,7 @@ true ] } - }, - "required": [ - "backingFile", - "backupFileInitNextRefreshDelay" - ] + } }, { "properties": { @@ -144,22 +139,12 @@ "title": "Backing File", "description": "Specifies where the backing file is located. If the remote server is unavailable at startup, the backing file is loaded instead.", "type": "string", - "default": "", - "visibleIf": { - "initializeFromBackupFile": [ - true - ] - } + "default": "" }, "backupFileInitNextRefreshDelay": { "title": "Backup File Init Next Refresh Delay", "description": "Delay duration after which to schedule next HTTP refresh when initialized from the backing file.", "type": "string", - "visibleIf": { - "initializeFromBackupFile": [ - true - ] - }, "widget": { "id": "datalist", "data": [ diff --git a/ui/src/assets/schema/provider/filebacked-http-common.schema.json b/ui/src/assets/schema/provider/filebacked-http-common.schema.json index 2b318c44c..eb2dab07e 100644 --- a/ui/src/assets/schema/provider/filebacked-http-common.schema.json +++ b/ui/src/assets/schema/provider/filebacked-http-common.schema.json @@ -11,34 +11,7 @@ "useDefaultPredicateRegistry", "satisfyAnyPredicates" ], - "required": ["xmlId", "metadataURL"], - "dependencies": { - "initializeFromBackupFile": {"required": ["backingFile", "backupFileInitNextRefreshDelay"]} - }, - "anyOf": [ - { - "properties": { - "initializeFromBackupFile": { - "enum": [ - true - ] - } - }, - "required": [ - "backingFile", - "backupFileInitNextRefreshDelay" - ] - }, - { - "properties": { - "initializeFromBackupFile": { - "enum": [ - false - ] - } - } - } - ], + "required": ["xmlId", "metadataURL", "backingFile", "backupFileInitNextRefreshDelay"], "properties": { "xmlId": { "title": "ID", @@ -81,22 +54,12 @@ "title": "Backing File", "description": "Specifies where the backing file is located. If the remote server is unavailable at startup, the backing file is loaded instead.", "type": "string", - "default": "", - "visibleIf": { - "initializeFromBackupFile": [ - true - ] - } + "default": "" }, "backupFileInitNextRefreshDelay": { "title": "Backup File Init Next Refresh Delay", "description": "Delay duration after which to schedule next HTTP refresh when initialized from the backing file.", "type": "string", - "visibleIf": { - "initializeFromBackupFile": [ - true - ] - }, "widget": { "id": "datalist", "data": [