summaryrefslogtreecommitdiff
path: root/src/client/app/desktop
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2018-08-14 04:42:16 +0900
committerGitHub <noreply@github.com>2018-08-14 04:42:16 +0900
commitd35f62d0e47f857804303f7b63fac17425ab219f (patch)
tree09cd8f78ed6fca1addfba30699402197cd8a21af /src/client/app/desktop
parentfix(package): update mongodb to version 3.1.2 (diff)
parentwip (diff)
downloadmisskey-d35f62d0e47f857804303f7b63fac17425ab219f.tar.gz
misskey-d35f62d0e47f857804303f7b63fac17425ab219f.tar.bz2
misskey-d35f62d0e47f857804303f7b63fac17425ab219f.zip
Merge pull request #2195 from syuilo/instance-management-system
管理画面
Diffstat (limited to 'src/client/app/desktop')
-rw-r--r--src/client/app/desktop/script.ts2
-rw-r--r--src/client/app/desktop/views/pages/admin/admin.dashboard.vue35
-rw-r--r--src/client/app/desktop/views/pages/admin/admin.suspend-user.vue39
-rw-r--r--src/client/app/desktop/views/pages/admin/admin.vue90
4 files changed, 166 insertions, 0 deletions
diff --git a/src/client/app/desktop/script.ts b/src/client/app/desktop/script.ts
index 8175ce9b66..8dc0482191 100644
--- a/src/client/app/desktop/script.ts
+++ b/src/client/app/desktop/script.ts
@@ -24,6 +24,7 @@ import updateBanner from './api/update-banner';
import MkIndex from './views/pages/index.vue';
import MkDeck from './views/pages/deck/deck.vue';
+import MkAdmin from './views/pages/admin/admin.vue';
import MkUser from './views/pages/user/user.vue';
import MkFavorites from './views/pages/favorites.vue';
import MkSelectDrive from './views/pages/selectdrive.vue';
@@ -55,6 +56,7 @@ init(async (launch) => {
routes: [
{ path: '/', name: 'index', component: MkIndex },
{ path: '/deck', name: 'deck', component: MkDeck },
+ { path: '/admin', name: 'admin', component: MkAdmin },
{ path: '/i/customize-home', component: MkHomeCustomize },
{ path: '/i/favorites', component: MkFavorites },
{ path: '/i/messaging/:user', component: MkMessagingRoom },
diff --git a/src/client/app/desktop/views/pages/admin/admin.dashboard.vue b/src/client/app/desktop/views/pages/admin/admin.dashboard.vue
new file mode 100644
index 0000000000..4e6ada6cdb
--- /dev/null
+++ b/src/client/app/desktop/views/pages/admin/admin.dashboard.vue
@@ -0,0 +1,35 @@
+<template>
+<div>
+ <h1>%i18n:@dashboard%</h1>
+ <p><b>%i18n:@all-users%</b>: <span>{{ stats.usersCount | number }}</span></p>
+ <p><b>%i18n:@original-users%</b>: <span>{{ stats.originalUsersCount | number }}</span></p>
+ <p><b>%i18n:@all-notes%</b>: <span>{{ stats.notesCount | number }}</span></p>
+ <p><b>%i18n:@original-notes%</b>: <span>{{ stats.originalNotesCount | number }}</span></p>
+</div>
+</template>
+
+<script lang="ts">
+import Vue from "vue";
+
+export default Vue.extend({
+ data() {
+ return {
+ stats: null
+ };
+ },
+ created() {
+ (this as any).api('stats').then(stats => {
+ this.stats = stats;
+ });
+ }
+});
+</script>
+
+<style lang="stylus" scoped>
+h1
+ margin 0 0 1em 0
+ padding 0 0 8px 0
+ font-size 1em
+ color #555
+ border-bottom solid 1px #eee
+</style>
diff --git a/src/client/app/desktop/views/pages/admin/admin.suspend-user.vue b/src/client/app/desktop/views/pages/admin/admin.suspend-user.vue
new file mode 100644
index 0000000000..01d0301eb1
--- /dev/null
+++ b/src/client/app/desktop/views/pages/admin/admin.suspend-user.vue
@@ -0,0 +1,39 @@
+<template>
+<div>
+ <header>%i18n:@suspend-user%</header>
+ <input v-model="username"/>
+ <button @click="suspendUser" :disabled="suspending">%i18n:@suspend%</button>
+</div>
+</template>
+
+<script lang="ts">
+import Vue from "vue";
+import parseAcct from "../../../../../../misc/acct/parse";
+
+export default Vue.extend({
+ data() {
+ return {
+ username: null,
+ suspending: false
+ };
+ },
+ methods: {
+ async suspendUser() {
+ this.suspending = true;
+
+ const user = await (this as any).os.api(
+ "users/show",
+ parseAcct(this.username)
+ );
+
+ await (this as any).os.api("admin/suspend-user", {
+ userId: user.id
+ });
+
+ this.suspending = false;
+
+ (this as any).os.apis.dialog({ text: "%i18n:@suspended%" });
+ }
+ }
+});
+</script>
diff --git a/src/client/app/desktop/views/pages/admin/admin.vue b/src/client/app/desktop/views/pages/admin/admin.vue
new file mode 100644
index 0000000000..a2b8d47ff6
--- /dev/null
+++ b/src/client/app/desktop/views/pages/admin/admin.vue
@@ -0,0 +1,90 @@
+<template>
+<div class="mk-admin">
+ <nav>
+ <ul>
+ <li @click="nav('dashboard')" :class="{ active: page == 'dashboard' }">%fa:chalkboard .fw%%i18n:@dashboard%</li>
+ <!-- <li @click="nav('users')" :class="{ active: page == 'users' }">%fa:users .fw%%i18n:@users%</li> -->
+ <!-- <li @click="nav('drive')" :class="{ active: page == 'drive' }">%fa:cloud .fw%%i18n:@drive%</li> -->
+ <!-- <li @click="nav('update')" :class="{ active: page == 'update' }">%i18n:@update%</li> -->
+ </ul>
+ </nav>
+ <main>
+ <div v-if="page == 'dashboard'">
+ <x-dashboard/>
+ </div>
+ <div v-if="page == 'users'">
+ <x-suspend-user/>
+ </div>
+ <div v-if="page == 'drive'"></div>
+ <div v-if="page == 'update'"></div>
+ </main>
+</div>
+</template>
+
+<script lang="ts">
+import Vue from "vue";
+import XDashboard from "./admin.dashboard.vue";
+import XSuspendUser from "./admin.suspend-user.vue";
+
+export default Vue.extend({
+ components: {
+ XDashboard,
+ XSuspendUser
+ },
+ data() {
+ return {
+ page: 'dashboard'
+ };
+ },
+ methods: {
+ nav(page: string) {
+ this.page = page;
+ }
+ }
+});
+</script>
+
+<style lang="stylus" scoped>
+@import '~const.styl'
+
+.mk-admin
+ display flex
+ height 100%
+ margin 32px
+
+ > nav
+ flex 0 0 250px
+ width 100%
+ height 100%
+ padding 16px 0 0 0
+ overflow auto
+ border-right solid 1px #ddd
+
+ > ul
+ list-style none
+
+ > li
+ display block
+ padding 10px 16px
+ margin 0
+ color #666
+ cursor pointer
+ user-select none
+ transition margin-left 0.2s ease
+
+ > [data-fa]
+ margin-right 4px
+
+
+ &:hover
+ color #555
+
+ &.active
+ margin-left 8px
+ color $theme-color !important
+
+ > main
+ width 100%
+ padding 16px 32px
+
+</style>