summaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-03-16 06:05:39 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-03-16 06:05:39 +0900
commit56a1deb9d5ea7e3fb2beedbbc218ebf1d1fc719b (patch)
tree67f4e00fd83ad1f5b7d7146deb49ffe97e9cff63 /src/web
parentFix bug (diff)
downloadsharkey-56a1deb9d5ea7e3fb2beedbbc218ebf1d1fc719b.tar.gz
sharkey-56a1deb9d5ea7e3fb2beedbbc218ebf1d1fc719b.tar.bz2
sharkey-56a1deb9d5ea7e3fb2beedbbc218ebf1d1fc719b.zip
:v:
Diffstat (limited to 'src/web')
-rw-r--r--src/web/app/common/scripts/streaming/stream.ts5
-rw-r--r--src/web/app/desktop/views/components/taskmanager.vue15
2 files changed, 20 insertions, 0 deletions
diff --git a/src/web/app/common/scripts/streaming/stream.ts b/src/web/app/common/scripts/streaming/stream.ts
index 189af0ab30..cb4041fd89 100644
--- a/src/web/app/common/scripts/streaming/stream.ts
+++ b/src/web/app/common/scripts/streaming/stream.ts
@@ -22,6 +22,7 @@ export default class Connection extends EventEmitter {
data: string
}> = [];
public id: string;
+ public isSuspended = false;
private os: MiOS;
constructor(os: MiOS, endpoint, params?) {
@@ -91,6 +92,8 @@ export default class Connection extends EventEmitter {
* Callback of when received a message from connection
*/
private onMessage(message) {
+ if (this.isSuspended) return;
+
if (this.os.debug) {
this.in++;
this.inout.push({ type: 'in', at: new Date(), data: message.data });
@@ -108,6 +111,8 @@ export default class Connection extends EventEmitter {
* Send a message to connection
*/
public send(data) {
+ if (this.isSuspended) return;
+
// まだ接続が確立されていなかったらバッファリングして次に接続した時に送信する
if (this.state != 'connected') {
this.buffer.push(data);
diff --git a/src/web/app/desktop/views/components/taskmanager.vue b/src/web/app/desktop/views/components/taskmanager.vue
index c0a8b2e9ab..a00fabb047 100644
--- a/src/web/app/desktop/views/components/taskmanager.vue
+++ b/src/web/app/desktop/views/components/taskmanager.vue
@@ -94,6 +94,13 @@
<el-tab-pane label="Streams (Inspect)">
<el-tabs type="card" style="height:50%">
<el-tab-pane v-for="c in os.connections" :label="c.name == '' ? '[Home]' : c.name" :key="c.id" :name="c.id" ref="connectionsTab">
+ <div style="padding: 12px 0 0 12px">
+ <el-button size="mini" @click="send(c)">Send</el-button>
+ <el-button size="mini" type="warning" @click="c.isSuspended = true" v-if="!c.isSuspended">Suspend</el-button>
+ <el-button size="mini" type="success" @click="c.isSuspended = false" v-else>Resume</el-button>
+ <el-button size="mini" type="danger" @click="c.close">Disconnect</el-button>
+ </div>
+
<el-table
:data="c.inout"
style="width: 100%"
@@ -177,6 +184,14 @@ export default Vue.extend({
},
onWindowsChanged() {
this.$forceUpdate();
+ },
+ send(c) {
+ (this as any).apis.input({
+ title: 'Send a JSON message',
+ allowEmpty: false
+ }).then(json => {
+ c.send(JSON.parse(json));
+ });
}
}
});