Templates: replace stringlist with list (BC) (#17654)
This commit is contained in:
parent
11779a6f0a
commit
fd83affb3f
9 changed files with 17 additions and 20 deletions
|
|
@ -168,7 +168,7 @@ export default {
|
|||
return this.type === "Bool";
|
||||
},
|
||||
array() {
|
||||
return this.type === "StringList";
|
||||
return this.type === "List";
|
||||
},
|
||||
select() {
|
||||
return this.validValues.length > 0;
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@
|
|||
<PropertyField
|
||||
id="vehicleParamIdentifiers"
|
||||
v-model="values.identifiers"
|
||||
type="StringList"
|
||||
type="List"
|
||||
property="identifiers"
|
||||
size="w-100"
|
||||
class="me-2"
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ func (c *CmdConfigure) processParams(templateItem *templates.Template, deviceCat
|
|||
}
|
||||
|
||||
switch param.Type {
|
||||
case templates.TypeStringList:
|
||||
case templates.TypeList:
|
||||
values := c.processListInputConfig(param)
|
||||
var nonEmptyValues []string
|
||||
for _, value := range values {
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ params:
|
|||
help:
|
||||
de: "Kann meist erst später eingetragen werden, siehe: https://docs.evcc.io/docs/features/vehicle"
|
||||
en: "Mostly this can be added later, see: https://docs.evcc.io/en/docs/features/vehicle"
|
||||
type: stringlist
|
||||
type: list
|
||||
- name: priority
|
||||
description:
|
||||
de: Priorität
|
||||
|
|
@ -345,13 +345,11 @@ presets:
|
|||
advanced: true
|
||||
- name: identifiers
|
||||
advanced: true
|
||||
type: stringlist
|
||||
- name: priority
|
||||
advanced: true
|
||||
- name: cache
|
||||
default: 15m
|
||||
advanced: true
|
||||
type: duration
|
||||
vehicle-common:
|
||||
params:
|
||||
- name: title
|
||||
|
|
@ -369,7 +367,6 @@ presets:
|
|||
advanced: true
|
||||
- name: identifiers
|
||||
advanced: true
|
||||
type: stringlist
|
||||
- name: priority
|
||||
advanced: true
|
||||
vehicle-features:
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ func (t *Template) RenderDocumentation(product Product, lang string) ([]byte, er
|
|||
}
|
||||
|
||||
switch p.Type {
|
||||
case TypeStringList:
|
||||
case TypeList:
|
||||
for _, e := range v.([]string) {
|
||||
t.Params[index].Values = append(p.Values, yamlQuote(e))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@ const (
|
|||
TypeDuration
|
||||
TypeFloat
|
||||
TypeInt
|
||||
TypeStringList
|
||||
TypeList
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
const _ParamTypeName = "StringBoolChoiceChargeModesDurationFloatIntStringList"
|
||||
const _ParamTypeName = "StringBoolChoiceChargeModesDurationFloatIntList"
|
||||
|
||||
var _ParamTypeIndex = [...]uint8{0, 6, 10, 16, 27, 35, 40, 43, 53}
|
||||
var _ParamTypeIndex = [...]uint8{0, 6, 10, 16, 27, 35, 40, 43, 47}
|
||||
|
||||
const _ParamTypeLowerName = "stringboolchoicechargemodesdurationfloatintstringlist"
|
||||
const _ParamTypeLowerName = "stringboolchoicechargemodesdurationfloatintlist"
|
||||
|
||||
func (i ParamType) String() string {
|
||||
if i < 0 || i >= ParamType(len(_ParamTypeIndex)-1) {
|
||||
|
|
@ -31,10 +31,10 @@ func _ParamTypeNoOp() {
|
|||
_ = x[TypeDuration-(4)]
|
||||
_ = x[TypeFloat-(5)]
|
||||
_ = x[TypeInt-(6)]
|
||||
_ = x[TypeStringList-(7)]
|
||||
_ = x[TypeList-(7)]
|
||||
}
|
||||
|
||||
var _ParamTypeValues = []ParamType{TypeString, TypeBool, TypeChoice, TypeChargeModes, TypeDuration, TypeFloat, TypeInt, TypeStringList}
|
||||
var _ParamTypeValues = []ParamType{TypeString, TypeBool, TypeChoice, TypeChargeModes, TypeDuration, TypeFloat, TypeInt, TypeList}
|
||||
|
||||
var _ParamTypeNameToValueMap = map[string]ParamType{
|
||||
_ParamTypeName[0:6]: TypeString,
|
||||
|
|
@ -51,8 +51,8 @@ var _ParamTypeNameToValueMap = map[string]ParamType{
|
|||
_ParamTypeLowerName[35:40]: TypeFloat,
|
||||
_ParamTypeName[40:43]: TypeInt,
|
||||
_ParamTypeLowerName[40:43]: TypeInt,
|
||||
_ParamTypeName[43:53]: TypeStringList,
|
||||
_ParamTypeLowerName[43:53]: TypeStringList,
|
||||
_ParamTypeName[43:47]: TypeList,
|
||||
_ParamTypeLowerName[43:47]: TypeList,
|
||||
}
|
||||
|
||||
var _ParamTypeNames = []string{
|
||||
|
|
@ -63,7 +63,7 @@ var _ParamTypeNames = []string{
|
|||
_ParamTypeName[27:35],
|
||||
_ParamTypeName[35:40],
|
||||
_ParamTypeName[40:43],
|
||||
_ParamTypeName[43:53],
|
||||
_ParamTypeName[43:47],
|
||||
}
|
||||
|
||||
// ParamTypeString retrieves an enum value from the enum constants string name.
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ func (t *Template) RenderProxyWithValues(values map[string]interface{}, lang str
|
|||
}
|
||||
|
||||
switch p.Type {
|
||||
case TypeStringList:
|
||||
case TypeList:
|
||||
for _, e := range v.([]string) {
|
||||
t.Params[index].Values = append(p.Values, yamlQuote(e))
|
||||
}
|
||||
|
|
@ -240,7 +240,7 @@ func (t *Template) RenderProxyWithValues(values map[string]interface{}, lang str
|
|||
for _, param := range t.Params {
|
||||
if !param.IsRequired() {
|
||||
switch param.Type {
|
||||
case TypeStringList:
|
||||
case TypeList:
|
||||
if len(param.Values) == 0 {
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ type Param struct {
|
|||
// DefaultValue returns a default or example value depending on the renderMode
|
||||
func (p *Param) DefaultValue(renderMode int) interface{} {
|
||||
// return empty list to allow iterating over in template
|
||||
if p.Type == TypeStringList {
|
||||
if p.Type == TypeList {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue