mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-24 07:54:07 +01:00
🎨 Automatic purge for local data repo https://github.com/siyuan-note/siyuan/issues/13091
This commit is contained in:
parent
93b687a407
commit
6a442ad85d
23 changed files with 259 additions and 15 deletions
|
|
@ -142,16 +142,31 @@ export const about = {
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fn__flex b3-label config__item">
|
||||
<div class="fn__flex-1">
|
||||
<div class="b3-label fn__flex"><div class="fn__block">
|
||||
<div>
|
||||
${window.siyuan.languages.dataRepoPurge}
|
||||
<div class="b3-label__text">${window.siyuan.languages.dataRepoPurgeTip}</div>
|
||||
</div>
|
||||
<div class="fn__space"></div>
|
||||
<button id="purgeRepo" class="b3-button b3-button--outline fn__size200 fn__flex-center">
|
||||
<svg><use xlink:href="#iconTrashcan"></use></svg>${window.siyuan.languages.purge}
|
||||
</button>
|
||||
</div>
|
||||
<div class="fn__hr"></div>
|
||||
<div class="fn__flex config__item">
|
||||
<div class="fn__flex-center fn__flex-1 ft__on-surface">${window.siyuan.languages.dataRepoPurgeTip}</div>
|
||||
<span class="fn__space"></span>
|
||||
<button id="purgeRepo" class="b3-button b3-button--outline fn__size200 fn__flex-center">
|
||||
<svg><use xlink:href="#iconTrashcan"></use></svg>${window.siyuan.languages.purge}
|
||||
</button>
|
||||
</div>
|
||||
<div class="fn__hr"></div>
|
||||
<div class="fn__flex config__item">
|
||||
<div class="fn__flex-center fn__flex-1 ft__on-surface">${window.siyuan.languages.dataRepoAutoPurgeIndexRetentionDays}</div>
|
||||
<span class="fn__space"></span>
|
||||
<input class="b3-text-field fn__flex-center fn__size200" min="1" type="number" id="indexRetentionDays" value="${window.siyuan.config.repo.indexRetentionDays}">
|
||||
</div>
|
||||
<div class="fn__hr"></div>
|
||||
<div class="fn__flex config__item">
|
||||
<div class="fn__flex-center fn__flex-1 ft__on-surface">${window.siyuan.languages.dataRepoAutoPurgeRetentionIndexesDaily}</div>
|
||||
<span class="fn__space"></span>
|
||||
<input class="b3-text-field fn__flex-center fn__size200" min="1" type="number" id="retentionIndexesDaily" value="${window.siyuan.config.repo.retentionIndexesDaily}">
|
||||
</div>
|
||||
</div></div>
|
||||
<div class="fn__flex b3-label config__item">
|
||||
<div class="fn__flex-1">
|
||||
${window.siyuan.languages.systemLog}
|
||||
|
|
@ -208,6 +223,18 @@ ${checkUpdateHTML}
|
|||
if (window.siyuan.config.system.isInsider) {
|
||||
about.element.querySelector("#isInsider").innerHTML = "<span class='ft__secondary'>Insider Preview</span>";
|
||||
}
|
||||
const indexRetentionDaysElement = about.element.querySelector("#indexRetentionDays") as HTMLInputElement;
|
||||
indexRetentionDaysElement.addEventListener("change", () => {
|
||||
fetchPost("/api/repo/setRepoIndexRetentionDays", {days: parseInt(indexRetentionDaysElement.value)}, () => {
|
||||
window.siyuan.config.repo.indexRetentionDays = parseInt(indexRetentionDaysElement.value);
|
||||
});
|
||||
});
|
||||
const retentionIndexesDailyElement = about.element.querySelector("#retentionIndexesDaily") as HTMLInputElement;
|
||||
retentionIndexesDailyElement.addEventListener("change", () => {
|
||||
fetchPost("/api/repo/setRetentionIndexesDaily", {indexes: parseInt(retentionIndexesDailyElement.value)}, () => {
|
||||
window.siyuan.config.repo.retentionIndexesDaily = parseInt(retentionIndexesDailyElement.value);
|
||||
});
|
||||
});
|
||||
const tokenElement = about.element.querySelector("#token") as HTMLInputElement;
|
||||
tokenElement.addEventListener("click", () => {
|
||||
tokenElement.select();
|
||||
|
|
|
|||
|
|
@ -83,6 +83,12 @@ export const initAbout = () => {
|
|||
<svg><use xlink:href="#iconTrashcan"></use></svg>${window.siyuan.languages.purge}
|
||||
</button>
|
||||
<div class="b3-label__text">${window.siyuan.languages.dataRepoPurgeTip}</div>
|
||||
<div class="fn__hr"></div>
|
||||
<input class="b3-text-field fn__block" style="padding-right: 64px;" id="indexRetentionDays" min="1" type="number" class="b3-text-field" value="${window.siyuan.config.repo.indexRetentionDays}">
|
||||
<div class="b3-label__text">${window.siyuan.languages.dataRepoAutoPurgeIndexRetentionDays}</div>
|
||||
<div class="fn__hr"></div>
|
||||
<input class="b3-text-field fn__block" style="padding-right: 64px;" id="retentionIndexesDaily" min="1" type="number" class="b3-text-field" value="${window.siyuan.config.repo.retentionIndexesDaily}">
|
||||
<div class="b3-label__text">${window.siyuan.languages.dataRepoAutoPurgeRetentionIndexesDaily}</div>
|
||||
</div>
|
||||
<div class="b3-label">
|
||||
${window.siyuan.languages.systemLog}
|
||||
|
|
@ -410,6 +416,18 @@ export const initAbout = () => {
|
|||
modelMainElement.querySelector("#tokenTip").innerHTML = window.siyuan.languages.about14.replace("${token}", window.siyuan.config.api.token);
|
||||
});
|
||||
});
|
||||
const indexRetentionDaysElement = modelMainElement.querySelector("#indexRetentionDays") as HTMLInputElement;
|
||||
indexRetentionDaysElement.addEventListener("change", () => {
|
||||
fetchPost("/api/repo/setRepoIndexRetentionDays", {days: parseInt(indexRetentionDaysElement.value)}, () => {
|
||||
window.siyuan.config.repo.indexRetentionDays = parseInt(indexRetentionDaysElement.value);
|
||||
});
|
||||
});
|
||||
const retentionIndexesDailyElement = modelMainElement.querySelector("#retentionIndexesDaily") as HTMLInputElement;
|
||||
retentionIndexesDailyElement.addEventListener("change", () => {
|
||||
fetchPost("/api/repo/setRetentionIndexesDaily", {indexes: parseInt(retentionIndexesDailyElement.value)}, () => {
|
||||
window.siyuan.config.repo.retentionIndexesDaily = parseInt(retentionIndexesDailyElement.value);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
10
app/src/types/config.d.ts
vendored
10
app/src/types/config.d.ts
vendored
|
|
@ -1110,10 +1110,18 @@ declare namespace Config {
|
|||
*/
|
||||
key: string;
|
||||
/**
|
||||
* Synchronous index timing, if it exceeds this time, the user is prompted that the index
|
||||
* Sync index timing, if it exceeds this time, the user is prompted that the index
|
||||
* performance is degraded (unit: milliseconds)
|
||||
*/
|
||||
syncIndexTiming: number;
|
||||
/**
|
||||
* Automatic purge for local data repo index retention days
|
||||
*/
|
||||
indexRetentionDays: number;
|
||||
/**
|
||||
* Automatic purge for local data repo indexes retention daily
|
||||
*/
|
||||
retentionIndexesDaily: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue