Skip to content
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

[FeatureEditor] - Allow editing by fields #9849

Open
1 of 6 tasks
Gaetanbrl opened this issue Dec 28, 2023 · 4 comments · May be fixed by #10524
Open
1 of 6 tasks

[FeatureEditor] - Allow editing by fields #9849

Gaetanbrl opened this issue Dec 28, 2023 · 4 comments · May be fixed by #10524
Assignees

Comments

@Gaetanbrl
Copy link
Contributor

Gaetanbrl commented Dec 28, 2023

ref PR #10524

Description

According to the new Fields UI, it could be usefull to manage edition by fields.

This could be an answer to this use case :

As data manager (e.g natural area)
I need to use a configuration from fields UI
to allow some reporters to complete the land use value but prevent them to change assigned operator

Many way exists to do that.

I propose first to manage this by customEditorOptions in order to use regeEx control on field name. Then, editors can catch the props and affect editable value (true/false).

Next, I imagine in a second time to manage this type of configuration by the new fields UI. This requires to create a new columns in Fields table but it could be less good than expected. So, another way to do that in fields is to create a "settings" button by fields to open a modal and display many options as allowEdit and future improvements (i will create new ones).

I know that geoserver will always allow edition if someone use Qgis with the correct credentials, but we have many cases where basic user profile just use mapstore and needs to be regulated.

What kind of improvement you want to add? (check one with "x", remove the others)

  • Minor changes to existing features
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

Other useful information

Please, share your point of view and technical advices according to mapstore2 good practices and possibility.

@Gaetanbrl Gaetanbrl changed the title Allow editing by fields [FeatureEditor] - Allow editing by fields Dec 28, 2023
@Gaetanbrl
Copy link
Contributor Author

Gaetanbrl commented Jan 2, 2024

Currently, if we add editable prop by field for FeatureEditor plugin, this not works fine because editor mode can be activate from each other editable column.

By default, react-data-grid seems correctly check that field is editable or not and need a dble click to open cell editor view.
Here a native example where only 2/3 cols are editable :

https://codepen.io/gaetanbrl/pen/OJqyZzQ

Here mapstore example where NOM column have editable: false prop but user can always edit if editor is activated from other column :

reactdatagrid

Maybe MapStore2 gridEvents (or other code) is not compliant with this dev and needs to be change (i will analyse that now).

@Gaetanbrl
Copy link
Contributor Author

Gaetanbrl commented Jan 2, 2024

@offtherailz do you know why cell editor still open when we click on other cell ? is this what you want ?

@Gaetanbrl
Copy link
Contributor Author

Gaetanbrl commented Jan 5, 2024

I found 2 others alternatives.

Solution - Use disabled props on each Editor

tested and works fine

This solution needs to change Editor code to insert disabled property if the column is not editable.

render() {
return (<input
{...this.props.inputProps}
style={!this.state.validated || this.state.isValid ? {} : {
borderColor: 'red'

Here, the nom field is disabled and cursor show red circle on hover (ease to understand by all users) :

image

Solution - Return null Editor

tested and works fine

The solution needs to change Editor code to render null if the column is not editable.

Here, the nom field is not editable :

editableRenderNull

Here an Editor (<input>) code example for this solution :

image

@Gaetanbrl
Copy link
Contributor Author

According to https://groups.google.com/g/mapstore-developers/c/D717X0rzQHQ

This issue will include possibility to edit geometry or not.

The pull request will contains more details.

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

Successfully merging a pull request may close this issue.

3 participants