Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Microservices Testing Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tesis-testing-microservicios
Microservices Testing Frontend
Commits
cd3750fe
Commit
cd3750fe
authored
1 year ago
by
brunoravera
Browse files
Options
Downloads
Patches
Plain Diff
delete pattern confirm dialog
parent
4ba0b1ef
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
web/src/pages/Patterns/patterns.tsx
+1
-1
1 addition, 1 deletion
web/src/pages/Patterns/patterns.tsx
web/src/pages/Patterns/remove-pattern/remove-pattern-icon-button.tsx
+56
-11
56 additions, 11 deletions
...es/Patterns/remove-pattern/remove-pattern-icon-button.tsx
with
57 additions
and
12 deletions
web/src/pages/Patterns/patterns.tsx
+
1
−
1
View file @
cd3750fe
...
...
@@ -124,7 +124,7 @@ const ActionsRow: React.FC<ActionsRowProps> = ({ pattern }) => {
variant
=
"unstyled"
icon
=
{
<
Icon
as
=
{
FaEdit
}
/>
}
/>
<
RemovePatternIconButton
pattern
Id
=
{
pattern
.
id
}
/>
<
RemovePatternIconButton
pattern
=
{
pattern
}
/>
</
HStack
>
)
}
This diff is collapsed.
Click to expand it.
web/src/pages/Patterns/remove-pattern/remove-pattern-icon-button.tsx
+
56
−
11
View file @
cd3750fe
import
React
from
'
react
'
import
{
IconButtonProps
,
IconButton
,
Icon
}
from
'
@chakra-ui/react
'
import
{
IconButtonProps
,
IconButton
,
Icon
,
useDisclosure
,
AlertDialog
,
AlertDialogOverlay
,
AlertDialogContent
,
AlertDialogHeader
,
AlertDialogBody
,
AlertDialogFooter
,
Button
,
Text
,
}
from
'
@chakra-ui/react
'
import
{
FaTrash
}
from
'
react-icons/fa
'
import
{
DeletePatternMutation
,
GetPatternsQuery
}
from
'
../query-builder
'
import
{
useQueryClient
}
from
'
react-query
'
import
{
Pattern
}
from
'
src/models
'
export
type
RemovePatternIconButtonProps
=
{
pattern
Id
:
string
pattern
:
Pattern
}
&
Partial
<
IconButtonProps
>
export
const
RemovePatternIconButton
:
React
.
FC
<
RemovePatternIconButtonProps
>
=
({
pattern
Id
,
...
props
})
=>
{
>
=
({
pattern
,
...
props
})
=>
{
const
queryClient
=
useQueryClient
()
const
{
isOpen
,
onOpen
,
onClose
}
=
useDisclosure
()
const
cancelRef
=
React
.
useRef
<
HTMLButtonElement
>
(
null
)
const
deletePatternMutation
=
DeletePatternMutation
.
useMutation
({
onSuccess
:
()
=>
{
...
...
@@ -21,15 +37,44 @@ export const RemovePatternIconButton: React.FC<
})
const
handleDeletePattern
=
()
=>
{
deletePatternMutation
.
mutate
({
id
:
pattern
I
d
})
deletePatternMutation
.
mutate
({
id
:
pattern
.
i
d
})
}
return
(
<
IconButton
aria-label
=
"view pattern"
variant
=
"unstyled"
icon
=
{
<
Icon
as
=
{
FaTrash
}
/>
}
{
...
props
}
onClick
=
{
handleDeletePattern
}
/>
<>
<
IconButton
aria-label
=
"view pattern"
variant
=
"unstyled"
icon
=
{
<
Icon
as
=
{
FaTrash
}
/>
}
{
...
props
}
onClick
=
{
onOpen
}
/>
<
AlertDialog
isOpen
=
{
isOpen
}
onClose
=
{
onClose
}
leastDestructiveRef
=
{
cancelRef
}
>
<
AlertDialogOverlay
>
<
AlertDialogContent
>
<
AlertDialogHeader
fontSize
=
"lg"
fontWeight
=
"bold"
>
Eliminar este patron?
</
AlertDialogHeader
>
<
AlertDialogBody
>
<
Text
>
Si eliminas el patron
<
Text
as
=
"b"
>
{
pattern
.
title
}
</
Text
>
todos
sus datos asociados seran eliminados.
</
Text
>
</
AlertDialogBody
>
<
AlertDialogFooter
>
<
Button
ref
=
{
cancelRef
}
variant
=
"ghost"
onClick
=
{
onClose
}
>
Cancelar
</
Button
>
<
Button
variant
=
"solid"
onClick
=
{
handleDeletePattern
}
ml
=
"3"
>
Eliminar
</
Button
>
</
AlertDialogFooter
>
</
AlertDialogContent
>
</
AlertDialogOverlay
>
</
AlertDialog
>
</>
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment