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

Method Page

agent/app/service/agents.go:743–770  ·  view source on GitHub ↗
(req dto.SearchWithPage)

Source from the content-addressed store, hash-verified

741}
742
743func (a AgentService) Page(req dto.SearchWithPage) (int64, []dto.AgentItem, error) {
744 var opts []repo.DBOption
745 if strings.TrimSpace(req.Info) != "" {
746 opts = append(opts, repo.WithByLikeName(req.Info))
747 }
748 count, list, err := agentRepo.Page(req.Page, req.PageSize, opts...)
749 if err != nil {
750 return 0, nil, err
751 }
752 items := make([]dto.AgentItem, 0, len(list))
753 appInstalls := make([]model.AppInstall, 0, len(list))
754 for _, item := range list {
755 appInstall, _ := appInstallRepo.GetFirst(repo.WithByID(item.AppInstallID))
756 appInstalls = append(appInstalls, appInstall)
757 }
758 syncAgentAppInstalls(appInstalls)
759 for index, item := range list {
760 appInstall := appInstalls[index]
761 envMap := readInstallEnv(appInstall.Env)
762 agentItem := buildAgentItem(&item, &appInstall, envMap)
763 agentItem.Upgradable = checkAgentUpgradable(appInstall)
764 items = append(items, agentItem)
765 }
766 if err := hydrateAgentWebsiteItems(items); err != nil {
767 return 0, nil, err
768 }
769 return count, items, nil
770}
771
772func (a AgentService) Delete(req dto.AgentDeleteReq) error {
773 agent, err := agentRepo.GetFirst(repo.WithByID(req.ID))

Callers

nothing calls this directly

Calls 9

syncAgentAppInstallsFunction · 0.85
readInstallEnvFunction · 0.85
buildAgentItemFunction · 0.85
checkAgentUpgradableFunction · 0.85
hydrateAgentWebsiteItemsFunction · 0.85
WithByLikeNameMethod · 0.65
PageMethod · 0.65
GetFirstMethod · 0.65
WithByIDMethod · 0.65

Tested by

no test coverage detected