@@ -22,7 +22,7 @@ import {
22
22
StatusIndicatorProps ,
23
23
Table ,
24
24
} from '@cloudscape-design/components' ;
25
- import { disableAlarms , enableAlarms , getAlarmList } from 'apis/resource' ;
25
+ import { getAlarmList } from 'apis/resource' ;
26
26
import React , { useEffect , useState } from 'react' ;
27
27
import { useTranslation } from 'react-i18next' ;
28
28
import { buildAlarmsLink } from 'ts/url' ;
@@ -49,8 +49,6 @@ const AlarmTable: React.FC<AlarmTableProps> = (props: AlarmTableProps) => {
49
49
const [ currentPage , setCurrentPage ] = useState ( 1 ) ;
50
50
const [ totalCount , setTotalCount ] = useState ( 0 ) ;
51
51
const [ alarmList , setAlarmList ] = useState < IAlarm [ ] > ( [ ] ) ;
52
- const [ loadingEnable , setLoadingEnable ] = useState ( false ) ;
53
- const [ loadingDisable , setLoadingDisable ] = useState ( false ) ;
54
52
55
53
const listAlarms = async ( ) => {
56
54
setLoadingData ( true ) ;
@@ -71,46 +69,6 @@ const AlarmTable: React.FC<AlarmTableProps> = (props: AlarmTableProps) => {
71
69
}
72
70
} ;
73
71
74
- const enableAlarm = async ( item ?: IAlarm ) => {
75
- setLoadingEnable ( true ) ;
76
- try {
77
- const alarmNames = item
78
- ? [ item ?. AlarmName ]
79
- : selectedItems . map ( ( item ) => item . AlarmName ) ;
80
- const resData : ApiResponse < null > = await enableAlarms ( {
81
- region,
82
- alarmNames,
83
- } ) ;
84
- if ( resData . success ) {
85
- setSelectedItems ( [ ] ) ;
86
- listAlarms ( ) ;
87
- setLoadingEnable ( false ) ;
88
- }
89
- } catch ( error ) {
90
- setLoadingEnable ( false ) ;
91
- }
92
- } ;
93
-
94
- const disableAlarm = async ( item ?: IAlarm ) => {
95
- setLoadingDisable ( true ) ;
96
- try {
97
- const alarmNames = item
98
- ? [ item ?. AlarmName ]
99
- : selectedItems . map ( ( item ) => item . AlarmName ) ;
100
- const resData : ApiResponse < null > = await disableAlarms ( {
101
- region,
102
- alarmNames,
103
- } ) ;
104
- if ( resData . success ) {
105
- setSelectedItems ( [ ] ) ;
106
- listAlarms ( ) ;
107
- setLoadingDisable ( false ) ;
108
- }
109
- } catch ( error ) {
110
- setLoadingDisable ( false ) ;
111
- }
112
- } ;
113
-
114
72
useEffect ( ( ) => {
115
73
listAlarms ( ) ;
116
74
} , [ currentPage ] ) ;
@@ -234,24 +192,6 @@ const AlarmTable: React.FC<AlarmTableProps> = (props: AlarmTableProps) => {
234
192
listAlarms ( ) ;
235
193
} }
236
194
/>
237
- < Button
238
- loading = { loadingEnable }
239
- disabled = { selectedItems . length <= 0 }
240
- onClick = { ( ) => {
241
- enableAlarm ( ) ;
242
- } }
243
- >
244
- { t ( 'button.enableAll' ) }
245
- </ Button >
246
- < Button
247
- loading = { loadingDisable }
248
- disabled = { selectedItems . length <= 0 }
249
- onClick = { ( ) => {
250
- disableAlarm ( ) ;
251
- } }
252
- >
253
- { t ( 'button.disableAll' ) }
254
- </ Button >
255
195
< Button
256
196
href = { buildAlarmsLink ( region , projectId ) }
257
197
iconAlign = "right"
0 commit comments