From 522aae9209550ac0acc3168a40d154f10366c399 Mon Sep 17 00:00:00 2001 From: samiul Date: Fri, 26 Jun 2026 16:08:11 +0600 Subject: [PATCH 1/2] fix db roles forms to form-builder Signed-off-by: samiul --- .../ui/create-ui.yaml | 129 +++++------ .../ui/functions.js | 212 +++++++++--------- .../ui/create-ui.yaml | 129 +++++------ .../ui/functions.js | 212 +++++++++--------- .../ui/create-ui.yaml | 129 +++++------ .../ui/functions.js | 212 +++++++++--------- .../ui/create-ui.yaml | 151 +++++-------- .../ui/functions.js | 212 +++++++++--------- .../ui/create-ui.yaml | 129 +++++------ .../ui/functions.js | 212 +++++++++--------- 10 files changed, 850 insertions(+), 877 deletions(-) diff --git a/charts/enginekubevaultcom-elasticsearchrole-editor/ui/create-ui.yaml b/charts/enginekubevaultcom-elasticsearchrole-editor/ui/create-ui.yaml index ea00a86940..e2eb762364 100644 --- a/charts/enginekubevaultcom-elasticsearchrole-editor/ui/create-ui.yaml +++ b/charts/enginekubevaultcom-elasticsearchrole-editor/ui/create-ui.yaml @@ -1,73 +1,62 @@ -steps: -- form: - elements: - - fetch: getDatabases|core.k8s.appscode.com|v1alpha1|genericresources - if: isConsole - label: - text: labels.selectDb - refresh: true - required: true - schema: - $ref: discriminator#/properties/database - sortable: true - type: select - - computed: setRoleName - label: - text: metadata.name - required: true - schema: - $ref: schema#/properties/metadata/properties/name +step: +- elements: + - if: + name: isConsole + type: function + label: Select Database + loader: getDatabases|core.k8s.appscode.com|v1alpha1|genericresources + refresh: true + schema: temp/properties/database + sortable: true + type: select + validation: + type: required + - label: Name + schema: schema/properties/metadata/properties/name + type: input + validation: + type: required + watcher: + func: setRoleName + paths: + - schema/properties/spec/properties/secretEngineRef/properties/name + - disable: true + if: + name: isDbSelected + type: function + init: + type: func + value: getDbNamespace + label: Namespace + schema: schema/properties/metadata/properties/namespace + type: input + - if: + name: isDbSelected + type: function + label: Select SecretEngine + loader: getEngines|engine.kubevault.com|v1alpha1|secretengines + refresh: true + schema: schema/properties/spec/properties/secretEngineRef/properties/name + type: select + validation: + type: required + - label: Default TTL + schema: schema/properties/spec/properties/defaultTTL + type: input + - label: Max TTL + schema: schema/properties/spec/properties/maxTTL + type: input + - element: + label: Statement type: input - - computed: getDbNamespace - disabled: true - if: isDbSelected - label: - text: metadata.namespace - schema: - $ref: schema#/properties/metadata/properties/namespace + label: Creation Statement + schema: schema/properties/spec/properties/creationStatements + type: array-item-form + - element: + label: Statement type: input - - fetch: getEngines|engine.kubevault.com|v1alpha1|secretengines - if: isDbSelected - label: - text: labels.selectEngine - refresh: true - required: true - schema: - $ref: schema#/properties/spec/properties/secretEngineRef/properties/name - type: select - - label: - text: spec.defaultTTL - schema: - $ref: schema#/properties/spec/properties/defaultTTL - type: input - - label: - text: spec.maxTTL - schema: - $ref: schema#/properties/spec/properties/maxTTL - type: input - - element: - label: - text: labels.statement - schema: - $ref: schema#/properties/spec/properties/creationStatements/items - type: input - label: - text: spec.creation - schema: - $ref: schema#/properties/spec/properties/creationStatements - type: list-input-form - - element: - label: - text: labels.statement - schema: - $ref: schema#/properties/spec/properties/revocationStatements/items - type: input - label: - text: spec.revocation - schema: - $ref: schema#/properties/spec/properties/revocationStatements - type: list-input-form - type: single-step-form - id: basic - title: Create ElasicSearchRole + label: Revocation Statement + schema: schema/properties/spec/properties/revocationStatements + type: array-item-form + type: single-step-form type: multi-step-form diff --git a/charts/enginekubevaultcom-elasticsearchrole-editor/ui/functions.js b/charts/enginekubevaultcom-elasticsearchrole-editor/ui/functions.js index 842d7377a8..38a2dcbb4f 100644 --- a/charts/enginekubevaultcom-elasticsearchrole-editor/ui/functions.js +++ b/charts/enginekubevaultcom-elasticsearchrole-editor/ui/functions.js @@ -1,113 +1,123 @@ -function isConsole({ storeGet }) { - const owner = storeGet('/route/params/user') - const path = storeGet('/route/path') - const prefix = `/${owner}/kubernetes` - if (path.startsWith(prefix)) return true - return false -} +const { ref, computed, axios, watch, useOperator, store } = window.vueHelpers || {} -async function getDatabases({ axios, storeGet }, group, version, resource) { - const owner = storeGet('/route/params/user') || '' - const cluster = storeGet('/route/params/cluster') || '' - if (isConsole({ storeGet })) { - try { - const resp = await axios.get( - `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, - { - params: { - convertToTable: true, - labelSelector: 'k8s.io/group=kubedb.com', - }, - }, - ) +export const useFunc = (model) => { + const { getValue, setDiscriminatorValue, commit, storeGet, discriminator } = useOperator( + model, + store.state, + ) - const resources = (resp && resp.data && resp.data.rows) || [] + function isConsole() { + const owner = storeGet('/route/params/user') + const path = storeGet('/route/path') + const prefix = `/${owner}/kubernetes` + if (path.startsWith(prefix)) return true + return false + } - resources.map((item) => { - const name = (item.cells && item.cells[0].data) || '' - const namespace = (item.cells?.length > 0 && item.cells[1].data) || '' - const resource = (item.cells?.length > 1 && item.cells[2].data) || '' - item.text = name - item.value = { - name: name, - namespace: namespace, - resource: resource, - } - return true - }) - const filteredResources = resources.filter( - (item) => item.value.resource.toLowerCase() === 'elasticsearch', - ) - return filteredResources - } catch (e) { - console.log(e) - return [] - } - } else return [] -} + async function getDatabases(group, version, resource) { + const owner = storeGet('/route/params/user') || '' + const cluster = storeGet('/route/params/cluster') || '' + if (isConsole()) { + try { + const resp = await axios.get( + `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, + { + params: { + convertToTable: true, + labelSelector: 'k8s.io/group=kubedb.com', + }, + }, + ) -function isDbSelected({ getValue, storeGet, discriminator, watchDependency }) { - if (!isConsole({ storeGet })) return true - watchDependency('discriminator#/database') - const val = getValue(discriminator, '/database') || {} - return val && val.name ? true : false -} + const resources = (resp && resp.data && resp.data.rows) || [] -function setRoleName({ watchDependency, getValue, model }) { - watchDependency('model#/spec/secretEngineRef/name') - const engineName = getValue(model, '/spec/secretEngineRef/name') || '' - const timestamp = `${Math.floor(Date.now() / 1000)}` - return engineName ? `${engineName}-role-${timestamp}` : engineName -} + resources.map((item) => { + const name = (item.cells && item.cells[0].data) || '' + const namespace = (item.cells?.length > 0 && item.cells[1].data) || '' + const resource = (item.cells?.length > 1 && item.cells[2].data) || '' + item.text = name + item.value = { + name: name, + namespace: namespace, + resource: resource, + } + return true + }) + const filteredResources = resources.filter( + (item) => item.value.resource.toLowerCase() === 'elasticsearch', + ) + return filteredResources + } catch (e) { + console.log(e) + return [] + } + } else return [] + } -function getDbNamespace({ getValue, storeGet, discriminator, watchDependency }) { - if (isConsole({ storeGet })) { - watchDependency('discriminator#/database') - const data = getValue(discriminator, '/database') || {} - return (data && data.namespace) || '' - } else { - const namespace = storeGet('/route/query/namespace') || '' - return namespace + function isDbSelected() { + if (!isConsole()) return true + // watchDependency('discriminator#/database') + const val = getValue(discriminator, '/database') || {} + return val && val.name ? true : false } -} -async function getEngines({ axios, storeGet, getValue, discriminator }, group, version, resource) { - const owner = storeGet('/route/params/user') || '' - const cluster = storeGet('/route/params/cluster') || '' - const dbValue = getValue(discriminator, '/database') || {} - const dbName = storeGet('/route/params/name') || dbValue.name || '' - const dbNamespace = storeGet('/route/query/namespace') || dbValue.namespace || '' - if (dbName) { - try { - const resp = await axios.get( - `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, - ) + function setRoleName() { + // watchDependency('model#/spec/secretEngineRef/name') + const engineName = getValue(model, '/spec/secretEngineRef/name') || '' + const timestamp = `${Math.floor(Date.now() / 1000)}` + + return engineName ? `${engineName}-role-${timestamp}` : engineName + } - const resources = (resp && resp.data && resp.data.items) || [] - const filteredResources = resources.filter( - (item) => - item.spec?.elasticsearch?.databaseRef?.name === dbName && - item.spec?.elasticsearch?.databaseRef?.namespace === dbNamespace, - ) - filteredResources.map((item) => { - const name = (item.metadata && item.metadata.name) || '' - item.text = name - item.value = name - return true - }) - return filteredResources - } catch (e) { - console.log(e) - return [] + function getDbNamespace() { + if (isConsole()) { + // watchDependency('discriminator#/database') + const data = getValue(discriminator, '/database') || {} + return (data && data.namespace) || '' + } else { + const namespace = storeGet('/route/query/namespace') || '' + return namespace } - } else return [] -} + } -return { - isConsole, - getDatabases, - isDbSelected, - setRoleName, - getDbNamespace, - getEngines, + async function getEngines(group, version, resource) { + const owner = storeGet('/route/params/user') || '' + const cluster = storeGet('/route/params/cluster') || '' + const dbValue = getValue(discriminator, '/database') || {} + const dbName = storeGet('/route/params/name') || dbValue.name || '' + const dbNamespace = storeGet('/route/query/namespace') || dbValue.namespace || '' + if (dbName) { + try { + const resp = await axios.get( + `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, + ) + + const resources = (resp && resp.data && resp.data.items) || [] + const filteredResources = resources.filter( + (item) => + item.spec?.elasticsearch?.databaseRef?.name === dbName && + item.spec?.elasticsearch?.databaseRef?.namespace === dbNamespace, + ) + filteredResources.map((item) => { + const name = (item.metadata && item.metadata.name) || '' + item.text = name + item.value = name + return true + }) + return filteredResources + } catch (e) { + console.log(e) + return [] + } + } else return [] + } + + return { + isConsole, + getDatabases, + isDbSelected, + setRoleName, + getDbNamespace, + getEngines, + } } diff --git a/charts/enginekubevaultcom-mariadbrole-editor/ui/create-ui.yaml b/charts/enginekubevaultcom-mariadbrole-editor/ui/create-ui.yaml index 026d12a469..e2eb762364 100644 --- a/charts/enginekubevaultcom-mariadbrole-editor/ui/create-ui.yaml +++ b/charts/enginekubevaultcom-mariadbrole-editor/ui/create-ui.yaml @@ -1,73 +1,62 @@ -steps: -- form: - elements: - - fetch: getDatabases|core.k8s.appscode.com|v1alpha1|genericresources - if: isConsole - label: - text: labels.selectDb - refresh: true - required: true - schema: - $ref: discriminator#/properties/database - sortable: true - type: select - - computed: setRoleName - label: - text: metadata.name - required: true - schema: - $ref: schema#/properties/metadata/properties/name +step: +- elements: + - if: + name: isConsole + type: function + label: Select Database + loader: getDatabases|core.k8s.appscode.com|v1alpha1|genericresources + refresh: true + schema: temp/properties/database + sortable: true + type: select + validation: + type: required + - label: Name + schema: schema/properties/metadata/properties/name + type: input + validation: + type: required + watcher: + func: setRoleName + paths: + - schema/properties/spec/properties/secretEngineRef/properties/name + - disable: true + if: + name: isDbSelected + type: function + init: + type: func + value: getDbNamespace + label: Namespace + schema: schema/properties/metadata/properties/namespace + type: input + - if: + name: isDbSelected + type: function + label: Select SecretEngine + loader: getEngines|engine.kubevault.com|v1alpha1|secretengines + refresh: true + schema: schema/properties/spec/properties/secretEngineRef/properties/name + type: select + validation: + type: required + - label: Default TTL + schema: schema/properties/spec/properties/defaultTTL + type: input + - label: Max TTL + schema: schema/properties/spec/properties/maxTTL + type: input + - element: + label: Statement type: input - - computed: getDbNamespace - disabled: true - if: isDbSelected - label: - text: metadata.namespace - schema: - $ref: schema#/properties/metadata/properties/namespace + label: Creation Statement + schema: schema/properties/spec/properties/creationStatements + type: array-item-form + - element: + label: Statement type: input - - fetch: getEngines|engine.kubevault.com|v1alpha1|secretengines - if: isDbSelected - label: - text: labels.selectEngine - refresh: true - required: true - schema: - $ref: schema#/properties/spec/properties/secretEngineRef/properties/name - type: select - - label: - text: spec.defaultTTL - schema: - $ref: schema#/properties/spec/properties/defaultTTL - type: input - - label: - text: spec.maxTTL - schema: - $ref: schema#/properties/spec/properties/maxTTL - type: input - - element: - label: - text: labels.statement - schema: - $ref: schema#/properties/spec/properties/creationStatements/items - type: input - label: - text: spec.creation - schema: - $ref: schema#/properties/spec/properties/creationStatements - type: list-input-form - - element: - label: - text: labels.statement - schema: - $ref: schema#/properties/spec/properties/revocationStatements/items - type: input - label: - text: spec.revocation - schema: - $ref: schema#/properties/spec/properties/revocationStatements - type: list-input-form - type: single-step-form - id: basic - title: Create MariaDBRole + label: Revocation Statement + schema: schema/properties/spec/properties/revocationStatements + type: array-item-form + type: single-step-form type: multi-step-form diff --git a/charts/enginekubevaultcom-mariadbrole-editor/ui/functions.js b/charts/enginekubevaultcom-mariadbrole-editor/ui/functions.js index d04b8060d0..525d164783 100644 --- a/charts/enginekubevaultcom-mariadbrole-editor/ui/functions.js +++ b/charts/enginekubevaultcom-mariadbrole-editor/ui/functions.js @@ -1,113 +1,123 @@ -function isConsole({ storeGet }) { - const owner = storeGet('/route/params/user') - const path = storeGet('/route/path') - const prefix = `/${owner}/kubernetes` - if (path.startsWith(prefix)) return true - return false -} +const { ref, computed, axios, watch, useOperator, store } = window.vueHelpers || {} -async function getDatabases({ axios, storeGet }, group, version, resource) { - const owner = storeGet('/route/params/user') || '' - const cluster = storeGet('/route/params/cluster') || '' - if (isConsole({ storeGet })) { - try { - const resp = await axios.get( - `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, - { - params: { - convertToTable: true, - labelSelector: 'k8s.io/group=kubedb.com', - }, - }, - ) +export const useFunc = (model) => { + const { getValue, setDiscriminatorValue, commit, storeGet, discriminator } = useOperator( + model, + store.state, + ) - const resources = (resp && resp.data && resp.data.rows) || [] + function isConsole() { + const owner = storeGet('/route/params/user') + const path = storeGet('/route/path') + const prefix = `/${owner}/kubernetes` + if (path.startsWith(prefix)) return true + return false + } - resources.map((item) => { - const name = (item.cells && item.cells[0].data) || '' - const namespace = (item.cells?.length > 0 && item.cells[1].data) || '' - const resource = (item.cells?.length > 1 && item.cells[2].data) || '' - item.text = name - item.value = { - name: name, - namespace: namespace, - resource: resource, - } - return true - }) - const filteredResources = resources.filter( - (item) => item.value.resource.toLowerCase() === 'mariadb', - ) - return filteredResources - } catch (e) { - console.log(e) - return [] - } - } else return [] -} + async function getDatabases(group, version, resource) { + const owner = storeGet('/route/params/user') || '' + const cluster = storeGet('/route/params/cluster') || '' + if (isConsole()) { + try { + const resp = await axios.get( + `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, + { + params: { + convertToTable: true, + labelSelector: 'k8s.io/group=kubedb.com', + }, + }, + ) -function isDbSelected({ getValue, storeGet, discriminator, watchDependency }) { - if (!isConsole({ storeGet })) return true - watchDependency('discriminator#/database') - const val = getValue(discriminator, '/database') || {} - return val && val.name ? true : false -} + const resources = (resp && resp.data && resp.data.rows) || [] -function setRoleName({ watchDependency, getValue, model }) { - watchDependency('model#/spec/secretEngineRef/name') - const engineName = getValue(model, '/spec/secretEngineRef/name') || '' - const timestamp = `${Math.floor(Date.now() / 1000)}` - return engineName ? `${engineName}-role-${timestamp}` : engineName -} + resources.map((item) => { + const name = (item.cells && item.cells[0].data) || '' + const namespace = (item.cells?.length > 0 && item.cells[1].data) || '' + const resource = (item.cells?.length > 1 && item.cells[2].data) || '' + item.text = name + item.value = { + name: name, + namespace: namespace, + resource: resource, + } + return true + }) + const filteredResources = resources.filter( + (item) => item.value.resource.toLowerCase() === 'mariadb', + ) + return filteredResources + } catch (e) { + console.log(e) + return [] + } + } else return [] + } -function getDbNamespace({ getValue, storeGet, discriminator, watchDependency }) { - if (isConsole({ storeGet })) { - watchDependency('discriminator#/database') - const data = getValue(discriminator, '/database') || {} - return (data && data.namespace) || '' - } else { - const namespace = storeGet('/route/query/namespace') || '' - return namespace + function isDbSelected() { + if (!isConsole()) return true + // watchDependency('discriminator#/database') + const val = getValue(discriminator, '/database') || {} + return val && val.name ? true : false } -} -async function getEngines({ axios, storeGet, getValue, discriminator }, group, version, resource) { - const owner = storeGet('/route/params/user') || '' - const cluster = storeGet('/route/params/cluster') || '' - const dbValue = getValue(discriminator, '/database') || {} - const dbName = storeGet('/route/params/name') || dbValue.name || '' - const dbNamespace = storeGet('/route/query/namespace') || dbValue.namespace || '' - if (dbName) { - try { - const resp = await axios.get( - `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, - ) + function setRoleName() { + // watchDependency('model#/spec/secretEngineRef/name') + const engineName = getValue(model, '/spec/secretEngineRef/name') || '' + const timestamp = `${Math.floor(Date.now() / 1000)}` + + return engineName ? `${engineName}-role-${timestamp}` : engineName + } - const resources = (resp && resp.data && resp.data.items) || [] - const filteredResources = resources.filter( - (item) => - item.spec?.mariadb?.databaseRef?.name === dbName && - item.spec?.mariadb?.databaseRef?.namespace === dbNamespace, - ) - filteredResources.map((item) => { - const name = (item.metadata && item.metadata.name) || '' - item.text = name - item.value = name - return true - }) - return filteredResources - } catch (e) { - console.log(e) - return [] + function getDbNamespace() { + if (isConsole()) { + // watchDependency('discriminator#/database') + const data = getValue(discriminator, '/database') || {} + return (data && data.namespace) || '' + } else { + const namespace = storeGet('/route/query/namespace') || '' + return namespace } - } else return [] -} + } -return { - isConsole, - getDatabases, - isDbSelected, - setRoleName, - getDbNamespace, - getEngines, + async function getEngines(group, version, resource) { + const owner = storeGet('/route/params/user') || '' + const cluster = storeGet('/route/params/cluster') || '' + const dbValue = getValue(discriminator, '/database') || {} + const dbName = storeGet('/route/params/name') || dbValue.name || '' + const dbNamespace = storeGet('/route/query/namespace') || dbValue.namespace || '' + if (dbName) { + try { + const resp = await axios.get( + `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, + ) + + const resources = (resp && resp.data && resp.data.items) || [] + const filteredResources = resources.filter( + (item) => + item.spec?.mariadb?.databaseRef?.name === dbName && + item.spec?.mariadb?.databaseRef?.namespace === dbNamespace, + ) + filteredResources.map((item) => { + const name = (item.metadata && item.metadata.name) || '' + item.text = name + item.value = name + return true + }) + return filteredResources + } catch (e) { + console.log(e) + return [] + } + } else return [] + } + + return { + isConsole, + getDatabases, + isDbSelected, + setRoleName, + getDbNamespace, + getEngines, + } } diff --git a/charts/enginekubevaultcom-mysqlrole-editor/ui/create-ui.yaml b/charts/enginekubevaultcom-mysqlrole-editor/ui/create-ui.yaml index a68bfa4800..e2eb762364 100644 --- a/charts/enginekubevaultcom-mysqlrole-editor/ui/create-ui.yaml +++ b/charts/enginekubevaultcom-mysqlrole-editor/ui/create-ui.yaml @@ -1,73 +1,62 @@ -steps: -- form: - elements: - - fetch: getDatabases|core.k8s.appscode.com|v1alpha1|genericresources - if: isConsole - label: - text: labels.selectDb - refresh: true - required: true - schema: - $ref: discriminator#/properties/database - sortable: true - type: select - - computed: setRoleName - label: - text: metadata.name - required: true - schema: - $ref: schema#/properties/metadata/properties/name +step: +- elements: + - if: + name: isConsole + type: function + label: Select Database + loader: getDatabases|core.k8s.appscode.com|v1alpha1|genericresources + refresh: true + schema: temp/properties/database + sortable: true + type: select + validation: + type: required + - label: Name + schema: schema/properties/metadata/properties/name + type: input + validation: + type: required + watcher: + func: setRoleName + paths: + - schema/properties/spec/properties/secretEngineRef/properties/name + - disable: true + if: + name: isDbSelected + type: function + init: + type: func + value: getDbNamespace + label: Namespace + schema: schema/properties/metadata/properties/namespace + type: input + - if: + name: isDbSelected + type: function + label: Select SecretEngine + loader: getEngines|engine.kubevault.com|v1alpha1|secretengines + refresh: true + schema: schema/properties/spec/properties/secretEngineRef/properties/name + type: select + validation: + type: required + - label: Default TTL + schema: schema/properties/spec/properties/defaultTTL + type: input + - label: Max TTL + schema: schema/properties/spec/properties/maxTTL + type: input + - element: + label: Statement type: input - - computed: getDbNamespace - disabled: true - if: isDbSelected - label: - text: metadata.namespace - schema: - $ref: schema#/properties/metadata/properties/namespace + label: Creation Statement + schema: schema/properties/spec/properties/creationStatements + type: array-item-form + - element: + label: Statement type: input - - fetch: getEngines|engine.kubevault.com|v1alpha1|secretengines - if: isDbSelected - label: - text: labels.selectEngine - refresh: true - required: true - schema: - $ref: schema#/properties/spec/properties/secretEngineRef/properties/name - type: select - - label: - text: spec.defaultTTL - schema: - $ref: schema#/properties/spec/properties/defaultTTL - type: input - - label: - text: spec.maxTTL - schema: - $ref: schema#/properties/spec/properties/maxTTL - type: input - - element: - label: - text: labels.statement - schema: - $ref: schema#/properties/spec/properties/creationStatements/items - type: input - label: - text: spec.creation - schema: - $ref: schema#/properties/spec/properties/creationStatements - type: list-input-form - - element: - label: - text: labels.statement - schema: - $ref: schema#/properties/spec/properties/revocationStatements/items - type: input - label: - text: spec.revocation - schema: - $ref: schema#/properties/spec/properties/revocationStatements - type: list-input-form - type: single-step-form - id: basic - title: Create MySQLRole + label: Revocation Statement + schema: schema/properties/spec/properties/revocationStatements + type: array-item-form + type: single-step-form type: multi-step-form diff --git a/charts/enginekubevaultcom-mysqlrole-editor/ui/functions.js b/charts/enginekubevaultcom-mysqlrole-editor/ui/functions.js index aaf9f15c83..bba3dfb620 100644 --- a/charts/enginekubevaultcom-mysqlrole-editor/ui/functions.js +++ b/charts/enginekubevaultcom-mysqlrole-editor/ui/functions.js @@ -1,113 +1,123 @@ -function isConsole({ storeGet }) { - const owner = storeGet('/route/params/user') - const path = storeGet('/route/path') - const prefix = `/${owner}/kubernetes` - if (path.startsWith(prefix)) return true - return false -} +const { ref, computed, axios, watch, useOperator, store } = window.vueHelpers || {} -async function getDatabases({ axios, storeGet }, group, version, resource) { - const owner = storeGet('/route/params/user') || '' - const cluster = storeGet('/route/params/cluster') || '' - if (isConsole({ storeGet })) { - try { - const resp = await axios.get( - `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, - { - params: { - convertToTable: true, - labelSelector: 'k8s.io/group=kubedb.com', - }, - }, - ) +export const useFunc = (model) => { + const { getValue, setDiscriminatorValue, commit, storeGet, discriminator } = useOperator( + model, + store.state, + ) - const resources = (resp && resp.data && resp.data.rows) || [] + function isConsole() { + const owner = storeGet('/route/params/user') + const path = storeGet('/route/path') + const prefix = `/${owner}/kubernetes` + if (path.startsWith(prefix)) return true + return false + } - resources.map((item) => { - const name = (item.cells && item.cells[0].data) || '' - const namespace = (item.cells?.length > 0 && item.cells[1].data) || '' - const resource = (item.cells?.length > 1 && item.cells[2].data) || '' - item.text = name - item.value = { - name: name, - namespace: namespace, - resource: resource, - } - return true - }) - const filteredResources = resources.filter( - (item) => item.value.resource.toLowerCase() === 'mysql', - ) - return filteredResources - } catch (e) { - console.log(e) - return [] - } - } else return [] -} + async function getDatabases(group, version, resource) { + const owner = storeGet('/route/params/user') || '' + const cluster = storeGet('/route/params/cluster') || '' + if (isConsole()) { + try { + const resp = await axios.get( + `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, + { + params: { + convertToTable: true, + labelSelector: 'k8s.io/group=kubedb.com', + }, + }, + ) -function isDbSelected({ getValue, storeGet, discriminator, watchDependency }) { - if (!isConsole({ storeGet })) return true - watchDependency('discriminator#/database') - const val = getValue(discriminator, '/database') || {} - return val && val.name ? true : false -} + const resources = (resp && resp.data && resp.data.rows) || [] -function setRoleName({ watchDependency, getValue, model }) { - watchDependency('model#/spec/secretEngineRef/name') - const engineName = getValue(model, '/spec/secretEngineRef/name') || '' - const timestamp = `${Math.floor(Date.now() / 1000)}` - return engineName ? `${engineName}-role-${timestamp}` : engineName -} + resources.map((item) => { + const name = (item.cells && item.cells[0].data) || '' + const namespace = (item.cells?.length > 0 && item.cells[1].data) || '' + const resource = (item.cells?.length > 1 && item.cells[2].data) || '' + item.text = name + item.value = { + name: name, + namespace: namespace, + resource: resource, + } + return true + }) + const filteredResources = resources.filter( + (item) => item.value.resource.toLowerCase() === 'mysql', + ) + return filteredResources + } catch (e) { + console.log(e) + return [] + } + } else return [] + } -function getDbNamespace({ getValue, storeGet, discriminator, watchDependency }) { - if (isConsole({ storeGet })) { - watchDependency('discriminator#/database') - const data = getValue(discriminator, '/database') || {} - return (data && data.namespace) || '' - } else { - const namespace = storeGet('/route/query/namespace') || '' - return namespace + function isDbSelected() { + if (!isConsole()) return true + // watchDependency('discriminator#/database') + const val = getValue(discriminator, '/database') || {} + return val && val.name ? true : false } -} -async function getEngines({ axios, storeGet, getValue, discriminator }, group, version, resource) { - const owner = storeGet('/route/params/user') || '' - const cluster = storeGet('/route/params/cluster') || '' - const dbValue = getValue(discriminator, '/database') || {} - const dbName = storeGet('/route/params/name') || dbValue.name || '' - const dbNamespace = storeGet('/route/query/namespace') || dbValue.namespace || '' - if (dbName) { - try { - const resp = await axios.get( - `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, - ) + function setRoleName() { + // watchDependency('model#/spec/secretEngineRef/name') + const engineName = getValue(model, '/spec/secretEngineRef/name') || '' + const timestamp = `${Math.floor(Date.now() / 1000)}` + + return engineName ? `${engineName}-role-${timestamp}` : engineName + } - const resources = (resp && resp.data && resp.data.items) || [] - const filteredResources = resources.filter( - (item) => - item.spec?.mysql?.databaseRef?.name === dbName && - item.spec?.mysql?.databaseRef?.namespace === dbNamespace, - ) - filteredResources.map((item) => { - const name = (item.metadata && item.metadata.name) || '' - item.text = name - item.value = name - return true - }) - return filteredResources - } catch (e) { - console.log(e) - return [] + function getDbNamespace() { + if (isConsole()) { + // watchDependency('discriminator#/database') + const data = getValue(discriminator, '/database') || {} + return (data && data.namespace) || '' + } else { + const namespace = storeGet('/route/query/namespace') || '' + return namespace } - } else return [] -} + } -return { - isConsole, - getDatabases, - isDbSelected, - setRoleName, - getDbNamespace, - getEngines, + async function getEngines(group, version, resource) { + const owner = storeGet('/route/params/user') || '' + const cluster = storeGet('/route/params/cluster') || '' + const dbValue = getValue(discriminator, '/database') || {} + const dbName = storeGet('/route/params/name') || dbValue.name || '' + const dbNamespace = storeGet('/route/query/namespace') || dbValue.namespace || '' + if (dbName) { + try { + const resp = await axios.get( + `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, + ) + + const resources = (resp && resp.data && resp.data.items) || [] + const filteredResources = resources.filter( + (item) => + item.spec?.mysql?.databaseRef?.name === dbName && + item.spec?.mysql?.databaseRef?.namespace === dbNamespace, + ) + filteredResources.map((item) => { + const name = (item.metadata && item.metadata.name) || '' + item.text = name + item.value = name + return true + }) + return filteredResources + } catch (e) { + console.log(e) + return [] + } + } else return [] + } + + return { + isConsole, + getDatabases, + isDbSelected, + setRoleName, + getDbNamespace, + getEngines, + } } diff --git a/charts/enginekubevaultcom-postgresrole-editor/ui/create-ui.yaml b/charts/enginekubevaultcom-postgresrole-editor/ui/create-ui.yaml index 41f93a4740..e2eb762364 100644 --- a/charts/enginekubevaultcom-postgresrole-editor/ui/create-ui.yaml +++ b/charts/enginekubevaultcom-postgresrole-editor/ui/create-ui.yaml @@ -1,95 +1,62 @@ -steps: -- form: - elements: - - fetch: getDatabases|core.k8s.appscode.com|v1alpha1|genericresources - if: isConsole - label: - text: labels.selectDb - refresh: true - required: true - schema: - $ref: discriminator#/properties/database - sortable: true - type: select - - computed: setRoleName - label: - text: metadata.name - required: true - schema: - $ref: schema#/properties/metadata/properties/name +step: +- elements: + - if: + name: isConsole + type: function + label: Select Database + loader: getDatabases|core.k8s.appscode.com|v1alpha1|genericresources + refresh: true + schema: temp/properties/database + sortable: true + type: select + validation: + type: required + - label: Name + schema: schema/properties/metadata/properties/name + type: input + validation: + type: required + watcher: + func: setRoleName + paths: + - schema/properties/spec/properties/secretEngineRef/properties/name + - disable: true + if: + name: isDbSelected + type: function + init: + type: func + value: getDbNamespace + label: Namespace + schema: schema/properties/metadata/properties/namespace + type: input + - if: + name: isDbSelected + type: function + label: Select SecretEngine + loader: getEngines|engine.kubevault.com|v1alpha1|secretengines + refresh: true + schema: schema/properties/spec/properties/secretEngineRef/properties/name + type: select + validation: + type: required + - label: Default TTL + schema: schema/properties/spec/properties/defaultTTL + type: input + - label: Max TTL + schema: schema/properties/spec/properties/maxTTL + type: input + - element: + label: Statement type: input - - computed: getDbNamespace - disabled: true - if: isDbSelected - label: - text: metadata.namespace - schema: - $ref: schema#/properties/metadata/properties/namespace + label: Creation Statement + schema: schema/properties/spec/properties/creationStatements + type: array-item-form + - element: + label: Statement type: input - - fetch: getEngines|engine.kubevault.com|v1alpha1|secretengines - if: isDbSelected - label: - text: labels.selectEngine - refresh: true - required: true - schema: - $ref: schema#/properties/spec/properties/secretEngineRef/properties/name - type: select - - label: - text: spec.defaultTTL - schema: - $ref: schema#/properties/spec/properties/defaultTTL - type: input - - label: - text: spec.maxTTL - schema: - $ref: schema#/properties/spec/properties/maxTTL - type: input - - element: - label: - text: labels.statement - schema: - $ref: schema#/properties/spec/properties/creationStatements/items - type: input - label: - text: spec.creation - schema: - $ref: schema#/properties/spec/properties/creationStatements - type: list-input-form - - element: - label: - text: labels.statement - schema: - $ref: schema#/properties/spec/properties/revocationStatements/items - type: input - label: - text: spec.revocation - schema: - $ref: schema#/properties/spec/properties/revocationStatements - type: list-input-form - - element: - label: - text: labels.statement - schema: - $ref: schema#/properties/spec/properties/rollbackStatements/items - type: input - label: - text: spec.rollback - schema: - $ref: schema#/properties/spec/properties/rollbackStatements - type: list-input-form - - element: - label: - text: labels.statement - schema: - $ref: schema#/properties/spec/properties/renewStatements/items - type: input - label: - text: spec.renew - schema: - $ref: schema#/properties/spec/properties/renewStatements - type: list-input-form - type: single-step-form - id: basic - title: Create PostgresRole + label: Revocation Statement + schema: schema/properties/spec/properties/revocationStatements + type: array-item-form + type: single-step-form type: multi-step-form diff --git a/charts/enginekubevaultcom-postgresrole-editor/ui/functions.js b/charts/enginekubevaultcom-postgresrole-editor/ui/functions.js index 453fe64363..bdd5020b2a 100644 --- a/charts/enginekubevaultcom-postgresrole-editor/ui/functions.js +++ b/charts/enginekubevaultcom-postgresrole-editor/ui/functions.js @@ -1,113 +1,123 @@ -function isConsole({ storeGet }) { - const owner = storeGet('/route/params/user') - const path = storeGet('/route/path') - const prefix = `/${owner}/kubernetes` - if (path.startsWith(prefix)) return true - return false -} +const { ref, computed, axios, watch, useOperator, store } = window.vueHelpers || {} -async function getDatabases({ axios, storeGet }, group, version, resource) { - const owner = storeGet('/route/params/user') || '' - const cluster = storeGet('/route/params/cluster') || '' - if (isConsole({ storeGet })) { - try { - const resp = await axios.get( - `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, - { - params: { - convertToTable: true, - labelSelector: 'k8s.io/group=kubedb.com', - }, - }, - ) +export const useFunc = (model) => { + const { getValue, setDiscriminatorValue, commit, storeGet, discriminator } = useOperator( + model, + store.state, + ) - const resources = (resp && resp.data && resp.data.rows) || [] + function isConsole() { + const owner = storeGet('/route/params/user') + const path = storeGet('/route/path') + const prefix = `/${owner}/kubernetes` + if (path.startsWith(prefix)) return true + return false + } - resources.map((item) => { - const name = (item.cells && item.cells[0].data) || '' - const namespace = (item.cells?.length > 0 && item.cells[1].data) || '' - const resource = (item.cells?.length > 1 && item.cells[2].data) || '' - item.text = name - item.value = { - name: name, - namespace: namespace, - resource: resource, - } - return true - }) - const filteredResources = resources.filter( - (item) => item.value.resource.toLowerCase() === 'postgres', - ) - return filteredResources - } catch (e) { - console.log(e) - return [] - } - } else return [] -} + async function getDatabases(group, version, resource) { + const owner = storeGet('/route/params/user') || '' + const cluster = storeGet('/route/params/cluster') || '' + if (isConsole()) { + try { + const resp = await axios.get( + `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, + { + params: { + convertToTable: true, + labelSelector: 'k8s.io/group=kubedb.com', + }, + }, + ) -function isDbSelected({ getValue, storeGet, discriminator, watchDependency }) { - if (!isConsole({ storeGet })) return true - watchDependency('discriminator#/database') - const val = getValue(discriminator, '/database') || {} - return val && val.name ? true : false -} + const resources = (resp && resp.data && resp.data.rows) || [] -function setRoleName({ watchDependency, getValue, model }) { - watchDependency('model#/spec/secretEngineRef/name') - const engineName = getValue(model, '/spec/secretEngineRef/name') || '' - const timestamp = `${Math.floor(Date.now() / 1000)}` - return engineName ? `${engineName}-role-${timestamp}` : engineName -} + resources.map((item) => { + const name = (item.cells && item.cells[0].data) || '' + const namespace = (item.cells?.length > 0 && item.cells[1].data) || '' + const resource = (item.cells?.length > 1 && item.cells[2].data) || '' + item.text = name + item.value = { + name: name, + namespace: namespace, + resource: resource, + } + return true + }) + const filteredResources = resources.filter( + (item) => item.value.resource.toLowerCase() === 'mongodb', + ) + return filteredResources + } catch (e) { + console.log(e) + return [] + } + } else return [] + } -function getDbNamespace({ getValue, storeGet, discriminator, watchDependency }) { - if (isConsole({ storeGet })) { - watchDependency('discriminator#/database') - const data = getValue(discriminator, '/database') || {} - return (data && data.namespace) || '' - } else { - const namespace = storeGet('/route/query/namespace') || '' - return namespace + function isDbSelected() { + if (!isConsole()) return true + // watchDependency('discriminator#/database') + const val = getValue(discriminator, '/database') || {} + return val && val.name ? true : false } -} -async function getEngines({ axios, storeGet, getValue, discriminator }, group, version, resource) { - const owner = storeGet('/route/params/user') || '' - const cluster = storeGet('/route/params/cluster') || '' - const dbValue = getValue(discriminator, '/database') || {} - const dbName = storeGet('/route/params/name') || dbValue.name || '' - const dbNamespace = storeGet('/route/query/namespace') || dbValue.namespace || '' - if (dbName) { - try { - const resp = await axios.get( - `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, - ) + function setRoleName() { + // watchDependency('model#/spec/secretEngineRef/name') + const engineName = getValue(model, '/spec/secretEngineRef/name') || '' + const timestamp = `${Math.floor(Date.now() / 1000)}` + + return engineName ? `${engineName}-role-${timestamp}` : engineName + } - const resources = (resp && resp.data && resp.data.items) || [] - const filteredResources = resources.filter( - (item) => - item.spec?.postgres?.databaseRef?.name === dbName && - item.spec?.postgres?.databaseRef?.namespace === dbNamespace, - ) - filteredResources.map((item) => { - const name = (item.metadata && item.metadata.name) || '' - item.text = name - item.value = name - return true - }) - return filteredResources - } catch (e) { - console.log(e) - return [] + function getDbNamespace() { + if (isConsole()) { + // watchDependency('discriminator#/database') + const data = getValue(discriminator, '/database') || {} + return (data && data.namespace) || '' + } else { + const namespace = storeGet('/route/query/namespace') || '' + return namespace } - } else return [] -} + } -return { - isConsole, - getDatabases, - isDbSelected, - setRoleName, - getDbNamespace, - getEngines, + async function getEngines(group, version, resource) { + const owner = storeGet('/route/params/user') || '' + const cluster = storeGet('/route/params/cluster') || '' + const dbValue = getValue(discriminator, '/database') || {} + const dbName = storeGet('/route/params/name') || dbValue.name || '' + const dbNamespace = storeGet('/route/query/namespace') || dbValue.namespace || '' + if (dbName) { + try { + const resp = await axios.get( + `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, + ) + + const resources = (resp && resp.data && resp.data.items) || [] + const filteredResources = resources.filter( + (item) => + item.spec?.mongodb?.databaseRef?.name === dbName && + item.spec?.mongodb?.databaseRef?.namespace === dbNamespace, + ) + filteredResources.map((item) => { + const name = (item.metadata && item.metadata.name) || '' + item.text = name + item.value = name + return true + }) + return filteredResources + } catch (e) { + console.log(e) + return [] + } + } else return [] + } + + return { + isConsole, + getDatabases, + isDbSelected, + setRoleName, + getDbNamespace, + getEngines, + } } diff --git a/charts/enginekubevaultcom-redisrole-editor/ui/create-ui.yaml b/charts/enginekubevaultcom-redisrole-editor/ui/create-ui.yaml index c0c622c9c0..e2eb762364 100644 --- a/charts/enginekubevaultcom-redisrole-editor/ui/create-ui.yaml +++ b/charts/enginekubevaultcom-redisrole-editor/ui/create-ui.yaml @@ -1,73 +1,62 @@ -steps: -- form: - elements: - - fetch: getDatabases|core.k8s.appscode.com|v1alpha1|genericresources - if: isConsole - label: - text: labels.selectDb - refresh: true - required: true - schema: - $ref: discriminator#/properties/database - sortable: true - type: select - - computed: setRoleName - label: - text: metadata.name - required: true - schema: - $ref: schema#/properties/metadata/properties/name +step: +- elements: + - if: + name: isConsole + type: function + label: Select Database + loader: getDatabases|core.k8s.appscode.com|v1alpha1|genericresources + refresh: true + schema: temp/properties/database + sortable: true + type: select + validation: + type: required + - label: Name + schema: schema/properties/metadata/properties/name + type: input + validation: + type: required + watcher: + func: setRoleName + paths: + - schema/properties/spec/properties/secretEngineRef/properties/name + - disable: true + if: + name: isDbSelected + type: function + init: + type: func + value: getDbNamespace + label: Namespace + schema: schema/properties/metadata/properties/namespace + type: input + - if: + name: isDbSelected + type: function + label: Select SecretEngine + loader: getEngines|engine.kubevault.com|v1alpha1|secretengines + refresh: true + schema: schema/properties/spec/properties/secretEngineRef/properties/name + type: select + validation: + type: required + - label: Default TTL + schema: schema/properties/spec/properties/defaultTTL + type: input + - label: Max TTL + schema: schema/properties/spec/properties/maxTTL + type: input + - element: + label: Statement type: input - - computed: getDbNamespace - disabled: true - if: isDbSelected - label: - text: metadata.namespace - schema: - $ref: schema#/properties/metadata/properties/namespace + label: Creation Statement + schema: schema/properties/spec/properties/creationStatements + type: array-item-form + - element: + label: Statement type: input - - fetch: getEngines|engine.kubevault.com|v1alpha1|secretengines - if: isDbSelected - label: - text: labels.selectEngine - refresh: true - required: true - schema: - $ref: schema#/properties/spec/properties/secretEngineRef/properties/name - type: select - - label: - text: spec.defaultTTL - schema: - $ref: schema#/properties/spec/properties/defaultTTL - type: input - - label: - text: spec.maxTTL - schema: - $ref: schema#/properties/spec/properties/maxTTL - type: input - - element: - label: - text: labels.statement - schema: - $ref: schema#/properties/spec/properties/creationStatements/items - type: input - label: - text: spec.creation - schema: - $ref: schema#/properties/spec/properties/creationStatements - type: list-input-form - - element: - label: - text: labels.statement - schema: - $ref: schema#/properties/spec/properties/revocationStatements/items - type: input - label: - text: spec.revocation - schema: - $ref: schema#/properties/spec/properties/revocationStatements - type: list-input-form - type: single-step-form - id: basic - title: Create RedisRole + label: Revocation Statement + schema: schema/properties/spec/properties/revocationStatements + type: array-item-form + type: single-step-form type: multi-step-form diff --git a/charts/enginekubevaultcom-redisrole-editor/ui/functions.js b/charts/enginekubevaultcom-redisrole-editor/ui/functions.js index a1010ff966..58bdc8b7d3 100644 --- a/charts/enginekubevaultcom-redisrole-editor/ui/functions.js +++ b/charts/enginekubevaultcom-redisrole-editor/ui/functions.js @@ -1,113 +1,123 @@ -function isConsole({ storeGet }) { - const owner = storeGet('/route/params/user') - const path = storeGet('/route/path') - const prefix = `/${owner}/kubernetes` - if (path.startsWith(prefix)) return true - return false -} +const { ref, computed, axios, watch, useOperator, store } = window.vueHelpers || {} -async function getDatabases({ axios, storeGet }, group, version, resource) { - const owner = storeGet('/route/params/user') || '' - const cluster = storeGet('/route/params/cluster') || '' - if (isConsole({ storeGet })) { - try { - const resp = await axios.get( - `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, - { - params: { - convertToTable: true, - labelSelector: 'k8s.io/group=kubedb.com', - }, - }, - ) +export const useFunc = (model) => { + const { getValue, setDiscriminatorValue, commit, storeGet, discriminator } = useOperator( + model, + store.state, + ) - const resources = (resp && resp.data && resp.data.rows) || [] + function isConsole() { + const owner = storeGet('/route/params/user') + const path = storeGet('/route/path') + const prefix = `/${owner}/kubernetes` + if (path.startsWith(prefix)) return true + return false + } - resources.map((item) => { - const name = (item.cells && item.cells[0].data) || '' - const namespace = (item.cells?.length > 0 && item.cells[1].data) || '' - const resource = (item.cells?.length > 1 && item.cells[2].data) || '' - item.text = name - item.value = { - name: name, - namespace: namespace, - resource: resource, - } - return true - }) - const filteredResources = resources.filter( - (item) => item.value.resource.toLowerCase() === 'redis', - ) - return filteredResources - } catch (e) { - console.log(e) - return [] - } - } else return [] -} + async function getDatabases(group, version, resource) { + const owner = storeGet('/route/params/user') || '' + const cluster = storeGet('/route/params/cluster') || '' + if (isConsole()) { + try { + const resp = await axios.get( + `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, + { + params: { + convertToTable: true, + labelSelector: 'k8s.io/group=kubedb.com', + }, + }, + ) -function isDbSelected({ getValue, storeGet, discriminator, watchDependency }) { - if (!isConsole({ storeGet })) return true - watchDependency('discriminator#/database') - const val = getValue(discriminator, '/database') || {} - return val && val.name ? true : false -} + const resources = (resp && resp.data && resp.data.rows) || [] -function setRoleName({ watchDependency, getValue, model }) { - watchDependency('model#/spec/secretEngineRef/name') - const engineName = getValue(model, '/spec/secretEngineRef/name') || '' - const timestamp = `${Math.floor(Date.now() / 1000)}` - return engineName ? `${engineName}-role-${timestamp}` : engineName -} + resources.map((item) => { + const name = (item.cells && item.cells[0].data) || '' + const namespace = (item.cells?.length > 0 && item.cells[1].data) || '' + const resource = (item.cells?.length > 1 && item.cells[2].data) || '' + item.text = name + item.value = { + name: name, + namespace: namespace, + resource: resource, + } + return true + }) + const filteredResources = resources.filter( + (item) => item.value.resource.toLowerCase() === 'redis', + ) + return filteredResources + } catch (e) { + console.log(e) + return [] + } + } else return [] + } -function getDbNamespace({ getValue, storeGet, discriminator, watchDependency }) { - if (isConsole({ storeGet })) { - watchDependency('discriminator#/database') - const data = getValue(discriminator, '/database') || {} - return (data && data.namespace) || '' - } else { - const namespace = storeGet('/route/query/namespace') || '' - return namespace + function isDbSelected() { + if (!isConsole()) return true + // watchDependency('discriminator#/database') + const val = getValue(discriminator, '/database') || {} + return val && val.name ? true : false } -} -async function getEngines({ axios, storeGet, getValue, discriminator }, group, version, resource) { - const owner = storeGet('/route/params/user') || '' - const cluster = storeGet('/route/params/cluster') || '' - const dbValue = getValue(discriminator, '/database') || {} - const dbName = storeGet('/route/params/name') || dbValue.name || '' - const dbNamespace = storeGet('/route/query/namespace') || dbValue.namespace || '' - if (dbName) { - try { - const resp = await axios.get( - `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, - ) + function setRoleName() { + // watchDependency('model#/spec/secretEngineRef/name') + const engineName = getValue(model, '/spec/secretEngineRef/name') || '' + const timestamp = `${Math.floor(Date.now() / 1000)}` + + return engineName ? `${engineName}-role-${timestamp}` : engineName + } - const resources = (resp && resp.data && resp.data.items) || [] - const filteredResources = resources.filter( - (item) => - item.spec?.redis?.databaseRef?.name === dbName && - item.spec?.redis?.databaseRef?.namespace === dbNamespace, - ) - filteredResources.map((item) => { - const name = (item.metadata && item.metadata.name) || '' - item.text = name - item.value = name - return true - }) - return filteredResources - } catch (e) { - console.log(e) - return [] + function getDbNamespace() { + if (isConsole()) { + // watchDependency('discriminator#/database') + const data = getValue(discriminator, '/database') || {} + return (data && data.namespace) || '' + } else { + const namespace = storeGet('/route/query/namespace') || '' + return namespace } - } else return [] -} + } -return { - isConsole, - getDatabases, - isDbSelected, - setRoleName, - getDbNamespace, - getEngines, + async function getEngines(group, version, resource) { + const owner = storeGet('/route/params/user') || '' + const cluster = storeGet('/route/params/cluster') || '' + const dbValue = getValue(discriminator, '/database') || {} + const dbName = storeGet('/route/params/name') || dbValue.name || '' + const dbNamespace = storeGet('/route/query/namespace') || dbValue.namespace || '' + if (dbName) { + try { + const resp = await axios.get( + `/clusters/${owner}/${cluster}/proxy/${group}/${version}/${resource}`, + ) + + const resources = (resp && resp.data && resp.data.items) || [] + const filteredResources = resources.filter( + (item) => + item.spec?.redis?.databaseRef?.name === dbName && + item.spec?.redis?.databaseRef?.namespace === dbNamespace, + ) + filteredResources.map((item) => { + const name = (item.metadata && item.metadata.name) || '' + item.text = name + item.value = name + return true + }) + return filteredResources + } catch (e) { + console.log(e) + return [] + } + } else return [] + } + + return { + isConsole, + getDatabases, + isDbSelected, + setRoleName, + getDbNamespace, + getEngines, + } } From 25ff9fa93954ae101543c4551b37fa3c1312e007 Mon Sep 17 00:00:00 2001 From: samiul Date: Fri, 26 Jun 2026 18:13:16 +0600 Subject: [PATCH 2/2] wip vaultserver Signed-off-by: samiul --- .../ui/create-ui.yaml | 1332 +++++++++-------- 1 file changed, 668 insertions(+), 664 deletions(-) diff --git a/charts/kubevaultcom-vaultserver-editor-options/ui/create-ui.yaml b/charts/kubevaultcom-vaultserver-editor-options/ui/create-ui.yaml index b182342e01..a0d47b0d04 100644 --- a/charts/kubevaultcom-vaultserver-editor-options/ui/create-ui.yaml +++ b/charts/kubevaultcom-vaultserver-editor-options/ui/create-ui.yaml @@ -1,666 +1,670 @@ -steps: -- form: - elements: - - disabled: isVariantAvailable - label: - text: labels.vaultserver.name - schema: - $ref: schema#/properties/metadata/properties/release/properties/name - type: input - - add_new_button: - label: labels.add_new_namespace - target: _blank - url: - function: getCreateNameSpaceUrl - disabled: isVariantAvailable - fetch: getResources|core|v1|namespaces - label: - text: labels.namespace - refresh: true - schema: - $ref: schema#/properties/metadata/properties/release/properties/namespace - type: select - - fetch: getVaultServerVersions|catalog.kubevault.com|v1alpha1|vaultserverversions - label: - text: labels.vaultserver.version - schema: - $ref: schema#/properties/spec/properties/version - type: select - - isArray: true - keys: - label: - text: labels.labels.key - label: - text: labels.labels.label - schema: - $ref: schema#/properties/spec/properties/labels - type: key-value-input-form - values: - label: - text: labels.labels.value - schema: - $ref: schema#/properties/spec/properties/labels/additionalProperties - type: input - - isArray: true - keys: - label: - text: labels.annotations.key - label: - text: labels.annotations.label - schema: - $ref: schema#/properties/spec/properties/annotations - type: key-value-input-form - values: - label: - text: labels.annotations.value - schema: - $ref: schema#/properties/spec/properties/annotations/additionalProperties - type: input - - customClass: mt-10 - disabled: isLowAvailableStorageBackendSelected - label: - text: labels.replicaset.number - schema: - $ref: schema#/properties/spec/properties/replicas - type: input - - hasDescription: true - label: - text: labels.terminationPolicy - options: - - description: options.terminationPolicy.delete.description - text: options.terminationPolicy.delete.label - value: Delete - - description: options.terminationPolicy.halt.description - text: options.terminationPolicy.halt.label - value: Halt - - description: options.terminationPolicy.wipeOut.description - text: options.terminationPolicy.wipeOut.label - value: WipeOut - - description: options.terminationPolicy.doNotTerminate.description - text: options.terminationPolicy.doNotTerminate.label - value: DoNotTerminate - schema: - $ref: schema#/properties/spec/properties/terminationPolicy - type: radio - - label: - text: labels.machine_profile - type: label-element - - computed: setMachineToCustom - fetch: getMachineListForOptions - label: - text: Machine - onChange: setResourceLimit - schema: - $ref: schema#/properties/spec/properties/machine - type: select - - computed: setLimitsCpuOrMem|cpu - disabled: disableLimit - label: - text: labels.cpu - schema: - $ref: schema#/properties/spec/properties/resources/properties/limits/properties/cpu - type: input - - computed: setLimitsCpuOrMem|memory - disabled: disableLimit - label: - text: labels.memory - schema: - $ref: schema#/properties/spec/properties/resources/properties/limits/properties/memory - type: input - - elements: - - customClass: mt-10 - elements: - - label: - text: labels.backend.provider - onChange: onBackendTypeChange - options: - - azure - - consul - - dynamodb - - etcd - - gcs - - inmem - - mysql - - postgresql - - raft - - s3 - - swift - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/type - type: select - - elements: - - label: - text: labels.backend.accountName - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/azure/properties/accountName - type: input - if: isEqualToModelPathValue|azure|/spec/backend/provider/type - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/azure - type: single-step-form - - elements: - - label: - text: labels.backend.address - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/consul/properties/address - type: input - - label: - text: labels.backend.path - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/consul/properties/path - type: input - if: isEqualToModelPathValue|consul|/spec/backend/provider/type - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/consul - type: single-step-form - - elements: - - label: - text: labels.backend.address - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/etcd/properties/address - type: input - if: isEqualToModelPathValue|etcd|/spec/backend/provider/type - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/etcd - type: single-step-form - - elements: - - label: - text: labels.backend.bucket - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/gcs/properties/bucket - type: input - if: isEqualToModelPathValue|gcs|/spec/backend/provider/type - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/gcs - type: single-step-form - - elements: - - elements: - - label: - text: labels.backend.storageSize - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft/properties/persistence/properties/size - type: input - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft/properties/persistence - type: single-step-form - - elements: - - fetch: getStorageClassNames|/spec/backend/provider/raft/storageClass/name - label: - text: labels.backend.storageClass - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft/properties/storageClass/properties/name - type: select - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft/properties/storageClass - type: single-step-form - if: isEqualToModelPathValue|raft|/spec/backend/provider/type - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft - type: single-step-form - - elements: - - label: - text: labels.backend.bucket - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/s3/properties/bucket - type: input - - label: - text: labels.backend.region - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/s3/properties/region - type: input - if: isEqualToModelPathValue|s3|/spec/backend/provider/type - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider/properties/s3 - type: single-step-form - schema: - $ref: schema#/properties/spec/properties/backend/properties/provider - type: single-step-form - - discriminator: - createCredentialSecret: - default: true - type: string - elements: - - label: - text: labels.backend.credentialSecret - onChange: onCreateCredentialSecretChange - options: - - text: options.secret.customSecret.label - value: true - - text: options.secret.existingSecret.label - value: false - schema: - $ref: discriminator#/properties/createCredentialSecret - type: radio - - allowUserDefinedOption: true - fetch: getSecrets - if: showCredentialExistingSecretField - label: - text: labels.secret - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/name - type: select - - elements: - - label: - text: labels.backend.accountKey - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/azure/properties/accountKey - type: input - if: showCredentialCreateSecretField|azure - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/azure - type: single-step-form - - elements: - - label: - text: labels.backend.aclToken - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/consul/properties/aclToken - type: input - if: showCredentialCreateSecretField|consul - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/consul - type: single-step-form - - elements: - - label: - text: labels.backend.accessKey - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb/properties/accessKey - type: input - - label: - text: labels.backend.secretKey - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb/properties/secretKey - type: input - - label: - text: labels.backend.sessionToken - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb/properties/sessionToken - type: input - if: showCredentialCreateSecretField|dynamodb - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb - type: single-step-form - - elements: - - label: - text: labels.backend.username - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/etcd/properties/username - type: input - - label: - text: labels.backend.password - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/etcd/properties/password - type: input - if: showCredentialCreateSecretField|etcd - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/etcd - type: single-step-form - - elements: - - label: - text: labels.backend.saJson - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/gcs/properties/saJson - type: editor - if: showCredentialCreateSecretField|gcs - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/gcs - type: single-step-form - - elements: - - label: - text: labels.backend.username - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/mysql/properties/username - type: input - - label: - text: labels.backend.password - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/mysql/properties/password - type: input - if: showCredentialCreateSecretField|mysql - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/mysql - type: single-step-form - - elements: - - label: - text: labels.backend.connectionURL - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/postgresql/properties/connectionURL - type: input - if: showCredentialCreateSecretField|postgresql - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/postgresql - type: single-step-form - - elements: - - label: - text: labels.backend.accessKey - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/s3/properties/accessKey - type: input - - label: - text: labels.backend.secretKey - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/s3/properties/secretKey - type: input - if: showCredentialCreateSecretField|s3 - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/s3 - type: single-step-form - - elements: - - label: - text: labels.backend.username - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/swift/properties/username - type: input - - label: - text: labels.backend.password - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/swift/properties/password - type: input - - label: - text: labels.backend.authToken - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/swift/properties/authToken - type: input - if: showCredentialCreateSecretField|swift - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/swift - type: single-step-form - if: showCredentialSecret - schema: - $ref: schema#/properties/spec/properties/backend/properties/credentialSecret - type: single-step-form - - discriminator: - createTlsSecret: - default: true - type: string - elements: - - label: - text: labels.backend.tlsSecret - onChange: onCreateTlsSecretChange - options: - - text: options.secret.customSecret.label - value: true - - text: options.secret.existingSecret.label - value: false - schema: - $ref: discriminator#/properties/createTlsSecret - type: radio - - allowUserDefinedOption: true - fetch: getSecrets - if: showTlsExistingSecretField - label: - text: labels.secret - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/name - type: select - - elements: - - label: - text: labels.backend.tlsCaFile - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/mysql/properties/tlsCaFile - type: input - if: showTlsCreateSecretField|mysql - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/mysql - type: single-step-form - - elements: - - label: - text: labels.backend.caCert - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/consul/properties/caCrt - type: editor - - label: - text: labels.backend.clientCrt - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/consul/properties/clientCrt - type: editor - - label: - text: labels.backend.clientKey - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/consul/properties/clientKey - type: editor - if: showTlsCreateSecretField|consul - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/consul - type: single-step-form - if: showTlsSecret - schema: - $ref: schema#/properties/spec/properties/backend/properties/tlsSecret - type: single-step-form - label: - text: labels.backend.title - schema: - $ref: schema#/properties/spec/properties/backend - show_label: true - type: single-step-form - - elements: - - customClass: mt-10 - elements: - - label: - text: labels.unsealer.mode - options: - - awsKmsSsm - - azureKeyVault - - googleKmsGcs - - kubernetesSecret - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/type - type: select - - elements: - - label: - text: labels.unsealer.kmsKeyID - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/awsKmsSsm/properties/kmsKeyID - type: input - - label: - text: labels.unsealer.region - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/awsKmsSsm/properties/region - type: input - if: isEqualToModelPathValue|awsKmsSsm|/spec/unsealer/mode/type - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/awsKmsSsm - type: single-step-form - - elements: - - label: - text: labels.unsealer.vaultBaseURL - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/azureKeyVault/properties/vaultBaseURL - type: input - if: isEqualToModelPathValue|azureKeyVault|/spec/unsealer/mode/type - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/azureKeyVault - type: single-step-form - - elements: - - label: - text: labels.unsealer.bucket - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/bucket - type: input - - label: - text: labels.unsealer.kmsCryptoKey - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsCryptoKey - type: input - - label: - text: labels.unsealer.kmsKeyRing - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsKeyRing - type: input - - label: - text: labels.unsealer.kmsLocation - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsLocation - type: input - - label: - text: labels.unsealer.kmsProject - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsProject - type: input - if: isEqualToModelPathValue|googleKmsGcs|/spec/unsealer/mode/type - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs - type: single-step-form - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/mode - type: single-step-form - - discriminator: - createCredentialSecret: - default: true - type: boolean - elements: - - label: - text: labels.backend.credentialSecret - onChange: onCreateUnsealerCredentialSecretChange - options: - - text: options.secret.customSecret.label - value: true - - text: options.secret.existingSecret.label - value: false - schema: - $ref: discriminator#/properties/createCredentialSecret - type: radio - - allowUserDefinedOption: true - fetch: getSecrets - if: showUnsealerCredentialExistingSecretField - label: - text: labels.secret - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/name - type: select - - elements: - - label: - text: labels.unsealer.accessKey - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/awsKmsSsm/properties/accessKey - type: input - - label: - text: labels.unsealer.secretKey - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/awsKmsSsm/properties/secretKey - type: input - if: showUnsealerCredentialCreateSecretField|awsKmsSsm - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/awsKmsSsm - type: single-step-form - - elements: - - label: - text: labels.unsealer.clientCert - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientCert - type: input - - label: - text: labels.unsealer.clientCertPassword - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientCertPassword - type: input - - label: - text: labels.unsealer.clientId - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientId - type: input - - label: - text: labels.unsealer.clientSecret - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientSecret - type: input - if: showUnsealerCredentialCreateSecretField|azureKeyVault - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault - type: single-step-form - - elements: - - label: - text: labels.unsealer.saJson - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/googleKmsGcs/properties/saJson - type: editor - if: showUnsealerCredentialCreateSecretField|googleKmsGcs - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/googleKmsGcs - type: single-step-form - if: isNotEqualToModelPathValue|kubernetesSecret|/spec/unsealer/mode/type - schema: - $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret - type: single-step-form - label: - text: labels.unsealer.title - schema: - $ref: schema#/properties/spec/properties/unsealer - show_label: true - type: single-step-form - - alias: reusable-backup-option - chart: - name: uibytebuildersdev-component-backup-option - version: v0.30.0 - moduleResolver: fetchJsons - schema: - $ref: schema#/properties/spec/properties/backup - type: reusable-element - - label: - text: labels.configOptions - type: label-element - - cluster: - $ref: store#/route/params/cluster - hasDependencies: true - hasDescription: true - options: - - description: options.configOptions.backend.description - text: options.configOptions.backend.label - value: backend - - description: options.configOptions.allowedSecretEngines.description - text: options.configOptions.allowedSecretEngines.label - value: allowed-secret-engines - - description: options.configOptions.authMethods.description - text: options.configOptions.authMethods.label - value: auth-methods - - description: options.configOptions.dataSources.description - text: options.configOptions.dataSources.label - value: data-sources - - description: options.configOptions.unsealer.description - text: options.configOptions.unsealer.label - value: unsealer - - dependencies: - - group: stash.appscode.com - name: Stash - resource: backupconfigurations - url: https://stash.run/ - version: v1beta1 - description: options.configOptions.backup.description - text: options.configOptions.backup.label - value: backupconfiguration - - description: options.configOptions.healthChecker.description - text: options.configOptions.healthChecker.label - value: health-checker - - dependencies: - - group: cert-manager.io - name: Cert-Manager - resource: issuers - url: https://cert-manager.io/docs/ - version: v1 - description: options.configOptions.tls.description - text: options.configOptions.tls.label - value: tls - - description: options.configOptions.networking.description - text: options.configOptions.networking.label - value: networking - - dependencies: - - group: monitoring.coreos.com - name: Prometheus Operator - resource: servicemonitors - url: https://github.com/prometheus-operator - version: v1 - description: options.configOptions.monitoring.description - text: options.configOptions.monitoring.label - value: monitoring - - description: options.configOptions.customConfig.description - text: options.configOptions.customConfig.label - value: custom-config - - description: options.configOptions.podTemplate.description - text: options.configOptions.podTemplate.label - value: pod-template - owner: - $ref: store#/route/params/user - type: configure-options - type: single-step-form +step: +- elements: + - type: input + disable: isVariantAvailable + label: Vault Server Name + schema: schema/properties/metadata/properties/release/properties/name + # - disabled: isVariantAvailable + # label: + # text: labels.vaultserver.name + # schema: + # $ref: schema#/properties/metadata/properties/release/properties/name + # type: input + # - add_new_button: + # label: labels.add_new_namespace + # target: _blank + # url: + # function: getCreateNameSpaceUrl + # disabled: isVariantAvailable + # fetch: getResources|core|v1|namespaces + # label: + # text: labels.namespace + # refresh: true + # schema: + # $ref: schema#/properties/metadata/properties/release/properties/namespace + # type: select + # - fetch: getVaultServerVersions|catalog.kubevault.com|v1alpha1|vaultserverversions + # label: + # text: labels.vaultserver.version + # schema: + # $ref: schema#/properties/spec/properties/version + # type: select + # - isArray: true + # keys: + # label: + # text: labels.labels.key + # label: + # text: labels.labels.label + # schema: + # $ref: schema#/properties/spec/properties/labels + # type: key-value-input-form + # values: + # label: + # text: labels.labels.value + # schema: + # $ref: schema#/properties/spec/properties/labels/additionalProperties + # type: input + # - isArray: true + # keys: + # label: + # text: labels.annotations.key + # label: + # text: labels.annotations.label + # schema: + # $ref: schema#/properties/spec/properties/annotations + # type: key-value-input-form + # values: + # label: + # text: labels.annotations.value + # schema: + # $ref: schema#/properties/spec/properties/annotations/additionalProperties + # type: input + # - customClass: mt-10 + # disabled: isLowAvailableStorageBackendSelected + # label: + # text: labels.replicaset.number + # schema: + # $ref: schema#/properties/spec/properties/replicas + # type: input + # - hasDescription: true + # label: + # text: labels.terminationPolicy + # options: + # - description: options.terminationPolicy.delete.description + # text: options.terminationPolicy.delete.label + # value: Delete + # - description: options.terminationPolicy.halt.description + # text: options.terminationPolicy.halt.label + # value: Halt + # - description: options.terminationPolicy.wipeOut.description + # text: options.terminationPolicy.wipeOut.label + # value: WipeOut + # - description: options.terminationPolicy.doNotTerminate.description + # text: options.terminationPolicy.doNotTerminate.label + # value: DoNotTerminate + # schema: + # $ref: schema#/properties/spec/properties/terminationPolicy + # type: radio + # - label: + # text: labels.machine_profile + # type: label-element + # - computed: setMachineToCustom + # fetch: getMachineListForOptions + # label: + # text: Machine + # onChange: setResourceLimit + # schema: + # $ref: schema#/properties/spec/properties/machine + # type: select + # - computed: setLimitsCpuOrMem|cpu + # disabled: disableLimit + # label: + # text: labels.cpu + # schema: + # $ref: schema#/properties/spec/properties/resources/properties/limits/properties/cpu + # type: input + # - computed: setLimitsCpuOrMem|memory + # disabled: disableLimit + # label: + # text: labels.memory + # schema: + # $ref: schema#/properties/spec/properties/resources/properties/limits/properties/memory + # type: input + # - elements: + # - customClass: mt-10 + # elements: + # - label: + # text: labels.backend.provider + # onChange: onBackendTypeChange + # options: + # - azure + # - consul + # - dynamodb + # - etcd + # - gcs + # - inmem + # - mysql + # - postgresql + # - raft + # - s3 + # - swift + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/type + # type: select + # - elements: + # - label: + # text: labels.backend.accountName + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/azure/properties/accountName + # type: input + # if: isEqualToModelPathValue|azure|/spec/backend/provider/type + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/azure + # type: single-step-form + # - elements: + # - label: + # text: labels.backend.address + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/consul/properties/address + # type: input + # - label: + # text: labels.backend.path + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/consul/properties/path + # type: input + # if: isEqualToModelPathValue|consul|/spec/backend/provider/type + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/consul + # type: single-step-form + # - elements: + # - label: + # text: labels.backend.address + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/etcd/properties/address + # type: input + # if: isEqualToModelPathValue|etcd|/spec/backend/provider/type + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/etcd + # type: single-step-form + # - elements: + # - label: + # text: labels.backend.bucket + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/gcs/properties/bucket + # type: input + # if: isEqualToModelPathValue|gcs|/spec/backend/provider/type + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/gcs + # type: single-step-form + # - elements: + # - elements: + # - label: + # text: labels.backend.storageSize + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft/properties/persistence/properties/size + # type: input + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft/properties/persistence + # type: single-step-form + # - elements: + # - fetch: getStorageClassNames|/spec/backend/provider/raft/storageClass/name + # label: + # text: labels.backend.storageClass + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft/properties/storageClass/properties/name + # type: select + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft/properties/storageClass + # type: single-step-form + # if: isEqualToModelPathValue|raft|/spec/backend/provider/type + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/raft + # type: single-step-form + # - elements: + # - label: + # text: labels.backend.bucket + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/s3/properties/bucket + # type: input + # - label: + # text: labels.backend.region + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/s3/properties/region + # type: input + # if: isEqualToModelPathValue|s3|/spec/backend/provider/type + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider/properties/s3 + # type: single-step-form + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/provider + # type: single-step-form + # - discriminator: + # createCredentialSecret: + # default: true + # type: string + # elements: + # - label: + # text: labels.backend.credentialSecret + # onChange: onCreateCredentialSecretChange + # options: + # - text: options.secret.customSecret.label + # value: true + # - text: options.secret.existingSecret.label + # value: false + # schema: + # $ref: discriminator#/properties/createCredentialSecret + # type: radio + # - allowUserDefinedOption: true + # fetch: getSecrets + # if: showCredentialExistingSecretField + # label: + # text: labels.secret + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/name + # type: select + # - elements: + # - label: + # text: labels.backend.accountKey + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/azure/properties/accountKey + # type: input + # if: showCredentialCreateSecretField|azure + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/azure + # type: single-step-form + # - elements: + # - label: + # text: labels.backend.aclToken + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/consul/properties/aclToken + # type: input + # if: showCredentialCreateSecretField|consul + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/consul + # type: single-step-form + # - elements: + # - label: + # text: labels.backend.accessKey + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb/properties/accessKey + # type: input + # - label: + # text: labels.backend.secretKey + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb/properties/secretKey + # type: input + # - label: + # text: labels.backend.sessionToken + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb/properties/sessionToken + # type: input + # if: showCredentialCreateSecretField|dynamodb + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/dynamodb + # type: single-step-form + # - elements: + # - label: + # text: labels.backend.username + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/etcd/properties/username + # type: input + # - label: + # text: labels.backend.password + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/etcd/properties/password + # type: input + # if: showCredentialCreateSecretField|etcd + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/etcd + # type: single-step-form + # - elements: + # - label: + # text: labels.backend.saJson + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/gcs/properties/saJson + # type: editor + # if: showCredentialCreateSecretField|gcs + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/gcs + # type: single-step-form + # - elements: + # - label: + # text: labels.backend.username + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/mysql/properties/username + # type: input + # - label: + # text: labels.backend.password + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/mysql/properties/password + # type: input + # if: showCredentialCreateSecretField|mysql + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/mysql + # type: single-step-form + # - elements: + # - label: + # text: labels.backend.connectionURL + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/postgresql/properties/connectionURL + # type: input + # if: showCredentialCreateSecretField|postgresql + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/postgresql + # type: single-step-form + # - elements: + # - label: + # text: labels.backend.accessKey + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/s3/properties/accessKey + # type: input + # - label: + # text: labels.backend.secretKey + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/s3/properties/secretKey + # type: input + # if: showCredentialCreateSecretField|s3 + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/s3 + # type: single-step-form + # - elements: + # - label: + # text: labels.backend.username + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/swift/properties/username + # type: input + # - label: + # text: labels.backend.password + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/swift/properties/password + # type: input + # - label: + # text: labels.backend.authToken + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/swift/properties/authToken + # type: input + # if: showCredentialCreateSecretField|swift + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret/properties/swift + # type: single-step-form + # if: showCredentialSecret + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/credentialSecret + # type: single-step-form + # - discriminator: + # createTlsSecret: + # default: true + # type: string + # elements: + # - label: + # text: labels.backend.tlsSecret + # onChange: onCreateTlsSecretChange + # options: + # - text: options.secret.customSecret.label + # value: true + # - text: options.secret.existingSecret.label + # value: false + # schema: + # $ref: discriminator#/properties/createTlsSecret + # type: radio + # - allowUserDefinedOption: true + # fetch: getSecrets + # if: showTlsExistingSecretField + # label: + # text: labels.secret + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/name + # type: select + # - elements: + # - label: + # text: labels.backend.tlsCaFile + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/mysql/properties/tlsCaFile + # type: input + # if: showTlsCreateSecretField|mysql + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/mysql + # type: single-step-form + # - elements: + # - label: + # text: labels.backend.caCert + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/consul/properties/caCrt + # type: editor + # - label: + # text: labels.backend.clientCrt + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/consul/properties/clientCrt + # type: editor + # - label: + # text: labels.backend.clientKey + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/consul/properties/clientKey + # type: editor + # if: showTlsCreateSecretField|consul + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/tlsSecret/properties/consul + # type: single-step-form + # if: showTlsSecret + # schema: + # $ref: schema#/properties/spec/properties/backend/properties/tlsSecret + # type: single-step-form + # label: + # text: labels.backend.title + # schema: + # $ref: schema#/properties/spec/properties/backend + # show_label: true + # type: single-step-form + # - elements: + # - customClass: mt-10 + # elements: + # - label: + # text: labels.unsealer.mode + # options: + # - awsKmsSsm + # - azureKeyVault + # - googleKmsGcs + # - kubernetesSecret + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/type + # type: select + # - elements: + # - label: + # text: labels.unsealer.kmsKeyID + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/awsKmsSsm/properties/kmsKeyID + # type: input + # - label: + # text: labels.unsealer.region + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/awsKmsSsm/properties/region + # type: input + # if: isEqualToModelPathValue|awsKmsSsm|/spec/unsealer/mode/type + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/awsKmsSsm + # type: single-step-form + # - elements: + # - label: + # text: labels.unsealer.vaultBaseURL + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/azureKeyVault/properties/vaultBaseURL + # type: input + # if: isEqualToModelPathValue|azureKeyVault|/spec/unsealer/mode/type + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/azureKeyVault + # type: single-step-form + # - elements: + # - label: + # text: labels.unsealer.bucket + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/bucket + # type: input + # - label: + # text: labels.unsealer.kmsCryptoKey + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsCryptoKey + # type: input + # - label: + # text: labels.unsealer.kmsKeyRing + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsKeyRing + # type: input + # - label: + # text: labels.unsealer.kmsLocation + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsLocation + # type: input + # - label: + # text: labels.unsealer.kmsProject + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs/properties/kmsProject + # type: input + # if: isEqualToModelPathValue|googleKmsGcs|/spec/unsealer/mode/type + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/mode/properties/googleKmsGcs + # type: single-step-form + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/mode + # type: single-step-form + # - discriminator: + # createCredentialSecret: + # default: true + # type: boolean + # elements: + # - label: + # text: labels.backend.credentialSecret + # onChange: onCreateUnsealerCredentialSecretChange + # options: + # - text: options.secret.customSecret.label + # value: true + # - text: options.secret.existingSecret.label + # value: false + # schema: + # $ref: discriminator#/properties/createCredentialSecret + # type: radio + # - allowUserDefinedOption: true + # fetch: getSecrets + # if: showUnsealerCredentialExistingSecretField + # label: + # text: labels.secret + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/name + # type: select + # - elements: + # - label: + # text: labels.unsealer.accessKey + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/awsKmsSsm/properties/accessKey + # type: input + # - label: + # text: labels.unsealer.secretKey + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/awsKmsSsm/properties/secretKey + # type: input + # if: showUnsealerCredentialCreateSecretField|awsKmsSsm + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/awsKmsSsm + # type: single-step-form + # - elements: + # - label: + # text: labels.unsealer.clientCert + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientCert + # type: input + # - label: + # text: labels.unsealer.clientCertPassword + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientCertPassword + # type: input + # - label: + # text: labels.unsealer.clientId + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientId + # type: input + # - label: + # text: labels.unsealer.clientSecret + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault/properties/clientSecret + # type: input + # if: showUnsealerCredentialCreateSecretField|azureKeyVault + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/azureKeyVault + # type: single-step-form + # - elements: + # - label: + # text: labels.unsealer.saJson + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/googleKmsGcs/properties/saJson + # type: editor + # if: showUnsealerCredentialCreateSecretField|googleKmsGcs + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret/properties/googleKmsGcs + # type: single-step-form + # if: isNotEqualToModelPathValue|kubernetesSecret|/spec/unsealer/mode/type + # schema: + # $ref: schema#/properties/spec/properties/unsealer/properties/credentialSecret + # type: single-step-form + # label: + # text: labels.unsealer.title + # schema: + # $ref: schema#/properties/spec/properties/unsealer + # show_label: true + # type: single-step-form + # - alias: reusable-backup-option + # chart: + # name: uibytebuildersdev-component-backup-option + # version: v0.30.0 + # moduleResolver: fetchJsons + # schema: + # $ref: schema#/properties/spec/properties/backup + # type: reusable-element + # - label: + # text: labels.configOptions + # type: label-element + # - cluster: + # $ref: store#/route/params/cluster + # hasDependencies: true + # hasDescription: true + # options: + # - description: options.configOptions.backend.description + # text: options.configOptions.backend.label + # value: backend + # - description: options.configOptions.allowedSecretEngines.description + # text: options.configOptions.allowedSecretEngines.label + # value: allowed-secret-engines + # - description: options.configOptions.authMethods.description + # text: options.configOptions.authMethods.label + # value: auth-methods + # - description: options.configOptions.dataSources.description + # text: options.configOptions.dataSources.label + # value: data-sources + # - description: options.configOptions.unsealer.description + # text: options.configOptions.unsealer.label + # value: unsealer + # - dependencies: + # - group: stash.appscode.com + # name: Stash + # resource: backupconfigurations + # url: https://stash.run/ + # version: v1beta1 + # description: options.configOptions.backup.description + # text: options.configOptions.backup.label + # value: backupconfiguration + # - description: options.configOptions.healthChecker.description + # text: options.configOptions.healthChecker.label + # value: health-checker + # - dependencies: + # - group: cert-manager.io + # name: Cert-Manager + # resource: issuers + # url: https://cert-manager.io/docs/ + # version: v1 + # description: options.configOptions.tls.description + # text: options.configOptions.tls.label + # value: tls + # - description: options.configOptions.networking.description + # text: options.configOptions.networking.label + # value: networking + # - dependencies: + # - group: monitoring.coreos.com + # name: Prometheus Operator + # resource: servicemonitors + # url: https://github.com/prometheus-operator + # version: v1 + # description: options.configOptions.monitoring.description + # text: options.configOptions.monitoring.label + # value: monitoring + # - description: options.configOptions.customConfig.description + # text: options.configOptions.customConfig.label + # value: custom-config + # - description: options.configOptions.podTemplate.description + # text: options.configOptions.podTemplate.label + # value: pod-template + # owner: + # $ref: store#/route/params/user + # type: configure-options + # type: single-step-form id: options - title: steps.0.label + loader: initBundle + type: single-step-form type: multi-step-form