| 2109 | } |
| 2110 | |
| 2111 | func loadComposeCount(client *client.Client) int { |
| 2112 | options := container.ListOptions{All: true} |
| 2113 | options.Filters = filters.NewArgs() |
| 2114 | options.Filters.Add("label", composeProjectLabel) |
| 2115 | list, err := client.ContainerList(context.Background(), options) |
| 2116 | if err != nil { |
| 2117 | return 0 |
| 2118 | } |
| 2119 | composeCreatedByLocal, _ := composeRepo.ListRecord() |
| 2120 | composeMap := make(map[string]struct{}) |
| 2121 | for _, container := range list { |
| 2122 | if name, ok := container.Labels[composeProjectLabel]; ok { |
| 2123 | if _, has := composeMap[name]; !has { |
| 2124 | composeMap[name] = struct{}{} |
| 2125 | } |
| 2126 | } |
| 2127 | } |
| 2128 | for _, compose := range composeCreatedByLocal { |
| 2129 | if _, has := composeMap[compose.Name]; !has { |
| 2130 | composeMap[compose.Name] = struct{}{} |
| 2131 | } |
| 2132 | } |
| 2133 | |
| 2134 | return len(composeMap) |
| 2135 | } |
| 2136 | func loadContainerPortForInfo(itemPorts []container.Port) []dto.PortHelper { |
| 2137 | var exposedPorts []dto.PortHelper |
| 2138 | samePortMap := make(map[string]dto.PortHelper) |