mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-06-16 05:55:33 +00:00
update disk display
add casaos logs api update ui
This commit is contained in:
parent
d7d53d639b
commit
4939fe10aa
2
UI
2
UI
@ -1 +1 @@
|
|||||||
Subproject commit 574be529e2e1f431cf03b631a849a5530e71c175
|
Subproject commit 63efca105aacbbf7ac7952f2ce9ac8e3b2e8b641
|
@ -1,14 +1,11 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"io/ioutil"
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/IceWhaleTech/CasaOS/pkg/config"
|
"github.com/IceWhaleTech/CasaOS/pkg/config"
|
||||||
command2 "github.com/IceWhaleTech/CasaOS/pkg/utils/command"
|
command2 "github.com/IceWhaleTech/CasaOS/pkg/utils/command"
|
||||||
"github.com/IceWhaleTech/CasaOS/pkg/utils/file"
|
|
||||||
"github.com/IceWhaleTech/CasaOS/pkg/utils/loger"
|
"github.com/IceWhaleTech/CasaOS/pkg/utils/loger"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -40,38 +37,21 @@ func (s *systemService) UpSystemConfig(str string, widget string) {
|
|||||||
config.Cfg.Section("system").Key("WidgetList").SetValue(widget)
|
config.Cfg.Section("system").Key("WidgetList").SetValue(widget)
|
||||||
config.SystemConfigInfo.WidgetList = widget
|
config.SystemConfigInfo.WidgetList = widget
|
||||||
}
|
}
|
||||||
config.Cfg.SaveTo("conf/conf.ini")
|
config.Cfg.SaveTo(config.SystemConfigInfo.ConfigPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *systemService) GetCasaOSLogs(lineNumber int) string {
|
func (s *systemService) GetCasaOSLogs(lineNumber int) string {
|
||||||
|
file, err := os.Open(s.log.Path())
|
||||||
reader, err := file.NewReadLineFromEnd(s.log.Path())
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return err.Error()
|
||||||
}
|
|
||||||
defer reader.Close()
|
|
||||||
test, err := reader.ReadLine()
|
|
||||||
|
|
||||||
fmt.Println(err)
|
|
||||||
fmt.Println(test)
|
|
||||||
return string(test)
|
|
||||||
file, _ := os.Open(s.log.Path())
|
|
||||||
fileScanner := bufio.NewReader(file)
|
|
||||||
lineNumber = 5
|
|
||||||
lineCount := 1
|
|
||||||
var r string
|
|
||||||
for i := lineCount; i < lineNumber; i++ {
|
|
||||||
line, _, err := fileScanner.ReadLine()
|
|
||||||
r += string(line)
|
|
||||||
if err == io.EOF {
|
|
||||||
return r
|
|
||||||
}
|
|
||||||
// 如下是某些业务逻辑操作
|
|
||||||
// 如下代码打印每次读取的文件行内容
|
|
||||||
|
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
return r
|
content, err := ioutil.ReadAll(file)
|
||||||
|
if err != nil {
|
||||||
|
return err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(content)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSystemService(log loger.OLog) SystemService {
|
func NewSystemService(log loger.OLog) SystemService {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user