diff --git a/src/components/navbar/NavBar.tsx b/src/components/navbar/NavBar.tsx
index 9f4b6ab..ba076c1 100644
--- a/src/components/navbar/NavBar.tsx
+++ b/src/components/navbar/NavBar.tsx
@@ -9,6 +9,7 @@ import { loginInfo } from "../../context/AuthProvider";
import Tag from "../../interfaces/Tag";
import Repository from "../../interfaces/Repositoriy";
import Layer from "../../interfaces/Layer";
+import { getHostNameFromURL } from "../../utils";
const NavBar: React.FC = () => {
const { auth } = useAuth();
@@ -22,8 +23,7 @@ const NavBar: React.FC = () => {
const handleClick = () => {
const url = process.env.REGISTRY_URL ? process.env.REGISTRY_URL : "";
- const urlSplit = url.split('/');
- navigator.clipboard.writeText(urlSplit[urlSplit.length - 1]);
+ navigator.clipboard.writeText(getHostNameFromURL(url));
setSnackbarOpen(true);
};
diff --git a/src/components/repositoryInfo/RepositoryInfo.tsx b/src/components/repositoryInfo/RepositoryInfo.tsx
index 9dfcca5..cc238f8 100644
--- a/src/components/repositoryInfo/RepositoryInfo.tsx
+++ b/src/components/repositoryInfo/RepositoryInfo.tsx
@@ -1,19 +1,79 @@
import React from "react";
import { useLocation } from "react-router-dom";
-import { ListItemButton, Box, Typography, Grid, ListItemText } from "@mui/material";
+import { ListItemButton, Button, Box, Card, CardContent, Typography, CardActions, Grid, ListItemText, Snackbar, Alert } from "@mui/material";
+import AccessTimeIcon from '@mui/icons-material/AccessTime';
import useRepositories from "../../hooks/useRepositories";
import Tag from "../../interfaces/Tag";
import Repository from "../../interfaces/Repositoriy";
+import { getHostNameFromURL, printSize, printTimePassed } from "../../utils";
import NotFound from "../NotFound";
const RepositoryInfo: React.FC = () => {
const location = useLocation();
const path = location.pathname;
const { repositories } = useRepositories();
+ const [snackbarOpen, setSnackbarOpen] = React.useState(false);
const repository = repositories.find((element) => (element.name === path.slice(12,path.length)));
+
+ const generatePushCommand = (hostName: string) => {
+ return "docker push " + hostName + "/" + (repository?.name ? repository?.name : "") + ":tagname";
+ }
+
+ const handleClick = () => {
+ const hostName = getHostNameFromURL(process.env.REGISTRY_URL ? process.env.REGISTRY_URL : "");
+ navigator.clipboard.writeText(generatePushCommand(hostName));
+ setSnackbarOpen(true);
+ };
+
+ const handleClose = () => {
+ setSnackbarOpen(false);
+ };
return (repository ? (
-
{repository?.tags.map((tag) => (tag.label)).join(" ")}
+
+
+
+ {/*
+ Word of the Day
+ */}
+
+ {repository.name}
+
+
+
+ {"Last updated: " + repository.tags.filter((tag: Tag) => (tag.label === "latest")).map((tag: Tag) => (tag.created ? printTimePassed(tag.created) : "")).join(" ")}
+
+
+ Docker commands
+
+
+ To push a new tag to this repository,
+
+ {generatePushCommand(getHostNameFromURL(process.env.REGISTRY_URL ? process.env.REGISTRY_URL : ""))}
+
+ {/*
+
+ */}
+
+
+ Copied!
+
+
+
+
+
+
+ Tags
+
+
+ {"This repository contains " + repository.tags.length + " tag" + (repository.tags.length > 1 ? "s" : "") + "."}
+
+
+
+
+
+
+
) : (
));
diff --git a/src/style/modules/_modules-dir.sass b/src/style/modules/_modules-dir.sass
index a8d3bb8..791e71c 100644
--- a/src/style/modules/_modules-dir.sass
+++ b/src/style/modules/_modules-dir.sass
@@ -1,3 +1,4 @@
@import "sectionHome"
+@import "repositoryInfo"
@import "login"
@import "URL"
\ No newline at end of file
diff --git a/src/style/modules/_repositoryInfo.sass b/src/style/modules/_repositoryInfo.sass
new file mode 100644
index 0000000..adabc36
--- /dev/null
+++ b/src/style/modules/_repositoryInfo.sass
@@ -0,0 +1,19 @@
+.repositoryInfo
+ .repositoryDetail
+ margin: 5%
+ padding: 15px
+ .lines
+ margin-bottom: 10px
+ .clock-icon
+ vertical-align: middle
+ margin-right: 10px
+ .commandDisplay
+ line-height: 300%
+ border-radius: 5px
+ padding: 0 15px
+ margin-top: 5px
+ .tagsDetail
+ margin: 5%
+ padding: 15px
+ .lines
+ margin-bottom: 10px
\ No newline at end of file
diff --git a/src/style/style.css b/src/style/style.css
index 2e4792f..3f3d513 100644
--- a/src/style/style.css
+++ b/src/style/style.css
@@ -24,6 +24,36 @@ a {
margin: auto;
}
+.repositoryInfo .repositoryDetail {
+ margin: 5%;
+ padding: 15px;
+}
+
+.repositoryInfo .repositoryDetail .lines {
+ margin-bottom: 10px;
+}
+
+.repositoryInfo .repositoryDetail .clock-icon {
+ vertical-align: middle;
+ margin-right: 10px;
+}
+
+.repositoryInfo .repositoryDetail .commandDisplay {
+ line-height: 300%;
+ border-radius: 5px;
+ padding: 0 15px;
+ margin-top: 5px;
+}
+
+.repositoryInfo .tagsDetail {
+ margin: 5%;
+ padding: 15px;
+}
+
+.repositoryInfo .tagsDetail .lines {
+ margin-bottom: 10px;
+}
+
.login .grid-container {
-webkit-box-align: center;
-ms-flex-align: center;
diff --git a/src/style/style.css.map b/src/style/style.css.map
index 13adb72..ccc7fd3 100644
--- a/src/style/style.css.map
+++ b/src/style/style.css.map
@@ -1,6 +1,6 @@
{
"version": 3,
- "mappings": "AG8CA,AAAA,WAAW,CAAC;EACR,KAAK,EAAE,IAAI;CAAG;;AAElB,AAAA,CAAC,CAAC;EACE,eAAe,EAAE,IAAI;CAAG;;AElD5B,AAAA,OAAO,CAAC;EACJ,MAAM,EAAE,CAAC;CAKU;;AANvB,AAEI,OAFG,CAEH,SAAS,CAAC;EACN,KAAK,EAAE,KAAK;CAAG;;AAHvB,AAII,OAJG,CAIH,WAAW,CAAC;EACR,UAAU,EAAE,MAAM;EAClB,KAAK,EAAE,GAAG;CAAG;;AGNrB,AACI,YADQ,CACR,eAAe,CAAC;EACZ,SAAS,EAAE,GAAG;EACd,MAAM,EAAE,IAAI;CAAG;;ACHvB,AACI,MADE,CACF,eAAe,CAAC;EACZ,WAAW,EAAE,MAAM;EACnB,MAAM,EAAE,IAAI;EACZ,UAAU,EAAE,GAAG;EACf,SAAS,EAAE,cAAc;CAeS;;AApB1C,AAMQ,MANF,CACF,eAAe,GAKT,CAAC,CAAC;EACA,KAAK,EAAE,GAAG;EACV,MAAM,EAAE,MAAM;CAAG;;AAR7B,AASQ,MATF,CACF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iBAAiB,CAQb,eAAe,CAAC;EACZ,WAAW,EAAE,IAAI;EACjB,aAAa,EAAE,GAAG;EAClB,OAAO,EAAE,MAAM;EACf,UAAU,EAAE,GAAG;CAAG;;AAb9B,AAcI,eAdW,CAcX,WAAW,CAAC;EACR,MAAM,EAAE,EAAE;EACV,OAAO,EAAE,IAAI;CAEe;;AAlBpC,AAiBQ,eAjBO,CAcX,WAAW,CAGP,MAAM,CAAC;EACH,aAAa,EAAE,IAAI;CAAG;;AClBlC,AACI,MADE,CACF,eAAe,CAAC;EACZ,WAAW,EAAE,MAAM;EACnB,MAAM,EAAE,IAAI;EACZ,UAAU,EAAE,GAAG;EACf,SAAS,EAAE,cAAc;CAeS;;AApB1C,AAMQ,MANF,CACF,eAAe,GAKT,CAAC,CAAC;EACA,KAAK,EAAE,GAAG;EACV,MAAM,EAAE,MAAM;CAAG;;AAR7B,AASQ,MATF,CACF,eAAe,CAQX,YAAY,CAAC;EACT,OAAO,EAAE,YAAY;EACrB,UAAU,EAAE,MAAM;EAClB,MAAM,EAAE,IAAI;EACZ,SAAS,EAAE,IAAI;CAAG;;AAb9B,AAcQ,MAdF,CACF,eAAe,CAaX,UAAU,CAAC;EACP,MAAM,EAAE,IAAI;EACZ,KAAK,EAAE,GAAG;CACpB;;AAjBF,AAkBQ,MAlBF,CACF,eAAe,CAiBX,eAAe,CAAC;EACZ,MAAM,EAAE,IAAI;EACZ,gBAAgB,EAAE,OAAO;CAAG;;ACpBxC,AAAA,QAAQ,CAAC;EACL,SAAS,EAAE,GAAG;EACd,MAAM,EAAE,IAAI;EACZ,UAAU,EAAE,GAAG;CAEU;;AAL7B,AAII,QAJI,CAIJ,eAAe,CAAC;EACZ,UAAU,EAAE,IAAI;CAAG",
"sources": [
"style.sass",
"_variables.sass",
@@ -11,6 +11,7 @@
"layouts/_footer.sass",
"modules/_modules-dir.sass",
"modules/_sectionHome.sass",
+ "modules/_repositoryInfo.sass",
"modules/_login.sass",
"modules/_URL.sass"
],
diff --git a/src/utils.tsx b/src/utils.tsx
index 1c661c6..7a3e452 100644
--- a/src/utils.tsx
+++ b/src/utils.tsx
@@ -15,6 +15,11 @@ const checkValidURL = async (url: string) => {
return true;
}
+const getHostNameFromURL = (url: string): string => {
+ const urlSplit = url.split('/');
+ return urlSplit[urlSplit.length - 1];
+}
+
const printTwoDecimalPlaces = (num: number): string => {
return (Math.round(num * 100) / 100).toFixed(2);
}
@@ -49,4 +54,4 @@ const printSize = (sizeInByte: number): string => {
}
};
-export { checkValidURL, printTwoDecimalPlaces, printTimePassed, printSize };
\ No newline at end of file
+export { checkValidURL, printTwoDecimalPlaces, printTimePassed, printSize, getHostNameFromURL };
\ No newline at end of file