diff --git a/app/src/util/history.ts b/app/src/util/history.ts
index e2813d63c..303f211af 100644
--- a/app/src/util/history.ts
+++ b/app/src/util/history.ts
@@ -104,49 +104,71 @@ const renderAssets = (element: HTMLElement) => {
});
};
-const renderRepo = (element: Element, currentPage: number) => {
- element.setAttribute("data-init", "true");
- element.setAttribute("data-page", currentPage.toString());
- const previousElement = element.querySelector('[data-type="previous"]');
- const nextElement = element.querySelector('[data-type="next"]');
- if (currentPage > 1) {
- previousElement.removeAttribute("disabled");
- } else {
- previousElement.setAttribute("disabled", "disabled");
+const renderRepoItem = (response: IWebSocketData, element: Element, type: string) => {
+ if (response.data.snapshots.length === 0) {
+ element.lastElementChild.innerHTML = `
${window.siyuan.languages.emptyContent}`;
+ return;
}
- fetchPost("/api/repo/getRepoSnapshots", {page: currentPage}, (response) => {
- if (currentPage < response.data.pageCount) {
- nextElement.removeAttribute("disabled");
- } else {
- nextElement.setAttribute("disabled", "disabled");
- }
- if (response.data.snapshots.length === 0) {
- element.lastElementChild.innerHTML = `${window.siyuan.languages.emptyContent}`;
- return;
- }
- let repoHTML = "";
- response.data.snapshots.forEach((item: { memo: string, id: string, hCreated: string, count: number, hSize: string }) => {
- repoHTML += `
+ let actionHTML = ``
+ if (type === "download") {
+ actionHTML = ``
+ }
+ let repoHTML = "";
+ response.data.snapshots.forEach((item: { memo: string, id: string, hCreated: string, count: number, hSize: string, tag: string }) => {
+ repoHTML += `
- ${item.hCreated}${escapeHtml(item.memo)}${item.hSize}
+ ${item.hCreated}
+ ${escapeHtml(item.memo)}
+ ${item.hSize}
+ ${window.siyuan.languages.fileCount}${item.count}
-
-
-
-
-
-
+ ${actionHTML}
- ${item.count}
`;
- });
- element.lastElementChild.innerHTML = `${repoHTML}`;
});
+ element.lastElementChild.innerHTML = `${repoHTML}`;
+}
+
+const renderRepo = (element: Element, currentPage: number) => {
+ const previousElement = element.querySelector('[data-type="previous"]');
+ const nextElement = element.querySelector('[data-type="next"]');
+ if (currentPage < 0) {
+ if (currentPage === -1) {
+ fetchPost("/api/repo/getRepoTagSnapshots", {}, (response) => {
+ renderRepoItem(response, element, "upload");
+ })
+ }
+ if (currentPage === -2) {
+ fetchPost("/api/repo/getCloudRepoTagSnapshots", {}, (response) => {
+ renderRepoItem(response, element, "download");
+ })
+ }
+ previousElement.classList.add("fn__none")
+ nextElement.classList.add("fn__none")
+ } else {
+ previousElement.classList.remove("fn__none")
+ nextElement.classList.remove("fn__none")
+ element.setAttribute("data-init", "true");
+ element.setAttribute("data-page", currentPage.toString());
+ if (currentPage > 1) {
+ previousElement.removeAttribute("disabled");
+ } else {
+ previousElement.setAttribute("disabled", "disabled");
+ }
+ fetchPost("/api/repo/getRepoSnapshots", {page: currentPage}, (response) => {
+ if (currentPage < response.data.pageCount) {
+ nextElement.removeAttribute("disabled");
+ } else {
+ nextElement.setAttribute("disabled", "disabled");
+ }
+ renderRepoItem(response, element, "upload");
+ });
+ }
};
const renderRmNotebook = (element: HTMLElement) => {
@@ -222,10 +244,9 @@ export const openHistory = () => {