Skip to content
Merged
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
24 changes: 15 additions & 9 deletions charts/opskubedbcom-cassandraopsrequest-editor/ui/create-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,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/createSecret/properties/status
- elements:
- elements:
- customClass: mb-15
Expand Down Expand Up @@ -366,6 +380,7 @@ step:
schema: temp/properties/applyConfig
type: multi-file-editor
validateContent: false
placeholder: Add config parameters...
watcher:
func: onApplyconfigChange
paths:
Expand All @@ -390,15 +405,6 @@ step:
refresh: fetchConfigSecrets
schema: temp/properties/selectedConfigurationRemove
type: select
- editorHeight: 500px
hideFormatButton: true
init:
type: func
value: onRemoveConfigChange
readonly: true
schema: temp/properties/removeConfig
type: multi-file-editor
validateContent: false
watcher:
func: onRemoveConfigChange
paths:
Expand Down
36 changes: 9 additions & 27 deletions charts/opskubedbcom-cassandraopsrequest-editor/ui/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,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 @@ -930,6 +931,7 @@ export const useFunc = (model) => {
},
},
)
databaseInfoResponse = resp?.data?.response || {}
configSecrets = resp?.data?.response?.availableSecrets || []
secretConfigData = resp?.data?.response?.configurations || []
} catch (e) {
Expand All @@ -949,6 +951,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 @@ -1226,38 +1233,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 @@ -1909,5 +1890,6 @@ export const useFunc = (model) => {
onNewConfigSecretChange,
onSelectedSecretChange,
isTlsEnabled,
getCurrentConfig,
}
}
24 changes: 15 additions & 9 deletions charts/opskubedbcom-clickhouseopsrequest-editor/ui/create-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,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/createSecret/properties/status
- elements:
- elements:
- customClass: mb-15
Expand Down Expand Up @@ -366,6 +380,7 @@ step:
schema: temp/properties/applyConfig
type: multi-file-editor
validateContent: false
placeholder: Add config parameters...
watcher:
func: onApplyconfigChange
paths:
Expand All @@ -390,15 +405,6 @@ step:
refresh: fetchConfigSecrets
schema: temp/properties/selectedConfigurationRemove
type: select
- editorHeight: 500px
hideFormatButton: true
init:
type: func
value: onRemoveConfigChange
readonly: true
schema: temp/properties/removeConfig
type: multi-file-editor
validateContent: false
watcher:
func: onRemoveConfigChange
paths:
Expand Down
40 changes: 11 additions & 29 deletions charts/opskubedbcom-clickhouseopsrequest-editor/ui/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ export const useFunc = (model) => {
let configSecrets = []
let secretConfigData = []
let existingSecrets = []
let databaseInfoResponse = {}

async function fetchConfigSecrets() {
const owner = storeGet('/route/params/user')
Expand All @@ -922,10 +923,10 @@ export const useFunc = (model) => {

try {
const resp = await axios.post(
`/clusters/${owner}/${cluster}/proxy/ui.kubedb.com/v1alpha1/databaseinfos`,
`/clusters/${owner}/${cluster}/proxy/ui.kubedb.com/v1alpha1/databaseconfigurations`,
{
apiVersion: 'ui.kubedb.com/v1alpha1',
kind: 'DatabaseInfo',
kind: 'DatabaseConfiguration',
request: {
source: {
ref: {
Expand All @@ -943,6 +944,7 @@ export const useFunc = (model) => {
},
},
)
databaseInfoResponse = resp?.data?.response || {}
configSecrets = resp?.data?.response?.availableSecrets || []
secretConfigData = resp?.data?.response?.configurations || []
} catch (e) {
Expand All @@ -962,6 +964,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 @@ -1239,38 +1246,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 @@ -1936,5 +1917,6 @@ export const useFunc = (model) => {
onNewConfigSecretChange,
onSelectedSecretChange,
isTlsEnabled,
getCurrentConfig,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ step:
name: getCurrentConfig
watchPaths:
- schema/properties/metadata/properties/namespace
- temp/properties/standalone/properties/createSecret/properties/status
- temp/properties/createSecret/properties/status
- elements:
- elements:
- customClass: mb-15
Expand Down Expand Up @@ -404,6 +404,7 @@ step:
schema: temp/properties/applyConfig
type: multi-file-editor
validateContent: false
placeholder: Add config parameters...
watcher:
func: onApplyconfigChange
paths:
Expand Down
3 changes: 2 additions & 1 deletion charts/opskubedbcom-druidopsrequest-editor/ui/create-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ step:
name: getCurrentConfig
watchPaths:
- schema/properties/metadata/properties/namespace
- temp/properties/standalone/properties/createSecret/properties/status
- temp/properties/createSecret/properties/status
- elements:
- elements:
- customClass: mb-15
Expand Down Expand Up @@ -693,6 +693,7 @@ step:
schema: temp/properties/applyConfig
type: multi-file-editor
validateContent: false
placeholder: Add config parameters...
watcher:
func: onApplyconfigChange
paths:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ step:
name: getCurrentConfig
watchPaths:
- schema/properties/metadata/properties/namespace
- temp/properties/standalone/properties/createSecret/properties/status
- temp/properties/createSecret/properties/status
- elements:
- elements:
- customClass: mb-15
Expand Down Expand Up @@ -1386,6 +1386,7 @@ step:
schema: temp/properties/applyConfig
type: multi-file-editor
validateContent: false
placeholder: Add config parameters...
watcher:
func: onApplyconfigChange
paths:
Expand Down
24 changes: 15 additions & 9 deletions charts/opskubedbcom-hanadbopsrequest-editor/ui/create-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,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/createSecret/properties/status
- elements:
- elements:
- customClass: mb-15
Expand Down Expand Up @@ -263,6 +277,7 @@ step:
schema: temp/properties/applyConfig
type: multi-file-editor
validateContent: false
placeholder: Add config parameters...
watcher:
func: onApplyconfigChange
paths:
Expand All @@ -287,15 +302,6 @@ step:
refresh: fetchConfigSecrets
schema: temp/properties/selectedConfigurationRemove
type: select
- editorHeight: 500px
hideFormatButton: true
init:
type: func
value: onRemoveConfigChange
readonly: true
schema: temp/properties/removeConfig
type: multi-file-editor
validateContent: false
watcher:
func: onRemoveConfigChange
paths:
Expand Down
Loading
Loading