minor: cleanup code
This commit is contained in:
parent
949ef16e7f
commit
981b0fbfed
|
@ -8,6 +8,7 @@
|
|||
"devh": ". ./set_env.sh && vite --host",
|
||||
"build": "run-p type-check \"build-only {@}\" --",
|
||||
"preview": ". ./set_env.sh && vite preview",
|
||||
"previewh": ". ./set_env.sh && vite preview --host",
|
||||
"build-only": ". ./set_env.sh && vite build",
|
||||
"build:dev": ". ./set_env.sh && vite build --mode development",
|
||||
"type-check": "vue-tsc --build --force",
|
||||
|
|
|
@ -40,7 +40,7 @@ let websocketService: IWebsocketService;
|
|||
onMounted(() => {
|
||||
|
||||
logHelloMessage();
|
||||
let host = "";
|
||||
let host: string;
|
||||
if (isDevMode()) {
|
||||
host = import.meta.env.VITE_DEVICE_HOST_NAME || "dap.local";
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {registerModule} from "@/router/msgRouter";
|
||||
import {type ApiJsonMsg, ControlEvent, type ControlMsg, ControlMsgType, WtModuleID} from "@/api";
|
||||
import {type ApiJsonMsg, type ControlMsg, ControlMsgType, WtModuleID} from "@/api";
|
||||
import {isDevMode} from "@/composables/buildMode";
|
||||
import {useDataFlowStore} from "@/stores/useDataFlowStore";
|
||||
import {type IInstanceList, WtDataFlowCmd} from "@/api/apiDataFlow";
|
||||
|
|
|
@ -293,7 +293,6 @@ export const useDataViewerStore = defineStore('text-viewer', () => {
|
|||
const appendedLength = frameBreakAfterSequence.value ? frameBreakSequenceNormalized.value.length : 0;
|
||||
/* else after the first match, skip the matchArr at the beginning of array in subsequent match */
|
||||
const skipLength = frameBreakAfterSequence.value ? 0 : frameBreakSequenceNormalized.value.length;
|
||||
let remain = false;
|
||||
let startIndex = 0;
|
||||
|
||||
inputArray.forEach(array => {
|
||||
|
@ -314,7 +313,7 @@ export const useDataViewerStore = defineStore('text-viewer', () => {
|
|||
result.push(array.subarray(startIndex, array.length));
|
||||
}
|
||||
});
|
||||
remain = startIndex < inputArray[inputArray.length - 1].length;
|
||||
const remain = startIndex < inputArray[inputArray.length - 1].length;
|
||||
return {result, remain};
|
||||
}
|
||||
}, {
|
||||
|
@ -343,7 +342,7 @@ export const useDataViewerStore = defineStore('text-viewer', () => {
|
|||
const encoder = new TextEncoder();
|
||||
input = unescapeString(input);
|
||||
const encodedStr = encoder.encode(input);
|
||||
addSegment(encodedStr, isRX);
|
||||
addSegment(encodedStr, isRX, doSend);
|
||||
}
|
||||
|
||||
function addSegment(input: Uint8Array, isRX: boolean, doSend: boolean = false) {
|
||||
|
@ -456,7 +455,6 @@ export const useDataViewerStore = defineStore('text-viewer', () => {
|
|||
return encoder.encode(str);
|
||||
})
|
||||
|
||||
const dataArchive: IDataArchive[] = [];
|
||||
const dataBuf: IDataBuf[] = [];
|
||||
const dataBufLength = ref(0);
|
||||
|
||||
|
@ -477,7 +475,7 @@ export const useDataViewerStore = defineStore('text-viewer', () => {
|
|||
const batchUpdateTime = ref(80); /* ms */
|
||||
let batchStartIndex: number = 0;
|
||||
|
||||
watch(batchUpdateTime, value => {
|
||||
watch(batchUpdateTime, () => {
|
||||
if (batchDataUpdateIntervalID >= 0) {
|
||||
clearInterval(batchDataUpdateIntervalID);
|
||||
batchDataUpdateIntervalID = -1;
|
||||
|
@ -538,7 +536,7 @@ export const useDataViewerStore = defineStore('text-viewer', () => {
|
|||
softRefreshFilterBuf();
|
||||
}
|
||||
|
||||
function softRefreshFilterBuf(delayTime: number = 0) {
|
||||
function softRefreshFilterBuf() {
|
||||
/* handle filtered buf array */
|
||||
const totalBufLength = dataBuf.length - batchStartIndex + dataFiltered.length;
|
||||
|
||||
|
@ -605,7 +603,7 @@ export const useDataViewerStore = defineStore('text-viewer', () => {
|
|||
TxByteCountLocal = item.length;
|
||||
}
|
||||
|
||||
let str = ""
|
||||
let str: string;
|
||||
str = decodeUtf8(item);
|
||||
str = escapeHTML(str);
|
||||
str = strToHTML(str);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {defineStore} from "pinia";
|
||||
import {type Ref, ref} from "vue";
|
||||
import type {AttachInfo, InstanceInfo} from "@/api/apiDataFlow";
|
||||
import type {InstanceInfo} from "@/api/apiDataFlow";
|
||||
|
||||
export const useDataFlowStore = defineStore('data_flow', () => {
|
||||
const instanceList: Ref<InstanceInfo[]> = ref([]);
|
||||
|
|
|
@ -61,7 +61,6 @@ import {breakpointsTailwind, useBreakpoints} from '@vueuse/core'
|
|||
import {useDataViewerStore} from '@/stores/dataViewerStore';
|
||||
import * as api from '@/api';
|
||||
import {ControlEvent} from '@/api';
|
||||
import * as uart from '@/api/apiUart';
|
||||
import {
|
||||
type IUartMsgBaud,
|
||||
type IUartMsgConfig,
|
||||
|
@ -214,7 +213,7 @@ function mouseResize(e: MouseEvent) {
|
|||
|
||||
function touchResize(e: TouchEvent) {
|
||||
let t = e.touches[0];
|
||||
let f = 0;
|
||||
let f: number;
|
||||
|
||||
if (layoutMode.value === 'row') {
|
||||
f = t.clientX;
|
||||
|
|
|
@ -438,7 +438,7 @@ watch(() => store.showVirtualScroll, () => {
|
|||
}
|
||||
});
|
||||
|
||||
const handleScroll = (ev: Event) => {
|
||||
const handleScroll = () => {
|
||||
if (store.forceToBottom) {
|
||||
if (vuetifyVirtualScrollBarRef.value.scrollTop - lastScrollHeight < 0) {
|
||||
store.forceToBottom = false;
|
||||
|
|
Loading…
Reference in New Issue