-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Petu Eusebiu <[email protected]>
- Loading branch information
1 parent
d9370fb
commit 3a1ea9c
Showing
7 changed files
with
99 additions
and
8 deletions.
There are no files selected for viewing
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
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
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
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,29 @@ | ||
import * as React from 'react'; | ||
|
||
// components | ||
import { Button, Dialog, DialogTitle, DialogActions } from '@mui/material'; | ||
|
||
export default function ConfirmDialog(props) { | ||
const { onClose, open, title, onConfirm } = props; | ||
|
||
return ( | ||
<Dialog onClose={onClose} open={open} color="primary"> | ||
<DialogTitle> {title} </DialogTitle> | ||
<DialogActions> | ||
<Button variant="contained" onClick={() => onClose()} color="primary"> | ||
No | ||
</Button> | ||
<Button | ||
color="primary" | ||
variant="contained" | ||
onClick={() => { | ||
onConfirm(); | ||
onClose(); | ||
}} | ||
> | ||
Yes | ||
</Button> | ||
</DialogActions> | ||
</Dialog> | ||
); | ||
} |
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,49 @@ | ||
import * as React from 'react'; | ||
import { IconButton } from '@mui/material'; | ||
import DeleteIcon from '@mui/icons-material/Delete'; | ||
|
||
// utility | ||
import { api, endpoints } from '../../api'; | ||
|
||
// components | ||
import ConfirmDialog from 'components/Shared/ConfirmDialog'; | ||
import { host } from '../../host'; | ||
|
||
export default function DeleteTag(props) { | ||
const { repo, tag, handleDeleteTag } = props; | ||
const [open, setOpen] = React.useState(false); | ||
|
||
const handleClickOpen = () => { | ||
setOpen(true); | ||
}; | ||
|
||
const handleClose = () => { | ||
setOpen(false); | ||
}; | ||
|
||
const deleteTag = (repo, tag) => { | ||
api | ||
.delete(`${host()}${endpoints.deleteImage(repo, tag)}`) | ||
.then((response) => { | ||
if (response && response.status == 202) { | ||
handleDeleteTag(tag); | ||
} | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
}); | ||
}; | ||
|
||
const onConfirm = () => { | ||
deleteTag(repo, tag); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<IconButton onClick={handleClickOpen}> | ||
<DeleteIcon /> | ||
</IconButton> | ||
<ConfirmDialog onClose={handleClose} open={open} title={`Delete ${repo}:${tag} ?`} onConfirm={onConfirm} /> | ||
</div> | ||
); | ||
} |
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
const hostConfig = { | ||
auto: true, | ||
auto: false, | ||
default: 'http://localhost:5000' | ||
}; | ||
|
||
|