feat: Delete app while ignoring it during synchronization. (#9852)

This commit is contained in:
CityFun 2025-08-05 14:29:50 +08:00 committed by GitHub
parent 7c49f6c79b
commit c661cc37b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 1 deletions

View file

@ -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

View file

@ -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)

View file

@ -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"