Skip to content

Commit

Permalink
feat: 移除编排删除后跳转 (1Panel-dev#6613)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssongliu authored Sep 29, 2024
1 parent f9bdcf8 commit 2ac9a88
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
10 changes: 8 additions & 2 deletions backend/app/service/container_compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,14 @@ func (u *ContainerService) ComposeOperation(req dto.ComposeOperation) error {
_ = composeRepo.DeleteRecord(commonRepo.WithByName(req.Name))
return nil
}
if stdout, err := compose.Operate(req.Path, req.Operation); err != nil {
return errors.New(string(stdout))
if req.Operation == "up" {
if stdout, err := compose.Up(req.Path); err != nil {
return errors.New(string(stdout))
}
} else {
if stdout, err := compose.Operate(req.Path, req.Operation); err != nil {
return errors.New(string(stdout))
}
}
global.LOG.Infof("docker-compose %s %s successful", req.Operation, req.Name)
return nil
Expand Down
7 changes: 1 addition & 6 deletions frontend/src/views/container/compose/detail/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ const dialogContainerLogRef = ref();
const opRef = ref();
const emit = defineEmits<{ (e: 'back'): void }>();
interface DialogProps {
createdBy: string;
name: string;
Expand Down Expand Up @@ -283,11 +282,7 @@ const onComposeOperate = async (operation: string) => {
.then(() => {
loading.value = false;
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
if (operation === 'down') {
emit('back');
} else {
search();
}
search();
})
.catch(() => {
loading.value = false;
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/views/container/compose/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div v-loading="loading">
<div v-show="isOnDetail">
<ComposeDetail @back="backList" ref="composeDetailRef" />
<ComposeDetail ref="composeDetailRef" />
</div>
<el-card v-if="dockerStatus != 'Running'" class="mask-prompt">
<span>{{ $t('container.serviceUnavailable') }}</span>
Expand Down Expand Up @@ -181,10 +181,6 @@ const getContainerStatus = (containers) => {
return i18n.global.t('container.running') + ` (${runningCount}/${totalCount})`;
}
};
const backList = async () => {
isOnDetail.value = false;
search();
};
const dialogRef = ref();
const onOpenDialog = async () => {
Expand Down

0 comments on commit 2ac9a88

Please sign in to comment.