Skip to content

Commit

Permalink
Fix: Handle docker host deleted while editing
Browse files Browse the repository at this point in the history
  • Loading branch information
chakflying committed Oct 9, 2023
1 parent 6bc6d99 commit f4fceca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/DockerHostDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default {
Confirm,
},
props: {},
emits: [ "added" ],
emits: [ "added", "deleted" ],
data() {
return {
modal: null,
Expand Down Expand Up @@ -180,6 +180,7 @@ export default {
this.processing = false;
if (res.ok) {
this.$emit("deleted", this.id);
this.modal.hide();
}
});
Expand Down
14 changes: 13 additions & 1 deletion src/pages/EditMonitor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@
</form>

<NotificationDialog ref="notificationDialog" @added="addedNotification" />
<DockerHostDialog ref="dockerHostDialog" @added="addedDockerHost" />
<DockerHostDialog ref="dockerHostDialog" @added="addedDockerHost" @deleted="deletedDockerHost" />
<ProxyDialog ref="proxyDialog" @added="addedProxy" />
<CreateGroupDialog ref="createGroupDialog" @added="addedDraftGroup" />
</div>
Expand Down Expand Up @@ -1501,6 +1501,18 @@ message HealthCheckResponse {
this.monitor.docker_host = id;
},
/**
* A docker host was deleted
* Unset the docker host if it was deleted
* @param {number} id - The ID of the Docker host that was deleted.
* @returns {void}
*/
deletedDockerHost(id) {
if (this.monitor.docker_host === id) {
this.monitor.docker_host = null;
}
},
/**
* Adds a draft group.
* @param {string} draftGroupName The name of the draft group.
Expand Down

0 comments on commit f4fceca

Please sign in to comment.