update rebuild container

This commit is contained in:
Eleven 2023-06-27 17:18:53 +08:00
parent 7220a92841
commit ff0bbed15a

View File

@ -313,6 +313,7 @@
import {
dockerImageCreateContainer,
dockerImageInspect,
dockerInspectContainer,
dockerContainerRebuildContainer
} from "@/api/docker-api";
export default {
@ -359,6 +360,52 @@ export default {
methods: {
//
createContainer() {
// containerId
if (this.containerId) {
// form container
this.inspectContainer();
} else {
// form image
this.inspectImage();
}
},
// inspect container
inspectContainer() {
// image
dockerImageInspect(this.urlPrefix, {
id: this.reqDataId,
imageId: this.imageId,
}).then((res) => {
this.temp.image = (res.data.repoTags || []).join(",")
})
dockerInspectContainer(this.urlPrefix, {
id: this.reqDataId,
containerId: this.containerId,
}).then(res => {
console.log(res.data)
this.buildVisible = true;
this.temp = {
name: res.data.name,
volumes: [{}],
exposedPorts: (res.data?.config?.exposedPorts || [{}]).map((item) => {
item.disabled = item.port !== null;
item.ip = "0.0.0.0";
item.scheme = item.scheme || "tcp";
return item;
}),
autorun: true,
imageId: this.imageId,
env: [{}],
storageOpt: [{}],
commands: [{}],
...this.temp
};
this.$refs["editForm"]?.resetFields();
});
},
// inspect image
inspectImage() {
dockerImageInspect(this.urlPrefix, {
id: this.reqDataId,
imageId: this.imageId,