From c78945436e39121f46e083eac7a6572ca2efe2d2 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 9 Jun 2018 04:14:26 +0900 Subject: #1686 --- .../app/common/scripts/streaming/notes-stats.ts | 30 ++++ .../app/common/scripts/streaming/server-stats.ts | 30 ++++ src/client/app/common/scripts/streaming/server.ts | 30 ---- src/client/app/common/views/widgets/index.ts | 2 + .../app/common/views/widgets/posts-monitor.vue | 182 +++++++++++++++++++++ src/client/app/common/views/widgets/server.vue | 6 +- 6 files changed, 247 insertions(+), 33 deletions(-) create mode 100644 src/client/app/common/scripts/streaming/notes-stats.ts create mode 100644 src/client/app/common/scripts/streaming/server-stats.ts delete mode 100644 src/client/app/common/scripts/streaming/server.ts create mode 100644 src/client/app/common/views/widgets/posts-monitor.vue (limited to 'src/client/app/common') diff --git a/src/client/app/common/scripts/streaming/notes-stats.ts b/src/client/app/common/scripts/streaming/notes-stats.ts new file mode 100644 index 0000000000..9e3e78a709 --- /dev/null +++ b/src/client/app/common/scripts/streaming/notes-stats.ts @@ -0,0 +1,30 @@ +import Stream from './stream'; +import StreamManager from './stream-manager'; +import MiOS from '../../../mios'; + +/** + * Notes stats stream connection + */ +export class NotesStatsStream extends Stream { + constructor(os: MiOS) { + super(os, 'notes-stats'); + } +} + +export class NotesStatsStreamManager extends StreamManager { + private os: MiOS; + + constructor(os: MiOS) { + super(); + + this.os = os; + } + + public getConnection() { + if (this.connection == null) { + this.connection = new NotesStatsStream(this.os); + } + + return this.connection; + } +} diff --git a/src/client/app/common/scripts/streaming/server-stats.ts b/src/client/app/common/scripts/streaming/server-stats.ts new file mode 100644 index 0000000000..9983dfcaf0 --- /dev/null +++ b/src/client/app/common/scripts/streaming/server-stats.ts @@ -0,0 +1,30 @@ +import Stream from './stream'; +import StreamManager from './stream-manager'; +import MiOS from '../../../mios'; + +/** + * Server stats stream connection + */ +export class ServerStatsStream extends Stream { + constructor(os: MiOS) { + super(os, 'server-stats'); + } +} + +export class ServerStatsStreamManager extends StreamManager { + private os: MiOS; + + constructor(os: MiOS) { + super(); + + this.os = os; + } + + public getConnection() { + if (this.connection == null) { + this.connection = new ServerStatsStream(this.os); + } + + return this.connection; + } +} diff --git a/src/client/app/common/scripts/streaming/server.ts b/src/client/app/common/scripts/streaming/server.ts deleted file mode 100644 index 2ea4239288..0000000000 --- a/src/client/app/common/scripts/streaming/server.ts +++ /dev/null @@ -1,30 +0,0 @@ -import Stream from './stream'; -import StreamManager from './stream-manager'; -import MiOS from '../../../mios'; - -/** - * Server stream connection - */ -export class ServerStream extends Stream { - constructor(os: MiOS) { - super(os, 'server'); - } -} - -export class ServerStreamManager extends StreamManager { - private os: MiOS; - - constructor(os: MiOS) { - super(); - - this.os = os; - } - - public getConnection() { - if (this.connection == null) { - this.connection = new ServerStream(this.os); - } - - return this.connection; - } -} diff --git a/src/client/app/common/views/widgets/index.ts b/src/client/app/common/views/widgets/index.ts index a4cabc43ba..0190393ba7 100644 --- a/src/client/app/common/views/widgets/index.ts +++ b/src/client/app/common/views/widgets/index.ts @@ -4,6 +4,7 @@ import wAnalogClock from './analog-clock.vue'; import wVersion from './version.vue'; import wRss from './rss.vue'; import wServer from './server.vue'; +import wPostsMonitor from './posts-monitor.vue'; import wMemo from './memo.vue'; import wBroadcast from './broadcast.vue'; import wCalendar from './calendar.vue'; @@ -22,6 +23,7 @@ Vue.component('mkw-tips', wTips); Vue.component('mkw-donation', wDonation); Vue.component('mkw-broadcast', wBroadcast); Vue.component('mkw-server', wServer); +Vue.component('mkw-posts-monitor', wPostsMonitor); Vue.component('mkw-memo', wMemo); Vue.component('mkw-rss', wRss); Vue.component('mkw-version', wVersion); diff --git a/src/client/app/common/views/widgets/posts-monitor.vue b/src/client/app/common/views/widgets/posts-monitor.vue new file mode 100644 index 0000000000..bdf811bad0 --- /dev/null +++ b/src/client/app/common/views/widgets/posts-monitor.vue @@ -0,0 +1,182 @@ + + + + + diff --git a/src/client/app/common/views/widgets/server.vue b/src/client/app/common/views/widgets/server.vue index 2fdd60499b..d796a3ae05 100644 --- a/src/client/app/common/views/widgets/server.vue +++ b/src/client/app/common/views/widgets/server.vue @@ -55,11 +55,11 @@ export default define({ this.fetching = false; }); - this.connection = (this as any).os.streams.serverStream.getConnection(); - this.connectionId = (this as any).os.streams.serverStream.use(); + this.connection = (this as any).os.streams.serverStatsStream.getConnection(); + this.connectionId = (this as any).os.streams.serverStatsStream.use(); }, beforeDestroy() { - (this as any).os.streams.serverStream.dispose(this.connectionId); + (this as any).os.streams.serverStatsStream.dispose(this.connectionId); }, methods: { toggle() { -- cgit v1.2.3-freya