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

Wps value range #7033

Merged
merged 25 commits into from Apr 30, 2024
Merged

Wps value range #7033

merged 25 commits into from Apr 30, 2024

Conversation

sixlighthouses
Copy link
Contributor

@sixlighthouses sixlighthouses commented Jan 22, 2024

What this PR does

Fixes #6897

Implement AllowedValue Range with DefaultValue Support for WPS Parameters

This PR introduces support for allowed value ranges in the Web Processing Service (WPS) parameters. This feature allows users to specify a minimum and maximum value for number types of parameters in WPS and have those honoured in the input parameters rendered by Terria

This feature will improve the user experience by providing more control over the input parameters and preventing errors due to values outside of the acceptable range.

            <Input minOccurs="1" maxOccurs="1">
                <ows:Identifier>KeelDepth</ows:Identifier>
                <ows:Title>Keel Depth</ows:Title>
                <ows:Abstract>Draft of the landing boat</ows:Abstract>
                <LiteralData>
                <ows:DataType ows:reference="http://www.w3.org/TR/xmlschema-2/#float">float</ows:DataType>
                <ows:AllowedValues>
                <ows:Range>
                <ows:MinimumValue>1.0</ows:MinimumValue>
                <ows:MaximumValue>10.0</ows:MaximumValue>
                </ows:Range>
                </ows:AllowedValues>
                <ows:AnyValue/>
                <DefaultValue>5.0</DefaultValue>
                </LiteralData>
            </Input>

Renders the following

image

Test me

Test branch at http://ci.terria.io/wps-value-range
If you do not have a WPS available with the required parameters, let me know I have a mock wps server that allows for testing

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated relevant documentation in doc/.
  • I've updated CHANGES.md with what I changed.
  • I've provided instructions in the PR description on how to test this PR.

@sixlighthouses sixlighthouses marked this pull request as ready for review January 23, 2024 23:22
@sppigot
Copy link
Contributor

sppigot commented Mar 8, 2024

Thanks @sixlighthouses - could you point me at your mock wps please? CORS getting in the way here.

@sixlighthouses
Copy link
Contributor Author

ProcessDescriptionCsiro.zip
@sppigot attached zip with flask app that I use to mock wps.
I just run it with
flask --app app run --host=0.0.0.0

then I can use
http://172.23.177.140:5000/wps

in the add web data input for terria

image

@na9da
Copy link
Collaborator

na9da commented Apr 18, 2024

@sixlighthouses - just doing a quick pass - great start.

A couple of behaviors that would be nice to add.

  1. Currently the field is shown in red and doesn't allow the user to submit the form even if a default value is present.
  2. The field should be invalid if the user enters a value outside the range and should show appropriate message when that happens.

Can discuss how we might be able to implement them.

@sixlighthouses
Copy link
Contributor Author

@na9da I added an overridden isValid check to NumberParameter and also a rangeDescription to add the should be between min max text in the input label. Please have a look when you get a chance
image

Copy link
Collaborator

@na9da na9da left a comment

Choose a reason for hiding this comment

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

Looks good @sixlighthouses . Ready to merge 🚀

@sixlighthouses sixlighthouses merged commit acc1834 into main Apr 30, 2024
9 checks passed
@sixlighthouses sixlighthouses deleted the wps-value-range branch April 30, 2024 03:27
staffordsmith83 pushed a commit that referenced this pull request May 9, 2024
* refactor the DateTimeParameterEditor to be a functional component

* add the proptypes check to appease the tests

* format and minor code tidy

* update CHANGES.MD

* add the currentTime from timelineStack as the default date time in WPS params

* no need to set dateValue when declaring it with useState

* Add a NumberParameterEditor to allow for the setting of a min-max range

* make NumberParameterEditor a functional component and add the DefaultValue from WPS as the initial value

* update CHANGES.MD

* add entry to CHANGES

* set default on load and override isValid in NumberParameter

* undo ParameterEditor change

* run prettier checks

* add rangeDescription check to ParameterEditor

* use super.isValid in NumberParameter

* remove scss button style and implement PR feedback for NumberParameter

* fix type issue

* update CHANGES

* remove changes to DateTimeParameters.jsx from this branch and reset CHANGES

* remove entries from CHANGES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WPS: allowedValues and defaultValue support for WPS Input LiteralData
3 participants