mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-29 18:26:03 +08:00
feat: Delete app while ignoring it during synchronization. (#9852)
This commit is contained in:
parent
7c49f6c79b
commit
c661cc37b3
3 changed files with 15 additions and 1 deletions
|
|
@ -11,6 +11,7 @@ type AppIgnoreUpgradeRepo struct {
|
|||
|
||||
type IAppIgnoreUpgradeRepo interface {
|
||||
WithScope(scope string) DBOption
|
||||
WithAppID(appID uint) DBOption
|
||||
List(opts ...DBOption) ([]model.AppIgnoreUpgrade, error)
|
||||
Create(appIgnoreUpgrade *model.AppIgnoreUpgrade) error
|
||||
Delete(opts ...DBOption) error
|
||||
|
|
@ -26,6 +27,12 @@ func (a AppIgnoreUpgradeRepo) WithScope(scope string) DBOption {
|
|||
}
|
||||
}
|
||||
|
||||
func (a AppIgnoreUpgradeRepo) WithAppID(appID uint) DBOption {
|
||||
return func(g *gorm.DB) *gorm.DB {
|
||||
return g.Where("app_id = ?", appID)
|
||||
}
|
||||
}
|
||||
|
||||
func (a AppIgnoreUpgradeRepo) List(opts ...DBOption) ([]model.AppIgnoreUpgrade, error) {
|
||||
var appIgnoreUpgradeList []model.AppIgnoreUpgrade
|
||||
err := getDb(opts...).Find(&appIgnoreUpgradeList).Error
|
||||
|
|
|
|||
|
|
@ -440,6 +440,11 @@ func deleteAppInstall(deleteReq request.AppInstallDelete) error {
|
|||
_ = op.DeleteDir(parentDir)
|
||||
}
|
||||
tx.Commit()
|
||||
|
||||
existApps, _ := appInstallRepo.ListBy(context.Background(), appInstallRepo.WithAppId(install.AppId))
|
||||
if len(existApps) == 0 {
|
||||
_ = appIgnoreUpgradeRepo.Delete(appIgnoreUpgradeRepo.WithAppID(install.AppId))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
uninstallTask.AddSubTask(task.GetTaskName(install.Name, task.TaskUninstall, task.TaskScopeApp), uninstall, nil)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
<template>
|
||||
<div v-loading="firstLoading">
|
||||
<div v-if="defaultButton">
|
||||
<el-button icon="Refresh" @click="getContent(false)">{{ $t('commons.button.refresh') }}</el-button>
|
||||
<el-button icon="Refresh" v-if="!showTail" @click="getContent(false)">
|
||||
{{ $t('commons.button.refresh') }}
|
||||
</el-button>
|
||||
<el-checkbox
|
||||
border
|
||||
:disabled="isTailDisabled"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue