From ea7211a0bcc74820aebf009cb1a8dc074195971e Mon Sep 17 00:00:00 2001 From: Vincent Fiduccia Date: Tue, 22 Jun 2021 23:32:56 -0700 Subject: [PATCH] Generic reference[type] question support (#3304) --- components/Questions/Reference.vue | 103 +++++++++++++++++++++++++++++ components/Questions/Secret.vue | 40 ----------- components/Questions/index.vue | 27 +++++--- mixins/labeled-form-element.js | 2 +- 4 files changed, 122 insertions(+), 50 deletions(-) create mode 100644 components/Questions/Reference.vue delete mode 100644 components/Questions/Secret.vue diff --git a/components/Questions/Reference.vue b/components/Questions/Reference.vue new file mode 100644 index 0000000000..6543075948 --- /dev/null +++ b/components/Questions/Reference.vue @@ -0,0 +1,103 @@ + + + diff --git a/components/Questions/Secret.vue b/components/Questions/Secret.vue deleted file mode 100644 index 3646f4b94d..0000000000 --- a/components/Questions/Secret.vue +++ /dev/null @@ -1,40 +0,0 @@ - - - diff --git a/components/Questions/index.vue b/components/Questions/index.vue index 420602f0cc..2215dd8811 100644 --- a/components/Questions/index.vue +++ b/components/Questions/index.vue @@ -11,17 +11,24 @@ import IntType from './Int'; import FloatType from './Float'; import ArrayType from './Array'; import MapType from './Map'; +import ReferenceType from './Reference'; export const knownTypes = { - string: StringType, - hostname: StringType, // @TODO - multiline: StringType, - password: StringType, - boolean: BooleanType, - enum: EnumType, - int: IntType, - float: FloatType, - map: MapType, + string: StringType, + hostname: StringType, // @TODO + multiline: StringType, + password: StringType, + boolean: BooleanType, + enum: EnumType, + int: IntType, + float: FloatType, + map: MapType, + reference: ReferenceType, + configmap: ReferenceType, + secret: ReferenceType, + storageclass: ReferenceType, + pvc: ReferenceType, + // storageclass // pvc // secret @@ -34,6 +41,8 @@ export function componentForQuestion(q) { return ArrayType; } else if ( q.type.startsWith('map[') ) { // Same, only works with map[string|multiline] return MapType; + } else if ( q.type.startsWith('reference[') ) { // Same, only works with map[string|multiline] + return ReferenceType; } return 'string'; diff --git a/mixins/labeled-form-element.js b/mixins/labeled-form-element.js index 50e3da325f..3ed0549b7c 100644 --- a/mixins/labeled-form-element.js +++ b/mixins/labeled-form-element.js @@ -51,7 +51,7 @@ export default { }, placeholder: { - type: String, + type: [String, Number], default: '' },