|
@@ -1,8 +1,12 @@
|
|
<template>
|
|
<template>
|
|
<div>
|
|
<div>
|
|
- <h3>Admin Session</h3>
|
|
|
|
- <div v-for="request in requestCmds" :key="request.keyword"><button @click="sendRequest(request)">{{ request.label }} </button></div>
|
|
|
|
- <div v-for="response in responses" :key="response.cnt">{{ response.data }}</div>
|
|
|
|
|
|
+ <h3>Admin Session</h3>
|
|
|
|
+ <div v-for="request in requestCmds" :key="request.keyword">
|
|
|
|
+ <button @click="sendRequest(request)">{{ request.label }}</button>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-for="response in responses" :key="response.cnt">
|
|
|
|
+ <pre>{{ response.data }}</pre>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -19,22 +23,51 @@ export default class AdminCommands extends Vue {
|
|
|
|
|
|
requestCmds = [
|
|
requestCmds = [
|
|
{ keyword: 'login', label: 'getCurrentLogins' },
|
|
{ keyword: 'login', label: 'getCurrentLogins' },
|
|
- //{ keyword: 'conn', label: 'getCurrentConnections' },
|
|
|
|
- //{ keyword: 'sub', label: 'getSubscriptions' },
|
|
|
|
- // { keyword: 'req', label: 'getRequests' },
|
|
|
|
- // { keyword: 'res', label: 'getResponses' },
|
|
|
|
|
|
+ { keyword: 'conn', label: 'getCurrentConnections' },
|
|
|
|
+ { keyword: 'sub', label: 'getSubscriptions' },
|
|
|
|
+ { keyword: 'req', label: 'getRequests' },
|
|
|
|
+ { keyword: 'res', label: 'getResponses' },
|
|
];
|
|
];
|
|
|
|
|
|
socket = null
|
|
socket = null
|
|
responses = []
|
|
responses = []
|
|
url = 'http://localhost:3111'
|
|
url = 'http://localhost:3111'
|
|
|
|
|
|
|
|
+ addResponse(cnt, data) {
|
|
|
|
+ const response = JSON.stringify(data,null,3)
|
|
|
|
+ // if(Array.isArray(data) && data.length > 0 )
|
|
|
|
+ // console.log(response)
|
|
|
|
+ this.responses.unshift({cnt, data: JSON.stringify(data,null,3)})
|
|
|
|
+ }
|
|
|
|
+ // parseLogin(data) {
|
|
|
|
+
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ x = [
|
|
|
|
+ {
|
|
|
|
+ "id": "9z55r61",
|
|
|
|
+ "token": "9z55r67016",
|
|
|
|
+ "lastActionOn": "2021-07-17T13:25:04.406Z",
|
|
|
|
+ "timeout": 10000,
|
|
|
|
+ "connections": [
|
|
|
|
+ {
|
|
|
|
+ "isDone": false,
|
|
|
|
+ "client": {
|
|
|
|
+ "transport": "socketio",
|
|
|
|
+ "id": "O6vmYhBbpHiDmibmAAAE",
|
|
|
|
+ "address": "::1",
|
|
|
|
+ "url": "/socket.io/?EIO=3&transport=polling&t=Ngqf3qf"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
connect(){
|
|
connect(){
|
|
const socket = io.connect(this.url)
|
|
const socket = io.connect(this.url)
|
|
let cnt = 0;
|
|
let cnt = 0;
|
|
socket.on('admin_response', (data) => {
|
|
socket.on('admin_response', (data) => {
|
|
cnt++;
|
|
cnt++;
|
|
- this.responses.unshift({cnt, data: JSON.stringify(data,null,3)})
|
|
|
|
|
|
+ this.addResponse(cnt, data);
|
|
})
|
|
})
|
|
|
|
|
|
socket.on('connect', (ws) => {
|
|
socket.on('connect', (ws) => {
|