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

Method SearchForWebsite

agent/app/service/app_install.go:200–244  ·  view source on GitHub ↗
(req request.AppInstalledSearch)

Source from the content-addressed store, hash-verified

198}
199
200func (a *AppInstallService) SearchForWebsite(req request.AppInstalledSearch) ([]response.AppInstallDTO, error) {
201 var (
202 installs []model.AppInstall
203 err error
204 opts []repo.DBOption
205 )
206 if req.Type != "" {
207 if req.Type == "proxy" {
208 phpApps, _ := appRepo.GetBy(appRepo.WithType("php"))
209 var ids []uint
210 for _, app := range phpApps {
211 ids = append(ids, app.ID)
212 }
213 runtimeApps, _ := appRepo.GetBy(appRepo.WithType("runtime"))
214 for _, app := range runtimeApps {
215 ids = append(ids, app.ID)
216 }
217 opts = append(opts, appInstallRepo.WithAppIdsNotIn(ids))
218 } else {
219 apps, err := appRepo.GetBy(appRepo.WithType(req.Type))
220 if err != nil {
221 return nil, err
222 }
223 var ids []uint
224 for _, app := range apps {
225 ids = append(ids, app.ID)
226 }
227 if req.Unused {
228 opts = append(opts, appInstallRepo.WithIdNotInWebsite())
229 }
230 opts = append(opts, appInstallRepo.WithAppIdsIn(ids))
231 }
232 installs, err = appInstallRepo.ListBy(context.Background(), opts...)
233 if err != nil {
234 return nil, err
235 }
236 } else {
237 installs, err = appInstallRepo.ListBy(context.Background())
238 if err != nil {
239 return nil, err
240 }
241 }
242
243 return handleInstalled(installs, false, true, false)
244}
245
246func (a *AppInstallService) Operate(req request.AppInstalledOperate) error {
247 install, err := appInstallRepo.GetFirstByCtx(context.Background(), repo.WithByID(req.InstallId))

Callers

nothing calls this directly

Calls 7

handleInstalledFunction · 0.85
GetByMethod · 0.65
WithTypeMethod · 0.65
WithAppIdsNotInMethod · 0.65
WithIdNotInWebsiteMethod · 0.65
WithAppIdsInMethod · 0.65
ListByMethod · 0.65

Tested by

no test coverage detected