Skip to content

Commit 536ff8f

Browse files
committed
feat: lineage edit
1 parent f539ac2 commit 536ff8f

File tree

15 files changed

+276
-1386
lines changed

15 files changed

+276
-1386
lines changed

.env.development

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
VITE_BASE_URL="/ml"
2-
VITE_BASE_DATAHUB_URL="/datahubServer"
1+
VITE_BASE_URL="/ml"

.env.production

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
VITE_BASE_URL="http://8.135.49.240:8081"
2-
VITE_BASE_DATAHUB_URL="/datahubServer"
1+
VITE_BASE_URL="http://8.135.49.240:8081"

.env.staging

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
VITE_BASE_URL="http://172.16.1.192:8080"
2-
VITE_BASE_DATAHUB_URL="/datahubServer"
1+
VITE_BASE_URL="http://172.16.1.192:8080"

config/vite/proxy.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,7 @@ const init: ProxyTargetList = {
88
rewrite: (path) => {
99
return path.replace(/^\/ml/, '')
1010
}
11-
},
12-
'/datahubServer': {
13-
target: 'http://172.16.1.190:9002', // 公司开发
14-
changeOrigin: true,
15-
rewrite: (path) => {
16-
return path.replace(/^\/datahubServer/, '')
17-
}
18-
},
11+
}
1912
}
2013

2114
export default init

src/components/metrics/clusterAnalysis/ClusterAnalysis.vue

+1-9
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,7 @@ import sqls, { SqlParams } from '../dataAnalysis/sqls'
1414
import { ref, watch } from 'vue'
1515
import { getRealSqlOfArr, getUndefined } from '../dataAnalysis/utils'
1616
import TableBanner from '../TableBanner.vue'
17-
18-
type ChangeValue = {
19-
database?: string,
20-
table?: string,
21-
time?: string | number,
22-
queryKind?: string,
23-
user?: string,
24-
type?: string
25-
}
17+
import { ChangeValue } from '../types'
2618
2719
const props = defineProps<{
2820
activeName: string

src/components/metrics/dataAnalysis/DataAnalysis.vue

+18-10
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,18 @@ import { computed, ref } from 'vue'
1414
import { getRealSqlOfArr, getStartAndEndTime, getUndefined } from './utils'
1515
import dayjs from 'dayjs'
1616
import TableBanner from '../TableBanner.vue'
17-
18-
type ChangeValue = {
19-
database?: string,
20-
table?: string,
21-
time?: string | number,
22-
queryKind?: string,
23-
user?: string,
24-
type?: string
25-
}
17+
import { ChangeValue } from '../types'
2618
2719
const queryFunc = (sql: string) => {
2820
return query(sql)
2921
}
3022
const databaseReal = ref<string | undefined>(undefined)
3123
const tableReal = ref<string | undefined>(undefined)
3224
const timeReal = ref<string | number>(dayjs.duration(24, 'hours').asMilliseconds())
25+
const timeDuration = ref<string>('1 MINUTE')
3326
3427
const selectChangeData = (data: ChangeValue) => {
35-
const { database, table, time } = data
28+
const { database, table, time, option } = data
3629
if (database) {
3730
databaseReal.value = getRealSqlOfArr(getUndefined(database))
3831
}
@@ -41,6 +34,7 @@ const selectChangeData = (data: ChangeValue) => {
4134
}
4235
if (time) {
4336
timeReal.value = time
37+
timeDuration.value = option?.duration || '1 MINUTE'
4438
}
4539
}
4640
@@ -101,6 +95,20 @@ const queryFunction = (
10195
></count>
10296
</el-col>
10397
</el-row>
98+
<el-row :gutter="10">
99+
<el-col :span="24">
100+
<ChartsVue
101+
index="3"
102+
title="Write Rows"
103+
sql-func-name="queryWriteRowDataAnalysis"
104+
:time-range="timeRange"
105+
:time-duration="timeDuration"
106+
:query-func="queryFunction"
107+
type="line"
108+
:height="470"
109+
></ChartsVue>
110+
</el-col>
111+
</el-row>
104112
<el-row :gutter="10">
105113
<el-col :span="12">
106114
<Progress

src/components/metrics/dataAnalysis/sqls.ts

+21
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,26 @@ function queryMaxPartsPerPartition({database, table}: SqlParams) {
304304
LIMIT 10
305305
`)
306306
}
307+
308+
/**
309+
* 查询近期的分析
310+
*/
311+
function queryWriteRowDataAnalysis ({
312+
timeDuration,
313+
startTime,
314+
endTime
315+
}: SqlParams) {
316+
const whereStr = dealSQLWhere([
317+
{ value: `event_time > '${startTime}' AND event_time < '${endTime}'` }
318+
])
319+
320+
return formatJson(`
321+
SELECT toStartOfInterval(toDateTime(event_time), INTERVAL ${timeDuration}),
322+
sum(written_rows) written_rows FROM system.query_log
323+
${whereStr} GROUP BY event_time ORDER BY event_time ASC
324+
`)
325+
}
326+
307327
/**
308328
* 查询近期的分析
309329
*/
@@ -919,6 +939,7 @@ export default {
919939
queryPartsOverTimeWithRowCount,
920940
queryMaxPartsPerPartition,
921941
queryRecentPartAnalysis,
942+
queryWriteRowDataAnalysis,
922943
// Cluster Analysis start
923944
queryDatabaseNumber,
924945
queryTableNumber,

src/components/metrics/queryAnalysis/QueryAnalysis.vue

+1-14
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,7 @@ import { getRealSqlOfArr, getStartAndEndTime, getUndefined } from '../dataAnalys
1515
import totalImg from '@/assets/images/metrics/total_query_analysis.svg'
1616
import aveMemory from '@/assets/images/metrics/ave_memory.svg'
1717
import aveTime from '@/assets/images/metrics/ave_time.svg'
18-
19-
type ChangeValue = {
20-
database?: string,
21-
table?: string,
22-
time?: string | number,
23-
queryKind?: string,
24-
user?: string,
25-
type?: string,
26-
option?: {
27-
duration: string,
28-
name: string,
29-
value: number | string
30-
}
31-
}
18+
import { ChangeValue } from '../types'
3219
3320
const props = defineProps<{
3421
activeName: string

src/components/metrics/types.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,18 @@ export type CommonData = CommonMeta | CommonMeta[]
1414
export type DataQueryFunc = (
1515
sqlFuncName: string,
1616
params: SqlParams
17-
) => Promise<CommonResType>
17+
) => Promise<CommonResType>
18+
19+
export type ChangeValue = {
20+
database?: string,
21+
table?: string,
22+
time?: string | number,
23+
queryKind?: string,
24+
user?: string,
25+
type?: string,
26+
option?: {
27+
duration: string,
28+
name: string,
29+
value: number | string
30+
}
31+
}

0 commit comments

Comments
 (0)