Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions charts/opskubedbcom-druidopsrequest-editor/ui/create-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
36 changes: 9 additions & 27 deletions charts/opskubedbcom-druidopsrequest-editor/ui/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -1117,6 +1118,7 @@ export const useFunc = (model) => {
},
},
)
databaseInfoResponse = resp?.data?.response || {}
configSecrets = resp?.data?.response?.availableSecrets || []
secretConfigData = resp?.data?.response?.configurations || []
} catch (e) {
Expand All @@ -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`)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -2208,5 +2189,6 @@ export const useFunc = (model) => {
hasTopologyType,
getResourceConfig,
isTlsEnabled,
getCurrentConfig,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
36 changes: 9 additions & 27 deletions charts/opskubedbcom-elasticsearchopsrequest-editor/ui/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -1182,6 +1183,7 @@ export const useFunc = (model) => {
},
},
)
databaseInfoResponse = resp?.data?.response || {}
configSecrets = resp?.data?.response?.availableSecrets || []
secretConfigData = resp?.data?.response?.configurations || []
} catch (e) {
Expand All @@ -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`)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -2152,5 +2133,6 @@ export const useFunc = (model) => {
hasResourceValue,
hasVolumeExpansion,
isTlsEnabled,
getCurrentConfig,
}
}
23 changes: 14 additions & 9 deletions charts/opskubedbcom-kafkaopsrequest-editor/ui/create-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
36 changes: 9 additions & 27 deletions charts/opskubedbcom-kafkaopsrequest-editor/ui/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -971,6 +972,7 @@ export const useFunc = (model) => {
},
},
)
databaseInfoResponse = resp?.data?.response || {}
configSecrets = resp?.data?.response?.availableSecrets || []
secretConfigData = resp?.data?.response?.configurations || []
} catch (e) {
Expand All @@ -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`)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -1912,5 +1893,6 @@ export const useFunc = (model) => {
onNewConfigSecretChange,
onSelectedSecretChange,
isTlsEnabled,
getCurrentConfig,
}
}
23 changes: 14 additions & 9 deletions charts/opskubedbcom-mariadbopsrequest-editor/ui/create-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
Loading
Loading