Skip to content

Commit

Permalink
Gauge bug fix nasa#6593: Value range and limit indicators and button …
Browse files Browse the repository at this point in the history
…disable if value is invalid
  • Loading branch information
sinisam92 committed Apr 20, 2023
1 parent 2820237 commit 18498af
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/api/forms/components/FormRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@ export default {
&& data.value !== '';
}
if (this.row.required && !valid) {
if (this.row.required && !valid
|| data.min < 0
|| data.max < data.min
|| data.limitLow < data.min
|| data.limitHigh > data.max
|| data.limitLow > data.limitHigh) {
return false;
}
Expand Down
9 changes: 5 additions & 4 deletions src/plugins/gauge/GaugePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export default function () {
"configuration",
"gaugeController"
],
validate: ({ value }, callback) => {
validate: (value, callback) => {
if (value.isUseTelemetryLimits) {
return true;
}
Expand All @@ -145,11 +145,11 @@ export default function () {
limitHigh: true
};

if (min === '') {
if (min === '' || min < 0) {
valid.min = false;
}

if (max === '') {
if (max === '' || limitHigh > max) {
valid.max = false;
}

Expand All @@ -159,7 +159,8 @@ export default function () {
}

if (limitLow !== '') {
valid.limitLow = min <= limitLow && limitLow < max;
valid.limitLow = min <= limitLow || limitLow >= limitHigh;

}

if (limitHigh !== '') {
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/gauge/components/GaugeFormController.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ export default {
methods: {
onChange(event) {
let data = {
model: {}
model: {},
min: this.min,
max: this.max,
limitLow: this.limitLow,
limitHigh: this.limitHigh
};
if (event) {
Expand Down

0 comments on commit 18498af

Please sign in to comment.