17
17
*
18
18
*/
19
19
20
- import { cancelTask } from '@/pages/DataStudio/HeaderContainer/service' ;
21
- import { JOB_LIFE_CYCLE } from '@/pages/DevOps/constants' ;
22
- import { isStatusDone } from '@/pages/DevOps/function' ;
23
- import { getData , postAll } from '@/services/api' ;
24
- import { API_CONSTANTS } from '@/services/endpoints' ;
25
- import { Jobs } from '@/types/DevOps/data' ;
26
- import { l } from '@/utils/intl' ;
27
- import { EllipsisOutlined , RedoOutlined } from '@ant-design/icons' ;
28
- import { Button , Dropdown , message , Modal , Space } from 'antd' ;
20
+ import { cancelTask , restartTask , savePointTask } from '@/pages/DataStudio/HeaderContainer/service' ;
21
+ import { JOB_LIFE_CYCLE } from '@/pages/DevOps/constants' ;
22
+ import { isStatusDone } from '@/pages/DevOps/function' ;
23
+ import { getData , postAll } from '@/services/api' ;
24
+ import { API_CONSTANTS } from '@/services/endpoints' ;
25
+ import { Jobs } from '@/types/DevOps/data' ;
26
+ import { l } from '@/utils/intl' ;
27
+ import { EllipsisOutlined , RedoOutlined } from '@ant-design/icons' ;
28
+ import { Button , Dropdown , message , Modal , Space } from 'antd' ;
29
29
30
30
const operatorType = {
31
31
RESTART_JOB : 'restart' ,
@@ -40,52 +40,37 @@ export type OperatorType = {
40
40
refesh : ( isForce : boolean ) => void ;
41
41
} ;
42
42
const JobOperator = ( props : OperatorType ) => {
43
- const { jobDetail, refesh } = props ;
43
+ const { jobDetail, refesh} = props ;
44
44
const webUri = `/api/flink/${ jobDetail ?. history ?. jobManagerAddress } /#/job/running/${ jobDetail ?. instance ?. jid } /overview` ;
45
45
46
46
const handleJobOperator = ( key : string ) => {
47
47
Modal . confirm ( {
48
- title : l ( 'devops.jobinfo.job.key' , '' , { key : key } ) ,
49
- content : l ( 'devops.jobinfo.job.keyConfirm' , '' , { key : key } ) ,
48
+ title : l ( 'devops.jobinfo.job.key' , '' , { key : key } ) ,
49
+ content : l ( 'devops.jobinfo.job.keyConfirm' , '' , { key : key } ) ,
50
50
okText : l ( 'button.confirm' ) ,
51
51
cancelText : l ( 'button.cancel' ) ,
52
52
onOk : async ( ) => {
53
53
if ( key == operatorType . CANCEL_JOB ) {
54
- postAll ( API_CONSTANTS . CANCEL_JOB , {
55
- clusterId : jobDetail ?. clusterInstance ?. id ,
56
- jobId : jobDetail ?. instance ?. jid
57
- } ) ;
54
+ cancelTask ( '' , jobDetail ?. instance ?. taskId , false ) ;
58
55
} else if ( key == operatorType . RESTART_JOB ) {
59
- getData ( API_CONSTANTS . RESTART_TASK , {
60
- id : jobDetail ?. instance ?. taskId ,
61
- isOnLine : jobDetail ?. instance ?. step == JOB_LIFE_CYCLE . PUBLISH
62
- } ) ;
56
+ restartTask ( '' , jobDetail ?. instance ?. taskId , jobDetail ?. instance ?. step == JOB_LIFE_CYCLE . PUBLISH )
63
57
} else if ( key == operatorType . SAVEPOINT_CANCEL ) {
64
- getData ( API_CONSTANTS . SAVEPOINT , {
65
- taskId : jobDetail ?. instance ?. taskId ,
66
- savePointType : 'cancel'
67
- } ) ;
58
+ savePointTask ( '' , jobDetail ?. instance ?. taskId , 'cancel' )
68
59
} else if ( key == operatorType . SAVEPOINT_STOP ) {
69
- getData ( API_CONSTANTS . SAVEPOINT , {
70
- taskId : jobDetail ?. instance ?. taskId ,
71
- savePointType : 'stop'
72
- } ) ;
60
+ savePointTask ( '' , jobDetail ?. instance ?. taskId , 'stop' )
73
61
} else if ( key == operatorType . SAVEPOINT_TRIGGER ) {
74
- getData ( API_CONSTANTS . SAVEPOINT , {
75
- taskId : jobDetail ?. instance ?. taskId ,
76
- savePointType : 'trigger'
77
- } ) ;
78
- } else {
62
+ savePointTask ( '' , jobDetail ?. instance ?. taskId , 'trigger' )
63
+ } else if ( key == operatorType . AUTO_STOP ) {
79
64
cancelTask ( '' , jobDetail ?. instance ?. taskId ) ;
80
65
}
81
- message . success ( l ( 'devops.jobinfo.job.key.success' , '' , { key : key } ) ) ;
66
+ message . success ( l ( 'devops.jobinfo.job.key.success' , '' , { key : key } ) ) ;
82
67
}
83
68
} ) ;
84
69
} ;
85
70
86
71
return (
87
72
< Space >
88
- < Button icon = { < RedoOutlined /> } onClick = { ( ) => refesh ( true ) } />
73
+ < Button icon = { < RedoOutlined /> } onClick = { ( ) => refesh ( true ) } />
89
74
90
75
< Button key = 'flinkwebui' href = { webUri } target = { '_blank' } >
91
76
FlinkWebUI
@@ -131,12 +116,16 @@ const JobOperator = (props: OperatorType) => {
131
116
{
132
117
key : operatorType . SAVEPOINT_CANCEL ,
133
118
label : l ( 'devops.jobinfo.savepoint.cancel' )
119
+ } ,
120
+ {
121
+ key : operatorType . CANCEL_JOB ,
122
+ label : l ( 'devops.jobinfo.savepoint.canceljob' )
134
123
}
135
124
]
136
125
} }
137
126
>
138
- < Button key = '4' style = { { padding : '0 8px' } } >
139
- < EllipsisOutlined />
127
+ < Button key = '4' style = { { padding : '0 8px' } } >
128
+ < EllipsisOutlined />
140
129
</ Button >
141
130
</ Dropdown >
142
131
</ >
0 commit comments