diff --git a/charts/opskubedbcom-cassandraopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-cassandraopsrequest-editor/ui/create-ui.yaml index 4117a5c00d..e57841b1a0 100644 --- a/charts/opskubedbcom-cassandraopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-cassandraopsrequest-editor/ui/create-ui.yaml @@ -196,18 +196,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|node|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|node|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-cassandraopsrequest-editor/ui/functions.js b/charts/opskubedbcom-cassandraopsrequest-editor/ui/functions.js index 0416e232a2..1b0e41a36f 100644 --- a/charts/opskubedbcom-cassandraopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-cassandraopsrequest-editor/ui/functions.js @@ -1648,24 +1648,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/node/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-clickhouseopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-clickhouseopsrequest-editor/ui/create-ui.yaml index 5aafc053c5..d6a35cfcf4 100644 --- a/charts/opskubedbcom-clickhouseopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-clickhouseopsrequest-editor/ui/create-ui.yaml @@ -196,18 +196,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|node|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|node|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-clickhouseopsrequest-editor/ui/functions.js b/charts/opskubedbcom-clickhouseopsrequest-editor/ui/functions.js index c40ed57673..436a178e3d 100644 --- a/charts/opskubedbcom-clickhouseopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-clickhouseopsrequest-editor/ui/functions.js @@ -1660,24 +1660,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/node/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-documentdbopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-documentdbopsrequest-editor/ui/create-ui.yaml index 71dea80daa..ac18d423ab 100644 --- a/charts/opskubedbcom-documentdbopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-documentdbopsrequest-editor/ui/create-ui.yaml @@ -196,18 +196,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/documentdb/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|documentdb|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/documentdb/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/documentdb/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|documentdb|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/documentdb/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-documentdbopsrequest-editor/ui/functions.js b/charts/opskubedbcom-documentdbopsrequest-editor/ui/functions.js index d58c684115..9b859e3ad8 100644 --- a/charts/opskubedbcom-documentdbopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-documentdbopsrequest-editor/ui/functions.js @@ -1659,24 +1659,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/documentdb/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-druidopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-druidopsrequest-editor/ui/create-ui.yaml index 9c68f7b96c..68c145ead2 100644 --- a/charts/opskubedbcom-druidopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-druidopsrequest-editor/ui/create-ui.yaml @@ -282,12 +282,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key + - type: input + label: Key schema: schema/properties/spec/properties/verticalScaling/properties/middleManagers/properties/topology/properties/key - type: input - - label: Value + validation: + type: custom + name: isVerticalScaleTopologyRequired|middleManagers|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/middleManagers/properties/topology/properties/value + - type: input + label: Value schema: schema/properties/spec/properties/verticalScaling/properties/middleManagers/properties/topology/properties/value - type: input + validation: + type: custom + name: isVerticalScaleTopologyRequired|middleManagers|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/middleManagers/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -343,12 +353,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key + - type: input + label: Key schema: schema/properties/spec/properties/verticalScaling/properties/historicals/properties/topology/properties/key - type: input - - label: Value + validation: + type: custom + name: isVerticalScaleTopologyRequired|historicals|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/historicals/properties/topology/properties/value + - type: input + label: Value schema: schema/properties/spec/properties/verticalScaling/properties/historicals/properties/topology/properties/value - type: input + validation: + type: custom + name: isVerticalScaleTopologyRequired|historicals|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/historicals/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -404,12 +424,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key + - type: input + label: Key schema: schema/properties/spec/properties/verticalScaling/properties/brokers/properties/topology/properties/key - type: input - - label: Value + validation: + type: custom + name: isVerticalScaleTopologyRequired|brokers|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/brokers/properties/topology/properties/value + - type: input + label: Value schema: schema/properties/spec/properties/verticalScaling/properties/brokers/properties/topology/properties/value - type: input + validation: + type: custom + name: isVerticalScaleTopologyRequired|brokers|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/brokers/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -465,12 +495,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key + - type: input + label: Key schema: schema/properties/spec/properties/verticalScaling/properties/coordinators/properties/topology/properties/key - type: input - - label: Value + validation: + type: custom + name: isVerticalScaleTopologyRequired|coordinators|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/coordinators/properties/topology/properties/value + - type: input + label: Value schema: schema/properties/spec/properties/verticalScaling/properties/coordinators/properties/topology/properties/value - type: input + validation: + type: custom + name: isVerticalScaleTopologyRequired|coordinators|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/coordinators/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-druidopsrequest-editor/ui/functions.js b/charts/opskubedbcom-druidopsrequest-editor/ui/functions.js index 8f8a5bf924..cce3c8731e 100644 --- a/charts/opskubedbcom-druidopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-druidopsrequest-editor/ui/functions.js @@ -991,24 +991,22 @@ export const useFunc = (model) => { // VERTICAL SCALING FUNCTIONS // ============================================================ - function isVerticalScaleTopologyRequired(type) { - // watchDependency(`discriminator#/topologyKey-${type}`) - // watchDependency(`discriminator#/topologyValue-${type}`) - - const key = getValue(discriminator, `/topologyKey-${type}`) - const value = getValue(discriminator, `/topologyValue-${type}`) + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) const path = `/spec/verticalScaling/${type}/topology` - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() + + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/create-ui.yaml index 3e29ec52cd..a303684625 100644 --- a/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/create-ui.yaml @@ -265,18 +265,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-node - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|node type: custom - - label: Value - schema: temp/topologyValue-node - type: input + name: isVerticalScaleTopologyRequired|node|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|node type: custom + name: isVerticalScaleTopologyRequired|node|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -337,18 +341,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-master - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/master/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|master type: custom - - label: Value - schema: temp/topologyValue-master - type: input + name: isVerticalScaleTopologyRequired|master|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/master/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/master/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|master type: custom + name: isVerticalScaleTopologyRequired|master|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/master/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -408,18 +416,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-data - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/data/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|data type: custom - - label: Value - schema: temp/topologyValue-data - type: input + name: isVerticalScaleTopologyRequired|data|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/data/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/data/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|data type: custom + name: isVerticalScaleTopologyRequired|data|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/data/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -479,18 +491,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-ingest - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/ingest/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|ingest type: custom - - label: Value - schema: temp/topologyValue-ingest - type: input + name: isVerticalScaleTopologyRequired|ingest|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/ingest/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/ingest/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|ingest type: custom + name: isVerticalScaleTopologyRequired|ingest|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/ingest/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -550,18 +566,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-ml - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/ml/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|ml type: custom - - label: Value - schema: temp/topologyValue-ml - type: input + name: isVerticalScaleTopologyRequired|ml|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/ml/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/ml/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|ml type: custom + name: isVerticalScaleTopologyRequired|ml|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/ml/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -621,18 +641,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-transform - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/transform/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|transform type: custom - - label: Value - schema: temp/topologyValue-transform - type: input + name: isVerticalScaleTopologyRequired|transform|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/transform/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/transform/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|transform type: custom + name: isVerticalScaleTopologyRequired|transform|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/transform/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -692,18 +716,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-dataCold - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/dataCold/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|dataCold type: custom - - label: Value - schema: temp/topologyValue-dataCold - type: input + name: isVerticalScaleTopologyRequired|dataCold|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/dataCold/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/dataCold/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|dataCold type: custom + name: isVerticalScaleTopologyRequired|dataCold|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/dataCold/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -763,18 +791,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-dataContent - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/dataContent/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|dataContent type: custom - - label: Value - schema: temp/topologyValue-dataContent - type: input + name: isVerticalScaleTopologyRequired|dataContent|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/dataContent/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/dataContent/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|dataContent type: custom + name: isVerticalScaleTopologyRequired|dataContent|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/dataContent/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -834,18 +866,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-dataFrozen - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/dataFrozen/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|dataFrozen type: custom - - label: Value - schema: temp/topologyValue-dataFrozen - type: input + name: isVerticalScaleTopologyRequired|dataFrozen|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/dataFrozen/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/dataFrozen/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|dataFrozen type: custom + name: isVerticalScaleTopologyRequired|dataFrozen|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/dataFrozen/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -905,18 +941,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-dataHot - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/dataHot/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|dataHot type: custom - - label: Value - schema: temp/topologyValue-dataHot - type: input + name: isVerticalScaleTopologyRequired|dataHot|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/dataHot/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/dataHot/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|dataHot type: custom + name: isVerticalScaleTopologyRequired|dataHot|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/dataHot/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -976,18 +1016,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-dataWarm - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/dataWarm/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|dataWarm type: custom - - label: Value - schema: temp/topologyValue-dataWarm - type: input + name: isVerticalScaleTopologyRequired|dataWarm|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/dataWarm/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/dataWarm/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|dataWarm type: custom + name: isVerticalScaleTopologyRequired|dataWarm|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/dataWarm/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/functions.js b/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/functions.js index 876f416af6..98ce931310 100644 --- a/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-elasticsearchopsrequest-editor/ui/functions.js @@ -1052,24 +1052,22 @@ export const useFunc = (model) => { // Vertical Scaling Functions // ===================================================== - function isVerticalScaleTopologyRequired(type) { - // watchDependency(`discriminator#/topologyKey-${type}`) - // watchDependency(`discriminator#/topologyValue-${type}`) - - const key = getValue(discriminator, `/topologyKey-${type}`) - const value = getValue(discriminator, `/topologyValue-${type}`) + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) const path = `/spec/verticalScaling/${type}/topology` - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() + + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-hanadbopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-hanadbopsrequest-editor/ui/create-ui.yaml index 70115b6a76..708d0a5745 100644 --- a/charts/opskubedbcom-hanadbopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-hanadbopsrequest-editor/ui/create-ui.yaml @@ -137,18 +137,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/hanadb/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|hanadb|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/hanadb/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/hanadb/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|hanadb|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/hanadb/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-hanadbopsrequest-editor/ui/functions.js b/charts/opskubedbcom-hanadbopsrequest-editor/ui/functions.js index 1b0b6541fa..304a8b91ce 100644 --- a/charts/opskubedbcom-hanadbopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-hanadbopsrequest-editor/ui/functions.js @@ -1541,24 +1541,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/node/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-hazelcastopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-hazelcastopsrequest-editor/ui/create-ui.yaml index b91fa6db3e..5ab2b58d78 100644 --- a/charts/opskubedbcom-hazelcastopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-hazelcastopsrequest-editor/ui/create-ui.yaml @@ -196,18 +196,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/hazelcast/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|hazelcast|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/hazelcast/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/hazelcast/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|hazelcast|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/hazelcast/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-hazelcastopsrequest-editor/ui/functions.js b/charts/opskubedbcom-hazelcastopsrequest-editor/ui/functions.js index 4221ee69b7..1ac7e73192 100644 --- a/charts/opskubedbcom-hazelcastopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-hazelcastopsrequest-editor/ui/functions.js @@ -1648,24 +1648,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/hazelcast/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-igniteopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-igniteopsrequest-editor/ui/create-ui.yaml index 5ceb5332e3..29f27c60f8 100644 --- a/charts/opskubedbcom-igniteopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-igniteopsrequest-editor/ui/create-ui.yaml @@ -197,18 +197,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|node|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|node|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-igniteopsrequest-editor/ui/functions.js b/charts/opskubedbcom-igniteopsrequest-editor/ui/functions.js index 2e6b78db54..30129e31d7 100644 --- a/charts/opskubedbcom-igniteopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-igniteopsrequest-editor/ui/functions.js @@ -1637,24 +1637,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/ignite/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-kafkaopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-kafkaopsrequest-editor/ui/create-ui.yaml index 12df04e3ff..177bd7097f 100644 --- a/charts/opskubedbcom-kafkaopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-kafkaopsrequest-editor/ui/create-ui.yaml @@ -214,18 +214,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-node - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|node type: custom - - label: Value - schema: temp/topologyValue-node - type: input + name: isVerticalScaleTopologyRequired|node|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|node type: custom + name: isVerticalScaleTopologyRequired|node|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -285,18 +289,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-broker - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/broker/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|broker type: custom - - label: Value - schema: temp/topologyValue-broker - type: input + name: isVerticalScaleTopologyRequired|broker|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/broker/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/broker/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|broker type: custom + name: isVerticalScaleTopologyRequired|broker|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/broker/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -352,18 +360,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-controller - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/controller/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|controller type: custom - - label: Value - schema: temp/topologyValue-controller - type: input + name: isVerticalScaleTopologyRequired|controller|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/controller/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/controller/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|controller type: custom + name: isVerticalScaleTopologyRequired|controller|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/controller/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-kafkaopsrequest-editor/ui/functions.js b/charts/opskubedbcom-kafkaopsrequest-editor/ui/functions.js index 7ff45b4655..aa76b4507d 100644 --- a/charts/opskubedbcom-kafkaopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-kafkaopsrequest-editor/ui/functions.js @@ -1390,24 +1390,23 @@ export const useFunc = (model) => { return data || 'No Data Found' } - function isVerticalScaleTopologyRequired(type) { - const key = getValue(model, `/temp/topologyKey-${type}`) - const value = getValue(model, `/temp/topologyValue-${type}`) + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - if ((key && !value) || (!key && value)) { - return 'Both Key and Value are required for topology' - } + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key && value) { - const topologyPath = `/spec/verticalScaling/${type}/topology` - commit('wizard/model$update', { - path: topologyPath, - value: { key, value }, - force: true, - }) + if (!key && !value) { + commit('wizard/model$delete', path) + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } - - return undefined } function createSecretUrl() { diff --git a/charts/opskubedbcom-mariadbopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-mariadbopsrequest-editor/ui/create-ui.yaml index 64f732f880..75beda3a55 100644 --- a/charts/opskubedbcom-mariadbopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-mariadbopsrequest-editor/ui/create-ui.yaml @@ -194,18 +194,22 @@ step: 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/mariadb/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|mariadb|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/mariadb/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/mariadb/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|mariadb|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/mariadb/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-mariadbopsrequest-editor/ui/functions.js b/charts/opskubedbcom-mariadbopsrequest-editor/ui/functions.js index 8a8c00feb6..b8b9034ada 100644 --- a/charts/opskubedbcom-mariadbopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-mariadbopsrequest-editor/ui/functions.js @@ -1626,24 +1626,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { + function isVerticalScaleTopologyRequired(type, mode) { // watchDependency(`discriminator#/topologyKey`) // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, `/topologyKey`) - const value = getValue(discriminator, `/topologyValue`) - const path = `/spec/verticalScaling/mariadb/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-memcachedopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-memcachedopsrequest-editor/ui/create-ui.yaml index ddfb6ad4a0..836ac0b20d 100644 --- a/charts/opskubedbcom-memcachedopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-memcachedopsrequest-editor/ui/create-ui.yaml @@ -180,18 +180,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-memcached - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/memcached/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|memcached type: custom - - label: Value - schema: temp/topologyValue-memcached - type: input + name: isVerticalScaleTopologyRequired|memcached|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/memcached/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/memcached/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|memcached type: custom + name: isVerticalScaleTopologyRequired|memcached|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/memcached/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-memcachedopsrequest-editor/ui/functions.js b/charts/opskubedbcom-memcachedopsrequest-editor/ui/functions.js index b9b5816030..18f48cbdee 100644 --- a/charts/opskubedbcom-memcachedopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-memcachedopsrequest-editor/ui/functions.js @@ -1503,24 +1503,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { + function isVerticalScaleTopologyRequired(type, mode) { // watchDependency(`discriminator#/topologyKey`) // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, `/topologyKey`) - const value = getValue(discriminator, `/topologyValue`) - const path = `/spec/verticalScaling/memcached/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-milvusopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-milvusopsrequest-editor/ui/create-ui.yaml index 1c62d48ab4..329edb71dc 100644 --- a/charts/opskubedbcom-milvusopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-milvusopsrequest-editor/ui/create-ui.yaml @@ -236,12 +236,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key + - type: input + label: Key schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key - type: input - - label: Value + validation: + type: custom + name: isVerticalScaleTopologyRequired|node|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value + - type: input + label: Value schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value - type: input + validation: + type: custom + name: isVerticalScaleTopologyRequired|node|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -300,12 +310,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key + - type: input + label: Key schema: schema/properties/spec/properties/verticalScaling/properties/datanode/properties/topology/properties/key - type: input - - label: Value + validation: + type: custom + name: isVerticalScaleTopologyRequired|datanode|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/datanode/properties/topology/properties/value + - type: input + label: Value schema: schema/properties/spec/properties/verticalScaling/properties/datanode/properties/topology/properties/value - type: input + validation: + type: custom + name: isVerticalScaleTopologyRequired|datanode|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/datanode/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -364,12 +384,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key + - type: input + label: Key schema: schema/properties/spec/properties/verticalScaling/properties/mixcoord/properties/topology/properties/key - type: input - - label: Value + validation: + type: custom + name: isVerticalScaleTopologyRequired|mixcoord|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/mixcoord/properties/topology/properties/value + - type: input + label: Value schema: schema/properties/spec/properties/verticalScaling/properties/mixcoord/properties/topology/properties/value - type: input + validation: + type: custom + name: isVerticalScaleTopologyRequired|mixcoord|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/mixcoord/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -428,12 +458,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key + - type: input + label: Key schema: schema/properties/spec/properties/verticalScaling/properties/proxy/properties/topology/properties/key - type: input - - label: Value + validation: + type: custom + name: isVerticalScaleTopologyRequired|proxy|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/proxy/properties/topology/properties/value + - type: input + label: Value schema: schema/properties/spec/properties/verticalScaling/properties/proxy/properties/topology/properties/value - type: input + validation: + type: custom + name: isVerticalScaleTopologyRequired|proxy|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/proxy/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -492,12 +532,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key + - type: input + label: Key schema: schema/properties/spec/properties/verticalScaling/properties/querynode/properties/topology/properties/key - type: input - - label: Value + validation: + type: custom + name: isVerticalScaleTopologyRequired|querynode|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/querynode/properties/topology/properties/value + - type: input + label: Value schema: schema/properties/spec/properties/verticalScaling/properties/querynode/properties/topology/properties/value - type: input + validation: + type: custom + name: isVerticalScaleTopologyRequired|querynode|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/querynode/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -556,12 +606,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key + - type: input + label: Key schema: schema/properties/spec/properties/verticalScaling/properties/streamingnode/properties/topology/properties/key - type: input - - label: Value + validation: + type: custom + name: isVerticalScaleTopologyRequired|streamingnode|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/streamingnode/properties/topology/properties/value + - type: input + label: Value schema: schema/properties/spec/properties/verticalScaling/properties/streamingnode/properties/topology/properties/value - type: input + validation: + type: custom + name: isVerticalScaleTopologyRequired|streamingnode|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/streamingnode/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-milvusopsrequest-editor/ui/functions.js b/charts/opskubedbcom-milvusopsrequest-editor/ui/functions.js index e59d25d1ba..36c6974d97 100644 --- a/charts/opskubedbcom-milvusopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-milvusopsrequest-editor/ui/functions.js @@ -1493,21 +1493,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/node/topology` + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() + + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-mongodbopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-mongodbopsrequest-editor/ui/create-ui.yaml index 0e92ad3f81..9f2c18b7ff 100644 --- a/charts/opskubedbcom-mongodbopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-mongodbopsrequest-editor/ui/create-ui.yaml @@ -280,18 +280,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-standalone - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/standalone/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|standalone type: custom - - label: Value - schema: temp/topologyValue-standalone - type: input + name: isVerticalScaleTopologyRequired|standalone|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/standalone/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/standalone/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|standalone type: custom + name: isVerticalScaleTopologyRequired|standalone|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/standalone/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -349,18 +353,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-replicaSet - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/replicaSet/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|replicaSet type: custom - - label: Value - schema: temp/topologyValue-replicaSet - type: input + name: isVerticalScaleTopologyRequired|replicaSet|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/replicaSet/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/replicaSet/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|replicaSet type: custom + name: isVerticalScaleTopologyRequired|replicaSet|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/replicaSet/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -423,18 +431,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-configServer - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/configServer/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|configServer type: custom - - label: Value - schema: temp/topologyValue-configServer - type: input + name: isVerticalScaleTopologyRequired|configServer|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/configServer/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/configServer/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|configServer type: custom + name: isVerticalScaleTopologyRequired|configServer|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/configServer/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -491,18 +503,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-mongos - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/mongos/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|mongos type: custom - - label: Value - schema: temp/topologyValue-mongos - type: input + name: isVerticalScaleTopologyRequired|mongos|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/mongos/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/mongos/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|mongos type: custom + name: isVerticalScaleTopologyRequired|mongos|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/mongos/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -559,18 +575,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-shard - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/shard/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|shard type: custom - - label: Value - schema: temp/topologyValue-shard - type: input + name: isVerticalScaleTopologyRequired|shard|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/shard/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/shard/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|shard type: custom + name: isVerticalScaleTopologyRequired|shard|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/shard/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-mongodbopsrequest-editor/ui/functions.js b/charts/opskubedbcom-mongodbopsrequest-editor/ui/functions.js index 46eb3c89e2..198b56453f 100644 --- a/charts/opskubedbcom-mongodbopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-mongodbopsrequest-editor/ui/functions.js @@ -1668,24 +1668,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired(type) { - // watchDependency(`discriminator#/topologyKey-${type}`) - // watchDependency(`discriminator#/topologyValue-${type}`) - - const key = getValue(discriminator, `/topologyKey-${type}`) - const value = getValue(discriminator, `/topologyValue-${type}`) + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) const path = `/spec/verticalScaling/${type}/topology` - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() + + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/create-ui.yaml index f6f05563cf..ebd884c514 100644 --- a/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/create-ui.yaml @@ -193,18 +193,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/mssqlserver/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|mssqlserver|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/mssqlserver/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/mssqlserver/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|mssqlserver|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/mssqlserver/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/functions.js b/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/functions.js index 8367fae031..ac49882439 100644 --- a/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-mssqlserveropsrequest-editor/ui/functions.js @@ -1605,24 +1605,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { + function isVerticalScaleTopologyRequired(type, mode) { // watchDependency(`discriminator#/topologyKey`) // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/mssqlserver/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-mysqlopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-mysqlopsrequest-editor/ui/create-ui.yaml index c0686de4be..4c37e34cc0 100644 --- a/charts/opskubedbcom-mysqlopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-mysqlopsrequest-editor/ui/create-ui.yaml @@ -199,18 +199,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/mysql/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|mysql|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/mysql/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/mysql/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|mysql|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/mysql/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-mysqlopsrequest-editor/ui/functions.js b/charts/opskubedbcom-mysqlopsrequest-editor/ui/functions.js index 44fd4fa58d..57dd011441 100644 --- a/charts/opskubedbcom-mysqlopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-mysqlopsrequest-editor/ui/functions.js @@ -1657,24 +1657,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/mysql/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-neo4jopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-neo4jopsrequest-editor/ui/create-ui.yaml index 1ae3cb44ae..be42b4f393 100644 --- a/charts/opskubedbcom-neo4jopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-neo4jopsrequest-editor/ui/create-ui.yaml @@ -196,18 +196,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/server/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|server|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/server/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/server/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|server|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/server/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-neo4jopsrequest-editor/ui/functions.js b/charts/opskubedbcom-neo4jopsrequest-editor/ui/functions.js index 2f37348098..7b1636a529 100644 --- a/charts/opskubedbcom-neo4jopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-neo4jopsrequest-editor/ui/functions.js @@ -1654,24 +1654,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/neo4j/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-oracleopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-oracleopsrequest-editor/ui/create-ui.yaml index 693732f22b..9436f25ada 100644 --- a/charts/opskubedbcom-oracleopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-oracleopsrequest-editor/ui/create-ui.yaml @@ -199,18 +199,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|node|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|node|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-oracleopsrequest-editor/ui/functions.js b/charts/opskubedbcom-oracleopsrequest-editor/ui/functions.js index 27e737c076..fe816d08d1 100644 --- a/charts/opskubedbcom-oracleopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-oracleopsrequest-editor/ui/functions.js @@ -1655,24 +1655,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/node/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/create-ui.yaml index cace98860f..bc5f21961d 100644 --- a/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/create-ui.yaml @@ -170,18 +170,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-perconaxtradb - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/perconaxtradb/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|perconaxtradb type: custom - - label: Value - schema: temp/topologyValue-perconaxtradb - type: input + name: isVerticalScaleTopologyRequired|perconaxtradb|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/perconaxtradb/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/perconaxtradb/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|perconaxtradb type: custom + name: isVerticalScaleTopologyRequired|perconaxtradb|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/perconaxtradb/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/functions.js b/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/functions.js index f6cfd9098d..85ab53f090 100644 --- a/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-perconaxtradbopsrequest-editor/ui/functions.js @@ -1579,24 +1579,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { + function isVerticalScaleTopologyRequired(type, mode) { // watchDependency(`discriminator#/topologyKey`) // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, `/topologyKey`) - const value = getValue(discriminator, `/topologyValue`) - const path = `/spec/verticalScaling/perconaxtradb/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-pgbounceropsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-pgbounceropsrequest-editor/ui/create-ui.yaml index c1305a2e26..9fa558f240 100644 --- a/charts/opskubedbcom-pgbounceropsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-pgbounceropsrequest-editor/ui/create-ui.yaml @@ -191,18 +191,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-pgbouncer - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/pgbouncer/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|pgbouncer type: custom - - label: Value - schema: temp/topologyValue-pgbouncer - type: input + name: isVerticalScaleTopologyRequired|pgbouncer|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/pgbouncer/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/pgbouncer/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|pgbouncer type: custom + name: isVerticalScaleTopologyRequired|pgbouncer|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/pgbouncer/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-pgbounceropsrequest-editor/ui/functions.js b/charts/opskubedbcom-pgbounceropsrequest-editor/ui/functions.js index 6a40b5f4e2..c43ec62c91 100644 --- a/charts/opskubedbcom-pgbounceropsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-pgbounceropsrequest-editor/ui/functions.js @@ -1606,24 +1606,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/pgbouncer/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-pgpoolopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-pgpoolopsrequest-editor/ui/create-ui.yaml index baaa3246ad..12e3598edd 100644 --- a/charts/opskubedbcom-pgpoolopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-pgpoolopsrequest-editor/ui/create-ui.yaml @@ -194,18 +194,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|node|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|node|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-pgpoolopsrequest-editor/ui/functions.js b/charts/opskubedbcom-pgpoolopsrequest-editor/ui/functions.js index 9d13ef7532..2f6c63c8f2 100644 --- a/charts/opskubedbcom-pgpoolopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-pgpoolopsrequest-editor/ui/functions.js @@ -1688,24 +1688,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/node/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-postgresopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-postgresopsrequest-editor/ui/create-ui.yaml index 517972aca2..5f993e2c96 100644 --- a/charts/opskubedbcom-postgresopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-postgresopsrequest-editor/ui/create-ui.yaml @@ -194,18 +194,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/postgres/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|postgres|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/postgres/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/postgres/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|postgres|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/postgres/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-postgresopsrequest-editor/ui/functions.js b/charts/opskubedbcom-postgresopsrequest-editor/ui/functions.js index 746c730507..80f6cf87c5 100644 --- a/charts/opskubedbcom-postgresopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-postgresopsrequest-editor/ui/functions.js @@ -1665,24 +1665,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { + function isVerticalScaleTopologyRequired(type, mode) { // watchDependency(`discriminator#/topologyKey`) // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, `/topologyKey`) - const value = getValue(discriminator, `/topologyValue`) - const path = `/spec/verticalScaling/postgres/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-proxysqlopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-proxysqlopsrequest-editor/ui/create-ui.yaml index b1b55b6372..d3763c84f7 100644 --- a/charts/opskubedbcom-proxysqlopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-proxysqlopsrequest-editor/ui/create-ui.yaml @@ -191,18 +191,22 @@ step: 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-proxysql - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/proxysql/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|proxysql type: custom - - label: Value - schema: temp/topologyValue-proxysql - type: input + name: isVerticalScaleTopologyRequired|proxysql|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/proxysql/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/proxysql/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|proxysql type: custom + name: isVerticalScaleTopologyRequired|proxysql|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/proxysql/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-proxysqlopsrequest-editor/ui/functions.js b/charts/opskubedbcom-proxysqlopsrequest-editor/ui/functions.js index 5d7b4e1558..32773b4da4 100644 --- a/charts/opskubedbcom-proxysqlopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-proxysqlopsrequest-editor/ui/functions.js @@ -1229,24 +1229,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/proxysql/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-qdrantopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-qdrantopsrequest-editor/ui/create-ui.yaml index e1b93d39ec..1dc37ea7bc 100644 --- a/charts/opskubedbcom-qdrantopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-qdrantopsrequest-editor/ui/create-ui.yaml @@ -196,18 +196,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|node|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|node|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-qdrantopsrequest-editor/ui/functions.js b/charts/opskubedbcom-qdrantopsrequest-editor/ui/functions.js index 445f7601bc..ef57a93a59 100644 --- a/charts/opskubedbcom-qdrantopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-qdrantopsrequest-editor/ui/functions.js @@ -1658,24 +1658,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/qdrant/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/create-ui.yaml index bac4061185..f7dec8edda 100644 --- a/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/create-ui.yaml @@ -198,18 +198,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|node|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|node|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/functions.js b/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/functions.js index aa87db21c8..f8a24af0e0 100644 --- a/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-rabbitmqopsrequest-editor/ui/functions.js @@ -1624,24 +1624,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/node/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-redisopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-redisopsrequest-editor/ui/create-ui.yaml index 246c648df1..23ec595498 100644 --- a/charts/opskubedbcom-redisopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-redisopsrequest-editor/ui/create-ui.yaml @@ -206,12 +206,22 @@ step: pod distribution across zones or regions type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input - - label: Value - schema: temp/topologyValue - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/redis/properties/topology/properties/key + validation: + type: custom + name: isVerticalScaleTopologyRequired|redis|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/redis/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/redis/properties/topology/properties/value + validation: + type: custom + name: isVerticalScaleTopologyRequired|redis|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/redis/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-redisopsrequest-editor/ui/functions.js b/charts/opskubedbcom-redisopsrequest-editor/ui/functions.js index 741e75a328..1ebf081399 100644 --- a/charts/opskubedbcom-redisopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-redisopsrequest-editor/ui/functions.js @@ -1675,24 +1675,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { + function isVerticalScaleTopologyRequired(type, mode) { // watchDependency(`discriminator#/topologyKey`) // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, `/topologyKey`) - const value = getValue(discriminator, `/topologyValue`) - const path = `/spec/verticalScaling/redis/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-singlestoreopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-singlestoreopsrequest-editor/ui/create-ui.yaml index a268f95d40..e2288b4264 100644 --- a/charts/opskubedbcom-singlestoreopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-singlestoreopsrequest-editor/ui/create-ui.yaml @@ -219,18 +219,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-aggregator - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/aggregator/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|aggregator type: custom - - label: Value - schema: temp/topologyValue-aggregator - type: input + name: isVerticalScaleTopologyRequired|aggregator|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/aggregator/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/aggregator/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|aggregator type: custom + name: isVerticalScaleTopologyRequired|aggregator|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/aggregator/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -285,25 +289,26 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-leaf - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/leaf/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|leaf type: custom - - label: Value - schema: temp/topologyValue-leaf - type: input + name: isVerticalScaleTopologyRequired|leaf|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/leaf/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/leaf/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|leaf type: custom + name: isVerticalScaleTopologyRequired|leaf|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/leaf/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true type: block-layout - if: - name: ifDbTypeEqualsTo|Topology|VerticalScaling - type: function label: Leaf Vertical Scaling type: block-layout - elements: @@ -354,25 +359,26 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-node - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|node type: custom - - label: Value - schema: temp/topologyValue-node - type: input + name: isVerticalScaleTopologyRequired|node|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|node type: custom + name: isVerticalScaleTopologyRequired|node|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true type: block-layout - if: - name: ifDbTypeEqualsTo|Combined|VerticalScaling - type: function label: Node Vertical Scaling type: block-layout if: diff --git a/charts/opskubedbcom-singlestoreopsrequest-editor/ui/functions.js b/charts/opskubedbcom-singlestoreopsrequest-editor/ui/functions.js index 6182d48195..eb2ebb4075 100644 --- a/charts/opskubedbcom-singlestoreopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-singlestoreopsrequest-editor/ui/functions.js @@ -1754,24 +1754,22 @@ export const useFunc = (model) => { return !!(model && model.alias) } - function isVerticalScaleTopologyRequired(type) { - // watchDependency(`discriminator#/topologyKey-${type}`) - // watchDependency(`discriminator#/topologyValue-${type}`) - - const key = getValue(discriminator, `/topologyKey-${type}`) - const value = getValue(discriminator, `/topologyValue-${type}`) + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) const path = `/spec/verticalScaling/${type}/topology` - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() + + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-solropsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-solropsrequest-editor/ui/create-ui.yaml index f8ecd2586d..57b656727a 100644 --- a/charts/opskubedbcom-solropsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-solropsrequest-editor/ui/create-ui.yaml @@ -270,18 +270,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-node - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|node type: custom - - label: Value - schema: temp/topologyValue-node - type: input + name: isVerticalScaleTopologyRequired|node|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|node type: custom + name: isVerticalScaleTopologyRequired|node|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -338,18 +342,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-coordinator - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/coordinator/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|coordinator type: custom - - label: Value - schema: temp/topologyValue-coordinator - type: input + name: isVerticalScaleTopologyRequired|coordinator|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/coordinator/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/coordinator/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|coordinator type: custom + name: isVerticalScaleTopologyRequired|coordinator|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/coordinator/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -403,18 +411,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-data - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/data/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|data type: custom - - label: Value - schema: temp/topologyValue-data - type: input + name: isVerticalScaleTopologyRequired|data|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/data/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/data/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|data type: custom + name: isVerticalScaleTopologyRequired|data|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/data/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true @@ -468,18 +480,22 @@ step: zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey-overseer - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/overseer/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired|overseer type: custom - - label: Value - schema: temp/topologyValue-overseer - type: input + name: isVerticalScaleTopologyRequired|overseer|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/overseer/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/overseer/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired|overseer type: custom + name: isVerticalScaleTopologyRequired|overseer|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/overseer/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-solropsrequest-editor/ui/functions.js b/charts/opskubedbcom-solropsrequest-editor/ui/functions.js index 0029aa5f68..2a851da526 100644 --- a/charts/opskubedbcom-solropsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-solropsrequest-editor/ui/functions.js @@ -1651,24 +1651,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired(type) { - // watchDependency(`discriminator#/topologyKey-${type}`) - // watchDependency(`discriminator#/topologyValue-${type}`) - - const key = getValue(discriminator, `/topologyKey-${type}`) - const value = getValue(discriminator, `/topologyValue-${type}`) + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) const path = `/spec/verticalScaling/${type}/topology` - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() + + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-weaviateopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-weaviateopsrequest-editor/ui/create-ui.yaml index a7a8b7954a..ca2417b67d 100644 --- a/charts/opskubedbcom-weaviateopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-weaviateopsrequest-editor/ui/create-ui.yaml @@ -196,18 +196,22 @@ step: example, 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|node|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|node|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-weaviateopsrequest-editor/ui/functions.js b/charts/opskubedbcom-weaviateopsrequest-editor/ui/functions.js index 5ac42ae174..4af161fa8d 100644 --- a/charts/opskubedbcom-weaviateopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-weaviateopsrequest-editor/ui/functions.js @@ -1640,24 +1640,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency('discriminator#/topologyKey') - // watchDependency('discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/weaviate/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return '' - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/charts/opskubedbcom-zookeeperopsrequest-editor/ui/create-ui.yaml b/charts/opskubedbcom-zookeeperopsrequest-editor/ui/create-ui.yaml index a6d5608a06..e6c80fdb1f 100644 --- a/charts/opskubedbcom-zookeeperopsrequest-editor/ui/create-ui.yaml +++ b/charts/opskubedbcom-zookeeperopsrequest-editor/ui/create-ui.yaml @@ -194,18 +194,22 @@ step: 'zone=us-central1-a' ensures workloads are deployed in that zone. type: label-element - elements: - - label: Key - schema: temp/topologyKey - type: input + - type: input + label: Key + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key validation: - name: isVerticalScaleTopologyRequired type: custom - - label: Value - schema: temp/topologyValue - type: input + name: isVerticalScaleTopologyRequired|node|key + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value + - type: input + label: Value + schema: schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/value validation: - name: isVerticalScaleTopologyRequired type: custom + name: isVerticalScaleTopologyRequired|node|value + watchPaths: + - schema/properties/spec/properties/verticalScaling/properties/node/properties/topology/properties/key type: horizontal-layout label: Node Selection showLabels: true diff --git a/charts/opskubedbcom-zookeeperopsrequest-editor/ui/functions.js b/charts/opskubedbcom-zookeeperopsrequest-editor/ui/functions.js index 6f4b146b31..fb6a9dfa88 100644 --- a/charts/opskubedbcom-zookeeperopsrequest-editor/ui/functions.js +++ b/charts/opskubedbcom-zookeeperopsrequest-editor/ui/functions.js @@ -1411,24 +1411,22 @@ export const useFunc = (model) => { return 'IfReady' } - function isVerticalScaleTopologyRequired() { - // watchDependency'discriminator#/topologyKey') - // watchDependency'discriminator#/topologyValue') + function isVerticalScaleTopologyRequired(type, mode) { + // watchDependency(`discriminator#/topologyKey`) + // watchDependency(`discriminator#/topologyValue`) + const path = `/spec/verticalScaling/${type}/topology` - const key = getValue(discriminator, '/topologyKey') - const value = getValue(discriminator, '/topologyValue') - const path = `/spec/verticalScaling/zookeeper/topology` + const key = String(getValue(model, `${path}/key`) ?? '').trim() + const value = String(getValue(model, `${path}/value`) ?? '').trim() - if (key || value) { - commit('wizard/model$update', { - path: path, - value: { key, value }, - force: true, - }) - return - } else { + if (!key && !value) { commit('wizard/model$delete', path) - return false + } + const missingPair = mode === 'key' ? !key && value : key && !value + if (missingPair) { + return mode === 'key' + ? 'Key is required when Value is provided' + : 'Value is required when Key is provided' } } diff --git a/schemas/ui-schema.json b/schemas/ui-schema.json index a2f8848280..c4cc6c27b8 100644 --- a/schemas/ui-schema.json +++ b/schemas/ui-schema.json @@ -2059,6 +2059,12 @@ }, "type": { "type": "string" + }, + "watchPaths": { + "items": { + "type": "string" + }, + "type": "array" } }, "required": ["type", "name"],