MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / deleteCustomApp

Function deleteCustomApp

agent/app/service/app.go:932–966  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

930}
931
932func deleteCustomApp() {
933 installs, err := appInstallRepo.ListBy(context.Background())
934 if err != nil {
935 global.LOG.Errorf("[AppStore] deleteCustomApp: failed to list installs, skipping: %v", err)
936 return
937 }
938 var appIDS []uint
939 for _, install := range installs {
940 appIDS = append(appIDS, install.AppId)
941 }
942 var ops []repo.DBOption
943 if len(appIDS) > 0 {
944 ops = append(ops, repo.WithByIDNotIn(appIDS))
945 }
946 apps, err := appRepo.GetBy(ops...)
947 if err != nil {
948 global.LOG.Errorf("[AppStore] deleteCustomApp: failed to get apps, skipping: %v", err)
949 return
950 }
951 var deleteIDS []uint
952 for _, app := range apps {
953 if app.Resource == constant.AppResourceCustom {
954 deleteIDS = append(deleteIDS, app.ID)
955 }
956 }
957 if len(deleteIDS) == 0 {
958 return
959 }
960 if err = appRepo.DeleteByIDs(context.Background(), deleteIDS); err != nil {
961 global.LOG.Errorf("[AppStore] deleteCustomApp: failed to delete apps: %v", err)
962 }
963 if err = appDetailRepo.DeleteByAppIds(context.Background(), deleteIDS); err != nil {
964 global.LOG.Errorf("[AppStore] deleteCustomApp: failed to delete app details: %v", err)
965 }
966}
967
968func (a AppService) SyncAppListFromRemote(taskID string) (err error) {
969 if xpack.MultiNodeProvider.IsUseCustomApp() {

Callers 1

Calls 5

ListByMethod · 0.65
WithByIDNotInMethod · 0.65
GetByMethod · 0.65
DeleteByIDsMethod · 0.65
DeleteByAppIdsMethod · 0.65

Tested by

no test coverage detected