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

#6758 Fixed default custom editors and FeatureEditor config in context #6836

Merged
merged 3 commits into from
May 7, 2021

Conversation

offtherailz
Copy link
Member

@offtherailz offtherailz commented May 6, 2021

Draft for tests that have to be refined/checked

Description

This PR solves the 2 points in this comment #6758 (comment)

  1. Fix wrong import for default custom editors
  2. Fix feature grid options callback issue due to multiple renders of plugins with different properties.
    Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

Issue

What is the current behavior?

#6758

What is the new behavior?

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

For testing:

The problems that caused this PR are 2:

So to test this you can create a context with the DropDownEditor and NumberEditor configured and check (example on dev ).

Trying to open the feature grid in edit mode (logged in as admin) you should be able to

  • edit the attribute type ONLY with the values "FOREST", "MOUNTAIN", "DESERT", "LAKE", "SECRET" without possibility to keep it empty or any pagination in the dropdown.
  • land attribute can not be a negative number

for a complete information and to replicate in other contexts.
The map in the example context contains the layer atlantis:landmarks and has this configuration of Attribute table:

{
 "cfg": {
      "customEditorsOptions": {
        "rules": [{
          "regex": {
            "attribute": "type",
            "typeName": "atlantis:landmarks"
          },
          "editor": "DropDownEditor",
          "editorProps": {
            "values": ["FOREST", "MOUNTAIN", "DESERT", "LAKE", "SECRET"],
            "forceSelection": true,
            "defaultOption": "FOREST",
            "allowEmpty": false
          }
        }, {
          "regex": {
            "attribute": "land",
            "typeName": "atlantis:landmarks"
          },
          "editor": "NumberEditor",
          "editorProps": {
            "minValue": 0
          }
        }]
      }
}

@offtherailz offtherailz added the bug label May 6, 2021
@offtherailz offtherailz requested a review from MV88 May 6, 2021 16:56
@offtherailz offtherailz self-assigned this May 6, 2021
@offtherailz
Copy link
Member Author

@tdipisa didn't put the milestone to this PR (should it be backported, so having a new minor, or not)?

@offtherailz offtherailz marked this pull request as ready for review May 7, 2021 08:02
@coveralls
Copy link

coveralls commented May 7, 2021

Coverage Status

Coverage decreased (-0.01%) to 78.707% when pulling d980af9 on offtherailz:6758 into ae25991 on geosolutions-it:master.

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.

a few comments
the PR is good other than that

componentDidUpdate(oldProps) {
const newOptions = pick(this.props, ['showFilteredObject', 'showTimeSync', 'timeSync', 'customEditorsOptions']);
const oldOptions = pick(oldProps, ['showFilteredObject', 'showTimeSync', 'timeSync', 'customEditorsOptions']);
if (JSON.stringify(newOptions) !== JSON.stringify(oldOptions) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why stringify and not !isEqual or deepEqual from lodash?

Copy link
Member Author

@offtherailz offtherailz May 7, 2021

Choose a reason for hiding this comment

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

I'll replace it with a deepEqual maybe be more robust and predictable.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok :)

@offtherailz offtherailz requested a review from MV88 May 7, 2021 12:44
@offtherailz offtherailz added the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label May 7, 2021
@offtherailz offtherailz added this to the 2021.01.03 milestone May 7, 2021
@geosolutions-it geosolutions-it deleted a comment from offtherailz May 7, 2021
@offtherailz offtherailz merged commit 5ebe564 into geosolutions-it:master May 7, 2021
offtherailz added a commit to offtherailz/MapStore2 that referenced this pull request May 7, 2021
@offtherailz offtherailz removed the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label May 7, 2021
agpenton pushed a commit to agpenton/MapStore2 that referenced this pull request Jul 8, 2021
agpenton pushed a commit to agpenton/MapStore2 that referenced this pull request Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants