mirror of https://github.com/rancher/ui.git
prevent useres from sending negative concurrency values
rancher/rancher#25982
This commit is contained in:
parent
7075130421
commit
651f1f3089
|
|
@ -12,6 +12,7 @@ export default Component.extend(ClusterDriver, {
|
||||||
globalStore: service(),
|
globalStore: service(),
|
||||||
growl: service(),
|
growl: service(),
|
||||||
settings: service(),
|
settings: service(),
|
||||||
|
intl: service(),
|
||||||
|
|
||||||
layout,
|
layout,
|
||||||
configField: 'importedConfig',
|
configField: 'importedConfig',
|
||||||
|
|
@ -41,8 +42,6 @@ export default Component.extend(ClusterDriver, {
|
||||||
if (isEmpty(this.model.cluster.k3sConfig)) {
|
if (isEmpty(this.model.cluster.k3sConfig)) {
|
||||||
set(this, 'model.cluster.k3sConfig', this.globalStore.createRecord({
|
set(this, 'model.cluster.k3sConfig', this.globalStore.createRecord({
|
||||||
type: 'k3sConfig',
|
type: 'k3sConfig',
|
||||||
serverConcurrency: 1,
|
|
||||||
workerConcurrency: 1,
|
|
||||||
kubernetesVersion: this.cluster.version.gitVersion
|
kubernetesVersion: this.cluster.version.gitVersion
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
@ -102,6 +101,30 @@ export default Component.extend(ClusterDriver, {
|
||||||
} ));
|
} ));
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
willSave() {
|
||||||
|
const {
|
||||||
|
configField: field,
|
||||||
|
config
|
||||||
|
} = this;
|
||||||
|
let errors = [];
|
||||||
|
|
||||||
|
if (field === 'k3sConfig' && config.k3supgradeStrategy) {
|
||||||
|
// doesn't work because missing deep validation
|
||||||
|
// errors = config.k3supgradeStrategy.validationErrors();
|
||||||
|
if (config.k3supgradeStrategy.serverConcurrency <= 0 || config.k3supgradeStrategy.workerConcurrency <= 0) {
|
||||||
|
errors.push(this.intl.t('clusterNew.k3simport.errors.concurrency.negative'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isEmpty(errors)) {
|
||||||
|
set(this, 'errors', errors);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._super();
|
||||||
|
},
|
||||||
|
|
||||||
doneSaving() {
|
doneSaving() {
|
||||||
if ( get(this, 'isEdit') ) {
|
if ( get(this, 'isEdit') ) {
|
||||||
if (this.close) {
|
if (this.close) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col span-6">
|
<div class="col span-6">
|
||||||
<!-- TODO use form-versions here when we have the api ready -->
|
|
||||||
<label class="acc-label">Kubernetes Version</label>
|
<label class="acc-label">Kubernetes Version</label>
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
{{#input-or-display
|
{{#input-or-display
|
||||||
|
|
@ -60,6 +59,7 @@
|
||||||
id="node-server-concurrency"
|
id="node-server-concurrency"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
type="number"
|
type="number"
|
||||||
|
min=1
|
||||||
value=k3sConfig.k3supgradeStrategy.serverConcurrency
|
value=k3sConfig.k3supgradeStrategy.serverConcurrency
|
||||||
}}
|
}}
|
||||||
{{/input-or-display}}
|
{{/input-or-display}}
|
||||||
|
|
@ -78,6 +78,7 @@
|
||||||
id="node-worker-concurrency"
|
id="node-worker-concurrency"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
type="number"
|
type="number"
|
||||||
|
min=1
|
||||||
value=k3sConfig.k3supgradeStrategy.workerConcurrency
|
value=k3sConfig.k3supgradeStrategy.workerConcurrency
|
||||||
}}
|
}}
|
||||||
{{/input-or-display}}
|
{{/input-or-display}}
|
||||||
|
|
|
||||||
|
|
@ -3820,6 +3820,9 @@ clusterNew:
|
||||||
k3simport:
|
k3simport:
|
||||||
label: Rancher K3S
|
label: Rancher K3S
|
||||||
shortLabel: K3S
|
shortLabel: K3S
|
||||||
|
errors:
|
||||||
|
concurrency:
|
||||||
|
negative: Only non-negative and non-zero concurrency values are valid.
|
||||||
huaweicce:
|
huaweicce:
|
||||||
label: Huawei Cloud Container Engine
|
label: Huawei Cloud Container Engine
|
||||||
shortLabel: Huawei CCE
|
shortLabel: Huawei CCE
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue