mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-14 09:16:11 -04:00
* Fix: Use ActionSelect Docker Host & validate input * Fix: Handle docker host deleted while editing * UI: Use add for ActionSelect & prevent delete instead --------- Co-authored-by: Nelson Chan <chakflying@hotmail.com>
This commit is contained in:
parent
6e80c850f4
commit
8e3ff25f7b
5 changed files with 59 additions and 20 deletions
|
@ -285,22 +285,17 @@
|
|||
<!-- Docker Host -->
|
||||
<!-- For Docker Type -->
|
||||
<div v-if="monitor.type === 'docker'" class="my-3">
|
||||
<h2 class="mb-2">{{ $t("Docker Host") }}</h2>
|
||||
<p v-if="$root.dockerHostList.length === 0">
|
||||
{{ $t("Not available, please setup.") }}
|
||||
</p>
|
||||
|
||||
<div v-else class="mb-3">
|
||||
<div class="mb-3">
|
||||
<label for="docker-host" class="form-label">{{ $t("Docker Host") }}</label>
|
||||
<select id="docket-host" v-model="monitor.docker_host" class="form-select">
|
||||
<option v-for="host in $root.dockerHostList" :key="host.id" :value="host.id">{{ host.name }}</option>
|
||||
</select>
|
||||
<a href="#" @click="$refs.dockerHostDialog.show(monitor.docker_host)">{{ $t("Edit") }}</a>
|
||||
<ActionSelect
|
||||
v-model="monitor.docker_host"
|
||||
:options="dockerHostOptionsList"
|
||||
:disabled="$root.dockerHostList == null || $root.dockerHostList.length === 0"
|
||||
:icon="'plus'"
|
||||
:action="() => $refs.dockerHostDialog.show()"
|
||||
:required="true"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary me-2" type="button" @click="$refs.dockerHostDialog.show()">
|
||||
{{ $t("Setup Docker Host") }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- MQTT -->
|
||||
|
@ -1119,6 +1114,21 @@ message HealthCheckResponse {
|
|||
return list;
|
||||
},
|
||||
|
||||
dockerHostOptionsList() {
|
||||
if (this.$root.dockerHostList && this.$root.dockerHostList.length > 0) {
|
||||
return this.$root.dockerHostList.map((host) => {
|
||||
return {
|
||||
label: host.name,
|
||||
value: host.id
|
||||
};
|
||||
});
|
||||
} else {
|
||||
return [{
|
||||
label: this.$t("noDockerHostMsg"),
|
||||
value: null,
|
||||
}];
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"$root.proxyList"() {
|
||||
|
@ -1351,6 +1361,12 @@ message HealthCheckResponse {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (this.monitor.type === "docker") {
|
||||
if (this.monitor.docker_host == null) {
|
||||
toast.error(this.$t("DockerHostRequired"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue