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
3 changes: 3 additions & 0 deletions charts/kubedbcom-redis-editor-options/ui/create-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ step:
label: Shards
schema: temp/announceShards
type: array-item-form
validation:
type: custom
name: validateAnnounceShards
watcher:
func: onAnnounceShardsChange
paths:
Expand Down
21 changes: 21 additions & 0 deletions charts/kubedbcom-redis-editor-options/ui/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1113,13 +1113,33 @@ export const useFunc = (model) => {
.map((endpoint) => endpoint.trim())
.filter((endpoint) => endpoint),
}))

commit('wizard/model$update', {
path: '/spec/cluster/announce/shards',
value: transformed,
force: true,
})
}

function validateAnnounceShards() {
const shards = getValue(discriminator, '/announceShards') || []
const master = getValue(model, '/spec/cluster/master') || 0
const replicas = getValue(model, '/spec/cluster/replicas') || 0
if (shards.length !== master) {
return `Shards Length should be equal to master(${master})`
}
for (let i = 0; i < shards.length; i++) {
const shard = shards[i]
const endpoints = shard
.split(',')
.map((endpoint) => endpoint.trim())
.filter((endpoint) => endpoint)
if (endpoints.length !== replicas) {
return `Each Shard should have ${replicas} comma-separated endpoints, but found ${endpoints.length}.`
}
}
}

function setBackup() {
const backup = getValue(model, '/spec/backup/tool')
const val = getValue(model, '/spec/admin/backup/enable/default')
Expand Down Expand Up @@ -1448,6 +1468,7 @@ export const useFunc = (model) => {
isVariantAvailable,
notEqualToDatabaseMode,
onAnnounceShardsChange,
validateAnnounceShards,
onAuthChange,
onBackupSwitch,
onCreateSentinelChange,
Expand Down
Loading