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

Function handleInstalled

agent/app/service/app_utils.go:1595–1726  ·  view source on GitHub ↗
(appInstallList []model.AppInstall, updated, sync, checkUpdate bool)

Source from the content-addressed store, hash-verified

1593}
1594
1595func handleInstalled(appInstallList []model.AppInstall, updated, sync, checkUpdate bool) ([]response.AppInstallDTO, error) {
1596 var (
1597 res []response.AppInstallDTO
1598 containersMap map[string]container.Summary
1599 )
1600 if sync {
1601 cli, err := docker.NewClient()
1602 if err == nil {
1603 defer cli.Close()
1604 containers, err := cli.ListAllContainers()
1605 if err == nil {
1606 containersMap = make(map[string]container.Summary, len(containers))
1607 for _, contain := range containers {
1608 containersMap[contain.Names[0]] = contain
1609 }
1610 }
1611 }
1612 }
1613
1614 for _, installed := range appInstallList {
1615 if updated && ignoreUpdate(installed) {
1616 continue
1617 }
1618
1619 if sync && !doNotNeedSync(installed) {
1620 synAppInstall(containersMap, &installed, false)
1621 }
1622
1623 installDTO := response.AppInstallDTO{
1624 ID: installed.ID,
1625 Name: installed.Name,
1626 AppID: installed.AppId,
1627 AppDetailID: installed.AppDetailId,
1628 Version: installed.Version,
1629 Status: installed.Status,
1630 Message: installed.Message,
1631 HttpPort: installed.HttpPort,
1632 HttpsPort: installed.HttpsPort,
1633 AppName: installed.App.Name,
1634 AppKey: installed.App.Key,
1635 AppType: installed.App.Type,
1636 Path: installed.GetPath(),
1637 CreatedAt: installed.CreatedAt,
1638 WebUI: installed.WebUI,
1639 App: response.AppDetail{
1640 Github: installed.App.Github,
1641 Website: installed.App.Website,
1642 Document: installed.App.Document,
1643 },
1644 Favorite: installed.Favorite,
1645 SortOrder: installed.SortOrder,
1646 Container: installed.ContainerName,
1647 ServiceName: strings.ToLower(installed.ServiceName),
1648 }
1649
1650 if !updated && !checkUpdate {
1651 installDTO.LinkDB = hasLinkDB(installed.ID)
1652 res = append(res, installDTO)

Callers 2

PageMethod · 0.85
SearchForWebsiteMethod · 0.85

Calls 14

CloseMethod · 0.95
ListAllContainersMethod · 0.95
ignoreUpdateFunction · 0.85
doNotNeedSyncFunction · 0.85
synAppInstallFunction · 0.85
hasLinkDBFunction · 0.85
isEditComposeFunction · 0.85
getMajorVersionFunction · 0.85
GetByMethod · 0.65
WithAppIdMethod · 0.65
ListMethod · 0.65
WithDetailIdMethod · 0.65

Tested by

no test coverage detected