-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The default catalog changes after the catalog is opened from the background tool #10486 #10586
The default catalog changes after the catalog is opened from the background tool #10486 #10586
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix works, but the code have to be written to be more maintainable and readable.
export function addBackupBackground(background) { | ||
return { | ||
type: ADD_BACKUP_BACKGROUND, | ||
background | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This action stashes the selected catalog, not a backup of the background.
I'd also document to understand what is the parameter accepted (e.g. ID, object....).
So for this action I should use the following:
export function addBackupBackground(background) { | |
return { | |
type: ADD_BACKUP_BACKGROUND, | |
background | |
}; | |
} | |
/** | |
* stashes the current selected catalog to restore after catalog close, when opening | |
* the catalog for background selection | |
* @params ... <--- Insert here the parameter type and name | |
*/ | |
export function stashSelectedCatalogService(service) { | |
return { | |
type: STASH_SELECTED_SERVICE, | |
service | |
}; | |
} |
action$.ofType(ADD_BACKGROUND) | ||
.switchMap(() => Rx.Observable.of( | ||
setControlProperty('metadataexplorer', 'enabled', true), | ||
allowBackgroundsDeletion(false), | ||
addBackupBackground(store.getState().catalog.selectedService), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use selectors when available in this case selectedServiceSelector
in selectors/catalog
.
This helps future refactors (e.g. internal restructuration of state) without having to find around the code all the x.y.z
strings.
web/client/epics/catalog.js
Outdated
return Rx.Observable.of(...([ | ||
setControlProperties('metadataexplorer', "enabled", false, "group", null), | ||
changeCatalogMode("view"), | ||
resetCatalog() | ||
].concat(metadataSource === 'backgroundSelector' ? | ||
[changeSelectedService(head(keys(services))), allowBackgroundsDeletion(true)] : []))); | ||
[changeSelectedService(state.backgroundSelector.backupBackground), allowBackgroundsDeletion(true)] : []))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also in this case, create a selector for that value and use it here.
@@ -25,6 +25,7 @@ export const CLEAR_MODAL_PARAMETERS = 'BACKGROUND_SELECTOR:CLEAR_MODAL_PARAMETER | |||
export const CONFIRM_DELETE_BACKGROUND_MODAL = 'BACKGROUND_SELECTOR:CONFIRM_DELETE_BACKGROUND_MODAL'; | |||
export const ALLOW_BACKGROUNDS_DELETION = 'BACKGROUND_SELECTOR:ALLOW_BACKGROUNDS_DELETION'; | |||
export const SYNC_CURRENT_BACKGROUND_LAYER = 'BACKGROUND_SELECTOR:SYNC_CURRENT_BACKGROUND_LAYER'; | |||
export const ADD_BACKUP_BACKGROUND = 'BACKGROUND_SELECTOR:ADD_BACKUP_BACKGROUND'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const ADD_BACKUP_BACKGROUND = 'BACKGROUND_SELECTOR:ADD_BACKUP_BACKGROUND'; | |
export const ADD_BACKUP_BACKGROUND = 'BACKGROUND_SELECTOR:STASH_SELECTED_SERVICE'; |
@ElenaGallo, could you please test this on DEV ? Thank you |
Test passed, @rowheat02 please backport to 2024.02.xx. Thanks |
Description
While adding the background layer, a backup for the selected catalog service is stored in the backgroundselector store.
And same service is set while closing the Catalog Modal.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x", remove the others)
Issue
What is the current behavior?
#10486
The selected catalog service changes after trying to add a background layer
What is the new behavior?
Selected Catalog service remains same even after trying to add background layer
Breaking change
Does this PR introduce a breaking change? (check one with "x", remove the other)
Other useful information