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

Allow array index in VALUE widget #1332

Merged
merged 3 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ SCREEN AUTO AUTO 1.0
VERTICAL
TITLE "<%= target_name %> Instrument Array Data"
ARRAY <%= target_name %> HEALTH_STATUS ARY
LABELVALUE <%= target_name %> HEALTH_STATUS ARY[0] RAW
LABELVALUE <%= target_name %> HEALTH_STATUS ARY[1] WITH_UNITS
ARRAY <%= target_name %> HEALTH_STATUS ARY 300 65 nil 8 FORMATTED
ARRAY <%= target_name %> HEALTH_STATUS ARY2 300 65 nil 5 WITH_UNITS
TEXTBOX <%= target_name %> HEALTH_STATUS ARY 200 65
TEXTBOX <%= target_name %> HEALTH_STATUS ARY2 300 200
TEXTBOX <%= target_name %> HEALTH_STATUS ARY2 300 65
ARRAY <%= target_name %> HEALTH_STATUS GROUND1STATUS 300 65 nil 8 FORMATTED
ARRAY <%= target_name %> HEALTH_STATUS GROUND2STATUS 300 65 nil 5 WITH_UNITS
END
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ SCREEN AUTO AUTO 1.0
VERTICAL
TITLE "<%= target_name %> Instrument Array Data"
ARRAY <%= target_name %> HEALTH_STATUS ARY
LABELVALUE <%= target_name %> HEALTH_STATUS ARY[0] RAW
LABELVALUE <%= target_name %> HEALTH_STATUS ARY[1] WITH_UNITS
ARRAY <%= target_name %> HEALTH_STATUS ARY 300 65 nil 8 FORMATTED
ARRAY <%= target_name %> HEALTH_STATUS ARY2 300 65 nil 5 WITH_UNITS
TEXTBOX <%= target_name %> HEALTH_STATUS ARY 200 65
TEXTBOX <%= target_name %> HEALTH_STATUS ARY2 300 200
TEXTBOX <%= target_name %> HEALTH_STATUS ARY2 300 65
ARRAY <%= target_name %> HEALTH_STATUS GROUND1STATUS 300 65 nil 8 FORMATTED
ARRAY <%= target_name %> HEALTH_STATUS GROUND2STATUS 300 65 nil 5 WITH_UNITS
END
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default {
grayLevel: 80,
grayRate: 5,
valueId: null,
arrayIndex: null,
viewDetails: false,
contextMenuShown: false,
x: 0,
Expand Down Expand Up @@ -96,8 +97,17 @@ export default {
// See store.js for how this is set
if (this.screen) {
if (this.screen.screenValues[this.valueId]) {
this.curValue = this.screen.screenValues[this.valueId][0]
if (
this.arrayIndex !== null &&
this.screen.screenValues[this.valueId][0]
) {
this.curValue =
this.screen.screenValues[this.valueId][0][this.arrayIndex]
} else {
this.curValue = this.screen.screenValues[this.valueId][0]
}
}
// }
} else {
this.curValue = null
}
Expand Down Expand Up @@ -190,6 +200,11 @@ export default {
created() {
// If they're not passing us the value and limitsState we have to register
if (this.value === null || this.limitsState === null) {
if (this.parameters[2].includes('[')) {
let match = this.parameters[2].match(/\[(\d+)\]/)
this.arrayIndex = parseInt(match[1])
this.parameters[2] = this.parameters[2].replace(match[0], '')
}
this.valueId = `${this.parameters[0]}__${this.parameters[1]}__${
this.parameters[2]
}__${this.getType()}`
Expand Down
Loading