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

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

fxprunayre
Copy link
Member

@fxprunayre fxprunayre commented May 15, 2024

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/8d457643-38ce-4df7-8dd2-414902862a0e

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

@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

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarCloud

@fxprunayre fxprunayre modified the milestones: 4.4.5, 4.4.6 Jun 3, 2024
Copy link

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarCloud

@joachimnielandt
Copy link
Collaborator

Retested latest changes - still working fine on my end! @fxprunayre

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 209a4f9 to 3af8717 Compare September 11, 2024 15:45
Copy link

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarCloud

@josegar74
Copy link
Member

Some comments:

  1. With the editor snippet, I get the button twice:
  <views>
    <view name="default" default="true"
          class="gn-label-above-input gn-indent-bluescale">
...
      <tab id="default" default="true" mode="flat">
        <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>
      </tab>
...

buttons

  1. Loading in the editor the example metadata, takes ages and from time to time I get this:
Error at xsl:if on line 434 of form-builder.xsl:
  org.springframework.web.context.request.async.AsyncRequestNotUsableException:
  ServletOutputStream failed to write: null
2024-10-10T15:33:39,653 ERROR [geonetwork] - org.springframework.web.context.request.async.AsyncRequestNotUsableException: ServletOutputStream failed to write: null
net.sf.saxon.trans.XPathException: org.springframework.web.context.request.async.AsyncRequestNotUsableException: ServletOutputStream failed to write: null
	at net.sf.saxon.event.XMLEmitter.writeAttribute(XMLEmitter.java:477) ~[saxon-9.1.0.8b-patch.jar:?]
	at net.sf.saxon.event.HTMLEmitter.writeAttribute(HTMLEmitter.java:234) ~[saxon-9.1.0.8b-patch.jar:?]
	at net.sf.saxon.event.XMLEmitter.attribute(XMLEmitter.java:394) ~[saxon-9.1.0.8b-patch.jar:?]

I think this is not related to the pull request, but more to the backend. Not very ready to manage huge metadata records.

  1. Selecting a value doesn't change anything. The new value is not selected in the select box and the form fields are not updated.

@fxprunayre
Copy link
Member Author

With the editor snippet, I get the button twice:

No need to customize the editor, the default editor will display the selector and allows to switch from one table to another.

@fxprunayre fxprunayre modified the milestones: 4.4.6, 4.4.7 Oct 24, 2024
@CLAassistant
Copy link

CLAassistant commented Dec 8, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

Copy link
Member

@josegar74 josegar74 left a comment

Choose a reason for hiding this comment

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

With the metadata provided, it works, but it is really slow. Loading the form / selecting a feature type or saving it, takes about 35 seconds on my computer.

I don't know if it's a problem with my computer or it's just that slow, but I guess without the changes it would be worse.

@fxprunayre fxprunayre merged commit 2432dc9 into main Dec 16, 2024
10 of 11 checks passed
@fxprunayre fxprunayre deleted the 44-featurecatalogue-selector branch December 16, 2024 11:59
@fxprunayre
Copy link
Member Author

I don't know if it's a problem with my computer or it's just that slow, but I guess without the changes it would be worse.

Yes on some cases we are producing huge forms and at some point it can be slow or fails to save (eg. #7998). So it is not your computer!

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.

4 participants