mirror of
https://github.com/silvanocerza/github-gitless-sync.git
synced 2026-07-22 05:41:36 +00:00
Make some settings name clearer
This commit is contained in:
parent
81b7f2b235
commit
88d2baa901
3 changed files with 22 additions and 22 deletions
|
|
@ -101,7 +101,7 @@ export default class GitHubSyncPlugin extends Plugin {
|
|||
this.syncIntervalId = window.setInterval(
|
||||
() => this.uploadModifiedFiles(),
|
||||
// Sync interval is set in minutes but setInterval expects milliseconds
|
||||
this.settings.syncInterval * 60 * 1000,
|
||||
this.settings.uploadInterval * 60 * 1000,
|
||||
);
|
||||
this.registerInterval(this.syncIntervalId);
|
||||
}
|
||||
|
|
@ -176,7 +176,7 @@ export default class GitHubSyncPlugin extends Plugin {
|
|||
this.settings.githubRepo,
|
||||
this.settings.githubBranch,
|
||||
);
|
||||
if (this.settings.syncStrategy == "interval") {
|
||||
if (this.settings.uploadStrategy == "interval") {
|
||||
this.restartSyncInterval();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ export interface GitHubSyncSettings {
|
|||
githubBranch: string;
|
||||
repoContentDir: string;
|
||||
localContentDir: string;
|
||||
syncStrategy: "manual" | "interval";
|
||||
syncInterval: number;
|
||||
uploadStrategy: "manual" | "interval";
|
||||
uploadInterval: number;
|
||||
syncOnStartup: boolean;
|
||||
conflictHandling: "ignore" | "ask" | "overwrite";
|
||||
showStatusBarItem: boolean;
|
||||
|
|
@ -22,8 +22,8 @@ export const DEFAULT_SETTINGS: GitHubSyncSettings = {
|
|||
githubBranch: "main",
|
||||
repoContentDir: "",
|
||||
localContentDir: "",
|
||||
syncStrategy: "manual",
|
||||
syncInterval: 1,
|
||||
uploadStrategy: "manual",
|
||||
uploadInterval: 1,
|
||||
syncOnStartup: false,
|
||||
conflictHandling: "ask",
|
||||
showStatusBarItem: true,
|
||||
|
|
|
|||
|
|
@ -121,43 +121,43 @@ export default class GitHubSyncSettingsTab extends PluginSettingTab {
|
|||
}),
|
||||
);
|
||||
|
||||
const saveStrategies = {
|
||||
const uploadStrategies = {
|
||||
manual: "Manually",
|
||||
interval: "On Interval",
|
||||
};
|
||||
const saveStrategySetting = new Setting(containerEl)
|
||||
.setName("Sync strategy")
|
||||
.setDesc("When to sync the local files with the remote repository");
|
||||
const uploadStrategySetting = new Setting(containerEl)
|
||||
.setName("Upload strategy")
|
||||
.setDesc("When to upload local files to remote repository");
|
||||
|
||||
let syncInterval = "1";
|
||||
if (this.plugin.settings.syncInterval) {
|
||||
syncInterval = this.plugin.settings.syncInterval.toString();
|
||||
if (this.plugin.settings.uploadInterval) {
|
||||
syncInterval = this.plugin.settings.uploadInterval.toString();
|
||||
}
|
||||
const intervalSettings = new Setting(containerEl)
|
||||
.setName("Sync interval")
|
||||
.setDesc("Sync interval in minutes between automatic synchronizations")
|
||||
.setName("Upload interval")
|
||||
.setDesc("Upload interval in minutes between automatic uploads")
|
||||
.addText((text) =>
|
||||
text
|
||||
.setPlaceholder("Interval in minutes")
|
||||
.setValue(syncInterval)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.syncInterval = parseInt(value) || 1;
|
||||
this.plugin.settings.uploadInterval = parseInt(value) || 1;
|
||||
await this.plugin.saveSettings();
|
||||
// We need to restart the interval if the value is changed
|
||||
this.plugin.restartSyncInterval();
|
||||
}),
|
||||
);
|
||||
intervalSettings.setDisabled(
|
||||
this.plugin.settings.syncStrategy !== "interval",
|
||||
this.plugin.settings.uploadStrategy !== "interval",
|
||||
);
|
||||
|
||||
saveStrategySetting.addDropdown((dropdown) =>
|
||||
uploadStrategySetting.addDropdown((dropdown) =>
|
||||
dropdown
|
||||
.addOptions(saveStrategies)
|
||||
.setValue(this.plugin.settings.syncStrategy)
|
||||
.onChange(async (value: keyof typeof saveStrategies) => {
|
||||
.addOptions(uploadStrategies)
|
||||
.setValue(this.plugin.settings.uploadStrategy)
|
||||
.onChange(async (value: keyof typeof uploadStrategies) => {
|
||||
intervalSettings.setDisabled(value !== "interval");
|
||||
this.plugin.settings.syncStrategy = value;
|
||||
this.plugin.settings.uploadStrategy = value;
|
||||
await this.plugin.saveSettings();
|
||||
if (value === "interval") {
|
||||
this.plugin.startSyncInterval();
|
||||
|
|
@ -252,7 +252,7 @@ export default class GitHubSyncSettingsTab extends PluginSettingTab {
|
|||
});
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("Show upload modified files button")
|
||||
.setName("Show upload all files button")
|
||||
.setDesc("Displays a ribbon button to upload all files")
|
||||
.addToggle((toggle) => {
|
||||
toggle
|
||||
|
|
|
|||
Loading…
Reference in a new issue