mirror of
https://github.com/remotely-save/remotely-save.git
synced 2024-06-07 21:10:45 +00:00
support json syncplans only
This commit is contained in:
parent
7422956621
commit
347c051d0c
@ -78,8 +78,7 @@ const turnSyncPlanToTable = (record: string) => {
|
||||
export const exportVaultSyncPlansToFiles = async (
|
||||
db: InternalDBs,
|
||||
vault: Vault,
|
||||
vaultRandomID: string,
|
||||
toFormat: "table" | "json" = "json"
|
||||
vaultRandomID: string
|
||||
) => {
|
||||
log.info("exporting");
|
||||
await mkdirpInVault(DEFAULT_DEBUG_FOLDER, vault);
|
||||
@ -88,16 +87,9 @@ export const exportVaultSyncPlansToFiles = async (
|
||||
if (records.length === 0) {
|
||||
md = "No sync plans history found";
|
||||
} else {
|
||||
if (toFormat === "json") {
|
||||
md =
|
||||
"Sync plans found:\n\n" +
|
||||
records.map((x) => "```json\n" + x + "\n```\n").join("\n");
|
||||
} else if (toFormat === "table") {
|
||||
md =
|
||||
"Sync plans found:\n\n" + records.map(turnSyncPlanToTable).join("\n\n");
|
||||
} else {
|
||||
const _: never = toFormat;
|
||||
}
|
||||
md =
|
||||
"Sync plans found:\n\n" +
|
||||
records.map((x) => "```json\n" + x + "\n```\n").join("\n");
|
||||
}
|
||||
const ts = Date.now();
|
||||
const filePath = `${DEFAULT_DEBUG_FOLDER}${DEFAULT_SYNC_PLANS_HISTORY_FILE_PREFIX}${ts}.md`;
|
||||
|
@ -261,9 +261,8 @@
|
||||
"settings_outputsettingsconsole_button": "Output",
|
||||
"settings_outputsettingsconsole_notice": "Finished outputing in console.",
|
||||
"settings_syncplans": "Export Sync Plans",
|
||||
"settings_syncplans_desc": "Sync plans are created every time after you trigger sync and before the actual sync. Useful to know what would actually happen in those sync. Click the button to export sync plans. You can choose to export to json or table format inside Markdown, which are equivalent.",
|
||||
"settings_syncplans_button_json": "Export (json)",
|
||||
"settings_syncplans_button_table": "Export (table)",
|
||||
"settings_syncplans_desc": "Sync plans are created every time after you trigger sync and before the actual sync. Useful to know what would actually happen in those sync. Click the button to export sync plans.",
|
||||
"settings_syncplans_button_json": "Export",
|
||||
"settings_syncplans_notice": "Sync plans history exported.",
|
||||
"settings_delsyncplans": "Delete Sync Plans History In DB",
|
||||
"settings_delsyncplans_desc": "Delete sync plans history in DB.",
|
||||
|
@ -38,7 +38,6 @@
|
||||
"command_startsync": "开始同步(start sync)",
|
||||
"command_drynrun": "开始同步(空跑模式)(start sync (dry run only))",
|
||||
"command_exportsyncplans_json": "导出同步计划为 json 格式(export sync plans in json format)",
|
||||
"command_exportsyncplans_table": "导出同步计划为表格格式(export sync plans in table format)",
|
||||
"command_exportlogsindb": "从数据库导出终端日志(export logs saved in db)",
|
||||
|
||||
"statusbar_time_years": "{{time}} 年前",
|
||||
@ -261,9 +260,8 @@
|
||||
"settings_outputsettingsconsole_button": "输出",
|
||||
"settings_outputsettingsconsole_notice": "已输出到终端",
|
||||
"settings_syncplans": "导出同步计划",
|
||||
"settings_syncplans_desc": "每次您启动同步,并在实际上传下载前,插件会生成同步计划。它可以使您知道每次同步发生了什么。点击按钮可以导出同步计划。并且,您可以选择导出为内嵌在 Markdown 里的 json 格式或表格格式,它们是等价的。",
|
||||
"settings_syncplans_button_json": "导出(json)",
|
||||
"settings_syncplans_button_table": "导出(表格)",
|
||||
"settings_syncplans_desc": "每次您启动同步,并在实际上传下载前,插件会生成同步计划。它可以使您知道每次同步发生了什么。点击按钮可以导出同步计划。",
|
||||
"settings_syncplans_button_json": "导出",
|
||||
"settings_syncplans_notice": "同步计划已导出",
|
||||
"settings_delsyncplans": "删除数据库里的同步计划历史",
|
||||
"settings_delsyncplans_desc": "删除数据库里的同步计划历史。",
|
||||
|
@ -38,7 +38,6 @@
|
||||
"command_startsync": "開始同步(start sync)",
|
||||
"command_drynrun": "開始同步(空跑模式)(start sync (dry run only))",
|
||||
"command_exportsyncplans_json": "匯出同步計劃為 json 格式(export sync plans in json format)",
|
||||
"command_exportsyncplans_table": "匯出同步計劃為表格格式(export sync plans in table format)",
|
||||
"command_exportlogsindb": "從資料庫匯出終端日誌(export logs saved in db)",
|
||||
|
||||
"statusbar_time_years": "{{time}} 年前",
|
||||
@ -261,9 +260,8 @@
|
||||
"settings_outputsettingsconsole_button": "輸出",
|
||||
"settings_outputsettingsconsole_notice": "已輸出到終端",
|
||||
"settings_syncplans": "匯出同步計劃",
|
||||
"settings_syncplans_desc": "每次您啟動同步,並在實際上傳下載前,外掛會生成同步計劃。它可以使您知道每次同步發生了什麼。點選按鈕可以匯出同步計劃。並且,您可以選擇匯出為內嵌在 Markdown 裡的 json 格式或表格格式,它們是等價的。",
|
||||
"settings_syncplans_button_json": "匯出(json)",
|
||||
"settings_syncplans_button_table": "匯出(表格)",
|
||||
"settings_syncplans_desc": "每次您啟動同步,並在實際上傳下載前,外掛會生成同步計劃。它可以使您知道每次同步發生了什麼。點選按鈕可以匯出同步計劃。",
|
||||
"settings_syncplans_button_json": "匯出",
|
||||
"settings_syncplans_notice": "同步計劃已匯出",
|
||||
"settings_delsyncplans": "刪除資料庫裡的同步計劃歷史",
|
||||
"settings_delsyncplans_desc": "刪除資料庫裡的同步計劃歷史。",
|
||||
|
@ -789,8 +789,7 @@ export default class RemotelySavePlugin extends Plugin {
|
||||
await exportVaultSyncPlansToFiles(
|
||||
this.db,
|
||||
this.app.vault,
|
||||
this.vaultRandomID,
|
||||
"json"
|
||||
this.vaultRandomID
|
||||
);
|
||||
new Notice(t("settings_syncplans_notice"));
|
||||
},
|
||||
|
@ -2052,24 +2052,12 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
|
||||
await exportVaultSyncPlansToFiles(
|
||||
this.plugin.db,
|
||||
this.app.vault,
|
||||
this.plugin.vaultRandomID,
|
||||
"json"
|
||||
);
|
||||
new Notice(t("settings_syncplans_notice"));
|
||||
});
|
||||
})
|
||||
.addButton(async (button) => {
|
||||
button.setButtonText(t("settings_syncplans_button_table"));
|
||||
button.onClick(async () => {
|
||||
await exportVaultSyncPlansToFiles(
|
||||
this.plugin.db,
|
||||
this.app.vault,
|
||||
this.plugin.vaultRandomID,
|
||||
"table"
|
||||
this.plugin.vaultRandomID
|
||||
);
|
||||
new Notice(t("settings_syncplans_notice"));
|
||||
});
|
||||
});
|
||||
|
||||
new Setting(debugDiv)
|
||||
.setName(t("settings_delsyncplans"))
|
||||
.setDesc(t("settings_delsyncplans_desc"))
|
||||
|
Loading…
Reference in New Issue
Block a user