From 0297fe67afd86269288d23b4b85007ac00ab1bf3 Mon Sep 17 00:00:00 2001 From: link Date: Tue, 14 Jun 2022 18:10:22 +0800 Subject: [PATCH 1/9] Dev (#290) * fix bug * updata UI * 0.3.2 ### Added - [Files] Files can now be selected multiple files and downloaded, deleted, moved, etc. - [Apps] Support to modify the application opening address.([#204](https://github.com/IceWhaleTech/CasaOS/issues/204)) ### Changed - [Apps] Hide the display of non-essential environment variables in the application. - [System] Network, disk, cpu, memory, etc. information is modified to be pushed via socket. - [System] Optimize opening speed.([#214](https://github.com/IceWhaleTech/CasaOS/issues/214)) ### Fixed - [System] Fixed the problem that sync data cannot submit the device ID ([#68](https://github.com/IceWhaleTech/CasaOS/issues/68)) - [Files] Fixed the code editor center alignment display problem.([#210](https://github.com/IceWhaleTech/CasaOS/issues/210)) - [Files] Fixed the problem of wrong name when downloading files.([#240](https://github.com/IceWhaleTech/CasaOS/issues/240)) - [System] Fixed the network display as a negative number problem.([#224](https://github.com/IceWhaleTech/CasaOS/issues/224)) * Modify log help class * Fix some bugs in 0.3.2 * Solve the operation file queue problem * Exclude web folders * update UI * add cancel file operate * Update UI * Merge sockets to transfer data * Conflict Resolution * Update send data interval * Update UI * fixed bug - Fix the problem of application opening failure on non-80 ports - Modify port failure problem - Modify environment variables disappearing problem * update version function * Fix version update issues * fixed bug - [System] Fixed the issue of widgets displaying wrongly on mobile devices. - [App] Fix the problem of application opening failure on non-80 ports ([#283](https://github.com/IceWhaleTech/CasaOS/issues/283) [#280](https://github.com/IceWhaleTech/CasaOS/issues/280)) - [System] Modify port failure problem ([#282](https://github.com/IceWhaleTech/CasaOS/issues/282)) - [App]Modify environment variables disappearing problem([#284](https://github.com/IceWhaleTech/CasaOS/issues/284)) - [System]Fix no update alert([#278](https://github.com/IceWhaleTech/CasaOS/issues/278)) - [System] Fixed some bugs of application cpu usage and memory staging([#272]https://github.com/IceWhaleTech/CasaOS/issues/272) * update UI --- CHANGELOG.md | 14 ++++++++++---- model/docker.go | 10 ++++++++++ service/app.go | 16 +++++++++------- web/index.html | 2 +- web/js/11.js | 2 +- web/js/12.js | 2 +- web/js/3.js | 2 +- web/js/4.js | 6 +++--- web/js/8.js | 26 +++++++++++++------------- web/js/app.js | 16 ++++++++-------- 10 files changed, 57 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6647f6..81aa0c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,12 +20,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.3.2.1] - 2022-06-14 +### Changed + +- [System] Adjusted the display style. + ### Fixed -- Fix the problem of application opening failure on non-80 ports ([#283](https://github.com/IceWhaleTech/CasaOS/issues/283) [#280](https://github.com/IceWhaleTech/CasaOS/issues/280)) -- Modify port failure problem ([#282](https://github.com/IceWhaleTech/CasaOS/issues/282)) -- Modify environment variables disappearing problem([#284](https://github.com/IceWhaleTech/CasaOS/issues/284)) -- Fix no update alert([#278](https://github.com/IceWhaleTech/CasaOS/issues/278)) +- [System] Fixed the issue of widgets displaying wrongly on mobile devices. +- [App] Fix the problem of application opening failure on non-80 ports ([#283](https://github.com/IceWhaleTech/CasaOS/issues/283) [#280](https://github.com/IceWhaleTech/CasaOS/issues/280)) +- [System] Modify port failure problem ([#282](https://github.com/IceWhaleTech/CasaOS/issues/282)) +- [App]Modify environment variables disappearing problem([#284](https://github.com/IceWhaleTech/CasaOS/issues/284)) +- [System]Fix no update alert([#278](https://github.com/IceWhaleTech/CasaOS/issues/278)) +- [System] Fixed some bugs of application cpu usage and memory staging([#272]https://github.com/IceWhaleTech/CasaOS/issues/272) ## [0.3.2] - 2022-06-10 diff --git a/model/docker.go b/model/docker.go index 1718eb6..59b006d 100644 --- a/model/docker.go +++ b/model/docker.go @@ -1,3 +1,13 @@ +/* + * @Author: LinkLeong link@icewhale.com + * @Date: 2021-12-08 18:10:25 + * @LastEditors: LinkLeong + * @LastEditTime: 2022-06-14 17:20:36 + * @FilePath: /CasaOS/model/docker.go + * @Description: + * @Website: https://www.casaos.io + * Copyright (c) 2022 by icewhale, All Rights Reserved. + */ package model type DockerStatsModel struct { diff --git a/service/app.go b/service/app.go index f976f13..4ed9728 100644 --- a/service/app.go +++ b/service/app.go @@ -464,12 +464,8 @@ func (a *appStruct) GetHardwareUsageSteam() { fts := filters.NewArgs() fts.Add("label", "casaos=casaos") - //fts.Add("label", "casaos") - //fts.Add("casaos", "casaos") - containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{All: true, Filters: fts}) - if err != nil { - loger.Error("Failed to get container_list", zap.Any("err", err)) - } + fts.Add("status", "running") + for i := 0; i < 100; i++ { if config.CasaOSGlobalVariables.AppChange { config.CasaOSGlobalVariables.AppChange = false @@ -479,6 +475,10 @@ func (a *appStruct) GetHardwareUsageSteam() { return true }) } + containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{All: true, Filters: fts}) + if err != nil { + loger.Error("Failed to get container_list", zap.Any("err", err)) + } var wg sync.WaitGroup for _, v := range containers { wg.Add(1) @@ -486,6 +486,7 @@ 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) @@ -501,6 +502,7 @@ func (a *appStruct) GetHardwareUsageSteam() { dockerStats.Data = data dockerStats.Icon = v.Labels["icon"] dockerStats.Title = strings.ReplaceAll(v.Names[0], "/", "") + dataStats.Store(v.ID, dockerStats) if i == 99 { stats.Body.Close() @@ -509,7 +511,7 @@ func (a *appStruct) GetHardwareUsageSteam() { } wg.Wait() isFinish = true - time.Sleep(time.Second * 3) + time.Sleep(time.Second * 1) } isFinish = false cancel() diff --git a/web/index.html b/web/index.html index 8ee9d75..fc39518 100644 --- a/web/index.html +++ b/web/index.html @@ -20,7 +20,7 @@ CasaOS - +