Skip to content

Commit

Permalink
Fix geosolutions-it#10201 clearing correctly details and showing only…
Browse files Browse the repository at this point in the history
… if they are different from NODATA (geosolutions-it#10221)

* Fix geosolutions-it#10201 clearing correctly details and showing only if they are different from NODATA

* Fix panel close after deleting details
  • Loading branch information
MV88 authored Apr 19, 2024
1 parent 6c207db commit 4ab1550
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default ({
onDelete={() => {
setDetailsBackup(savedDetailsText);
onUpdateLinkedResource('details', 'NODATA', 'DETAILS');
onUpdateResource('attributes.detailsSettings', {});
}}/>
<DetailsSheet
loading={loading}
Expand Down
4 changes: 3 additions & 1 deletion web/client/epics/details.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
closeDetailsPanel
} from '../actions/details';
import { toggleControl, setControlProperty } from '../actions/controls';
import { SAVE_MAP_RESOURCE } from '../actions/maps';
import { SAVE_DASHBOARD } from '../actions/dashboard';

import {
mapIdSelector
Expand Down Expand Up @@ -55,7 +57,7 @@ export const fetchDataForDetailsPanel = (action$, store) =>
});

export const closeDetailsPanelEpic = (action$) =>
action$.ofType(CLOSE_DETAILS_PANEL, LOCATION_CHANGE)
action$.ofType(CLOSE_DETAILS_PANEL, LOCATION_CHANGE, SAVE_MAP_RESOURCE, SAVE_DASHBOARD)
.switchMap(() => Rx.Observable.from( [
setControlProperty("details", "enabled", false)
])
Expand Down
4 changes: 2 additions & 2 deletions web/client/plugins/Details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default createPlugin('Details', {
action: openDetailsPanel,
selector: (state) => {
const detailsUri = detailsUriSelector(state);
if (detailsUri) {
if (detailsUri && detailsUri !== 'NODATA') {
return {};
}
return { style: {display: "none"} };
Expand Down Expand Up @@ -149,7 +149,7 @@ export default createPlugin('Details', {
action: openDetailsPanel,
selector: (state) => {
const detailsUri = detailsUriSelector(state);
if (detailsUri) {
if (detailsUri && detailsUri !== 'NODATA') {
return {
bsStyle: state.controls.details && state.controls.details.enabled ? 'primary' : 'tray',
active: state.controls.details && state.controls.details.enabled || false
Expand Down

0 comments on commit 4ab1550

Please sign in to comment.