From ec4f4c5786d6afdf79b4ea605324d6688ee8ee6a Mon Sep 17 00:00:00 2001 From: shofiq Date: Fri, 15 May 2026 16:18:33 +0600 Subject: [PATCH] add current config panel in reconfigure ops Signed-off-by: shofiq --- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 59 +++++-------------- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 50 +++++----------- .../ui/functions.js | 36 +++-------- .../ui/create-ui.yaml | 23 +++++--- .../ui/functions.js | 36 +++-------- schemas/ui-schema.json | 3 + 35 files changed, 394 insertions(+), 675 deletions(-) diff --git a/charts/opskubedbcom-druidopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-druidopsrequest-editor/ui/create-ui.yaml index 8fceee788e..2a5f984d74 100644 --- a/charts/opskubedbcom-druidopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-druidopsrequest-editor/ui/create-ui.yaml @@ -529,6 +529,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - customClass: mb-15 @@ -657,15 +671,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-druidopsrequest-editor/ui/functions.js b/charts/opskubedbcom-druidopsrequest-editor/ui/functions.js index 304f0a686a..e6f7b91df9 100644 --- a/charts/opskubedbcom-druidopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-druidopsrequest-editor/ui/functions.js @@ -1081,6 +1081,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -1117,6 +1118,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -1136,6 +1138,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1413,38 +1420,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -2208,5 +2189,6 @@ export const useFunc = (model) => { hasTopologyType, getResourceConfig, isTlsEnabled, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/create-ui.yaml index 02fbb2bbc9..5edb23bb17 100644 --- a/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/create-ui.yaml @@ -1264,6 +1264,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - customClass: mb-15 @@ -1392,15 +1406,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/functions.js b/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/functions.js index 1735ebf321..df02cc2a37 100644 --- a/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/functions.js @@ -1146,6 +1146,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -1182,6 +1183,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -1201,6 +1203,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1478,38 +1485,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -2152,5 +2133,6 @@ export const useFunc = (model) => { hasResourceValue, hasVolumeExpansion, isTlsEnabled, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-kafkaopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-kafkaopsrequest-editor/ui/create-ui.yaml index 42dab2cec1..beb7a3c0da 100644 --- a/charts/opskubedbcom-kafkaopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-kafkaopsrequest-editor/ui/create-ui.yaml @@ -475,6 +475,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - customClass: mb-15 @@ -603,15 +617,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-kafkaopsrequest-editor/ui/functions.js b/charts/opskubedbcom-kafkaopsrequest-editor/ui/functions.js index e19880ab9d..8120c68072 100644 --- a/charts/opskubedbcom-kafkaopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-kafkaopsrequest-editor/ui/functions.js @@ -935,6 +935,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -971,6 +972,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -990,6 +992,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1267,38 +1274,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1912,5 +1893,6 @@ export const useFunc = (model) => { onNewConfigSecretChange, onSelectedSecretChange, isTlsEnabled, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-mariadbopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-mariadbopsrequest-editor/ui/create-ui.yaml index d1b38a257c..c610a37f54 100644 --- a/charts/opskubedbcom-mariadbopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-mariadbopsrequest-editor/ui/create-ui.yaml @@ -280,6 +280,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - customClass: mb-15 @@ -408,15 +422,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-mariadbopsrequest-editor/ui/functions.js b/charts/opskubedbcom-mariadbopsrequest-editor/ui/functions.js index 9a16f52fc1..01d38ef1d6 100644 --- a/charts/opskubedbcom-mariadbopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-mariadbopsrequest-editor/ui/functions.js @@ -897,6 +897,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -933,6 +934,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -952,6 +954,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1229,38 +1236,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1898,5 +1879,6 @@ export const useFunc = (model) => { onNewConfigSecretChange, onSelectedSecretChange, isTlsEnabled, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-memcachedopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-memcachedopsrequest-editor/ui/create-ui.yaml index c7c794a66b..0e13b2caa2 100644 --- a/charts/opskubedbcom-memcachedopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-memcachedopsrequest-editor/ui/create-ui.yaml @@ -228,6 +228,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - elements: @@ -357,15 +371,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-memcachedopsrequest-editor/ui/functions.js b/charts/opskubedbcom-memcachedopsrequest-editor/ui/functions.js index 293b60dc23..c6c50e70a4 100644 --- a/charts/opskubedbcom-memcachedopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-memcachedopsrequest-editor/ui/functions.js @@ -892,6 +892,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -928,6 +929,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -947,6 +949,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1224,38 +1231,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1644,5 +1625,6 @@ export const useFunc = (model) => { onRemoveConfigChange, onNewConfigSecretChange, onSelectedSecretChange, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-mongodbopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-mongodbopsrequest-editor/ui/create-ui.yaml index 21e2058e00..177593d988 100644 --- a/charts/opskubedbcom-mongodbopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-mongodbopsrequest-editor/ui/create-ui.yaml @@ -720,6 +720,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - elements: @@ -849,15 +863,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/standalone/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange|standalone - readonly: true - schema: temp/properties/standalone/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange|standalone paths: @@ -1011,15 +1016,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/replicaSet/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange|replicaSet - readonly: true - schema: temp/properties/replicaSet/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange|replicaSet paths: @@ -1175,15 +1171,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/configServer/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange|configServer - readonly: true - schema: temp/properties/configServer/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange|configServer paths: @@ -1335,15 +1322,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/mongos/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange|mongos - readonly: true - schema: temp/properties/mongos/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange|mongos paths: @@ -1495,15 +1473,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/shard/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange|shard - readonly: true - schema: temp/properties/shard/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange|shard paths: diff --git a/charts/opskubedbcom-mongodbopsrequest-editor/ui/functions.js b/charts/opskubedbcom-mongodbopsrequest-editor/ui/functions.js index ccd9819e40..ac3c99b6a6 100644 --- a/charts/opskubedbcom-mongodbopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-mongodbopsrequest-editor/ui/functions.js @@ -956,6 +956,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -992,6 +993,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -1011,6 +1013,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1301,38 +1308,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1979,5 +1960,6 @@ export const useFunc = (model) => { cancelCreateSecret, onSelectedSecretChange, isTlsEnabled, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/create-ui.yaml index f4f9331691..61fb8c4d8d 100644 --- a/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/create-ui.yaml @@ -313,6 +313,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - customClass: mb-15 @@ -441,15 +455,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/functions.js b/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/functions.js index ee51bf58a3..ea6096cf6d 100644 --- a/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/functions.js @@ -877,6 +877,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -913,6 +914,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -932,6 +934,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1209,38 +1216,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1864,5 +1845,6 @@ export const useFunc = (model) => { onRemoveConfigChange, onNewConfigSecretChange, onSelectedSecretChange, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-mysqlopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-mysqlopsrequest-editor/ui/create-ui.yaml index 9b167ca44f..8a4074266a 100644 --- a/charts/opskubedbcom-mysqlopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-mysqlopsrequest-editor/ui/create-ui.yaml @@ -288,6 +288,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - customClass: mb-15 @@ -416,15 +430,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-mysqlopsrequest-editor/ui/functions.js b/charts/opskubedbcom-mysqlopsrequest-editor/ui/functions.js index 52a2a8edf5..e846611af0 100644 --- a/charts/opskubedbcom-mysqlopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-mysqlopsrequest-editor/ui/functions.js @@ -905,6 +905,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -941,6 +942,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -960,6 +962,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1237,38 +1244,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1933,5 +1914,6 @@ export const useFunc = (model) => { onNewConfigSecretChange, onSelectedSecretChange, isTlsEnabled, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/create-ui.yaml index 9099e0185a..b69d5d72fe 100644 --- a/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/create-ui.yaml @@ -290,6 +290,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - customClass: mb-15 @@ -418,15 +432,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/functions.js b/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/functions.js index 68e37c2bce..12751677a5 100644 --- a/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/functions.js @@ -860,6 +860,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -896,6 +897,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -915,6 +917,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1192,38 +1199,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1849,5 +1830,6 @@ export const useFunc = (model) => { onNewConfigSecretChange, onSelectedSecretChange, isTlsEnabled, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-pgbounceropsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-pgbounceropsrequest-editor/ui/create-ui.yaml index c41ef25c7b..c423c1618f 100644 --- a/charts/opskubedbcom-pgbounceropsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-pgbounceropsrequest-editor/ui/create-ui.yaml @@ -235,6 +235,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - customClass: mb-15 @@ -363,15 +377,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-pgbounceropsrequest-editor/ui/functions.js b/charts/opskubedbcom-pgbounceropsrequest-editor/ui/functions.js index cab07aedbe..e246879650 100644 --- a/charts/opskubedbcom-pgbounceropsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-pgbounceropsrequest-editor/ui/functions.js @@ -878,6 +878,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -914,6 +915,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -933,6 +935,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1210,38 +1217,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1820,5 +1801,6 @@ export const useFunc = (model) => { onRemoveConfigChange, onNewConfigSecretChange, onSelectedSecretChange, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-pgpoolopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-pgpoolopsrequest-editor/ui/create-ui.yaml index 8b0fc7328f..792a740378 100644 --- a/charts/opskubedbcom-pgpoolopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-pgpoolopsrequest-editor/ui/create-ui.yaml @@ -238,6 +238,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - customClass: mb-15 @@ -366,15 +380,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-pgpoolopsrequest-editor/ui/functions.js b/charts/opskubedbcom-pgpoolopsrequest-editor/ui/functions.js index ed222812ff..e78ccec28b 100644 --- a/charts/opskubedbcom-pgpoolopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-pgpoolopsrequest-editor/ui/functions.js @@ -901,6 +901,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -937,6 +938,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -956,6 +958,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1233,38 +1240,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1866,5 +1847,6 @@ export const useFunc = (model) => { onNewConfigSecretChange, onSelectedSecretChange, isTlsEnabled, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-postgresopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-postgresopsrequest-editor/ui/create-ui.yaml index 7b2ecd8003..a1462b6cfc 100644 --- a/charts/opskubedbcom-postgresopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-postgresopsrequest-editor/ui/create-ui.yaml @@ -291,6 +291,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - customClass: mb-15 @@ -419,15 +433,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-postgresopsrequest-editor/ui/functions.js b/charts/opskubedbcom-postgresopsrequest-editor/ui/functions.js index 64d3b6ddd9..62a033716e 100644 --- a/charts/opskubedbcom-postgresopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-postgresopsrequest-editor/ui/functions.js @@ -890,6 +890,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -926,6 +927,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -945,6 +947,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1222,38 +1229,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1974,5 +1955,6 @@ export const useFunc = (model) => { onNewConfigSecretChange, onSelectedSecretChange, isTlsEnabled, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/create-ui.yaml index f28a676bee..e5b7e6f2ad 100644 --- a/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/create-ui.yaml @@ -292,6 +292,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - customClass: mb-15 @@ -420,15 +434,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/functions.js b/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/functions.js index 1b4655db79..562b2e217f 100644 --- a/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/functions.js @@ -886,6 +886,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -922,6 +923,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -941,6 +943,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1218,38 +1225,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1903,5 +1884,6 @@ export const useFunc = (model) => { onNewConfigSecretChange, onSelectedSecretChange, isTlsEnabled, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-redisopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-redisopsrequest-editor/ui/create-ui.yaml index 588989c632..2d6a4bf1e6 100644 --- a/charts/opskubedbcom-redisopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-redisopsrequest-editor/ui/create-ui.yaml @@ -293,6 +293,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - customClass: mb-15 @@ -421,15 +435,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-redisopsrequest-editor/ui/functions.js b/charts/opskubedbcom-redisopsrequest-editor/ui/functions.js index ad79d7554d..e147472625 100644 --- a/charts/opskubedbcom-redisopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-redisopsrequest-editor/ui/functions.js @@ -892,6 +892,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -928,6 +929,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -947,6 +949,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1224,38 +1231,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1896,5 +1877,6 @@ export const useFunc = (model) => { onNewConfigSecretChange, onSelectedSecretChange, isTlsEnabled, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-singlestoreopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-singlestoreopsrequest-editor/ui/create-ui.yaml index 780209dabf..0c8664772c 100644 --- a/charts/opskubedbcom-singlestoreopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-singlestoreopsrequest-editor/ui/create-ui.yaml @@ -500,6 +500,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - customClass: mb-15 @@ -628,15 +642,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-singlestoreopsrequest-editor/ui/functions.js b/charts/opskubedbcom-singlestoreopsrequest-editor/ui/functions.js index ce11e8ce8b..24366fa00b 100644 --- a/charts/opskubedbcom-singlestoreopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-singlestoreopsrequest-editor/ui/functions.js @@ -935,6 +935,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -971,6 +972,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -990,6 +992,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1267,38 +1274,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1923,5 +1904,6 @@ export const useFunc = (model) => { onNewConfigSecretChange, onSelectedSecretChange, isTlsEnabled, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-solropsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-solropsrequest-editor/ui/create-ui.yaml index bf9cb36582..3d87cb2445 100644 --- a/charts/opskubedbcom-solropsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-solropsrequest-editor/ui/create-ui.yaml @@ -627,6 +627,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - elements: @@ -756,15 +770,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/node/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange|node - readonly: true - schema: temp/properties/node/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange|node paths: @@ -919,15 +924,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/coordinator/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange|coordinator - readonly: true - schema: temp/properties/coordinator/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange|coordinator paths: @@ -1079,15 +1075,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/data/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange|data - readonly: true - schema: temp/properties/data/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange|data paths: @@ -1239,15 +1226,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/overseer/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange|overseer - readonly: true - schema: temp/properties/overseer/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange|overseer paths: diff --git a/charts/opskubedbcom-solropsrequest-editor/ui/functions.js b/charts/opskubedbcom-solropsrequest-editor/ui/functions.js index 7fe7716632..f2b26986d5 100644 --- a/charts/opskubedbcom-solropsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-solropsrequest-editor/ui/functions.js @@ -931,6 +931,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -967,6 +968,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -986,6 +988,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1263,38 +1270,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1916,5 +1897,6 @@ export const useFunc = (model) => { onNewConfigSecretChange, onSelectedSecretChange, isTlsEnabled, + getCurrentConfig, } } diff --git a/charts/opskubedbcom-zookeeperopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-zookeeperopsrequest-editor/ui/create-ui.yaml index 4ae005142d..d643a58835 100644 --- a/charts/opskubedbcom-zookeeperopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-zookeeperopsrequest-editor/ui/create-ui.yaml @@ -280,6 +280,20 @@ step: subtitle: Select a new configuration secret, apply a custom configuration, or remove an existing setup to update your database settings type: label-element + - type: editor + label: Current Configuration + schema: temp/properties/currentConfig + readonly: true + editorHeight: 120px + validateContent: false + if: + name: getCurrentConfig + type: function + loader: + name: getCurrentConfig + watchPaths: + - schema/properties/metadata/properties/namespace + - temp/properties/standalone/properties/createSecret/properties/status - elements: - elements: - customClass: mb-15 @@ -408,15 +422,6 @@ step: refresh: fetchConfigSecrets schema: temp/properties/selectedConfigurationRemove type: select - - editorHeight: 500px - hideFormatButton: true - validateContent: false - init: - type: func - value: onRemoveConfigChange - readonly: true - schema: temp/properties/removeConfig - type: multi-file-editor watcher: func: onRemoveConfigChange paths: diff --git a/charts/opskubedbcom-zookeeperopsrequest-editor/ui/functions.js b/charts/opskubedbcom-zookeeperopsrequest-editor/ui/functions.js index 199a2295b4..893b7ecc7a 100644 --- a/charts/opskubedbcom-zookeeperopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-zookeeperopsrequest-editor/ui/functions.js @@ -726,6 +726,7 @@ export const useFunc = (model) => { let configSecrets = [] let secretConfigData = [] let existingSecrets = [] + let databaseInfoResponse = {} async function fetchConfigSecrets() { const owner = storeGet('/route/params/user') @@ -762,6 +763,7 @@ export const useFunc = (model) => { }, }, ) + databaseInfoResponse = resp?.data?.response || {} configSecrets = resp?.data?.response?.availableSecrets || [] secretConfigData = resp?.data?.response?.configurations || [] } catch (e) { @@ -781,6 +783,11 @@ export const useFunc = (model) => { } } + function getCurrentConfig() { + const currentConfig = databaseInfoResponse?.appliedConfig ?? '' + return currentConfig + } + async function getConfigSecrets(type) { type = type ? type + '/' : '' const secretStatus = getValue(discriminator, `${type}createSecret/status`) @@ -1058,38 +1065,12 @@ export const useFunc = (model) => { if (!selectedConfig) { commit('wizard/model$delete', `/spec/configuration/${type}removeCustomConfig`) - return [{ name: '', content: '' }] + return } commit('wizard/model$update', { path: `/spec/configuration/${type}removeCustomConfig`, value: true, }) - - const configuration = secretConfigData.find((item) => item.componentName === selectedConfig) - - if (!configuration.data) { - return [{ name: '', content: '' }] - } - - const configObj = [] - // Decode base64 and format as array of objects with name and content - Object.keys(configuration.data).forEach((fileName) => { - try { - // Decode base64 string - const decodedString = atob(configuration.data[fileName]) - configObj.push({ - name: fileName, - content: decodedString, - }) - } catch (e) { - console.error(`Error decoding ${fileName}:`, e) - configObj.push({ - name: fileName, - content: configuration.data[fileName], // Fallback to original if decode fails - }) - } - }) - return configObj } async function onNewConfigSecretChange(type) { @@ -1722,5 +1703,6 @@ export const useFunc = (model) => { onRemoveConfigChange, onNewConfigSecretChange, onSelectedSecretChange, + getCurrentConfig, } } diff --git a/schemas/ui-schema.json b/schemas/ui-schema.json index 32df7aba66..99c5613113 100644 --- a/schemas/ui-schema.json +++ b/schemas/ui-schema.json @@ -780,6 +780,9 @@ "const": "editor", "type": "string" }, + "validateContent": { + "type": "boolean" + }, "validation": { "$ref": "#/definitions/Validation" },