From 0571a0843ca5384823a3aca9204eb7659c67435e Mon Sep 17 00:00:00 2001 From: Johann150 Date: Sun, 13 Nov 2022 01:12:05 +0100 Subject: [PATCH] client: improve suspend toggle --- locales/en-US.yml | 2 ++ packages/client/src/pages/instance-info.vue | 31 +++++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 8fa7acf9a..973b9ab72 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -190,7 +190,9 @@ charts: "Charts" perHour: "Per Hour" perDay: "Per Day" stopActivityDelivery: "Stop sending activities" +stopActivityDeliveryDescription: "Local activities will not be sent to this instance. Receiving activities works as before." blockThisInstance: "Block this instance" +blockThisInstanceDescription: "Local activites will not be sent to this instance. Activites from this instance will be discarded." operations: "Operations" software: "Software" version: "Version" diff --git a/packages/client/src/pages/instance-info.vue b/packages/client/src/pages/instance-info.vue index 62c6d1786..55e7627d8 100644 --- a/packages/client/src/pages/instance-info.vue +++ b/packages/client/src/pages/instance-info.vue @@ -26,8 +26,27 @@ - {{ i18n.ts.stopActivityDelivery }} - {{ i18n.ts.blockThisInstance }} + + {{ i18n.ts.stopActivityDelivery }} + + + + {{ i18n.ts.blockThisInstance }} + + Refresh metadata @@ -152,7 +171,7 @@ const usersPagination = { offsetMode: true, }; -async function fetch() { +async function fetch(): Promise { instance = await os.api('federation/show-instance', { host: props.host, }); @@ -160,21 +179,21 @@ async function fetch() { isBlocked = instance.isBlocked; } -async function toggleBlock(ev) { +async function toggleBlock(): Promise { if (meta == null) return; await os.api('admin/update-meta', { blockedHosts: isBlocked ? meta.blockedHosts.concat([instance.host]) : meta.blockedHosts.filter(x => x !== instance.host), }); } -async function toggleSuspend(v) { +async function toggleSuspend(): Promise { await os.api('admin/federation/update-instance', { host: instance.host, isSuspended: suspended, }); } -function refreshMetadata() { +function refreshMetadata(): void { os.api('admin/federation/refresh-remote-instance-metadata', { host: instance.host, });