Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions agent/app/dto/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type DataTree struct {
Label string `json:"label"`
Key string `json:"key"`
Name string `json:"name"`
IsLocal bool `json:"isLocal"`
Size uint64 `json:"size"`
IsCheck bool `json:"isCheck"`
IsDisable bool `json:"isDisable"`
Expand Down
14 changes: 9 additions & 5 deletions agent/app/service/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,16 @@ func loadApps(fileOp fileUtils.FileOp) ([]dto.DataTree, error) {
appTreeMap := make(map[string]dto.DataTree)
for _, app := range apps {
itemApp := dto.DataTree{
ID: uuid.NewString(),
Label: fmt.Sprintf("%s - %s", app.App.Name, app.Name),
Key: app.App.Key,
Name: app.Name,
ID: uuid.NewString(),
Label: fmt.Sprintf("%s - %s", app.App.Name, app.Name),
Key: app.App.Key,
Name: app.Name,
IsLocal: app.App.Resource == "local",
}
appPath := path.Join(global.Dir.DataDir, "apps", app.App.Key, app.Name)
if itemApp.IsLocal {
appPath = path.Join(global.Dir.AppDir, "local", strings.TrimPrefix(app.App.Key, "local"), app.Name)
}
itemAppData := dto.DataTree{ID: uuid.NewString(), Label: "appData", Key: app.App.Key, Name: app.Name, IsCheck: true, Path: appPath}
if app.App.Key == constant.AppOpenresty && len(websites) != 0 {
itemAppData.IsDisable = true
Expand Down Expand Up @@ -295,7 +299,7 @@ func loadAppImage(list []dto.DataTree) []dto.DataTree {

for i := 0; i < len(list); i++ {
itemAppImage := dto.DataTree{ID: uuid.NewString(), Label: "appImage"}
stdout, err := cmd.RunDefaultWithStdoutBashCf("cat %s | grep image: ", path.Join(global.Dir.AppDir, list[i].Key, list[i].Name, "docker-compose.yml"))
stdout, err := cmd.RunDefaultWithStdoutBashCf("cat %s | grep image: ", list[i].Path)
if err != nil {
list[i].Children = append(list[i].Children, itemAppImage)
continue
Expand Down
Loading