diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-10 23:17:42 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-10 23:17:42 +0900 |
| commit | 2511114c287d95010e15a08deb7ff20561b0c3b0 (patch) | |
| tree | c65806f5bde9a57cd6ff73b2c7805d21fbf2c898 /src/client/pages/instance/federation.instance.vue | |
| parent | :art: (diff) | |
| download | misskey-2511114c287d95010e15a08deb7ff20561b0c3b0.tar.gz misskey-2511114c287d95010e15a08deb7ff20561b0c3b0.tar.bz2 misskey-2511114c287d95010e15a08deb7ff20561b0c3b0.zip | |
なんかもうめっちゃ変えた
Resolve #5846
Diffstat (limited to 'src/client/pages/instance/federation.instance.vue')
| -rw-r--r-- | src/client/pages/instance/federation.instance.vue | 34 |
1 files changed, 17 insertions, 17 deletions
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 @@ <div class="operations"> <span class="label">{{ $t('operations') }}</span> <mk-switch v-model="isSuspended" class="switch">{{ $t('stopActivityDelivery') }}</mk-switch> - <mk-switch v-model="isBlocked" class="switch">{{ $t('blockThisInstance') }}</mk-switch> + <mk-switch :value="isBlocked" class="switch" @change="changeBlock">{{ $t('blockThisInstance') }}</mk-switch> </div> <details class="metadata"> <summary class="label">{{ $t('metadata') }}</summary> @@ -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; }, |