diff --git a/ide/build.js b/ide/build.js index 6d2f658759a210dec8d2b227ba7bafc75848e6eb..4ead05d71f42e8573b2ebd108268626ca284d5df 100644 --- a/ide/build.js +++ b/ide/build.js @@ -15,7 +15,7 @@ const path = require('path'); const fs = require('fs'); -const child_process = require('child_process'); +const childProcess = require('child_process'); const os = require('os'); const log4js = require('log4js'); @@ -66,15 +66,15 @@ function cpFile(from, to) { } function checkEnvironment() { - let goVersion = child_process.execSync('go version', { + let goVersion = childProcess.execSync('go version', { encoding: 'utf-8', }); log.info('go is', goVersion); - let nodeVersion = child_process.execSync('node -v', { + let nodeVersion = childProcess.execSync('node -v', { encoding: 'utf-8', }); log.info('node version is', nodeVersion); - let tscVersion = child_process.execSync('tsc -v', { + let tscVersion = childProcess.execSync('tsc -v', { encoding: 'utf-8', }); log.info('tsc version is', tscVersion); @@ -120,7 +120,7 @@ function main() { // run tsc compile log.info('start compiling typeScript code'); let rootPath = path.join(__dirname, '/'); - child_process.execSync('tsc -p ' + rootPath, { + childProcess.execSync('tsc -p ' + rootPath, { encoding: 'utf-8', }); log.info('compiling typeScript code success'); @@ -178,15 +178,11 @@ function main() { let serverSrc = path.normalize(path.join(__dirname, '/server/main.go')); let rs; if (os.type() === 'Windows_NT') { - rs = child_process.spawnSync('go', ['build', '-o', outPath, serverSrc], { - encoding: 'utf-8', - }); - } else if (os.type() == 'Darwin') { - rs = child_process.spawnSync('go', ['build', '-o', outPath + '/main', serverSrc], { + rs = childProcess.spawnSync('go', ['build', '-o', outPath, serverSrc], { encoding: 'utf-8', }); } else { - rs = child_process.spawnSync('go', ['build', '-o', outPath + '/main', serverSrc], { + rs = childProcess.spawnSync('go', ['build', '-o', outPath + '/main', serverSrc], { encoding: 'utf-8', }); } diff --git a/ide/src/base-ui/chart/column/LitChartColumn.ts b/ide/src/base-ui/chart/column/LitChartColumn.ts index 9b7464b54066482035430bfda1f02f36da70200a..3f8dc9a41cd2484a0f835dfb8faaf235c630f8fe 100644 --- a/ide/src/base-ui/chart/column/LitChartColumn.ts +++ b/ide/src/base-ui/chart/column/LitChartColumn.ts @@ -16,6 +16,7 @@ import { BaseElement, element } from '../../BaseElement.js'; import { LitChartColumnConfig } from './LitChartColumnConfig.js'; import { resizeCanvas } from '../helper.js'; +import { getProbablyTime } from '../../../trace/database/logic-worker/ProcedureLogicWorkerCommon.js'; class Pillar { obj?: any; @@ -51,62 +52,54 @@ interface RLine { @element('lit-chart-column') export class LitChartColumn extends BaseElement { - private tipEL: HTMLDivElement | null | undefined; - canvas: HTMLCanvasElement | undefined | null; - ctx: CanvasRenderingContext2D | undefined | null; - cfg: LitChartColumnConfig | null | undefined; + private litChartColumnTipEL: HTMLDivElement | null | undefined; + litChartColumnCanvas: HTMLCanvasElement | undefined | null; + litChartColumnCtx: CanvasRenderingContext2D | undefined | null; + litChartColumnCfg: LitChartColumnConfig | null | undefined; offset?: { x: number | undefined; y: number | undefined }; data: Pillar[] = []; rowLines: RLine[] = []; connectedCallback() { super.connectedCallback(); - this.tipEL = this.shadowRoot!.querySelector('#tip'); - this.canvas = this.shadowRoot!.querySelector('#canvas'); - this.ctx = this.canvas!.getContext('2d', { alpha: true }); - resizeCanvas(this.canvas!); - this.offset = { x: 40, y: 20 }; - this.canvas!.onmouseout = (e) => { + this.litChartColumnTipEL = this.shadowRoot!.querySelector('#tip'); + this.litChartColumnCanvas = this.shadowRoot!.querySelector('#canvas'); + this.litChartColumnCtx = this.litChartColumnCanvas!.getContext('2d', { alpha: true }); + resizeCanvas(this.litChartColumnCanvas!); + this.offset = { x: 60, y: 20 }; + this.litChartColumnCanvas!.onmouseout = (e) => { this.hideTip(); this.data.forEach((it) => (it.hover = false)); this.render(); }; - this.canvas!.onmousemove = (ev) => { + this.litChartColumnCanvas!.onmousemove = (ev) => { let rect = this.getBoundingClientRect(); let x = ev.pageX - rect.left; let y = ev.pageY - rect.top; this.data.forEach((it) => { if (contains(it.bgFrame!, x, y)) { it.hover = true; - this.cfg?.hoverHandler?.(it.obj.no); + this.litChartColumnCfg?.hoverHandler?.(it.obj.no); } else { it.hover = false; } }); let pillars = this.data.filter((it) => it.hover); - if (this.cfg?.seriesField) { + if (this.litChartColumnCfg?.seriesField) { if (pillars.length > 0) { - let title = ``; - let msg = pillars.map((it) => ``).join(''); - let sum = `