Skip to content

Commit

Permalink
SHIBUI-1352 fixed provider selection issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Jul 11, 2019
1 parent 61ea922 commit 5dcf0ea
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 62 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
{
"type": "object",
"required": [
"name",
"@type",
"xmlId",
"metadataURL",
"metadataRequestURLConstructionScheme"
],
"properties": {
"name": {
"title": "label.metadata-provider-name-dashboard-display-only",
"description": "tooltip.metadata-provider-name-dashboard-display-only",
"type": "string",
"widget": {
"id": "string",
"help": "message.must-be-unique"
}
},
"@type": {
"title": "label.metadata-provider-type",
"description": "tooltip.metadata-provider-type",
"placeholder": "label.select-metadata-type",
"type": "string",
"readOnly": true,
"widget": {
"id": "select",
"disabled": true
},
"oneOf": [
{
"enum": [
"DynamicHttpMetadataResolver"
],
"description": "value.dynamic-http-metadata-provider"
}
]
},
"enabled": {
"title": "label.enable-provider-upon-saving",
"description": "tooltip.enable-provider-upon-saving",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
],
"properties": {
"name": {
"title": "label.service-provider-name-dashboard-display-only",
"description": "tooltip.metadata-provider-name",
"title": "label.metadata-provider-name-dashboard-display-only",
"description": "tooltip.metadata-provider-name-dashboard-display-only",
"type": "string",
"widget": {
"id": "string",
Expand All @@ -29,7 +29,7 @@
"oneOf": [
{
"enum": [
"FileSystemMetadataResolver"
"FilesystemMetadataResolver"
],
"description": "value.file-system-metadata-provider"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
],
"properties": {
"name": {
"title": "label.metadata-provider-name-display-only",
"description": "tooltip.metadata-provider-name-display-only",
"title": "label.metadata-provider-name-dashboard-display-only",
"description": "tooltip.metadata-provider-name-dashboard-display-only",
"type": "string",
"widget": {
"id": "string",
Expand All @@ -29,9 +29,9 @@
"oneOf": [
{
"enum": [
"FileSystemMetadataResolver"
"LocalDynamicMetadataResolver"
],
"description": "value.file-system-metadata-provider"
"description": "value.local-dynamic-metadata-provider"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ClearEditor } from '../action/editor.action';

export class ProviderSelectComponent implements OnDestroy {
actionsSubscription: Subscription;
providerSubscription: Subscription;

provider$: Observable<MetadataProvider>;

Expand All @@ -31,11 +32,9 @@ export class ProviderSelectComponent implements OnDestroy {
map(params => new SelectProviderRequest(params.providerId))
).subscribe(store);

this.provider$ = this.store.select(fromProviders.getSelectedProvider).pipe(filter(p => {
return p;
}));
this.provider$ = this.store.select(fromProviders.getSelectedProvider).pipe(filter(p => !!p));

this.provider$.subscribe(provider => {
this.providerSubscription = this.provider$.subscribe(provider => {
this.setDefinition(provider);
});
}
Expand All @@ -50,6 +49,7 @@ export class ProviderSelectComponent implements OnDestroy {

ngOnDestroy() {
this.actionsSubscription.unsubscribe();
this.providerSubscription.unsubscribe();
this.store.dispatch(new ClearProvider());
this.store.dispatch(new ClearWizard());
this.store.dispatch(new ClearEditor());
Expand Down
33 changes: 31 additions & 2 deletions ui/src/app/metadata/provider/model/dynamic-http.provider.form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export const DynamicHttpMetadataProviderWizard: Wizard<DynamicHttpMetadataProvid
...BaseMetadataProviderEditor,
label: 'DynamicHttpMetadataProvider',
type: 'DynamicHttpMetadataResolver',
bindings: {},
formatter: (changes: DynamicHttpMetadataProvider) => {
let base = BaseMetadataProviderEditor.formatter(changes);
if (base.dynamicMetadataResolverAttributes) {
Expand Down Expand Up @@ -136,13 +135,43 @@ export const DynamicHttpMetadataProviderEditor: Wizard<DynamicHttpMetadataProvid
index: 1,
initialValues: [],
fields: [
'name',
'@type',
'xmlId',
'metadataRequestURLConstructionScheme',
'enabled',
'requireValidMetadata',
'failFastInitialization'
],
order: ['xmlId', 'metadataRequestURLConstructionScheme', 'enabled', 'requireValidMetadata', 'failFastInitialization']
fieldsets: [
{
type: 'section',
class: ['mb-3'],
fields: [
'name',
'@type'
]
},
{
type: 'group-lg',
class: ['col-12'],
fields: [
'xmlId',
'metadataRequestURLConstructionScheme',
'enabled',
'requireValidMetadata',
'failFastInitialization'
]
}
],
override: {
'@type': {
type: 'string',
readOnly: true,
widget: 'string',
oneOf: [{ enum: ['DynamicHttpMetadataResolver'], description: 'value.dynamic-http-metadata-provider' }]
}
}
},
{
id: 'dynamic',
Expand Down
5 changes: 2 additions & 3 deletions ui/src/app/metadata/provider/reducer/collection.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ export const initialState: CollectionState = adapter.getInitialState({
export function reducer(state = initialState, action: ProviderCollectionActionsUnion): CollectionState {
switch (action.type) {
case ProviderCollectionActionTypes.SELECT_PROVIDER_SUCCESS: {
return {
return adapter.addOne(action.payload, {
...state,
selectedProviderId: action.payload.resourceId
};
});
}

case ProviderCollectionActionTypes.LOAD_PROVIDER_SUCCESS: {
return adapter.addAll(action.payload, {
...state,
Expand Down
49 changes: 3 additions & 46 deletions ui/src/assets/schema/provider/filebacked-http.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,59 +15,16 @@
],
"required": [
"name",
"@type",
"xmlId",
"metadataURL",
"backingFile",
"backupFileInitNextRefreshDelay"
],
"anyOf": [
{
"properties": {
"initializeFromBackupFile": {
"enum": [
true
]
}
}
},
{
"properties": {
"initializeFromBackupFile": {
"enum": [
false
]
}
}
}
],
"fieldsets": [
{
"type": "section",
"fields": [
"name",
"@type",
"enabled"
]
},
{
"type": "group-lg",
"fields": [
"xmlId",
"metadataURL",
"initializeFromBackupFile",
"backingFile",
"backupFileInitNextRefreshDelay",
"requireValidMetadata",
"failFastInitialization",
"useDefaultPredicateRegistry",
"satisfyAnyPredicates"
]
}
],
"properties": {
"name": {
"title": "label.metadata-provider-name",
"description": "tooltip.metadata-provider-name",
"title": "label.metadata-provider-name-dashboard-display-only",
"description": "tooltip.metadata-provider-name-dashboard-display-only",
"type": "string",
"widget": {
"id": "string",
Expand Down

0 comments on commit 5dcf0ea

Please sign in to comment.