Allow editing by fields and set fields value from general fields settings#10524
Allow editing by fields and set fields value from general fields settings#10524Gaetanbrl wants to merge 3 commits intogeosolutions-it:masterfrom
Conversation
b621a17 to
6d110a8
Compare
6d110a8 to
8939de4
Compare
|
The source branch is now rebase / align with master (8e2d443) |
8939de4 to
cb118cd
Compare
Fix karma Toolbar test fix linter
2e885a1 to
bdb8f0e
Compare
| setShowPopoverSync(getApi().getItem("showPopoverSync") !== null && pluginCfg?.showPopoverSync ? getApi().getItem("showPopoverSync") === "true" : pluginCfg?.showPopoverSync); | ||
| } | ||
| }, [props.mode]); | ||
| // const canEditGeometry = props.isEditingAllowed && |
There was a problem hiding this comment.
remove comments
| // const canEditGeometry = props.isEditingAllowed && |
| const layer = getLayerById(store.getState(), selectedLayerIdSelector(store.getState())); | ||
| // force value from fields | ||
| layer.fields.filter(f => f.value && f.source).forEach(f => { | ||
| updated[f.name] = f.value; |
There was a problem hiding this comment.
I wouldn't manipulate and input parameter, rather create a copy of that parameter and update a different one
| return Rx.Observable.of(drawSupportReset()); | ||
| }); | ||
|
|
||
| export const handleFeatureChanges = (action$, store) => action$.ofType(CREATE_NEW_FEATURE, GRID_ROW_UPDATE) |
| fields?.forEach?.((field) => { | ||
| if (field.source) { | ||
| field.value = get(userInfos, field.source) || find(userInfos.attribute, ["name", field.source])?.value; | ||
| field.editable = false; | ||
| } else if (!field.source && field.value) { | ||
| field.value = null; | ||
| field.editable = null; | ||
| } | ||
| }); |
There was a problem hiding this comment.
I think is not ideal to manipulate params like this for a question of Immutability
better to edit a new object and avoid mutation to match generic code style of mapstore. especially for reducers
| })(state); | ||
| return (canEdit || isAllowed) && !isCesium(state); | ||
| }; | ||
| // geometry can be editing according to geom field setting |
There was a problem hiding this comment.
- transform this comment in a jsdoc
- add a test for this selector
| showTitleTooltip: !!option?.description, | ||
| resizable, | ||
| editable, | ||
| editable: field?.editable === false ? false : editable, |
| updated | ||
| }; | ||
| } | ||
| export function gridRowUpdate(features, updated) { |
There was a problem hiding this comment.
- add jsdoc
- this needs a unit test
| }, []); | ||
|
|
||
| const onChange = (name, attribute, value) => { | ||
| const onChange = (name, attribute, value, isGeometryType = false) => { |
There was a problem hiding this comment.
where this 4th parameter being used?
|
Thanks for this review @MV88 . |
|
@Gaetanbrl I'm sorry, this PR is quite old. Do you have plans to re-handle this according to our review above? Otherwise, I would like to close the PR. |
Description
Documentation
Nothing to document without corresponding UI (need fields settings UI enhancement).
Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
Issue
What is the current behavior?
This is new behavior. See issue to get more details.
#10523
#9849
#10658
What is the new behavior?
Breaking change
Does this PR introduce a breaking change? (check one with "x", remove the other)
Other useful information