diff --git a/languages/en.json b/languages/en.json index 08001c1..957b7ab 100644 --- a/languages/en.json +++ b/languages/en.json @@ -2,6 +2,7 @@ "oronder.Auth-Token": "Auth Token", "oronder.Discord-Server-Id": "Discord Server Id", "oronder.Fetch-Discord-User-Ids": "Fetch Discord User Ids", + "oronder.Full-Sync": "Full Sync", "oronder.Fetching-Discord-Ids": "Fetching Discord Ids", "oronder.Oronder-Configuration": "Oronder Configuration", "oronder.Configure-Oronder": "Configure Oronder", diff --git a/src/settings-form-application.mjs b/src/settings-form-application.mjs index f1ff861..4e42948 100644 --- a/src/settings-form-application.mjs +++ b/src/settings-form-application.mjs @@ -12,6 +12,8 @@ export class OronderSettingsFormApplication extends FormApplication { valid_config: game.settings.get(MODULE_ID, VALID_CONFIG), fetch_button_icon: "fa-solid fa-rotate", fetch_button_msg: game.i18n.localize("oronder.Fetch-Discord-User-Ids"), + full_sync_button_icon: "fa-solid fa-users", + full_sync_button_msg: game.i18n.localize("oronder.Full-Sync"), players: game.users.filter(user => user.role < 3).map(user => ({ foundry_name: user.name, foundry_id: user.id, @@ -51,6 +53,9 @@ export class OronderSettingsFormApplication extends FormApplication { switch (event.currentTarget.dataset.action) { case "fetch": return this._fetch_discord_ids(); + case "sync-all": + return this._full_sync() + } } @@ -119,6 +124,14 @@ export class OronderSettingsFormApplication extends FormApplication { this.render() } + async _full_sync() { + this.object.full_sync_button_icon = 'fa-solid fa-spinner fa-spin' + this.render() + await full_sync() + this.object.fetch_button_icon = "fa-solid fa-users" + this.render() + } + async _fetch_discord_ids() { this.object.guild_id = this.form.elements.guild_id.value this.object.auth = this.form.elements.auth.value diff --git a/templates/settings-form-application.hbs b/templates/settings-form-application.hbs index 9a3f37b..7f2fbed 100644 --- a/templates/settings-form-application.hbs +++ b/templates/settings-form-application.hbs @@ -1,58 +1,62 @@
\ No newline at end of file