Limit alexa parameter state description options (#1621)

Signed-off-by: jsetton <jeremy.setton@gmail.com>
pull/1624/head
Jeremy 2023-01-04 19:31:39 -05:00 committed by GitHub
parent 2d95ef0e84
commit d915c8aec9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -26,6 +26,8 @@ export const PLAYBACK_OPERATIONS = ['Play', 'Pause', 'Previous', 'Next', 'Rewind
export const PLAYBACK_STEPS = ['PLAY', 'PAUSE', 'STOP', 'START_OVER', 'PREVIOUS', 'NEXT', 'REWIND', 'FAST_FORWARD']
export const STATE_DESCRIPTION_OPTIONS_LIMIT = 150
export const TEMPERATURE_SCALES = ['CELSIUS', 'FAHRENHEIT']
export const THERMOSTAT_MODES = ['OFF', 'HEAT', 'COOL', 'ECO', 'AUTO']

View File

@ -3,6 +3,7 @@ import {
EQUALIZER_MODES,
LANGUAGES,
PLAYBACK_OPERATIONS,
STATE_DESCRIPTION_OPTIONS_LIMIT,
TEMPERATURE_SCALES,
THERMOSTAT_MODES,
UNITS_OF_MEASURE
@ -232,7 +233,8 @@ export default {
stateDescription.options &&
stateDescription.options
.filter((option) => !isNaN(option.value))
.map((option) => `${option.value}=${option.label}`),
.map((option) => `${option.value}=${option.label}`)
.slice(0, STATE_DESCRIPTION_OPTIONS_LIMIT),
placeholder: placeholder.replace(/,/g, '\n'),
multiple: true
}),
@ -356,7 +358,9 @@ export default {
default:
stateDescription &&
stateDescription.options &&
stateDescription.options.map((option) => `${option.value}=${option.label}`),
stateDescription.options
.map((option) => `${option.value}=${option.label}`)
.slice(0, STATE_DESCRIPTION_OPTIONS_LIMIT),
placeholder: placeholder.replace(/,/g, '\n'),
multiple: true,
required: !stateDescription || !stateDescription.options || !stateDescription.options.length
@ -370,7 +374,9 @@ export default {
default:
stateDescription &&
stateDescription.options &&
stateDescription.options.map((option) => `${option.value}=${option.label}`),
stateDescription.options
.map((option) => `${option.value}=${option.label}`)
.slice(0, STATE_DESCRIPTION_OPTIONS_LIMIT),
placeholder: 'Normal=Normal:Cottons\nWhites=Whites',
multiple: true,
required: !stateDescription || !stateDescription.options || !stateDescription.options.length