1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-14 01:34:47 +08:00

feat: 解决在容器被删除之后重启应用状态不对的BUG

This commit is contained in:
zhengkunwang223 2023-03-07 15:43:12 +08:00 committed by zhengkunwang223
parent 71126db6b3
commit b54cbe1d11
6 changed files with 29 additions and 32 deletions

View File

@ -164,25 +164,25 @@ func (a AppInstallService) Operate(req request.AppInstalledOperate) error {
if err != nil {
return handleErr(install, err, out)
}
return nil
return syncById(install.ID)
case constant.Start:
out, err := compose.Start(dockerComposePath)
if err != nil {
return handleErr(install, err, out)
}
install.Status = constant.Running
return syncById(install.ID)
case constant.Stop:
out, err := compose.Stop(dockerComposePath)
if err != nil {
return handleErr(install, err, out)
}
install.Status = constant.Stopped
return syncById(install.ID)
case constant.Restart:
out, err := compose.Restart(dockerComposePath)
if err != nil {
return handleErr(install, err, out)
}
install.Status = constant.Running
return syncById(install.ID)
case constant.Delete:
tx, ctx := getTxAndContext()
if err := deleteAppInstall(ctx, install, req.DeleteBackup, req.ForceDelete, req.DeleteDB); err != nil && !req.ForceDelete {
@ -198,8 +198,6 @@ func (a AppInstallService) Operate(req request.AppInstalledOperate) error {
default:
return errors.New("operate not support")
}
return appInstallRepo.Save(&install)
}
func (a AppInstallService) SyncAll() error {

View File

@ -401,6 +401,7 @@ func handleErr(install model.AppInstall, err error, out string) error {
if out != "" {
install.Message = out
reErr = errors.New(out)
install.Status = constant.Error
}
_ = appInstallRepo.Save(&install)
return reErr

View File

@ -296,6 +296,9 @@ const operate = async () => {
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
search();
})
.catch(() => {
search();
})
.finally(() => {
loading.value = false;
});
@ -398,7 +401,7 @@ onMounted(() => {
search();
timer = setInterval(() => {
search();
}, 1000 * 8);
}, 10000 * 6);
});
onUnmounted(() => {

View File

@ -43,20 +43,22 @@
</el-dropdown-menu>
</template>
</el-dropdown>
<el-button plain @click="openUpload" style="margin-left: 10px">{{ $t('file.upload') }}</el-button>
<el-button plain @click="openWget">{{ $t('file.remoteFile') }}</el-button>
<el-button plain @click="openMove('copy')" :disabled="selects.length === 0">
{{ $t('file.copy') }}
</el-button>
<el-button plain @click="openMove('cut')" :disabled="selects.length === 0">
{{ $t('file.move') }}
</el-button>
<el-button plain @click="openCompress(selects)" :disabled="selects.length === 0">
{{ $t('file.compress') }}
</el-button>
<el-button plain @click="openDownload" :disabled="selects.length === 0">
{{ $t('file.download') }}
</el-button>
<el-button-group style="margin-left: 10px">
<el-button plain @click="openUpload">{{ $t('file.upload') }}</el-button>
<el-button plain @click="openWget">{{ $t('file.remoteFile') }}</el-button>
<el-button plain @click="openMove('copy')" :disabled="selects.length === 0">
{{ $t('file.copy') }}
</el-button>
<el-button plain @click="openMove('cut')" :disabled="selects.length === 0">
{{ $t('file.move') }}
</el-button>
<el-button plain @click="openCompress(selects)" :disabled="selects.length === 0">
{{ $t('file.compress') }}
</el-button>
<el-button plain @click="openDownload" :disabled="selects.length === 0">
{{ $t('file.download') }}
</el-button>
</el-button-group>
<div class="search search-button">
<el-input
v-model="req.search"

View File

@ -5,14 +5,7 @@
</template>
<el-row v-loading="loading">
<el-col :span="22" :offset="1">
<el-form
ref="sslForm"
label-position="top"
:model="ssl"
label-width="100px"
:rules="rules"
v-loading="loading"
>
<el-form ref="sslForm" label-position="top" :model="ssl" label-width="100px" :rules="rules">
<el-form-item :label="$t('website.primaryDomain')" prop="primaryDomain">
<el-input v-model="ssl.primaryDomain"></el-input>
</el-form-item>
@ -139,7 +132,7 @@ let ssl = ref({
websiteId: 0,
acmeAccountId: undefined,
dnsAccountId: undefined,
autoRenew: false,
autoRenew: true,
});
let dnsResolve = ref<Website.DNSResolve[]>([]);
let hasResolve = ref(false);
@ -160,7 +153,7 @@ const resetForm = () => {
websiteId: 0,
acmeAccountId: undefined,
dnsAccountId: undefined,
autoRenew: false,
autoRenew: true,
};
};

View File

@ -53,7 +53,7 @@
{{ websiteSSL.primaryDomain }}
</el-descriptions-item>
<el-descriptions-item :label="$t('website.otherDomains')">
{{ websiteSSL.otherDomains }}
{{ websiteSSL.domains }}
</el-descriptions-item>
<el-descriptions-item :label="$t('ssl.provider')">
{{ getProvider(websiteSSL.provider) }}