@@ -498,9 +498,9 @@ export class ContextsManager {
498
498
const ns = namespace ?? this . currentContext . getNamespace ( ) ;
499
499
try {
500
500
const result = await handler . deleteObject ( this . currentContext , name , ns ) ;
501
- this . handleResult ( result ) ;
501
+ this . handleResult ( result , `deletion of ${ kind } ${ name } ` ) ;
502
502
} catch ( error : unknown ) {
503
- this . handleApiException ( error ) ;
503
+ this . handleApiException ( error , `deletion of ${ kind } ${ name } ` ) ;
504
504
}
505
505
}
506
506
@@ -534,14 +534,14 @@ export class ContextsManager {
534
534
return handler . restartObject ( this . currentContext , name , ns ) ;
535
535
}
536
536
537
- private handleResult ( result : KubernetesObject | V1Status ) : void {
537
+ private handleResult ( result : KubernetesObject | V1Status , actionMsg : string ) : void {
538
538
if ( this . isV1Status ( result ) ) {
539
- this . handleStatus ( result ) ;
539
+ this . handleStatus ( result , actionMsg ) ;
540
540
}
541
541
// Ignore if result is a KubernetesObject
542
542
}
543
543
544
- private handleApiException ( error : unknown ) : void {
544
+ private handleApiException ( error : unknown , actionMsg : string ) : void {
545
545
if ( error instanceof ApiException ) {
546
546
const statusError = error as ApiException < string > ;
547
547
let status : unknown ;
@@ -551,7 +551,7 @@ export class ContextsManager {
551
551
throw error ;
552
552
}
553
553
if ( this . isV1Status ( status ) ) {
554
- this . handleStatus ( status ) ;
554
+ this . handleStatus ( status , actionMsg ) ;
555
555
} else {
556
556
throw error ;
557
557
}
@@ -570,9 +570,13 @@ export class ContextsManager {
570
570
) ;
571
571
}
572
572
573
- protected handleStatus ( status : V1Status ) : void {
574
- console . error ( 'status' , status ) ;
575
- // TODO: https://github.com/podman-desktop/extension-kubernetes-dashboard/issues/103
573
+ protected handleStatus ( status : V1Status , actionMsg : string ) : void {
574
+ window . showNotification ( {
575
+ title : actionMsg ,
576
+ body : status . message ,
577
+ type : 'error' ,
578
+ highlight : true ,
579
+ } ) ;
576
580
}
577
581
578
582
async deleteObjects ( objects : { kind : string ; name : string ; namespace ?: string } [ ] ) : Promise < void > {
@@ -805,9 +809,9 @@ export class ContextsManager {
805
809
undefined , // force
806
810
PatchStrategy . StrategicMergePatch ,
807
811
) ;
808
- this . handleResult ( result ) ;
812
+ this . handleResult ( result , `patch of ${ manifest . kind } ${ manifest . metadata ?. name } ` ) ;
809
813
} catch ( error : unknown ) {
810
- this . handleApiException ( error ) ;
814
+ this . handleApiException ( error , `patch of ${ manifest . kind } ${ manifest . metadata ?. name } ` ) ;
811
815
}
812
816
}
813
817
}
0 commit comments