@@ -10,7 +10,7 @@ import { AppContext } from '../../../shared/context';
10
10
import * as models from '../../../shared/models' ;
11
11
import { services } from '../../../shared/services' ;
12
12
import { ApplicationCreationWizardContainer , NewAppParams , WizardStepState } from '../application-creation-wizard/application-creation-wizard' ;
13
- import { ComparisonStatusIcon , HealthStatusIcon } from '../utils' ;
13
+ import * as AppUtils from '../utils' ;
14
14
15
15
require ( './applications-list.scss' ) ;
16
16
@@ -132,13 +132,13 @@ export class ApplicationsList extends React.Component<Props, State> {
132
132
< div className = 'row' >
133
133
< div className = 'columns small-3' > Status:</ div >
134
134
< div className = 'columns small-9' >
135
- < ComparisonStatusIcon status = { app . status . comparisonResult . status } /> { app . status . comparisonResult . status }
135
+ < AppUtils . ComparisonStatusIcon status = { app . status . comparisonResult . status } /> { app . status . comparisonResult . status }
136
136
</ div >
137
137
</ div >
138
138
< div className = 'row' >
139
139
< div className = 'columns small-3' > Health:</ div >
140
140
< div className = 'columns small-9' >
141
- < HealthStatusIcon state = { app . status . health } /> { app . status . health . status }
141
+ < AppUtils . HealthStatusIcon state = { app . status . health } /> { app . status . health . status }
142
142
</ div >
143
143
</ div >
144
144
< div className = 'row' >
@@ -167,7 +167,7 @@ export class ApplicationsList extends React.Component<Props, State> {
167
167
< button className = 'argo-button argo-button--base-o' > Actions < i className = 'fa fa-caret-down' /> </ button >
168
168
} items = { [
169
169
{ title : 'Sync' , action : ( ) => this . syncApplication ( app . metadata . name , 'HEAD' ) } ,
170
- { title : 'Delete' , action : ( ) => this . deleteApplication ( app . metadata . name , false ) } ,
170
+ { title : 'Delete' , action : ( ) => this . deleteApplication ( app . metadata . name ) } ,
171
171
] } />
172
172
</ div >
173
173
</ div >
@@ -263,18 +263,9 @@ export class ApplicationsList extends React.Component<Props, State> {
263
263
}
264
264
}
265
265
266
- private async deleteApplication ( appName : string , force : boolean ) {
267
- const confirmed = await this . appContext . apis . popup . confirm ( 'Delete application' , `Are your sure you want to delete application '${ appName } '?` ) ;
268
- if ( confirmed ) {
269
- try {
270
- await services . applications . delete ( appName , force ) ;
271
- this . appContext . router . history . push ( '/applications' ) ;
272
- } catch ( e ) {
273
- this . appContext . apis . notifications . show ( {
274
- content : < ErrorNotification title = 'Unable to delete application' e = { e } /> ,
275
- type : NotificationType . Error ,
276
- } ) ;
277
- }
278
- }
266
+ private async deleteApplication ( appName : string ) {
267
+ AppUtils . deleteApplication ( appName , this . appContext , ( ) => {
268
+ this . appContext . router . history . push ( '/applications' ) ;
269
+ } ) ;
279
270
}
280
271
}
0 commit comments