-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show ActionsMenu on resource hover
- Loading branch information
1 parent
27cf32c
commit 8044d7d
Showing
2 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/components/molecules/NavigatorRowLabel/ActionsMenu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import {Menu} from 'antd'; | ||
import {K8sResource} from '@models/k8sresource'; | ||
import {useAppDispatch} from '@redux/hooks'; | ||
import {removeResource} from '@redux/reducers/main'; | ||
|
||
const ActionsMenu = (props: {resource: K8sResource}) => { | ||
const {resource} = props; | ||
const dispatch = useAppDispatch(); | ||
|
||
const deleteResource = () => { | ||
dispatch(removeResource(resource.id)); | ||
}; | ||
|
||
return ( | ||
<Menu> | ||
<Menu.Item onClick={deleteResource} key="delete"> | ||
Delete | ||
</Menu.Item> | ||
</Menu> | ||
); | ||
}; | ||
|
||
export default ActionsMenu; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters