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

Feature catalogue / Add table of content of feature types #8041

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fxprunayre
Copy link
Member

A feature catalogue can contain one or more feature types description. When describing a model with lots of feature types, then the editor can be quite large (and then can cause issue related to timeout or number of fields)

A good example https://metadata.vlaanderen.be/srv/dut/catalog.search#/metadata/f1e77b4f-a174-4e2d-9af7-fe7f548b5a5c

The problem is quite similar to #7998 (ie. timeout, number of form fields).

To better manage this case, make a list of existing feature types and user can click on it to edit only one feature type at a time.

Configuration

This is enable by default for ISO19110 and ISO19115-3 feature catalogue in all views. The first table is selected by default.

A selector could also be manually configured using the following:

          <section name="gfc:featureType">
            <select name="Select a feature type"
                    xpath="/gfc:FC_FeatureCatalogue/gfc:featureType"
                    parameter="featureType"
                    value="*/gfc:typeName/gco:LocalName/text()"
                    layout="dropdown"/>
                    <!--tabs|pills|dropdown-->

            <section xpath="/gfc:FC_FeatureCatalogue/gfc:featureType[
                                    */gfc:typeName/gco:LocalName = $p2/featureType
                                    or (not($p2/featureType) and position() = 1)
                                    or ($p3 = 'md.format.html')]"
                     or="featureType"
                     in="/gfc:FC_FeatureCatalogue"/>
          </section>

$p2 correspond to the variable request and $p3 to the service in the XSL template (see base-variables.xsl and evaluate.xsl). So if there is no featureType parameter, the first feature type will be displayed. If the view mode is md.format.html, all feature types will be displayed.

It has only been tested for feature catalogue but can be probably reuse in other places eg. conformity

Layout

  • Dropdown (default)

image

  • Tabs

image

  • Pills

image

Other changes

  • Avoid JS error on large forms by using JQuery empty() instead of find and remove:
RangeError: Maximum call stack size exceeded
    at Sizzle.select (jquery-2.2.4.js?v=dc93b22fa65aadfbbe3d7ad69b4d5d83601574de:2592:12)
    at Function.Sizzle [as find] (jquery-2.2.4.js?v=dc93b22fa65aadfbbe3d7ad69b4d5d83601574de:869:9)
    at jQuery.fn.init.find (jquery-2.2.4.js?v=dc93b22fa65aadfbbe3d7ad69b4d5d83601574de:2792:11)
    at refreshForm (EditorService.js:324:42)
  • ISO19110 to ISO19115-3 conversion / Convert cardinality to CharacterString

Checklist

  • I have read the contribution guidelines
  • Pull request provided for main branch, backports managed with label
  • Good housekeeping of code, cleaning up comments, tests, and documentation
  • Clean commit history broken into understandable chucks, avoiding big commits with hundreds of files, cautious of reformatting and whitespace changes
  • Clean commit messages, longer verbose messages are encouraged
  • API Changes are identified in commit messages
  • Testing provided for features or enhancements using automatic tests
  • User documentation provided for new features or enhancements in manual
  • Build documentation provided for development instructions in README.md files
  • Library management using pom.xml dependency management. Update build documentation with intended library use and library tutorials or documentation

Funded by Vlaanderen

@fxprunayre fxprunayre added this to the 4.4.5 milestone May 15, 2024
Copy link
Collaborator

@joachimnielandt joachimnielandt left a comment

Choose a reason for hiding this comment

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

Tested locally and seems to work fine. The only thing that is confusing for users now is that when starting with an empty set of featureTypes, the dropdown is populated with an empty string when adding a featureType. This occurs as well when adding more afterwards (below are three featureTypes, the third one is empty and displayed as a collapsed).

image

@fxprunayre fxprunayre force-pushed the 44-featurecatalogue-selector branch from d250d68 to 6331bfb Compare May 15, 2024 12:50
@fxprunayre
Copy link
Member Author

The only thing that is confusing for users now is that when starting with an empty set of featureTypes, the dropdown is populated with an empty string when adding a featureType.

Indeed. Adding a "-" for now when the feature type name is not set. What do you think?

image

A feature catalogue can contain one or more feature types description.
When describing a model with lots of feature types, then the editor can be quite large (and then can cause issue related to timeout or number of fields)

The problem is quite similar to #7998 (ie. timeout, number of form fields).

To better manage this case, make a list of existing feature types and user can click on it to edit only one feature type at a time.

This is enable by default for ISO19110 and ISO19115-3 feature catalogue
in all views. The first table is selected by default.

A selector can be manually configured using the following:

```xml
          <section name="gfc:featureType">
            <select name="Select a feature type"
                    xpath="/gfc:FC_FeatureCatalogue/gfc:featureType"
                    parameter="featureType"
                    value="*/gfc:typeName/gco:LocalName/text()"
                    layout="dropdown"/>
                    <!--tabs|pills|dropdown-->

            <section xpath="/gfc:FC_FeatureCatalogue/gfc:featureType[
                                    */gfc:typeName/gco:LocalName = $p2/featureType
                                    or (not($p2/featureType) and position() = 1)
                                    or ($p3 = 'md.format.html')]"
                     or="featureType"
                     in="/gfc:FC_FeatureCatalogue"/>
          </section>
```

`$p2` correspond to the variable `request` and `$p3` to the `service` in the XSL template (see `base-variables.xsl` and `evaluate.xsl`).
So if there is no `featureType` parameter, the first feature type will be displayed.
If the view mode is `md.format.html`, all feature types will be displayed.

It has only been tested for feature catalogue but can be probably reuse
in other places eg. conformity

* Dropdown (default)

* Tabs

* Pills

* Avoid JS error on large forms by using JQuery `empty()` instead of
find and remove:

```
RangeError: Maximum call stack size exceeded
    at Sizzle.select (jquery-2.2.4.js?v=dc93b22fa65aadfbbe3d7ad69b4d5d83601574de:2592:12)
    at Function.Sizzle [as find] (jquery-2.2.4.js?v=dc93b22fa65aadfbbe3d7ad69b4d5d83601574de:869:9)
    at jQuery.fn.init.find (jquery-2.2.4.js?v=dc93b22fa65aadfbbe3d7ad69b4d5d83601574de:2792:11)
    at refreshForm (EditorService.js:324:42)
```

* ISO19110 to ISO19115-3 conversion / Convert cardinality to
  CharacterString
@fxprunayre fxprunayre force-pushed the 44-featurecatalogue-selector branch from 6331bfb to e6eac01 Compare May 15, 2024 13:16
@fxprunayre
Copy link
Member Author

After discussion, adding a placeholder for empty feature type name

image

Copy link

sonarcloud bot commented May 15, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

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

Successfully merging this pull request may close these issues.

None yet

2 participants