mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 18:10:12 +01:00
🎨 Improve the mouse hove data sync button information on the desktop and browser https://github.com/siyuan-note/siyuan/issues/8521
This commit is contained in:
parent
1b8adb473c
commit
2797fae417
2 changed files with 11 additions and 40 deletions
|
|
@ -928,6 +928,7 @@ func syncRepoDownload() (err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Conf.Sync.Stat = msg
|
Conf.Sync.Stat = msg
|
||||||
|
Conf.Save()
|
||||||
util.PushStatusBar(msg)
|
util.PushStatusBar(msg)
|
||||||
util.PushErrMsg(msg, 0)
|
util.PushErrMsg(msg, 0)
|
||||||
return
|
return
|
||||||
|
|
@ -937,6 +938,7 @@ func syncRepoDownload() (err error) {
|
||||||
Conf.Sync.Synced = util.CurrentTimeMillis()
|
Conf.Sync.Synced = util.CurrentTimeMillis()
|
||||||
msg := fmt.Sprintf(Conf.Language(150), trafficStat.UploadFileCount, trafficStat.DownloadFileCount, trafficStat.UploadChunkCount, trafficStat.DownloadChunkCount, humanize.Bytes(uint64(trafficStat.UploadBytes)), humanize.Bytes(uint64(trafficStat.DownloadBytes)))
|
msg := fmt.Sprintf(Conf.Language(150), trafficStat.UploadFileCount, trafficStat.DownloadFileCount, trafficStat.UploadChunkCount, trafficStat.DownloadChunkCount, humanize.Bytes(uint64(trafficStat.UploadBytes)), humanize.Bytes(uint64(trafficStat.DownloadBytes)))
|
||||||
Conf.Sync.Stat = msg
|
Conf.Sync.Stat = msg
|
||||||
|
Conf.Save()
|
||||||
autoSyncErrCount = 0
|
autoSyncErrCount = 0
|
||||||
logging.LogInfof("synced data repo download [provider=%d, ufc=%d, dfc=%d, ucc=%d, dcc=%d, ub=%s, db=%s] in [%.2fs]",
|
logging.LogInfof("synced data repo download [provider=%d, ufc=%d, dfc=%d, ucc=%d, dcc=%d, ub=%s, db=%s] in [%.2fs]",
|
||||||
Conf.Sync.Provider, trafficStat.UploadFileCount, trafficStat.DownloadFileCount, trafficStat.UploadChunkCount, trafficStat.DownloadChunkCount, humanize.Bytes(uint64(trafficStat.UploadBytes)), humanize.Bytes(uint64(trafficStat.DownloadBytes)), elapsed.Seconds())
|
Conf.Sync.Provider, trafficStat.UploadFileCount, trafficStat.DownloadFileCount, trafficStat.UploadChunkCount, trafficStat.DownloadChunkCount, humanize.Bytes(uint64(trafficStat.UploadBytes)), humanize.Bytes(uint64(trafficStat.DownloadBytes)), elapsed.Seconds())
|
||||||
|
|
@ -995,6 +997,7 @@ func syncRepoUpload() (err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Conf.Sync.Stat = msg
|
Conf.Sync.Stat = msg
|
||||||
|
Conf.Save()
|
||||||
util.PushStatusBar(msg)
|
util.PushStatusBar(msg)
|
||||||
util.PushErrMsg(msg, 0)
|
util.PushErrMsg(msg, 0)
|
||||||
return
|
return
|
||||||
|
|
@ -1004,6 +1007,7 @@ func syncRepoUpload() (err error) {
|
||||||
Conf.Sync.Synced = util.CurrentTimeMillis()
|
Conf.Sync.Synced = util.CurrentTimeMillis()
|
||||||
msg := fmt.Sprintf(Conf.Language(150), trafficStat.UploadFileCount, trafficStat.DownloadFileCount, trafficStat.UploadChunkCount, trafficStat.DownloadChunkCount, humanize.Bytes(uint64(trafficStat.UploadBytes)), humanize.Bytes(uint64(trafficStat.DownloadBytes)))
|
msg := fmt.Sprintf(Conf.Language(150), trafficStat.UploadFileCount, trafficStat.DownloadFileCount, trafficStat.UploadChunkCount, trafficStat.DownloadChunkCount, humanize.Bytes(uint64(trafficStat.UploadBytes)), humanize.Bytes(uint64(trafficStat.DownloadBytes)))
|
||||||
Conf.Sync.Stat = msg
|
Conf.Sync.Stat = msg
|
||||||
|
Conf.Save()
|
||||||
autoSyncErrCount = 0
|
autoSyncErrCount = 0
|
||||||
logging.LogInfof("synced data repo upload [provider=%d, ufc=%d, dfc=%d, ucc=%d, dcc=%d, ub=%s, db=%s] in [%.2fs]",
|
logging.LogInfof("synced data repo upload [provider=%d, ufc=%d, dfc=%d, ucc=%d, dcc=%d, ub=%s, db=%s] in [%.2fs]",
|
||||||
Conf.Sync.Provider, trafficStat.UploadFileCount, trafficStat.DownloadFileCount, trafficStat.UploadChunkCount, trafficStat.DownloadChunkCount, humanize.Bytes(uint64(trafficStat.UploadBytes)), humanize.Bytes(uint64(trafficStat.DownloadBytes)), elapsed.Seconds())
|
Conf.Sync.Provider, trafficStat.UploadFileCount, trafficStat.DownloadFileCount, trafficStat.UploadChunkCount, trafficStat.DownloadChunkCount, humanize.Bytes(uint64(trafficStat.UploadBytes)), humanize.Bytes(uint64(trafficStat.DownloadBytes)), elapsed.Seconds())
|
||||||
|
|
@ -1080,6 +1084,7 @@ func bootSyncRepo() (err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Conf.Sync.Stat = msg
|
Conf.Sync.Stat = msg
|
||||||
|
Conf.Save()
|
||||||
util.PushStatusBar(msg)
|
util.PushStatusBar(msg)
|
||||||
util.PushErrMsg(msg, 0)
|
util.PushErrMsg(msg, 0)
|
||||||
BootSyncSucc = 1
|
BootSyncSucc = 1
|
||||||
|
|
@ -1152,6 +1157,7 @@ func syncRepo(exit, byHand bool) (err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Conf.Sync.Stat = msg
|
Conf.Sync.Stat = msg
|
||||||
|
Conf.Save()
|
||||||
util.PushStatusBar(msg)
|
util.PushStatusBar(msg)
|
||||||
if 1 > autoSyncErrCount || byHand {
|
if 1 > autoSyncErrCount || byHand {
|
||||||
util.PushErrMsg(msg, 0)
|
util.PushErrMsg(msg, 0)
|
||||||
|
|
@ -1166,6 +1172,7 @@ func syncRepo(exit, byHand bool) (err error) {
|
||||||
Conf.Sync.Synced = util.CurrentTimeMillis()
|
Conf.Sync.Synced = util.CurrentTimeMillis()
|
||||||
msg := fmt.Sprintf(Conf.Language(150), trafficStat.UploadFileCount, trafficStat.DownloadFileCount, trafficStat.UploadChunkCount, trafficStat.DownloadChunkCount, humanize.Bytes(uint64(trafficStat.UploadBytes)), humanize.Bytes(uint64(trafficStat.DownloadBytes)))
|
msg := fmt.Sprintf(Conf.Language(150), trafficStat.UploadFileCount, trafficStat.DownloadFileCount, trafficStat.UploadChunkCount, trafficStat.DownloadChunkCount, humanize.Bytes(uint64(trafficStat.UploadBytes)), humanize.Bytes(uint64(trafficStat.DownloadBytes)))
|
||||||
Conf.Sync.Stat = msg
|
Conf.Sync.Stat = msg
|
||||||
|
Conf.Save()
|
||||||
autoSyncErrCount = 0
|
autoSyncErrCount = 0
|
||||||
logging.LogInfof("synced data repo [kernel=%s, provider=%d, ufc=%d, dfc=%d, ucc=%d, dcc=%d, ub=%s, db=%s] in [%.2fs]",
|
logging.LogInfof("synced data repo [kernel=%s, provider=%d, ufc=%d, dfc=%d, ucc=%d, dcc=%d, ub=%s, db=%s] in [%.2fs]",
|
||||||
kernelID, Conf.Sync.Provider, trafficStat.UploadFileCount, trafficStat.DownloadFileCount, trafficStat.UploadChunkCount, trafficStat.DownloadChunkCount, humanize.Bytes(uint64(trafficStat.UploadBytes)), humanize.Bytes(uint64(trafficStat.DownloadBytes)), elapsed.Seconds())
|
kernelID, Conf.Sync.Provider, trafficStat.UploadFileCount, trafficStat.DownloadFileCount, trafficStat.UploadChunkCount, trafficStat.DownloadChunkCount, humanize.Bytes(uint64(trafficStat.UploadBytes)), humanize.Bytes(uint64(trafficStat.DownloadBytes)), elapsed.Seconds())
|
||||||
|
|
|
||||||
|
|
@ -62,20 +62,11 @@ func SyncDataDownload() {
|
||||||
Conf.Sync.Synced = now
|
Conf.Sync.Synced = now
|
||||||
|
|
||||||
err := syncRepoDownload()
|
err := syncRepoDownload()
|
||||||
synced := util.Millisecond2Time(Conf.Sync.Synced).Format("2006-01-02 15:04:05") + "\n\n"
|
|
||||||
if nil == err {
|
|
||||||
synced += Conf.Sync.Stat
|
|
||||||
} else {
|
|
||||||
synced += fmt.Sprintf(Conf.Language(80), formatRepoErrorMsg(err))
|
|
||||||
}
|
|
||||||
msg := fmt.Sprintf(Conf.Language(82), synced)
|
|
||||||
Conf.Sync.Stat = msg
|
|
||||||
Conf.Save()
|
|
||||||
code := 1
|
code := 1
|
||||||
if nil != err {
|
if nil != err {
|
||||||
code = 2
|
code = 2
|
||||||
}
|
}
|
||||||
util.BroadcastByType("main", "syncing", code, msg, nil)
|
util.BroadcastByType("main", "syncing", code, Conf.Sync.Stat, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SyncDataUpload() {
|
func SyncDataUpload() {
|
||||||
|
|
@ -98,20 +89,11 @@ func SyncDataUpload() {
|
||||||
Conf.Sync.Synced = now
|
Conf.Sync.Synced = now
|
||||||
|
|
||||||
err := syncRepoUpload()
|
err := syncRepoUpload()
|
||||||
synced := util.Millisecond2Time(Conf.Sync.Synced).Format("2006-01-02 15:04:05") + "\n\n"
|
|
||||||
if nil == err {
|
|
||||||
synced += Conf.Sync.Stat
|
|
||||||
} else {
|
|
||||||
synced += fmt.Sprintf(Conf.Language(80), formatRepoErrorMsg(err))
|
|
||||||
}
|
|
||||||
msg := fmt.Sprintf(Conf.Language(82), synced)
|
|
||||||
Conf.Sync.Stat = msg
|
|
||||||
Conf.Save()
|
|
||||||
code := 1
|
code := 1
|
||||||
if nil != err {
|
if nil != err {
|
||||||
code = 2
|
code = 2
|
||||||
}
|
}
|
||||||
util.BroadcastByType("main", "syncing", code, msg, nil)
|
util.BroadcastByType("main", "syncing", code, Conf.Sync.Stat, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,20 +143,11 @@ func BootSyncData() {
|
||||||
Conf.Sync.Synced = now
|
Conf.Sync.Synced = now
|
||||||
util.BroadcastByType("main", "syncing", 0, Conf.Language(81), nil)
|
util.BroadcastByType("main", "syncing", 0, Conf.Language(81), nil)
|
||||||
err := bootSyncRepo()
|
err := bootSyncRepo()
|
||||||
synced := util.Millisecond2Time(Conf.Sync.Synced).Format("2006-01-02 15:04:05") + "\n\n"
|
|
||||||
if nil == err {
|
|
||||||
synced += Conf.Sync.Stat
|
|
||||||
} else {
|
|
||||||
synced += fmt.Sprintf(Conf.Language(80), formatRepoErrorMsg(err))
|
|
||||||
}
|
|
||||||
msg := fmt.Sprintf(Conf.Language(82), synced)
|
|
||||||
Conf.Sync.Stat = msg
|
|
||||||
Conf.Save()
|
|
||||||
code := 1
|
code := 1
|
||||||
if nil != err {
|
if nil != err {
|
||||||
code = 2
|
code = 2
|
||||||
}
|
}
|
||||||
util.BroadcastByType("main", "syncing", code, msg, nil)
|
util.BroadcastByType("main", "syncing", code, Conf.Sync.Stat, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -208,20 +181,11 @@ func syncData(exit, byHand, byWebSocket bool) {
|
||||||
Conf.Sync.Synced = now
|
Conf.Sync.Synced = now
|
||||||
|
|
||||||
err := syncRepo(exit, byHand)
|
err := syncRepo(exit, byHand)
|
||||||
synced := util.Millisecond2Time(Conf.Sync.Synced).Format("2006-01-02 15:04:05") + "\n\n"
|
|
||||||
if nil == err {
|
|
||||||
synced += Conf.Sync.Stat
|
|
||||||
} else {
|
|
||||||
synced += fmt.Sprintf(Conf.Language(80), formatRepoErrorMsg(err))
|
|
||||||
}
|
|
||||||
msg := fmt.Sprintf(Conf.Language(82), synced)
|
|
||||||
Conf.Sync.Stat = msg
|
|
||||||
Conf.Save()
|
|
||||||
code := 1
|
code := 1
|
||||||
if nil != err {
|
if nil != err {
|
||||||
code = 2
|
code = 2
|
||||||
}
|
}
|
||||||
util.BroadcastByType("main", "syncing", code, msg, nil)
|
util.BroadcastByType("main", "syncing", code, Conf.Sync.Stat, nil)
|
||||||
|
|
||||||
if nil == webSocketConn && Conf.Sync.Perception {
|
if nil == webSocketConn && Conf.Sync.Perception {
|
||||||
// 如果 websocket 连接已经断开,则重新连接
|
// 如果 websocket 连接已经断开,则重新连接
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue