This commit is contained in:
Liang Ding 2022-06-13 23:39:03 +08:00
parent a57b65de48
commit 1a831c5ad9
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D
2 changed files with 16 additions and 16 deletions

View File

@ -68,10 +68,10 @@ const renderAssets = (element: HTMLElement) => {
return; return;
} }
let logsHTML = ""; let logsHTML = "";
response.data.histories.forEach((item: { items: { path: string, title: string }[], time: string }, index: number) => { response.data.histories.forEach((item: { items: { path: string, title: string }[], hCreated: string }, index: number) => {
logsHTML += `<li class="b3-list-item" data-type="toggle" style="padding-left: 0"> logsHTML += `<li class="b3-list-item" data-type="toggle" style="padding-left: 0">
<span style="padding-left: 8px" class="b3-list-item__toggle"><svg class="b3-list-item__arrow${index === 0 ? " b3-list-item__arrow--open" : ""}${item.items.length > 0 ? "" : " fn__hidden"}"><use xlink:href="#iconRight"></use></svg></span> <span style="padding-left: 8px" class="b3-list-item__toggle"><svg class="b3-list-item__arrow${index === 0 ? " b3-list-item__arrow--open" : ""}${item.items.length > 0 ? "" : " fn__hidden"}"><use xlink:href="#iconRight"></use></svg></span>
<span class="b3-list-item__text">${item.time}</span> <span class="b3-list-item__text">${item.hCreated}</span>
</li>`; </li>`;
if (item.items.length > 0) { if (item.items.length > 0) {
logsHTML += `<ul class="${index === 0 ? "" : "fn__none"}">`; logsHTML += `<ul class="${index === 0 ? "" : "fn__none"}">`;
@ -112,10 +112,10 @@ const renderRepo = (element: HTMLElement) => {
return; return;
} }
let repoHTML = ""; let repoHTML = "";
response.data.logs.forEach((item: { files: { path: string, id: string }[], id: string, time: string }, index: number) => { response.data.logs.forEach((item: { files: { path: string, id: string }[], id: string, hCreated: string }, index: number) => {
repoHTML += `<li class="b3-list-item" style="padding-left: 0" data-type="toggle"> repoHTML += `<li class="b3-list-item" style="padding-left: 0" data-type="toggle">
<span style="padding-left: 8px" class="b3-list-item__toggle"><svg class="b3-list-item__arrow${index === 0 ? " b3-list-item__arrow--open" : ""}${item.files.length > 0 ? "" : " fn__hidden"}"><use xlink:href="#iconRight"></use></svg></span> <span style="padding-left: 8px" class="b3-list-item__toggle"><svg class="b3-list-item__arrow${index === 0 ? " b3-list-item__arrow--open" : ""}${item.files.length > 0 ? "" : " fn__hidden"}"><use xlink:href="#iconRight"></use></svg></span>
<span class="b3-list-item__text">${item.time}</span> <span class="b3-list-item__text">${item.hCreated}</span>
</li>`; </li>`;
if (item.files.length > 0) { if (item.files.length > 0) {
repoHTML += `<ul class="${index === 0 ? "" : "fn__none"}">`; repoHTML += `<ul class="${index === 0 ? "" : "fn__none"}">`;
@ -148,10 +148,10 @@ const renderRmNotebook = (element: HTMLElement) => {
return; return;
} }
let logsHTML = ""; let logsHTML = "";
response.data.histories.forEach((item: { items: { path: string, title: string }[], time: string }, index: number) => { response.data.histories.forEach((item: { items: { path: string, title: string }[], hCreated: string }, index: number) => {
logsHTML += `<li class="b3-list-item" style="padding-left: 0" data-type="toggle"> logsHTML += `<li class="b3-list-item" style="padding-left: 0" data-type="toggle">
<span style="padding-left: 8px" class="b3-list-item__toggle"><svg class="b3-list-item__arrow${index === 0 ? " b3-list-item__arrow--open" : ""}${item.items.length > 0 ? "" : " fn__hidden"}"><use xlink:href="#iconRight"></use></svg></span> <span style="padding-left: 8px" class="b3-list-item__toggle"><svg class="b3-list-item__arrow${index === 0 ? " b3-list-item__arrow--open" : ""}${item.items.length > 0 ? "" : " fn__hidden"}"><use xlink:href="#iconRight"></use></svg></span>
<span class="b3-list-item__text">${item.time}</span> <span class="b3-list-item__text">${item.hCreated}</span>
</li>`; </li>`;
if (item.items.length > 0) { if (item.items.length > 0) {
logsHTML += `<ul class="${index === 0 ? "" : "fn__none"}">`; logsHTML += `<ul class="${index === 0 ? "" : "fn__none"}">`;

View File

@ -243,8 +243,8 @@ func RollbackNotebookHistory(historyPath string) (err error) {
} }
type History struct { type History struct {
Time string `json:"time"` HCreated string `json:"hCreated"`
Items []*HistoryItem `json:"items"` Items []*HistoryItem `json:"items"`
} }
type HistoryItem struct { type HistoryItem struct {
@ -323,8 +323,8 @@ func GetDocHistory(boxID string) (ret []*History, err error) {
} }
ret = append(ret, &History{ ret = append(ret, &History{
Time: t, HCreated: t,
Items: docs, Items: docs,
}) })
count++ count++
@ -334,7 +334,7 @@ func GetDocHistory(boxID string) (ret []*History, err error) {
} }
sort.Slice(ret, func(i, j int) bool { sort.Slice(ret, func(i, j int) bool {
return ret[i].Time > ret[j].Time return ret[i].HCreated > ret[j].HCreated
}) })
return return
} }
@ -378,7 +378,7 @@ func GetNotebookHistory() (ret []*History, err error) {
} }
ret = append(ret, &History{ ret = append(ret, &History{
Time: t, HCreated: t,
Items: []*HistoryItem{ Items: []*HistoryItem{
{ {
Title: c.Name, Title: c.Name,
@ -394,7 +394,7 @@ func GetNotebookHistory() (ret []*History, err error) {
} }
sort.Slice(ret, func(i, j int) bool { sort.Slice(ret, func(i, j int) bool {
return ret[i].Time > ret[j].Time return ret[i].HCreated > ret[j].HCreated
}) })
return return
} }
@ -453,8 +453,8 @@ func GetAssetsHistory() (ret []*History, err error) {
} }
ret = append(ret, &History{ ret = append(ret, &History{
Time: t, HCreated: t,
Items: assets, Items: assets,
}) })
historyCount++ historyCount++
@ -464,7 +464,7 @@ func GetAssetsHistory() (ret []*History, err error) {
} }
sort.Slice(ret, func(i, j int) bool { sort.Slice(ret, func(i, j int) bool {
return ret[i].Time > ret[j].Time return ret[i].HCreated > ret[j].HCreated
}) })
return return
} }