From 36f29fe1a84c7e9ff2f5ccfbf88093c37c4bb5b0 Mon Sep 17 00:00:00 2001 From: "a624669980@163.com" Date: Wed, 15 Jun 2022 18:59:39 +0800 Subject: [PATCH] update ui --- UI | 2 +- service/app.go | 7 ++++--- web/index.html | 2 +- web/js/11.js | 2 +- web/js/12.js | 2 +- web/js/3.js | 2 +- web/js/4.js | 8 ++++---- web/js/8.js | 20 ++++++++++---------- web/js/app.js | 6 +++--- 9 files changed, 26 insertions(+), 25 deletions(-) diff --git a/UI b/UI index 62a6bd4..796ed1c 160000 --- a/UI +++ b/UI @@ -1 +1 @@ -Subproject commit 62a6bd44d5740e3cb0ba0694d37c943147bea362 +Subproject commit 796ed1cfd076eaad2bd546b3f5723a4608206368 diff --git a/service/app.go b/service/app.go index b08bcc8..b2d4686 100644 --- a/service/app.go +++ b/service/app.go @@ -479,10 +479,10 @@ func (a *appStruct) GetHardwareUsageSteam() { if err != nil { loger.Error("Failed to get container_list", zap.Any("err", err)) } + var temp sync.Map var wg sync.WaitGroup for _, v := range containers { if v.State != "running" { - dataStats.Delete(v.ID) continue } wg.Add(1) @@ -490,7 +490,6 @@ func (a *appStruct) GetHardwareUsageSteam() { defer wg.Done() stats, err := cli.ContainerStats(ctx, v.ID, true) if err != nil { - dataStats.Delete(v.ID) return } decode := json.NewDecoder(stats.Body) @@ -507,14 +506,16 @@ func (a *appStruct) GetHardwareUsageSteam() { dockerStats.Icon = v.Labels["icon"] dockerStats.Title = strings.ReplaceAll(v.Names[0], "/", "") - dataStats.Store(v.ID, dockerStats) + temp.Store(v.ID, dockerStats) if i == 99 { stats.Body.Close() } }(v, i) } wg.Wait() + dataStats = temp isFinish = true + time.Sleep(time.Second * 1) } isFinish = false diff --git a/web/index.html b/web/index.html index 395f8b2..84e74cf 100644 --- a/web/index.html +++ b/web/index.html @@ -20,7 +20,7 @@ CasaOS - +