diff --git a/src/api.js b/src/api.js
index fe4ead48..c8ffb257 100644
--- a/src/api.js
+++ b/src/api.js
@@ -81,6 +81,7 @@ const endpoints = {
authConfig: `/v2/_zot/ext/mgmt`,
openidAuth: `/zot/auth/login`,
logout: `/zot/auth/logout`,
+ deleteImage: (name, tag) => `/v2/${name}/manifests/${tag}`,
repoList: ({ pageNumber = 1, pageSize = 15 } = {}) =>
`/v2/_zot/ext/search?query={RepoListWithNewestImage(requestedPage: {limit:${pageSize} offset:${
(pageNumber - 1) * pageSize
diff --git a/src/components/Repo/RepoDetails.jsx b/src/components/Repo/RepoDetails.jsx
index f6d50f8b..c4d39522 100644
--- a/src/components/Repo/RepoDetails.jsx
+++ b/src/components/Repo/RepoDetails.jsx
@@ -158,7 +158,13 @@ const randomImage = () => {
return imageArray[randomIntFromInterval(0, 3)];
};
+function useRerender() {
+ const [, setToggle] = useState(false);
+ return () => setToggle((toggle) => !toggle && console.log('yeah'));
+}
+
function RepoDetails() {
+ const rerender = useRerender();
const [repoDetailData, setRepoDetailData] = useState({});
const [tags, setTags] = useState([]);
const placeholderImage = useRef(randomImage());
@@ -317,7 +323,7 @@ function RepoDetails() {
-
+
diff --git a/src/components/Repo/Tabs/Tags.jsx b/src/components/Repo/Tabs/Tags.jsx
index 808d55f5..824e2fd6 100644
--- a/src/components/Repo/Tabs/Tags.jsx
+++ b/src/components/Repo/Tabs/Tags.jsx
@@ -43,7 +43,7 @@ const useStyles = makeStyles(() => ({
export default function Tags(props) {
const classes = useStyles();
- const { tags } = props;
+ const { tags, repoName, rerender } = props;
const [tagsFilter, setTagsFilter] = useState('');
const [sortFilter, setSortFilter] = useState(tagsSortByCriteria.updateTimeDesc.value);
@@ -59,10 +59,12 @@ export default function Tags(props) {
return (
);
})
diff --git a/src/components/Shared/ConfirmDialog.jsx b/src/components/Shared/ConfirmDialog.jsx
new file mode 100644
index 00000000..1cb49968
--- /dev/null
+++ b/src/components/Shared/ConfirmDialog.jsx
@@ -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 (
+
+ );
+}
diff --git a/src/components/Shared/DeleteTag.jsx b/src/components/Shared/DeleteTag.jsx
new file mode 100644
index 00000000..3fa14128
--- /dev/null
+++ b/src/components/Shared/DeleteTag.jsx
@@ -0,0 +1,48 @@
+import * as React from 'react';
+import { Button } from '@mui/material';
+
+// 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, rerender } = 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(() => {
+ console.log('delete successfully');
+ rerender();
+ })
+ .catch((err) => {
+ console.error(err);
+ });
+ };
+
+ const onConfirm = () => {
+ console.log(`repo: ${repo}, tag: ${tag}`);
+ deleteTag(repo, tag);
+ };
+
+ return (
+
+
+
+
+ );
+}
diff --git a/src/components/Shared/TagCard.jsx b/src/components/Shared/TagCard.jsx
index f2eb7624..f49e4589 100644
--- a/src/components/Shared/TagCard.jsx
+++ b/src/components/Shared/TagCard.jsx
@@ -1,11 +1,13 @@
import React, { useState } from 'react';
import { makeStyles } from '@mui/styles';
import { useNavigate } from 'react-router-dom';
-import { Box, Card, CardContent, Collapse, Grid, Stack, Tooltip, Typography, Divider } from '@mui/material';
+import { Box, Card, CardContent, Collapse, Grid, Stack, IconButton, Tooltip, Typography, Divider } from '@mui/material';
import { Markdown } from 'utilities/MarkdowntojsxWrapper';
import transform from 'utilities/transform';
import { DateTime } from 'luxon';
import { KeyboardArrowDown, KeyboardArrowRight } from '@mui/icons-material';
+import DeleteIcon from '@mui/icons-material/Delete';
+import DeleteTag from 'components/Shared/DeleteTag';
const useStyles = makeStyles((theme) => ({
card: {
@@ -78,9 +80,10 @@ const useStyles = makeStyles((theme) => ({
}));
export default function TagCard(props) {
- const { repoName, tag, lastUpdated, vendor, manifests } = props;
+ const { repoName, tag, lastUpdated, vendor, manifests, rerender } = props;
const [open, setOpen] = useState(false);
+
const classes = useStyles();
const lastDate = lastUpdated
@@ -99,9 +102,16 @@ export default function TagCard(props) {
return (
-
- Tag
-
+
+
+ Tag
+
+
+
+
+
+
+
goToTags()}>
{repoName && `${repoName}:`}
{tag}
diff --git a/src/host.js b/src/host.js
index 582b6ac4..18d5bf52 100644
--- a/src/host.js
+++ b/src/host.js
@@ -1,5 +1,5 @@
const hostConfig = {
- auto: true,
+ auto: false,
default: 'http://localhost:5000'
};