This commit is contained in:
Vijayasantham 2024-02-12 14:43:43 +05:30 committed by GitHub
parent 8cbcdf5323
commit 17de78240f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 9 deletions

View File

@ -40,14 +40,16 @@
"command_exportsyncplans_json": "export sync plans in json format",
"command_exportlogsindb": "export logs saved in db",
"statusbar_time_years": "{{time}} years",
"statusbar_time_months": "{{time}} months",
"statusbar_time_weeks": "{{time}} weeks",
"statusbar_time_days": "{{time}} days",
"statusbar_time_hours": "{{time}} hours",
"statusbar_time_minutes": "{{time}} minutes",
"statusbar_time_lessminute": "less than a minute",
"statusbar_time_years": "Synced {{time}} years ago",
"statusbar_time_months": "Synced {{time}} months ago",
"statusbar_time_weeks": "Synced {{time}} weeks ago",
"statusbar_time_days": "Synced {{time}} days ago",
"statusbar_time_hours": "Synced {{time}} hours ago",
"statusbar_time_minutes": "Synced {{time}} minutes ago",
"statusbar_time_lessminute": "Synced less than a minute ago",
"statusbar_lastsync": "Synced {{time}} ago",
"statusbar_syncing": "Syncing...",
"statusbar_now": "Synced just now",
"statusbar_lastsync_label": "Last successful Sync on {{date}}",
"statusbar_lastsync_never": "Never Synced",
"statusbar_lastsync_never_label": "Never Synced before",

View File

@ -203,6 +203,10 @@ export default class RemotelySavePlugin extends Plugin {
}
}
// change status to "syncing..." on statusbar
if (this.statusBarElement !== undefined) {
this.updateLastSuccessSyncMsg(-1);
}
//log.info(`huh ${this.settings.password}`)
if (this.settings.currLogLevel === "info") {
getNotice(
@ -332,6 +336,7 @@ export default class RemotelySavePlugin extends Plugin {
getNotice(t("syncrun_step7"));
}
this.syncStatus = "syncing";
await doActualSync(
client,
this.db,
@ -1156,6 +1161,10 @@ export default class RemotelySavePlugin extends Plugin {
let lastSyncMsg = t("statusbar_lastsync_never");
let lastSyncLabelMsg = t("statusbar_lastsync_never_label");
if (lastSuccessSyncMillis !== undefined && lastSuccessSyncMillis === -1) {
lastSyncMsg = t("statusbar_syncing");
}
if (lastSuccessSyncMillis !== undefined && lastSuccessSyncMillis > 0) {
const deltaTime = Date.now() - lastSuccessSyncMillis;
@ -1166,6 +1175,8 @@ export default class RemotelySavePlugin extends Plugin {
const days = Math.floor(deltaTime / 86400000);
const hours = Math.floor(deltaTime / 3600000);
const minutes = Math.floor(deltaTime / 60000);
const seconds = Math.floor(deltaTime / 1000);
let timeText = "";
if (years > 0) {
@ -1180,8 +1191,10 @@ export default class RemotelySavePlugin extends Plugin {
timeText = t("statusbar_time_hours", { time: hours });
} else if (minutes > 0) {
timeText = t("statusbar_time_minutes", { time: minutes });
} else {
} else if (seconds > 30) {
timeText = t("statusbar_time_lessminute");
} else {
timeText = t("statusbar_now");
}
let dateText = new Date(lastSuccessSyncMillis).toLocaleTimeString(
@ -1194,7 +1207,7 @@ export default class RemotelySavePlugin extends Plugin {
}
);
lastSyncMsg = t("statusbar_lastsync", { time: timeText });
lastSyncMsg = timeText;
lastSyncLabelMsg = t("statusbar_lastsync_label", { date: dateText });
}