Вывод SPM сервисов

This commit is contained in:
serega6531 2021-01-13 12:41:58 +03:00
parent 1eb4f7e380
commit 89a23dd6c6
3 changed files with 17 additions and 2 deletions

View File

@ -108,6 +108,8 @@
const data = parsed.value; const data = parsed.value;
this.$store.commit('setCurrentPacketsCount', data.totalPackets); this.$store.commit('setCurrentPacketsCount', data.totalPackets);
this.$store.commit('setCurrentStreamsCount', data.totalStreams); this.$store.commit('setCurrentStreamsCount', data.totalStreams);
this.$store.commit('setCurrentServicesPacketsCount', data.servicesPackets);
this.$store.commit('setCurrentServicesStreamsCount', data.servicesStreams);
console.debug('Adding new counters to DB', parsed.value); console.debug('Adding new counters to DB', parsed.value);
const tx = this.db.transaction(DB_OBJSTORE_COUNTERS_HISTORY, 'readwrite'); const tx = this.db.transaction(DB_OBJSTORE_COUNTERS_HISTORY, 'readwrite');

View File

@ -18,7 +18,11 @@
<template v-for="service in this.$store.state.services"> <template v-for="service in this.$store.state.services">
<router-link :key="service.name" tag="li" class="nav-item text-nowrap edit-button" <router-link :key="service.name" tag="li" class="nav-item text-nowrap edit-button"
:to="{name:'stream', params: {servicePort: service.port}, query: $route.query}"> :to="{name:'stream', params: {servicePort: service.port}, query: $route.query}">
<a class="nav-link">{{service.name}} #{{service.port}}</a> <a class="nav-link">
{{service.name}} #{{service.port}}
({{ getSpmForService(service.port) }}
<u title="Streams per minute">SPM</u>)
</a>
<a class="nav-link pl-0" style="cursor: pointer" @click.stop.prevent="editService(service)"> <a class="nav-link pl-0" style="cursor: pointer" @click.stop.prevent="editService(service)">
<i class="fas fa-pencil-alt"/> <i class="fas fa-pencil-alt"/>
@ -72,6 +76,9 @@
this.updateServices(); this.updateServices();
}, },
methods: { methods: {
getSpmForService(port) {
return this.$store.state.currentServicesStreamsCount[port] ?? 0;
},
editService(service) { editService(service) {
this.serviceModalIsCreating = false; this.serviceModalIsCreating = false;
this.serviceModalEditingService = {}; this.serviceModalEditingService = {};

View File

@ -25,6 +25,8 @@ export default new Vuex.Store({
currentPacketsCount: 0, currentPacketsCount: 0,
currentStreamsCount: 0, currentStreamsCount: 0,
currentServicesPacketsCount: {},
currentServicesStreamsCount: {},
}, },
mutations: { mutations: {
setHexdumpBlockSize: (s, p) => s.hexdumpBlockSize = p, setHexdumpBlockSize: (s, p) => s.hexdumpBlockSize = p,
@ -50,6 +52,8 @@ export default new Vuex.Store({
setCurrentPacketsCount: (s, p) => s.currentPacketsCount = p, setCurrentPacketsCount: (s, p) => s.currentPacketsCount = p,
setCurrentStreamsCount: (s, p) => s.currentStreamsCount = p, setCurrentStreamsCount: (s, p) => s.currentStreamsCount = p,
setCurrentServicesPacketsCount: (s, p) => s.currentServicesPacketsCount = p,
setCurrentServicesStreamsCount: (s, p) => s.currentServicesStreamsCount = p,
}, },
actions: {}, actions: {},
plugins: [ plugins: [
@ -70,7 +74,9 @@ export default new Vuex.Store({
&& mName !== 'setServices' && mName !== 'setServices'
&& mName !== 'addService' && mName !== 'addService'
&& mName !== 'setCurrentPacketsCount' && mName !== 'setCurrentPacketsCount'
&& mName !== 'setCurrentStreamsCount'; && mName !== 'setCurrentStreamsCount'
&& mName !== 'setCurrentServicesPacketsCount'
&& mName !== 'setCurrentServicesStreamsCount';
console.debug('Processing?', process); console.debug('Processing?', process);
return process; return process;
}, },