mirror of
https://github.com/cuigh/swirl
synced 2024-12-30 15:53:24 +00:00
Allow updating replicas of service to zero
This commit is contained in:
parent
42f3ad8b23
commit
260bf8313b
@ -1535,7 +1535,7 @@ var Swirl;
|
||||
if (this.$mode.val() == "global") {
|
||||
return { ok: true };
|
||||
}
|
||||
const regex = /^[1-9]\d*$/;
|
||||
const regex = /^(0|[1-9]\d*)$/;
|
||||
return { ok: regex.test($.trim($input.val())) };
|
||||
}
|
||||
}
|
||||
@ -1712,7 +1712,7 @@ var Swirl;
|
||||
new PreferenceTable("#table-preferences");
|
||||
this.secret = new ConfigTable("#table-secrets");
|
||||
this.config = new ConfigTable("#table-configs");
|
||||
Validator.register("service-mode", new ServiceModeRule(this.$mode), "Please input a positive integer.");
|
||||
Validator.register("service-mode", new ServiceModeRule(this.$mode), "Please input a valid integer.");
|
||||
this.$mode.change(e => this.$replicas.toggle(this.$mode.val() != "global"));
|
||||
$("#btn-add-secret").click(() => EditPage.addConfig(this.secret));
|
||||
$("#btn-add-config").click(() => EditPage.addConfig(this.config));
|
||||
|
File diff suppressed because one or more lines are too long
@ -18,7 +18,7 @@ namespace Swirl.Service {
|
||||
return { ok: true }
|
||||
}
|
||||
|
||||
const regex = /^[1-9]\d*$/;
|
||||
const regex = /^(0|[1-9]\d*)$/;
|
||||
return { ok: regex.test($.trim($input.val())) };
|
||||
}
|
||||
}
|
||||
@ -217,7 +217,7 @@ namespace Swirl.Service {
|
||||
this.config = new ConfigTable("#table-configs");
|
||||
|
||||
// register custom validators
|
||||
Validator.register("service-mode", new ServiceModeRule(this.$mode), "Please input a positive integer.");
|
||||
Validator.register("service-mode", new ServiceModeRule(this.$mode), "Please input a valid integer.");
|
||||
|
||||
// bind events
|
||||
this.$mode.change(e => this.$replicas.toggle(this.$mode.val() != "global"))
|
||||
|
@ -13,7 +13,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="control is-expanded">
|
||||
<input id="txt-replicas" name="replicas" class="input" placeholder="" data-type="integer" data-v-rule="service-mode" {{if .Service.Mode == "global"}}style="display: none"{{else}}value="{{ trimZero(.Service.Replicas) }}"{{end}}>
|
||||
<input id="txt-replicas" name="replicas" class="input" placeholder="" data-type="integer" data-v-rule="service-mode" {{if .Service.Mode == "global"}}style="display: none"{{else}}value="{{ .Service.Replicas }}"{{end}}>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{ extends "base" }}
|
||||
{{ extends "_base" }}
|
||||
{{ import "../_modules/detail" }}
|
||||
|
||||
{{ block body_content() }}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{ extends "base" }}
|
||||
{{ extends "_base" }}
|
||||
{{ import "../_modules/service" }}
|
||||
|
||||
{{ block script() }}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{ extends "base" }}
|
||||
{{ extends "_base" }}
|
||||
{{ import "../_modules/pager" }}
|
||||
|
||||
{{ block script() }}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{ extends "base" }}
|
||||
{{ extends "_base" }}
|
||||
|
||||
{{ block body_content() }}
|
||||
<div class="container">
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{ extends "base" }}
|
||||
{{ extends "_base" }}
|
||||
{{ import "../_modules/service" }}
|
||||
|
||||
{{ block script() }}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{ extends "base" }}
|
||||
{{ extends "_base" }}
|
||||
|
||||
{{ block style() }}
|
||||
<link rel="stylesheet" href="/highlight/highlight.css?v=9.12">
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{ extends "base" }}
|
||||
{{ extends "_base" }}
|
||||
{{ import "../../_modules/service" }}
|
||||
|
||||
{{ block script() }}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{ extends "base" }}
|
||||
{{ extends "_base" }}
|
||||
{{ import "../../_modules/pager" }}
|
||||
|
||||
{{ block script() }}
|
||||
|
Loading…
Reference in New Issue
Block a user