Skip to content

Allow editing by fields and set fields value from general fields settings#10524

Open
Gaetanbrl wants to merge 3 commits intogeosolutions-it:masterfrom
geo2france:g2f-field-editable-autovalue
Open

Allow editing by fields and set fields value from general fields settings#10524
Gaetanbrl wants to merge 3 commits intogeosolutions-it:masterfrom
geo2france:g2f-field-editable-autovalue

Conversation

@Gaetanbrl
Copy link
Contributor

@Gaetanbrl Gaetanbrl commented Aug 30, 2024

Description

This pull request is link to
#10523
#9849
#10658
https://groups.google.com/g/mapstore-developers/c/D717X0rzQHQ
https://groups.google.com/g/mapstore-developers/c/JuZuElj19yg
https://groups.google.com/g/mapstore-developers/c/d2QwLpXEHZI

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?

  • Feature

Issue

What is the current behavior?

This is new behavior. See issue to get more details.

#10523
#9849
#10658

What is the new behavior?

  • ability to manage field editing independently
  • ability to get a field from user info (e.g name get name)
  • Ability to restrict geometric editing to certain groups (editors will only be able to modify attributes).

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

Other useful information

@Gaetanbrl Gaetanbrl force-pushed the g2f-field-editable-autovalue branch from b621a17 to 6d110a8 Compare August 30, 2024 10:37
@tdipisa tdipisa linked an issue Aug 30, 2024 that may be closed by this pull request
1 task
@tdipisa tdipisa requested review from offtherailz and tdipisa August 30, 2024 13:36
@tdipisa tdipisa added this to the 2025.01.00 milestone Aug 30, 2024
@Gaetanbrl Gaetanbrl force-pushed the g2f-field-editable-autovalue branch from 6d110a8 to 8939de4 Compare October 29, 2024 09:55
@Gaetanbrl
Copy link
Contributor Author

The source branch is now rebase / align with master (8e2d443)

@Gaetanbrl Gaetanbrl force-pushed the g2f-field-editable-autovalue branch from 8939de4 to cb118cd Compare November 7, 2024 15:05
@Gaetanbrl Gaetanbrl changed the title Editable fields - get feature field value from user infos Allow editing by fields and set fields value from general fields settings Nov 7, 2024
Fix karma Toolbar test

fix linter
Copy link
Contributor

@MV88 MV88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see inline comments

setShowPopoverSync(getApi().getItem("showPopoverSync") !== null && pluginCfg?.showPopoverSync ? getApi().getItem("showPopoverSync") === "true" : pluginCfg?.showPopoverSync);
}
}, [props.mode]);
// const canEditGeometry = props.isEditingAllowed &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

Suggested change
// 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add jsdoc?

Comment on lines +24 to +32
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;
}
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • transform this comment in a jsdoc
  • add a test for this selector

showTitleTooltip: !!option?.description,
resizable,
editable,
editable: field?.editable === false ? false : editable,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a test for this

updated
};
}
export function gridRowUpdate(features, updated) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • add jsdoc
  • this needs a unit test

}, []);

const onChange = (name, attribute, value) => {
const onChange = (name, attribute, value, isGeometryType = false) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where this 4th parameter being used?

@Gaetanbrl
Copy link
Contributor Author

Thanks for this review @MV88 .
I've been away for a while, I'll have a look as soon as I can.

@tdipisa tdipisa modified the milestones: 2025.01.00, 2025.02.00 Jun 12, 2025
@tdipisa tdipisa removed this from the 2025.02.00 milestone Nov 4, 2025
@tdipisa
Copy link
Member

tdipisa commented Jan 20, 2026

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants