Skip to content

Commit

Permalink
Fix save docker host issue
Browse files Browse the repository at this point in the history
  • Loading branch information
louislam committed Jul 30, 2022
1 parent f332239 commit 8ced616
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion server/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ async function sendDockerHostList(socket) {
]);

for (let bean of list) {
result.push(bean.export());
result.push(bean.toJSON());
}

io.to(socket.userID).emit("dockerHostList", result);
Expand Down
4 changes: 2 additions & 2 deletions server/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class DockerHost {
}

bean.user_id = userID;
bean.docker_daemon = dockerHost.docker_daemon;
bean.docker_type = dockerHost.docker_type;
bean.docker_daemon = dockerHost.dockerDaemon;
bean.docker_type = dockerHost.dockerType;
bean.name = dockerHost.name;

await R.store(bean);
Expand Down
10 changes: 5 additions & 5 deletions server/model/docker_host.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ class DockerHost extends BeanModel {
*/
toJSON() {
return {
id: this._id,
userId: this._user_id,
daemon: this._dockerDaemon,
type: this._dockerType,
name: this._name,
id: this.id,
userID: this.user_id,
dockerDaemon: this.docker_daemon,
dockerType: this.docker_type,
name: this.name,
};
}
}
Expand Down
11 changes: 10 additions & 1 deletion src/components/DockerHostDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@

<script lang="ts">
import { Modal } from "bootstrap";
import Confirm from "./Confirm.vue";
import { useToast } from "vue-toastification";
const toast = useToast();
export default {
components: {
Expand Down Expand Up @@ -88,14 +89,22 @@ export default {
show(dockerHostID) {
if (dockerHostID) {
let found = false;
this.id = dockerHostID;
for (let n of this.$root.dockerHostList) {
if (n.id === dockerHostID) {
this.dockerHost = n;
found = true;
break;
}
}
if (!found) {
toast.error("Docker Host not found!");
}
} else {
this.id = null;
this.dockerHost = {
Expand Down

0 comments on commit 8ced616

Please sign in to comment.