@midscene/visualizer 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/component/assets/logo-plain.js +128 -0
- package/dist/es/component/assets/logo-plain2.js +128 -0
- package/dist/es/component/blackboard.js +5 -1
- package/dist/es/component/detail-panel.js +2 -2
- package/dist/es/component/detail-side.css +3 -2
- package/dist/es/component/detail-side.js +14 -5
- package/dist/es/component/global-hover-preview.css +1 -1
- package/dist/es/component/global-hover-preview.js +6 -1
- package/dist/es/component/sidebar.css +2 -1
- package/dist/es/component/sidebar.js +19 -12
- package/dist/es/component/store.js +7 -6
- package/dist/es/component/timeline.js +2 -2
- package/dist/es/index.css +14 -9
- package/dist/es/index.js +33 -7
- package/dist/lib/component/assets/logo-plain.js +156 -0
- package/dist/lib/component/assets/logo-plain2.js +156 -0
- package/dist/lib/component/blackboard.js +5 -1
- package/dist/lib/component/detail-panel.js +2 -2
- package/dist/lib/component/detail-side.css +3 -2
- package/dist/lib/component/detail-side.js +14 -5
- package/dist/lib/component/global-hover-preview.css +1 -1
- package/dist/lib/component/global-hover-preview.js +6 -1
- package/dist/lib/component/sidebar.css +2 -1
- package/dist/lib/component/sidebar.js +19 -12
- package/dist/lib/component/store.js +7 -6
- package/dist/lib/component/timeline.js +2 -2
- package/dist/lib/index.css +14 -9
- package/dist/lib/index.js +37 -7
- package/dist/types/component/sidebar.d.ts +4 -1
- package/dist/types/component/store.d.ts +2 -1
- package/dist/types/index.d.ts +7 -2
- package/package.json +9 -4
- package/.eslintrc.js +0 -9
- package/dist/es/assets/logo-plain.16842bbc.svg +0 -70
- package/dist/es/assets/logo-plain2.16842bbc.svg +0 -70
- package/dist/lib/assets/logo-plain.16842bbc.svg +0 -70
- package/dist/lib/assets/logo-plain2.16842bbc.svg +0 -70
- package/docs/index.tsx +0 -6
- package/modern.config.ts +0 -15
- package/src/component/assets/logo-plain.svg +0 -70
- package/src/component/assets/logo-plain2.svg +0 -70
- package/src/component/blackboard.less +0 -37
- package/src/component/blackboard.tsx +0 -293
- package/src/component/color.tsx +0 -34
- package/src/component/common.less +0 -21
- package/src/component/detail-panel.less +0 -47
- package/src/component/detail-panel.tsx +0 -124
- package/src/component/detail-side.less +0 -131
- package/src/component/detail-side.tsx +0 -361
- package/src/component/global-hover-preview.less +0 -23
- package/src/component/global-hover-preview.tsx +0 -50
- package/src/component/misc.tsx +0 -20
- package/src/component/panel-title.less +0 -11
- package/src/component/panel-title.tsx +0 -11
- package/src/component/side-item.tsx +0 -0
- package/src/component/sidebar.less +0 -122
- package/src/component/sidebar.tsx +0 -205
- package/src/component/store.tsx +0 -151
- package/src/component/timeline.less +0 -25
- package/src/component/timeline.tsx +0 -486
- package/src/global.d.ts +0 -11
- package/src/index.less +0 -113
- package/src/index.tsx +0 -210
- package/src/utils.ts +0 -58
- package/tsconfig.json +0 -24
package/src/index.tsx
DELETED
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import './index.less';
|
|
2
|
-
import { ConfigProvider, message, Upload, Button } from 'antd';
|
|
3
|
-
import type { UploadProps } from 'antd';
|
|
4
|
-
import { useEffect, useRef, useState } from 'react';
|
|
5
|
-
import { Helmet } from '@modern-js/runtime/head';
|
|
6
|
-
import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels';
|
|
7
|
-
import Timeline from './component/timeline';
|
|
8
|
-
import DetailPanel from './component/detail-panel';
|
|
9
|
-
import logo from './component/assets/logo-plain.svg';
|
|
10
|
-
import GlobalHoverPreview from './component/global-hover-preview';
|
|
11
|
-
import { useExecutionDump, useInsightDump } from '@/component/store';
|
|
12
|
-
import DetailSide from '@/component/detail-side';
|
|
13
|
-
import Sidebar from '@/component/sidebar';
|
|
14
|
-
|
|
15
|
-
const { Dragger } = Upload;
|
|
16
|
-
const Index = (): JSX.Element => {
|
|
17
|
-
const executionDump = useExecutionDump((store) => store.dump);
|
|
18
|
-
const setGroupedDump = useExecutionDump((store) => store.setGroupedDump);
|
|
19
|
-
const reset = useExecutionDump((store) => store.reset);
|
|
20
|
-
const [mainLayoutChangeFlag, setMainLayoutChangeFlag] = useState(0);
|
|
21
|
-
const mainLayoutChangedRef = useRef(false);
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
return () => {
|
|
25
|
-
reset();
|
|
26
|
-
};
|
|
27
|
-
}, []);
|
|
28
|
-
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
const onResize = () => {
|
|
31
|
-
setMainLayoutChangeFlag((prev) => prev + 1);
|
|
32
|
-
};
|
|
33
|
-
window.addEventListener('resize', onResize);
|
|
34
|
-
|
|
35
|
-
return () => {
|
|
36
|
-
window.removeEventListener('resize', onResize);
|
|
37
|
-
};
|
|
38
|
-
}, []);
|
|
39
|
-
|
|
40
|
-
// TODO
|
|
41
|
-
// const loadInsightDump = (dump: InsightDump) => {
|
|
42
|
-
// console.log('will convert insight dump to execution dump');
|
|
43
|
-
// const data = insightDumpToExecutionDump(dump);
|
|
44
|
-
// console.log(data);
|
|
45
|
-
|
|
46
|
-
// setExecutionDump(data);
|
|
47
|
-
// };
|
|
48
|
-
|
|
49
|
-
const uploadProps: UploadProps = {
|
|
50
|
-
name: 'file',
|
|
51
|
-
multiple: false,
|
|
52
|
-
capture: false,
|
|
53
|
-
customRequest: () => {
|
|
54
|
-
// noop
|
|
55
|
-
},
|
|
56
|
-
beforeUpload(file) {
|
|
57
|
-
const ifValidFile = file.name.endsWith('web-dump.json'); // || file.name.endsWith('.insight.json');
|
|
58
|
-
// const ifActionFile =
|
|
59
|
-
// file.name.endsWith('.actions.json') || /_force_regard_as_action_file/.test(location.href);
|
|
60
|
-
if (!ifValidFile) {
|
|
61
|
-
message.error('invalid file extension');
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
const reader = new FileReader();
|
|
65
|
-
reader.readAsText(file);
|
|
66
|
-
reader.onload = (e) => {
|
|
67
|
-
const result = e.target?.result;
|
|
68
|
-
if (typeof result === 'string') {
|
|
69
|
-
try {
|
|
70
|
-
const data = JSON.parse(result);
|
|
71
|
-
// setMainLayoutChangeFlag((prev) => prev + 1);
|
|
72
|
-
setGroupedDump(data);
|
|
73
|
-
// if (ifActionFile) {
|
|
74
|
-
// } else {
|
|
75
|
-
// loadInsightDump(data);
|
|
76
|
-
// }
|
|
77
|
-
} catch (e: any) {
|
|
78
|
-
console.error(e);
|
|
79
|
-
message.error('failed to parse dump data', e.message);
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
message.error('Invalid dump file');
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
return false;
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const loadTasksDemo = () => {
|
|
90
|
-
// setExecutionDump(actionDemo);
|
|
91
|
-
// message.info('Your are viewing the demo data.');
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const loadInsightDemo = () => {
|
|
95
|
-
// loadInsightDump(InsightDemo);
|
|
96
|
-
// message.info('Your are viewing the demo data.');
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
let mainContent: JSX.Element;
|
|
100
|
-
if (!executionDump) {
|
|
101
|
-
mainContent = (
|
|
102
|
-
<div className="main-right uploader-wrapper">
|
|
103
|
-
<Dragger className="uploader" {...uploadProps}>
|
|
104
|
-
<p className="ant-upload-drag-icon">
|
|
105
|
-
<img src={logo} alt="Logo" style={{ width: 100, height: 100, margin: 'auto' }} />
|
|
106
|
-
</p>
|
|
107
|
-
<p className="ant-upload-text">
|
|
108
|
-
Click or drag the{' '}
|
|
109
|
-
<b>
|
|
110
|
-
<i>.web-dump.json</i>
|
|
111
|
-
</b>{' '}
|
|
112
|
-
{/* or{' '}
|
|
113
|
-
<b>
|
|
114
|
-
<i>.actions.json</i>
|
|
115
|
-
</b>{' '} */}
|
|
116
|
-
file into this area.
|
|
117
|
-
</p>
|
|
118
|
-
<p className="ant-upload-text">
|
|
119
|
-
The latest dump file is usually placed in{' '}
|
|
120
|
-
<b>
|
|
121
|
-
<i>./midscene_run/</i>
|
|
122
|
-
</b>
|
|
123
|
-
</p>
|
|
124
|
-
<p className="ant-upload-text">
|
|
125
|
-
All data will be processed locally by the browser. No data will be sent to the server.
|
|
126
|
-
</p>
|
|
127
|
-
</Dragger>
|
|
128
|
-
<div className="demo-loader">
|
|
129
|
-
<Button type="link" onClick={loadTasksDemo}>
|
|
130
|
-
Load Tasks Demo
|
|
131
|
-
</Button>
|
|
132
|
-
<Button type="link" onClick={loadInsightDemo}>
|
|
133
|
-
Load Insight Demo
|
|
134
|
-
</Button>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
// dump
|
|
140
|
-
} else {
|
|
141
|
-
mainContent = (
|
|
142
|
-
<PanelGroup
|
|
143
|
-
autoSaveId="main-page-layout"
|
|
144
|
-
direction="horizontal"
|
|
145
|
-
onLayout={() => {
|
|
146
|
-
if (!mainLayoutChangedRef.current) {
|
|
147
|
-
setMainLayoutChangeFlag((prev) => prev + 1);
|
|
148
|
-
}
|
|
149
|
-
}}
|
|
150
|
-
>
|
|
151
|
-
<Panel maxSize={95}>
|
|
152
|
-
<Sidebar />
|
|
153
|
-
</Panel>
|
|
154
|
-
<PanelResizeHandle
|
|
155
|
-
onDragging={(isChanging) => {
|
|
156
|
-
if (mainLayoutChangedRef.current && !isChanging) {
|
|
157
|
-
// not changing anymore
|
|
158
|
-
setMainLayoutChangeFlag((prev) => prev + 1);
|
|
159
|
-
}
|
|
160
|
-
mainLayoutChangedRef.current = isChanging;
|
|
161
|
-
}}
|
|
162
|
-
/>
|
|
163
|
-
<Panel defaultSize={80} maxSize={95}>
|
|
164
|
-
<div className="main-right">
|
|
165
|
-
<Timeline key={mainLayoutChangeFlag} />
|
|
166
|
-
<div className="main-content">
|
|
167
|
-
<PanelGroup autoSaveId="page-detail-layout" direction="horizontal">
|
|
168
|
-
<Panel maxSize={95}>
|
|
169
|
-
<div className="main-side">
|
|
170
|
-
<DetailSide />
|
|
171
|
-
</div>
|
|
172
|
-
</Panel>
|
|
173
|
-
<PanelResizeHandle />
|
|
174
|
-
|
|
175
|
-
<Panel defaultSize={75} maxSize={95}>
|
|
176
|
-
<div className="main-canvas-container">
|
|
177
|
-
<DetailPanel />
|
|
178
|
-
</div>
|
|
179
|
-
</Panel>
|
|
180
|
-
</PanelGroup>
|
|
181
|
-
</div>
|
|
182
|
-
</div>
|
|
183
|
-
</Panel>
|
|
184
|
-
</PanelGroup>
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return (
|
|
189
|
-
<ConfigProvider
|
|
190
|
-
theme={{
|
|
191
|
-
components: {
|
|
192
|
-
Layout: {
|
|
193
|
-
headerHeight: 60,
|
|
194
|
-
headerPadding: '0 30px',
|
|
195
|
-
headerBg: '#FFF',
|
|
196
|
-
bodyBg: '#FFF',
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
}}
|
|
200
|
-
>
|
|
201
|
-
<Helmet>
|
|
202
|
-
<title>MidScene.js - Visualization Tool</title>
|
|
203
|
-
</Helmet>
|
|
204
|
-
<div className="page-container">{mainContent}</div>
|
|
205
|
-
<GlobalHoverPreview />
|
|
206
|
-
</ConfigProvider>
|
|
207
|
-
);
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export default Index;
|
package/src/utils.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
|
-
import dayjs from 'dayjs';
|
|
3
|
-
import type { ExecutionDump, ExecutionTaskInsightLocate, InsightDump, ExecutionTask } from '@midscene/core';
|
|
4
|
-
|
|
5
|
-
export function insightDumpToExecutionDump(insightDump: InsightDump | InsightDump[]): ExecutionDump {
|
|
6
|
-
const insightToTask = (insightDump: InsightDump): ExecutionTaskInsightLocate => {
|
|
7
|
-
const task: ExecutionTaskInsightLocate = {
|
|
8
|
-
type: 'Insight',
|
|
9
|
-
subType: insightDump.type === 'locate' ? 'Locate' : 'Query',
|
|
10
|
-
status: insightDump.error ? 'fail' : 'success',
|
|
11
|
-
param: {
|
|
12
|
-
...(insightDump.userQuery.element ? { query: insightDump.userQuery } : {}),
|
|
13
|
-
...(insightDump.userQuery.dataDemand ? { dataDemand: insightDump.userQuery.dataDemand } : {}),
|
|
14
|
-
insight: {} as any,
|
|
15
|
-
} as any,
|
|
16
|
-
log: {
|
|
17
|
-
dump: insightDump,
|
|
18
|
-
},
|
|
19
|
-
timing: {
|
|
20
|
-
end: insightDump.logTime,
|
|
21
|
-
cost: insightDump.taskInfo?.durationMs,
|
|
22
|
-
start: insightDump.logTime - insightDump.taskInfo?.durationMs,
|
|
23
|
-
},
|
|
24
|
-
executor: () => {},
|
|
25
|
-
};
|
|
26
|
-
return task;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
if (!Array.isArray(insightDump)) {
|
|
30
|
-
const result: ExecutionDump = {
|
|
31
|
-
sdkVersion: insightDump.sdkVersion,
|
|
32
|
-
logTime: insightDump.logTime,
|
|
33
|
-
name: 'Insight',
|
|
34
|
-
tasks: [insightToTask(insightDump)],
|
|
35
|
-
};
|
|
36
|
-
return result;
|
|
37
|
-
} else {
|
|
38
|
-
const result: ExecutionDump = {
|
|
39
|
-
sdkVersion: insightDump[0].sdkVersion,
|
|
40
|
-
logTime: insightDump[0].logTime,
|
|
41
|
-
name: 'Insight',
|
|
42
|
-
tasks: insightDump.map(insightToTask),
|
|
43
|
-
};
|
|
44
|
-
return result;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function timeStr(timestamp?: number) {
|
|
49
|
-
return timestamp ? dayjs(timestamp).format('YYYY-MM-DD HH:mm:ss') : '-';
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function typeStr(task: ExecutionTask) {
|
|
53
|
-
return task.subType ? `${task.type} / ${task.subType || ''}` : task.type;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function filterBase64Value(input: string) {
|
|
57
|
-
return input.replace(/data:image\/[^"]+"/g, 'data:image..."');
|
|
58
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"emitDeclarationOnly": true,
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"forceConsistentCasingInFileNames": true,
|
|
8
|
-
"isolatedModules": true,
|
|
9
|
-
"jsx": "preserve",
|
|
10
|
-
"lib": ["DOM", "ESNext"],
|
|
11
|
-
"moduleResolution": "node",
|
|
12
|
-
"paths": {
|
|
13
|
-
"@/*": ["./src/*"]
|
|
14
|
-
},
|
|
15
|
-
"resolveJsonModule": true,
|
|
16
|
-
"rootDir": "src",
|
|
17
|
-
"skipLibCheck": true,
|
|
18
|
-
"strict": true,
|
|
19
|
-
"types": ["react"],
|
|
20
|
-
},
|
|
21
|
-
"exclude": ["**/node_modules"],
|
|
22
|
-
"include": ["src"]
|
|
23
|
-
}
|
|
24
|
-
|