Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
19a6211ebf
5 changed files with 24 additions and 11 deletions
|
@ -111,7 +111,7 @@ const renderRepoItem = (response: IWebSocketData, element: Element, type: string
|
|||
<span class="b3-chip b3-chip--secondary b3-chip--small${item.tag ? "" : " fn__none"}">${item.tag}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="ft__smaller ft__on-surface">${item.hCreated}</span>
|
||||
<span class="ft__smaller ft__on-surface"><code class='fn__code'>${item.id.substring(0, 7)}</code> ${item.hCreated}</span>
|
||||
<span class="b3-list-item__meta">${window.siyuan.languages.fileSize} ${item.hSize}</span>
|
||||
<span class="b3-list-item__meta">${window.siyuan.languages.fileCount} ${item.count}</span>`;
|
||||
let statHTML = "";
|
||||
|
@ -146,7 +146,12 @@ const renderRepo = (element: Element, currentPage: number) => {
|
|||
renderRepoItem(response, element, "cloudTag");
|
||||
});
|
||||
} else if (currentPage === -3) {
|
||||
fetchPost("/api/repo/getCloudRepoSnapshots", {marker: ""}, (response) => {
|
||||
fetchPost("/api/repo/getCloudRepoSnapshots", {page: currentPage}, (response) => {
|
||||
if (currentPage < response.data.pageCount) {
|
||||
nextElement.removeAttribute("disabled");
|
||||
} else {
|
||||
nextElement.setAttribute("disabled", "disabled");
|
||||
}
|
||||
renderRepoItem(response, element, "cloud");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -186,9 +186,9 @@ func getCloudRepoSnapshots(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
marker := arg["marker"].(string)
|
||||
page := int(arg["page"].(float64))
|
||||
|
||||
snapshots, nextMarker, err := model.GetCloudRepoSnapshots(marker)
|
||||
snapshots, pageCount, totalCount, err := model.GetCloudRepoSnapshots(page)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
|
@ -197,7 +197,8 @@ func getCloudRepoSnapshots(c *gin.Context) {
|
|||
|
||||
ret.Data = map[string]interface{}{
|
||||
"snapshots": snapshots,
|
||||
"nextMarker": nextMarker,
|
||||
"pageCount": pageCount,
|
||||
"totalCount": totalCount,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ require (
|
|||
github.com/radovskyb/watcher v1.0.7
|
||||
github.com/sashabaranov/go-gpt3 v1.4.0
|
||||
github.com/shirou/gopsutil/v3 v3.23.2
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230421090246-20abbaa745d6
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230421133029-69679a7f4e07
|
||||
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75
|
||||
github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b
|
||||
github.com/siyuan-note/filelock v0.0.0-20230417044524-125ee78b5cc9
|
||||
|
|
|
@ -277,8 +277,8 @@ github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5g
|
|||
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=
|
||||
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230421090246-20abbaa745d6 h1:s2BtWsabaCqDlS1D5A7zx63OCzpKjCW6Ke6rwpYhXCg=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230421090246-20abbaa745d6/go.mod h1:R3PnH4Y9/0TollG4g0tX7jGW7lvhNIEL9hYi5zQ4+sI=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230421133029-69679a7f4e07 h1:gSfQLXrr3hOriRP7r38fakauefBF/oRWvha9vG0n238=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230421133029-69679a7f4e07/go.mod h1:R3PnH4Y9/0TollG4g0tX7jGW7lvhNIEL9hYi5zQ4+sI=
|
||||
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=
|
||||
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
|
||||
github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b h1:828lTUW2C0uNiolODqoACu7J8sDUzswD4Xo04mUombg=
|
||||
|
|
|
@ -588,7 +588,14 @@ func DownloadCloudSnapshot(tag, id string) (err error) {
|
|||
}
|
||||
|
||||
defer util.PushClearProgress()
|
||||
downloadFileCount, downloadChunkCount, downloadBytes, err := repo.DownloadTagIndex(tag, id, map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress})
|
||||
|
||||
var downloadFileCount, downloadChunkCount int
|
||||
var downloadBytes int64
|
||||
if "" == tag {
|
||||
downloadFileCount, downloadChunkCount, downloadBytes, err = repo.DownloadIndex(id, map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress})
|
||||
} else {
|
||||
downloadFileCount, downloadChunkCount, downloadBytes, err = repo.DownloadTagIndex(tag, id, map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress})
|
||||
}
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
@ -672,7 +679,7 @@ func GetCloudRepoTagSnapshots() (ret []*dejavu.Log, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func GetCloudRepoSnapshots(marker string) (ret []*dejavu.Log, nextMarker string, err error) {
|
||||
func GetCloudRepoSnapshots(page int) (ret []*dejavu.Log, pageCount, totalCount int, err error) {
|
||||
ret = []*dejavu.Log{}
|
||||
if 1 > len(Conf.Repo.Key) {
|
||||
err = errors.New(Conf.Language(26))
|
||||
|
@ -684,7 +691,7 @@ func GetCloudRepoSnapshots(marker string) (ret []*dejavu.Log, nextMarker string,
|
|||
return
|
||||
}
|
||||
|
||||
logs, nextMarker, err := repo.GetCloudRepoLogs(marker)
|
||||
logs, pageCount, totalCount, err := repo.GetCloudRepoLogs(page)
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue