refactor(frontend): widgets/server-metric
内の型エラーを除去 (#12937)
This commit is contained in:
@@ -54,13 +54,13 @@ import * as Misskey from 'misskey-js';
|
||||
import bytes from '@/filters/bytes.js';
|
||||
|
||||
const props = defineProps<{
|
||||
connection: any,
|
||||
connection: Misskey.ChannelConnection<Misskey.Channels['serverStats']>,
|
||||
meta: Misskey.entities.ServerInfoResponse
|
||||
}>();
|
||||
|
||||
const viewBoxX = ref<number>(50);
|
||||
const viewBoxY = ref<number>(30);
|
||||
const stats = ref<any[]>([]);
|
||||
const stats = ref<Misskey.entities.ServerStats[]>([]);
|
||||
const inPolylinePoints = ref<string>('');
|
||||
const outPolylinePoints = ref<string>('');
|
||||
const inPolygonPoints = ref<string>('');
|
||||
@@ -77,6 +77,7 @@ onMounted(() => {
|
||||
props.connection.on('statsLog', onStatsLog);
|
||||
props.connection.send('requestLog', {
|
||||
id: Math.random().toString().substring(2, 10),
|
||||
length: 50,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -85,7 +86,7 @@ onBeforeUnmount(() => {
|
||||
props.connection.off('statsLog', onStatsLog);
|
||||
});
|
||||
|
||||
function onStats(connStats) {
|
||||
function onStats(connStats: Misskey.entities.ServerStats) {
|
||||
stats.value.push(connStats);
|
||||
if (stats.value.length > 50) stats.value.shift();
|
||||
|
||||
@@ -109,8 +110,8 @@ function onStats(connStats) {
|
||||
outRecent.value = connStats.net.tx;
|
||||
}
|
||||
|
||||
function onStatsLog(statsLog) {
|
||||
for (const revStats of [...statsLog].reverse()) {
|
||||
function onStatsLog(statsLog: Misskey.entities.ServerStatsLog) {
|
||||
for (const revStats of statsLog.reverse()) {
|
||||
onStats(revStats);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user