Format files
This commit is contained in:
parent
02486d671e
commit
438caa96a6
19 changed files with 557 additions and 585 deletions
|
|
@ -61,7 +61,7 @@ export class HistoryView extends ItemView {
|
|||
}
|
||||
|
||||
element.createEl("span", {
|
||||
text: entry.relativePath,
|
||||
text: entry.relativePath
|
||||
});
|
||||
|
||||
const syncSourceIcon = HistoryView.getSyncSourceIcon(entry.source);
|
||||
|
|
@ -107,7 +107,7 @@ export class HistoryView extends ItemView {
|
|||
entries.forEach((entry) => {
|
||||
container.createDiv(
|
||||
{
|
||||
cls: ["history-card", entry.status.toLocaleLowerCase()],
|
||||
cls: ["history-card", entry.status.toLocaleLowerCase()]
|
||||
},
|
||||
(card) => {
|
||||
if (
|
||||
|
|
@ -127,13 +127,13 @@ export class HistoryView extends ItemView {
|
|||
|
||||
card.createDiv(
|
||||
{
|
||||
cls: "history-card-header",
|
||||
cls: "history-card-header"
|
||||
},
|
||||
(header) => {
|
||||
header.createEl(
|
||||
"h5",
|
||||
{
|
||||
cls: "history-card-title",
|
||||
cls: "history-card-title"
|
||||
},
|
||||
(title) => {
|
||||
HistoryView.renderSyncItemTitle(
|
||||
|
|
@ -148,14 +148,14 @@ export class HistoryView extends ItemView {
|
|||
entry.timestamp,
|
||||
new Date()
|
||||
),
|
||||
cls: "history-card-timestamp",
|
||||
cls: "history-card-timestamp"
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
card.createEl("p", {
|
||||
text: `${entry.message}.`,
|
||||
cls: "history-card-message",
|
||||
cls: "history-card-message"
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -61,13 +61,13 @@ export class LogsView extends ItemView {
|
|||
container.createEl(
|
||||
"p",
|
||||
{
|
||||
text: "This view displays logs generated by VaultLink. You can set the log level in the ",
|
||||
text: "This view displays logs generated by VaultLink. You can set the log level in the "
|
||||
},
|
||||
(p) => {
|
||||
p.createEl(
|
||||
"a",
|
||||
{
|
||||
text: "settings",
|
||||
text: "settings"
|
||||
},
|
||||
(button) => {
|
||||
button.addEventListener("click", () => {
|
||||
|
|
@ -95,17 +95,17 @@ export class LogsView extends ItemView {
|
|||
logs.forEach((message) =>
|
||||
element.createDiv(
|
||||
{
|
||||
cls: ["log-message", message.level],
|
||||
cls: ["log-message", message.level]
|
||||
},
|
||||
(messageContainer) => {
|
||||
messageContainer.createEl("span", {
|
||||
text: LogsView.formatTimestamp(
|
||||
message.timestamp
|
||||
),
|
||||
cls: "timestamp",
|
||||
cls: "timestamp"
|
||||
});
|
||||
messageContainer.createEl("span", {
|
||||
text: message.message,
|
||||
text: message.message
|
||||
});
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ import { Notice, PluginSettingTab, Setting } from "obsidian";
|
|||
import type VaultLinkPlugin from "src/vault-link-plugin";
|
||||
import type { Database } from "src/database/database";
|
||||
import type { SyncService } from "src/services/sync-service";
|
||||
import { Logger, LogLevel } from "src/tracing/logger";
|
||||
import type { Syncer } from "src/sync-operations/syncer";
|
||||
import type { StatusDescription } from "./status-description";
|
||||
import { LogsView } from "./logs-view";
|
||||
import { HistoryView } from "./history-view";
|
||||
import { Logger, LogLevel } from "src/tracing/logger";
|
||||
|
||||
export class SyncSettingsTab extends PluginSettingTab {
|
||||
private editedVaultName: string;
|
||||
|
|
@ -26,7 +26,7 @@ export class SyncSettingsTab extends PluginSettingTab {
|
|||
database,
|
||||
syncService,
|
||||
statusDescription,
|
||||
syncer,
|
||||
syncer
|
||||
}: {
|
||||
app: App;
|
||||
plugin: VaultLinkPlugin;
|
||||
|
|
@ -72,12 +72,12 @@ export class SyncSettingsTab extends PluginSettingTab {
|
|||
private renderSettingsHeader(containerEl: HTMLElement): void {
|
||||
containerEl.createEl("h2", { text: "VaultLink" }).createSpan({
|
||||
text: this.plugin.manifest.version,
|
||||
cls: "version",
|
||||
cls: "version"
|
||||
});
|
||||
|
||||
containerEl.createDiv(
|
||||
{
|
||||
cls: "description",
|
||||
cls: "description"
|
||||
},
|
||||
(descriptionContainer) => {
|
||||
this.setStatusDescriptionSubscription((): void => {
|
||||
|
|
@ -90,13 +90,13 @@ export class SyncSettingsTab extends PluginSettingTab {
|
|||
|
||||
containerEl.createDiv(
|
||||
{
|
||||
cls: "button-container",
|
||||
cls: "button-container"
|
||||
},
|
||||
(buttonContainer) => {
|
||||
buttonContainer.createEl(
|
||||
"button",
|
||||
{
|
||||
text: "Show history",
|
||||
text: "Show history"
|
||||
},
|
||||
(button) =>
|
||||
(button.onclick = async (): Promise<void> => {
|
||||
|
|
@ -108,7 +108,7 @@ export class SyncSettingsTab extends PluginSettingTab {
|
|||
buttonContainer.createEl(
|
||||
"button",
|
||||
{
|
||||
text: "Show logs",
|
||||
text: "Show logs"
|
||||
},
|
||||
(button) =>
|
||||
(button.onclick = async (): Promise<void> => {
|
||||
|
|
@ -296,7 +296,7 @@ export class SyncSettingsTab extends PluginSettingTab {
|
|||
[LogLevel.DEBUG]: LogLevel.DEBUG,
|
||||
[LogLevel.INFO]: LogLevel.INFO,
|
||||
[LogLevel.WARNING]: LogLevel.WARNING,
|
||||
[LogLevel.ERROR]: LogLevel.ERROR,
|
||||
[LogLevel.ERROR]: LogLevel.ERROR
|
||||
})
|
||||
.onChange(async (value) =>
|
||||
this.database.setSetting(
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export class StatusBar {
|
|||
private updateStatus(): void {
|
||||
this.statusBarItem.empty();
|
||||
const container = this.statusBarItem.createDiv({
|
||||
cls: ["sync-status"],
|
||||
cls: ["sync-status"]
|
||||
});
|
||||
|
||||
let hasShownMessage = false;
|
||||
|
|
@ -47,14 +47,14 @@ export class StatusBar {
|
|||
if ((this.lastHistoryStats?.success ?? 0) > 0) {
|
||||
hasShownMessage = true;
|
||||
container.createSpan({
|
||||
text: `${this.lastHistoryStats?.success ?? 0} ✅`,
|
||||
text: `${this.lastHistoryStats?.success ?? 0} ✅`
|
||||
});
|
||||
}
|
||||
|
||||
if ((this.lastHistoryStats?.error ?? 0) > 0) {
|
||||
hasShownMessage = true;
|
||||
container.createSpan({
|
||||
text: `${this.lastHistoryStats?.error ?? 0} ❌`,
|
||||
text: `${this.lastHistoryStats?.error ?? 0} ❌`
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ export class StatusBar {
|
|||
} else {
|
||||
const button = container.createEl("button", {
|
||||
text: "VaultLink is disabled, click to configure",
|
||||
cls: "initialize-button",
|
||||
cls: "initialize-button"
|
||||
});
|
||||
button.onclick = (): void => {
|
||||
this.plugin.openSettings();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Database } from "src/database/database";
|
||||
import type {
|
||||
CheckConnectionResult,
|
||||
SyncService,
|
||||
SyncService
|
||||
} from "src/services/sync-service";
|
||||
import type { Syncer } from "src/sync-operations/syncer";
|
||||
import type { HistoryStats, SyncHistory } from "src/tracing/sync-history";
|
||||
|
|
@ -57,7 +57,7 @@ export class StatusDescription {
|
|||
if (this.lastConnectionState == undefined) {
|
||||
container.createSpan({
|
||||
text: "VaultLink is starting up…",
|
||||
cls: "warning",
|
||||
cls: "warning"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ export class StatusDescription {
|
|||
if (!this.lastConnectionState.isSuccessful) {
|
||||
container.createSpan({
|
||||
text: `VaultLink failed to connect to the remote server with the error "${this.lastConnectionState.message}"`,
|
||||
cls: "error",
|
||||
cls: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
@ -73,18 +73,18 @@ export class StatusDescription {
|
|||
container.createSpan({ text: "VaultLink is connected to the server " });
|
||||
container.createEl("a", {
|
||||
text: this.database.getSettings().remoteUri,
|
||||
href: this.database.getSettings().remoteUri,
|
||||
href: this.database.getSettings().remoteUri
|
||||
});
|
||||
|
||||
container.createSpan({
|
||||
text: ` and has indexed approximately `,
|
||||
text: ` and has indexed approximately `
|
||||
});
|
||||
container.createSpan({
|
||||
text: `${this.database.getDocuments().size}`,
|
||||
cls: "number",
|
||||
cls: "number"
|
||||
});
|
||||
container.createSpan({
|
||||
text: ` documents. `,
|
||||
text: ` documents. `
|
||||
});
|
||||
|
||||
if (
|
||||
|
|
@ -94,40 +94,40 @@ export class StatusDescription {
|
|||
) {
|
||||
if (this.database.getSettings().isSyncEnabled) {
|
||||
container.createSpan({
|
||||
text: "Syncing is enabled but VaultLink hasn't found anything to sync yet.",
|
||||
text: "Syncing is enabled but VaultLink hasn't found anything to sync yet."
|
||||
});
|
||||
} else {
|
||||
container.createSpan({
|
||||
text: "However, syncing is disabled right now.",
|
||||
cls: "warning",
|
||||
cls: "warning"
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
container.createSpan({
|
||||
text: "The plugin has ",
|
||||
text: "The plugin has "
|
||||
});
|
||||
container.createSpan({
|
||||
text: `${this.lastRemaining ?? 0}`,
|
||||
cls: "number",
|
||||
cls: "number"
|
||||
});
|
||||
container.createSpan({
|
||||
text: " outstanding operations while having succeeded ",
|
||||
text: " outstanding operations while having succeeded "
|
||||
});
|
||||
container.createSpan({
|
||||
text: `${this.lastHistoryStats?.success ?? 0}`,
|
||||
cls: ["number", "good"],
|
||||
cls: ["number", "good"]
|
||||
});
|
||||
container.createSpan({
|
||||
text: " times and failed ",
|
||||
text: " times and failed "
|
||||
});
|
||||
container.createSpan({
|
||||
text: `${this.lastHistoryStats?.error ?? 0}`,
|
||||
cls: ["number", "bad"],
|
||||
cls: ["number", "bad"]
|
||||
});
|
||||
container.createSpan({
|
||||
text: " times.",
|
||||
text: " times."
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue