Commit 4b65f008 authored by Eric's avatar Eric Committed by Eric_Lee

fix comment display bugs

parent 69cbd85c
...@@ -145,7 +145,14 @@ func (p *AssetPagination) displayPageAssets() { ...@@ -145,7 +145,14 @@ func (p *AssetPagination) displayPageAssets() {
names[i] = systemUser[i].Name names[i] = systemUser[i].Name
} }
row["systemUsers"] = strings.Join(names, ",") row["systemUsers"] = strings.Join(names, ",")
row["comment"] = j.Comment comments := make([]string,0)
for _, item := range strings.Split(strings.TrimSpace(j.Comment), "\r\n"){
if strings.TrimSpace(item) == ""{
continue
}
comments = append(comments,strings.ReplaceAll(strings.TrimSpace(item)," ",","))
}
row["comment"] = strings.Join(comments,"|")
data[i] = row data[i] = row
} }
w, _ := p.term.GetSize() w, _ := p.term.GetSize()
...@@ -159,9 +166,9 @@ func (p *AssetPagination) displayPageAssets() { ...@@ -159,9 +166,9 @@ func (p *AssetPagination) displayPageAssets() {
FieldsSize: map[string][3]int{ FieldsSize: map[string][3]int{
"ID": {0, 0, 4}, "ID": {0, 0, 4},
"hostname": {0, 8, 0}, "hostname": {0, 8, 0},
"IP": {15, 0, 0}, "IP": {0, 15, 40},
"systemUsers": {0, 12, 0}, "systemUsers": {0, 12, 0},
"comment": {0, 0, 0}, "comment": {0, 0, 40},
}, },
Data: data, Data: data,
TotalSize: w, TotalSize: w,
......
...@@ -52,6 +52,8 @@ func (dt *DirectTransport) Keep() { ...@@ -52,6 +52,8 @@ func (dt *DirectTransport) Keep() {
if !dt.closed { if !dt.closed {
dt.ch <- buf[:n] dt.ch <- buf[:n]
} else { } else {
// 解决用户终端返回时, 数据丢失
_ , _ = dt.readWriter.Write(buf[:n])
logger.Debug("Transport closed") logger.Debug("Transport closed")
break break
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment