11import { Button , Menu , MenuItem } from '@ui5/webcomponents-react' ;
2- import { useToast } from '../../context/ToastContext.tsx' ;
2+
33import { useRef , useState } from 'react' ;
44import '@ui5/webcomponents-icons/dist/copy' ;
55import '@ui5/webcomponents-icons/dist/accept' ;
6- import { useMcp } from '../../lib/shared/McpContext.tsx' ;
6+
77import { useTranslation } from 'react-i18next' ;
88
99export const ControlPlanesListMenu = ( ) => {
1010 const popoverRef = useRef ( null ) ;
1111 const [ open , setOpen ] = useState ( false ) ;
12- const { show } = useToast ( ) ;
12+
1313 const { t } = useTranslation ( ) ;
1414
1515 // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -21,7 +21,6 @@ export const ControlPlanesListMenu = () => {
2121 setOpen ( ( prev ) => ! prev ) ;
2222 }
2323 } ;
24- const mcp = useMcp ( ) ;
2524
2625 return (
2726 < >
@@ -30,19 +29,9 @@ export const ControlPlanesListMenu = () => {
3029 ref = { popoverRef }
3130 open = { open }
3231 onItemClick = { ( event ) => {
33- if ( event . detail . item . dataset . action === 'download' ) {
34- DownloadKubeconfig ( mcp . kubeconfig , mcp . name ) ;
35- return ;
32+ if ( event . detail . item . dataset . action === 'newManagedControlPlane' ) {
3633 }
37- if ( event . detail . item . dataset . action === 'copy' ) {
38- try {
39- navigator . clipboard . writeText ( mcp . kubeconfig ?? '' ) ;
40- show ( t ( 'CopyKubeconfigButton.copiedMessage' ) ) ;
41- } catch ( error ) {
42- //TODO: handle error, show error to user
43- show ( `${ t ( 'CopyKubeconfigButton.failedMessage' ) } ${ error } ` ) ;
44- console . error ( error ) ;
45- }
34+ if ( event . detail . item . dataset . action === 'deleteWorkspace' ) {
4635 }
4736
4837 setOpen ( false ) ;
@@ -64,28 +53,3 @@ export const ControlPlanesListMenu = () => {
6453 </ >
6554 ) ;
6655} ;
67-
68- // eslint-disable-next-line @typescript-eslint/no-explicit-any
69- export function DownloadKubeconfig ( config : any , displayName : string ) {
70- const filename = 'kubeconfig-' + displayName + '.yaml' ;
71-
72- try {
73- const file = new File ( [ config ] , filename , {
74- type : 'application/yaml' ,
75- } ) ;
76-
77- const link = document . createElement ( 'a' ) ;
78- const url = URL . createObjectURL ( file ) ;
79-
80- link . href = url ;
81- link . download = file . name ;
82- document . body . appendChild ( link ) ;
83- link . click ( ) ;
84-
85- document . body . removeChild ( link ) ;
86- window . URL . revokeObjectURL ( url ) ;
87- } catch ( error ) {
88- console . error ( error ) ;
89- }
90- // dynaLeaveAction(id);
91- }
0 commit comments