Skip to content

Commit

Permalink
[Gauge plugin] Addresses identified issues (nasa#6593)
Browse files Browse the repository at this point in the history
fix: OK button not properly disabling when data is invalid

note: (implementation works around the broken validation mechanism)
  • Loading branch information
TheFuturist32 committed Apr 12, 2024
1 parent 82ac311 commit 4c00e1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/api/forms/components/FormRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,13 @@ export default {
valid = regex.test(data.value);
}
const validate = data.model.validate;
if (valid && validate) {
valid = validate(data);
if (data.isValid !== undefined && data.isValid !== null && !data.isValid) {
return false;
} else {
const validate = data.model.validate;
if (valid && validate) {
valid = validate(data);
}
}
return Boolean(valid);
Expand Down
7 changes: 6 additions & 1 deletion src/plugins/gauge/components/GaugeFormController.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ export default {
min: this.min,
max: this.max,
limitLow: this.limitLow,
limitHigh: this.limitHigh
limitHigh: this.limitHigh,
isValid: true
};
if (event) {
Expand All @@ -132,6 +133,10 @@ export default {
this.model.validate(data, (valid) => {
Object.entries(valid).forEach(([key, isValid]) => {
if (!isValid) {
data.isValid = false;
}
const element = this.$refs[key];
const reqIndicatorElement = element.parentElement.querySelector('.req-indicator');
reqIndicatorElement.classList.toggle('invalid', !isValid);
Expand Down

0 comments on commit 4c00e1c

Please sign in to comment.