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
feat(new-resource-form): make visible the required prop fields (DSP-1115) #342
Conversation
Note that we currently need to use yalc in order to use a change made in UI to complete this task. |
The asterisks next to required fields seems to work well as well as submitting forms with non-required fields not filled out. I can still click on the "save" button when a required field is not filled out which was planned for. However it results in a console error and nothing is presented to the user. I think it would be good if we could somehow jump to the first required field that the user didn't fill out in this case. |
I will try this tuto: Medium - How to scroll to the first invalid control once a form has been submitted |
…riable instead of false
...kspace/resource/resource-instance-form/select-properties/select-properties.component.spec.ts
Outdated
Show resolved
Hide resolved
@@ -65,6 +72,23 @@ export class SelectPropertiesComponent implements OnInit { | |||
); | |||
} | |||
|
|||
isPropRequired(propId: string): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make more sense for this method to return a boolean in case we need this logic for other booleans in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in 7858d95
|
||
// check the cardinality to know if the prop is required or not | ||
this.isPropRequired(prop.id); | ||
this.propertyValuesKeyValuePair[prop.id + '-cardinality'] = [this.isRequiredProp ? 1 : 0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment explaining why we are adding this to the KeyValuePair?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in f131477
// console.log('createValueComponent', this.createValueComponent); | ||
// this.saveNewValue(); | ||
// convert from boolean (1/0) to boolean (true/false) | ||
this.isRequiredProp = !!+this.isRequiredProp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can explain why this is necessary (Input provided by KeyValuePair is stored as a number)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in fb3a064
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
resolves DSP-1115
the PR must be reviewed with the main unpublished version of dsp-ui using yalc