Suppress conflicts between retry options and auto_remove option
This patch fixes conflicts between retry options and auto_remove option. To suppress this conflicts, when retry option selected this patch clears auto_remove option and set readonly attribute for the checkbox. Also, to check them easily from user, move auto_remove option from Miscellaneous tab to Spec tab, i.e. under retry options. Change-Id: I34a409141adf1ad822e5999240ccbb8ae8e2acf5 Closes-Bug: #1763250
This commit is contained in:
parent
3f7935d3ac
commit
1d47c368fe
6
releasenotes/notes/bug-1763250-5035b39df953d25d.yaml
Normal file
6
releasenotes/notes/bug-1763250-5035b39df953d25d.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
fixes:
|
||||||
|
- >
|
||||||
|
[`bug/1763250 <https://bugs.launchpad.net/zun-ui/+bug/1763250>`_]
|
||||||
|
Fixed issue the conflict between retry and auto_remove options.
|
||||||
|
To avoid this conflict, auto_remove option will be cleared when
|
||||||
|
retry option is set.
|
@ -70,13 +70,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function submit(context) {
|
function submit(context) {
|
||||||
|
delete context.model.exit_policy;
|
||||||
if (context.model.restart_policy === "on-failure") {
|
if (context.model.restart_policy === "on-failure") {
|
||||||
if (!context.model.restart_policy_max_retry) {
|
if (!context.model.restart_policy_max_retry) {
|
||||||
context.model.restart_policy_max_retry = 0;
|
delete context.model.restart_policy_max_retry;
|
||||||
|
} else {
|
||||||
|
context.model.restart_policy =
|
||||||
|
context.model.restart_policy + ":" +
|
||||||
|
context.model.restart_policy_max_retry;
|
||||||
}
|
}
|
||||||
context.model.restart_policy =
|
|
||||||
context.model.restart_policy + ":" +
|
|
||||||
context.model.restart_policy_max_retry;
|
|
||||||
}
|
}
|
||||||
delete context.model.restart_policy_max_retry;
|
delete context.model.restart_policy_max_retry;
|
||||||
context.model.mounts = setMounts(context.model.mounts);
|
context.model.mounts = setMounts(context.model.mounts);
|
||||||
|
@ -83,6 +83,8 @@
|
|||||||
? response.data.command : "";
|
? response.data.command : "";
|
||||||
config.model.hostname = response.data.hostname
|
config.model.hostname = response.data.hostname
|
||||||
? response.data.hostname : "";
|
? response.data.hostname : "";
|
||||||
|
config.model.auto_remove = response.data.auto_remove
|
||||||
|
? response.data.auto_remove : false;
|
||||||
config.model.cpu = response.data.cpu
|
config.model.cpu = response.data.cpu
|
||||||
? response.data.cpu : "";
|
? response.data.cpu : "";
|
||||||
config.model.memory = response.data.memory
|
config.model.memory = response.data.memory
|
||||||
@ -91,6 +93,11 @@
|
|||||||
? response.data.restart_policy.Name : "";
|
? response.data.restart_policy.Name : "";
|
||||||
config.model.restart_policy_max_retry = response.data.restart_policy.MaximumRetryCount
|
config.model.restart_policy_max_retry = response.data.restart_policy.MaximumRetryCount
|
||||||
? parseInt(response.data.restart_policy.MaximumRetryCount, 10) : null;
|
? parseInt(response.data.restart_policy.MaximumRetryCount, 10) : null;
|
||||||
|
if (config.model.auto_remove) {
|
||||||
|
config.model.exit_policy = "remove";
|
||||||
|
} else {
|
||||||
|
config.model.exit_policy = config.model.restart_policy;
|
||||||
|
}
|
||||||
config.model.runtime = response.data.runtime
|
config.model.runtime = response.data.runtime
|
||||||
? response.data.runtime : "";
|
? response.data.runtime : "";
|
||||||
config.model.allocatedNetworks = getAllocatedNetworks(response.data.addresses);
|
config.model.allocatedNetworks = getAllocatedNetworks(response.data.addresses);
|
||||||
@ -100,8 +107,6 @@
|
|||||||
? hashToString(response.data.environment) : "";
|
? hashToString(response.data.environment) : "";
|
||||||
config.model.interactive = response.data.interactive
|
config.model.interactive = response.data.interactive
|
||||||
? response.data.interactive : false;
|
? response.data.interactive : false;
|
||||||
config.model.auto_remove = response.data.auto_remove
|
|
||||||
? response.data.auto_remove : false;
|
|
||||||
config.model.labels = response.data.labels
|
config.model.labels = response.data.labels
|
||||||
? hashToString(response.data.labels) : "";
|
? hashToString(response.data.labels) : "";
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,4 @@
|
|||||||
<dd translate>The environment variables in comma separated KEY=VALUE pairs</dd>
|
<dd translate>The environment variables in comma separated KEY=VALUE pairs</dd>
|
||||||
<dt translate>Enable Interactive Mode</dt>
|
<dt translate>Enable Interactive Mode</dt>
|
||||||
<dd translate>Allocate pseudo-TTY and keep STDIN open even if not attached. This also enables Web console in console tab on details view.</dd>
|
<dd translate>Allocate pseudo-TTY and keep STDIN open even if not attached. This also enables Web console in console tab on details view.</dd>
|
||||||
<dt translate>Auto remove</dt>
|
|
||||||
<dd translate>Automatically remove the container when it exits</dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
<dd translate>The number of virtual cpus.</dd>
|
<dd translate>The number of virtual cpus.</dd>
|
||||||
<dt translate>Memory</dt>
|
<dt translate>Memory</dt>
|
||||||
<dd translate>The container memory size in MiB.</dd>
|
<dd translate>The container memory size in MiB.</dd>
|
||||||
<dt translate>Restart Policy</dt>
|
|
||||||
<dd translate>Restart policy to apply when a container exits.</dd>
|
|
||||||
<dt translate>Runtime</dt>
|
<dt translate>Runtime</dt>
|
||||||
<dd translate>The runtime to use for this container. Default: "runc"</dd>
|
<dd translate>The runtime to use for this container. Default: "runc"</dd>
|
||||||
|
<dt translate>Exit Policy</dt>
|
||||||
|
<dd translate>Policy to apply when a container exits.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
@ -45,12 +45,13 @@
|
|||||||
{value: "always", name: gettext("Always")},
|
{value: "always", name: gettext("Always")},
|
||||||
{value: "never", name: gettext("Never")}
|
{value: "never", name: gettext("Never")}
|
||||||
];
|
];
|
||||||
var restartPolicies = [
|
var exitPolicies = [
|
||||||
{value: "", name: gettext("Select policy.")},
|
{value: "", name: gettext("Select policy.")},
|
||||||
{value: "no", name: gettext("No")},
|
{value: "no", name: gettext("No")},
|
||||||
{value: "on-failure", name: gettext("On failure")},
|
{value: "on-failure", name: gettext("Restart on failure")},
|
||||||
{value: "always", name: gettext("Always")},
|
{value: "always", name: gettext("Always restart")},
|
||||||
{value: "unless-stopped", name: gettext("Unless Stopped")}
|
{value: "unless-stopped", name: gettext("Restart if stopped")},
|
||||||
|
{value: "remove", name: gettext("Remove container")}
|
||||||
];
|
];
|
||||||
|
|
||||||
// schema
|
// schema
|
||||||
@ -87,6 +88,10 @@
|
|||||||
title: gettext("Hostname"),
|
title: gettext("Hostname"),
|
||||||
type: "string"
|
type: "string"
|
||||||
},
|
},
|
||||||
|
runtime: {
|
||||||
|
title: gettext("Runtime"),
|
||||||
|
type: "string"
|
||||||
|
},
|
||||||
cpu: {
|
cpu: {
|
||||||
title: gettext("CPU"),
|
title: gettext("CPU"),
|
||||||
type: "number",
|
type: "number",
|
||||||
@ -97,12 +102,8 @@
|
|||||||
type: "number",
|
type: "number",
|
||||||
minimum: 4
|
minimum: 4
|
||||||
},
|
},
|
||||||
destination: {
|
exit_policy: {
|
||||||
title: gettext("Destination"),
|
title: gettext("Exit Policy"),
|
||||||
type: "string"
|
|
||||||
},
|
|
||||||
restart_policy: {
|
|
||||||
title: gettext("Restart Policy"),
|
|
||||||
type: "string"
|
type: "string"
|
||||||
},
|
},
|
||||||
restart_policy_max_retry: {
|
restart_policy_max_retry: {
|
||||||
@ -110,10 +111,6 @@
|
|||||||
type: "number",
|
type: "number",
|
||||||
minimum: 0
|
minimum: 0
|
||||||
},
|
},
|
||||||
runtime: {
|
|
||||||
title: gettext("Runtime"),
|
|
||||||
type: "string"
|
|
||||||
},
|
|
||||||
// misc
|
// misc
|
||||||
workdir: {
|
workdir: {
|
||||||
title: gettext("Working Directory"),
|
title: gettext("Working Directory"),
|
||||||
@ -127,10 +124,6 @@
|
|||||||
title: gettext("Enable interactive mode"),
|
title: gettext("Enable interactive mode"),
|
||||||
type: "boolean"
|
type: "boolean"
|
||||||
},
|
},
|
||||||
auto_remove: {
|
|
||||||
title: gettext("Auto remove"),
|
|
||||||
type: "boolean"
|
|
||||||
},
|
|
||||||
// labels
|
// labels
|
||||||
labels: {
|
labels: {
|
||||||
title: gettext("Labels"),
|
title: gettext("Labels"),
|
||||||
@ -214,7 +207,7 @@
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
type: "section",
|
type: "section",
|
||||||
htmlClass: "col-xs-12",
|
htmlClass: "col-xs-6",
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
key: "hostname",
|
key: "hostname",
|
||||||
@ -223,6 +216,17 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: "section",
|
||||||
|
htmlClass: "col-xs-6",
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
key: "runtime",
|
||||||
|
placeholder: gettext("The runtime to create container with."),
|
||||||
|
readonly: action === "update"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: "section",
|
type: "section",
|
||||||
htmlClass: "col-xs-6",
|
htmlClass: "col-xs-6",
|
||||||
@ -250,16 +254,25 @@
|
|||||||
htmlClass: "col-xs-6",
|
htmlClass: "col-xs-6",
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
key: "restart_policy",
|
key: "exit_policy",
|
||||||
type: "select",
|
type: "select",
|
||||||
readonly: action === "update",
|
readonly: action === "update",
|
||||||
titleMap: restartPolicies,
|
titleMap: exitPolicies,
|
||||||
onChange: function() {
|
onChange: function() {
|
||||||
var readonly = model.restart_policy !== "on-failure";
|
var notOnFailure = model.exit_policy !== "on-failure";
|
||||||
if (readonly) {
|
if (notOnFailure) {
|
||||||
model.restart_policy_max_retry = "";
|
model.restart_policy_max_retry = "";
|
||||||
}
|
}
|
||||||
form[0].tabs[1].items[4].items[0].readonly = readonly;
|
form[0].tabs[1].items[5].items[0].readonly = notOnFailure;
|
||||||
|
// set auto_remove whether exit_policy is "remove".
|
||||||
|
// if exit_policy is set as "remove", clear restart_policy.
|
||||||
|
// otherwise, set restart_policy as same value as exit_policy.
|
||||||
|
model.auto_remove = (model.exit_policy === "remove");
|
||||||
|
if (model.auto_remove) {
|
||||||
|
model.restart_policy = "";
|
||||||
|
} else {
|
||||||
|
model.restart_policy = model.exit_policy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -270,21 +283,10 @@
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
key: "restart_policy_max_retry",
|
key: "restart_policy_max_retry",
|
||||||
placeholder: gettext("Retry times for 'On failure' policy."),
|
placeholder: gettext("Retry times for 'Restart on failure' policy."),
|
||||||
readonly: true
|
readonly: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "section",
|
|
||||||
htmlClass: "col-xs-6",
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
key: "runtime",
|
|
||||||
placeholder: gettext("The runtime to create container with."),
|
|
||||||
readonly: action === "update",
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -390,10 +392,6 @@
|
|||||||
{
|
{
|
||||||
key: "interactive",
|
key: "interactive",
|
||||||
readonly: action === "update"
|
readonly: action === "update"
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "auto_remove",
|
|
||||||
readonly: action === "update"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -455,11 +453,13 @@
|
|||||||
run: true,
|
run: true,
|
||||||
// spec
|
// spec
|
||||||
hostname: "",
|
hostname: "",
|
||||||
|
runtime: "",
|
||||||
cpu: "",
|
cpu: "",
|
||||||
memory: "",
|
memory: "",
|
||||||
|
exit_policy: "",
|
||||||
restart_policy: "",
|
restart_policy: "",
|
||||||
restart_policy_max_retry: "",
|
restart_policy_max_retry: "",
|
||||||
runtime: "",
|
auto_remove: false,
|
||||||
// mounts
|
// mounts
|
||||||
mounts: [],
|
mounts: [],
|
||||||
// networks
|
// networks
|
||||||
@ -472,7 +472,6 @@
|
|||||||
workdir: "",
|
workdir: "",
|
||||||
environment: "",
|
environment: "",
|
||||||
interactive: true,
|
interactive: true,
|
||||||
auto_remove: false,
|
|
||||||
// labels
|
// labels
|
||||||
labels: "",
|
labels: "",
|
||||||
// hints
|
// hints
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
resource-type-name="OS::Zun::Container"
|
resource-type-name="OS::Zun::Container"
|
||||||
cls="dl-horizontal"
|
cls="dl-horizontal"
|
||||||
item="ctrl.container"
|
item="ctrl.container"
|
||||||
property-groups="[['image', 'image_driver', 'image_pull_policy',
|
property-groups="[['image', 'image_driver', 'image_pull_policy', 'hostname', 'runtime',
|
||||||
'cpu', 'memory', 'restart_policy', 'runtime',
|
'cpu', 'memory', 'restart_policy', 'auto_remove',
|
||||||
'hostname', 'addresses', 'ports', 'security_groups']]">
|
'addresses', 'ports', 'security_groups']]">
|
||||||
</hz-resource-property-list>
|
</hz-resource-property-list>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -33,7 +33,7 @@
|
|||||||
cls="dl-horizontal"
|
cls="dl-horizontal"
|
||||||
item="ctrl.container"
|
item="ctrl.container"
|
||||||
property-groups="[['host', 'workdir', 'environment', 'interactive',
|
property-groups="[['host', 'workdir', 'environment', 'interactive',
|
||||||
'auto_remove', 'labels','links']]">
|
'labels', 'links']]">
|
||||||
</hz-resource-property-list>
|
</hz-resource-property-list>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user