From 2511114c287d95010e15a08deb7ff20561b0c3b0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 10 Feb 2020 23:17:42 +0900 Subject: なんかもうめっちゃ変えた MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolve #5846 --- src/client/pages/instance/federation.instance.vue | 34 +++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/client/pages/instance/federation.instance.vue') diff --git a/src/client/pages/instance/federation.instance.vue b/src/client/pages/instance/federation.instance.vue index a27556064a..b86f52809e 100644 --- a/src/client/pages/instance/federation.instance.vue +++ b/src/client/pages/instance/federation.instance.vue @@ -98,7 +98,7 @@
{{ $t('operations') }} {{ $t('stopActivityDelivery') }} - {{ $t('blockThisInstance') }} + {{ $t('blockThisInstance') }}
{{ $t('metadata') }} @@ -147,9 +147,7 @@ export default Vue.extend({ data() { return { - meta: null, - isSuspended: false, - isBlocked: false, + isSuspended: this.instance.isSuspended, now: null, chart: null, chartInstance: null, @@ -184,6 +182,14 @@ export default Vue.extend({ null; return stats; + }, + + meta() { + return this.$store.state.instance.meta; + }, + + isBlocked() { + return this.meta && this.meta.blockedHosts.includes(this.instance.host); } }, @@ -195,12 +201,6 @@ export default Vue.extend({ }); }, - isBlocked() { - this.$root.api('admin/update-meta', { - blockedHosts: this.isBlocked ? this.meta.blockedHosts.concat([this.instance.host]) : this.meta.blockedHosts.filter(x => x !== this.instance.host) - }); - }, - chartSrc() { this.renderChart(); }, @@ -210,13 +210,7 @@ export default Vue.extend({ } }, - async created() { - this.$root.getMeta().then(meta => { - this.meta = meta; - this.isSuspended = this.instance.isSuspended; - this.isBlocked = this.meta.blockedHosts.includes(this.instance.host); - }); - + async created() { this.now = new Date(); const [perHour, perDay] = await Promise.all([ @@ -235,6 +229,12 @@ export default Vue.extend({ }, methods: { + changeBlock(e) { + this.$root.api('admin/update-meta', { + blockedHosts: this.isBlocked ? this.meta.blockedHosts.concat([this.instance.host]) : this.meta.blockedHosts.filter(x => x !== this.instance.host) + }); + }, + setSrc(src) { this.chartSrc = src; }, -- cgit v1.2.3-freya