Fixed title and description in tag screen (#105)
Fixed title and description in tag screen Signed-off-by: Amelia-Maria Breda <ambreda@cisco.com>
This commit is contained in:
parent
c93447b0e4
commit
988249588f
@ -38,10 +38,10 @@ const mockedTagsData = {
|
|||||||
describe('Tags component', () => {
|
describe('Tags component', () => {
|
||||||
it('should open and close details dropdown for tags', () => {
|
it('should open and close details dropdown for tags', () => {
|
||||||
render(<Tags data={mockedTagsData} />);
|
render(<Tags data={mockedTagsData} />);
|
||||||
const openBtn = screen.getByText(/see digests/i);
|
const openBtn = screen.getByText(/see digest/i);
|
||||||
fireEvent.click(openBtn);
|
fireEvent.click(openBtn);
|
||||||
expect(screen.queryByText(/see digests/i)).not.toBeInTheDocument();
|
expect(screen.queryByText(/see digest/i)).not.toBeInTheDocument();
|
||||||
expect(screen.getByText(/hide digests/i)).toBeInTheDocument();
|
expect(screen.getByText(/hide digest/i)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
it('should navigate to tag page details when tag is clicked', async () => {
|
it('should navigate to tag page details when tag is clicked', async () => {
|
||||||
render(<Tags data={mockedTagsData} />);
|
render(<Tags data={mockedTagsData} />);
|
||||||
|
@ -129,7 +129,7 @@ const randomImage = () => {
|
|||||||
return imageArray[randomIntFromInterval(0, 3)];
|
return imageArray[randomIntFromInterval(0, 3)];
|
||||||
};
|
};
|
||||||
|
|
||||||
function RepoDetails(props) {
|
function RepoDetails() {
|
||||||
const [repoDetailData, setRepoDetailData] = useState({});
|
const [repoDetailData, setRepoDetailData] = useState({});
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
//const [isLoading, setIsLoading] = useState(false);
|
//const [isLoading, setIsLoading] = useState(false);
|
||||||
@ -138,7 +138,6 @@ function RepoDetails(props) {
|
|||||||
// get url param from <Route here (i.e. image name)
|
// get url param from <Route here (i.e. image name)
|
||||||
const { name } = useParams();
|
const { name } = useParams();
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { overviewTitle } = props;
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
api
|
api
|
||||||
@ -157,6 +156,7 @@ function RepoDetails(props) {
|
|||||||
vendors: repoInfo.Summary?.Vendors,
|
vendors: repoInfo.Summary?.Vendors,
|
||||||
newestTag: repoInfo.Summary?.NewestImage,
|
newestTag: repoInfo.Summary?.NewestImage,
|
||||||
description: repoInfo.Summary?.NewestImage.Description,
|
description: repoInfo.Summary?.NewestImage.Description,
|
||||||
|
title: repoInfo.Summary?.NewestImage.Title,
|
||||||
source: repoInfo.Summary?.NewestImage.Source,
|
source: repoInfo.Summary?.NewestImage.Source,
|
||||||
downloads: repoInfo.Summary?.NewestImage.DownloadCount,
|
downloads: repoInfo.Summary?.NewestImage.DownloadCount,
|
||||||
overview: repoInfo.Summary?.NewestImage.Documentation
|
overview: repoInfo.Summary?.NewestImage.Documentation
|
||||||
@ -234,7 +234,7 @@ function RepoDetails(props) {
|
|||||||
<Card className={classes.card} data-testid="overview-container">
|
<Card className={classes.card} data-testid="overview-container">
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<Typography variant="h4" align="left">
|
<Typography variant="h4" align="left">
|
||||||
{overviewTitle || 'Quickstart'}
|
Quickstart
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
variant="body1"
|
variant="body1"
|
||||||
@ -248,7 +248,7 @@ function RepoDetails(props) {
|
|||||||
>
|
>
|
||||||
{
|
{
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
repoDetailData.overview || 'N/A'
|
repoDetailData.description || 'N/A'
|
||||||
}
|
}
|
||||||
</Typography>
|
</Typography>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
@ -303,7 +303,7 @@ function RepoDetails(props) {
|
|||||||
>
|
>
|
||||||
{
|
{
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
repoDetailData?.description || 'N/A'
|
repoDetailData?.title || 'N/A'
|
||||||
}
|
}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Stack alignItems="center" sx={{ paddingLeft: '4rem' }} direction="row" spacing={2} pt={1}>
|
<Stack alignItems="center" sx={{ paddingLeft: '4rem' }} direction="row" spacing={2} pt={1}>
|
||||||
|
@ -36,6 +36,7 @@ const useStyles = makeStyles(() => ({
|
|||||||
function RepoDetailsMetadata(props) {
|
function RepoDetailsMetadata(props) {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { repoURL, weeklyDownloads, lastUpdated, size } = props;
|
const { repoURL, weeklyDownloads, lastUpdated, size } = props;
|
||||||
|
// @ts-ignore
|
||||||
const lastDate = (lastUpdated ? DateTime.fromISO(lastUpdated) : DateTime.now().minus({ days: 1 })).toRelative({
|
const lastDate = (lastUpdated ? DateTime.fromISO(lastUpdated) : DateTime.now().minus({ days: 1 })).toRelative({
|
||||||
unit: 'days'
|
unit: 'days'
|
||||||
});
|
});
|
||||||
|
@ -33,7 +33,7 @@ const useStyles = makeStyles(() => ({
|
|||||||
width: '100%'
|
width: '100%'
|
||||||
},
|
},
|
||||||
card: {
|
card: {
|
||||||
marginBottom: 2,
|
marginBottom: '2rem',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@ -62,6 +62,7 @@ function TagCard(props) {
|
|||||||
const [digests, setDigests] = React.useState([]);
|
const [digests, setDigests] = React.useState([]);
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const tagRow = row;
|
const tagRow = row;
|
||||||
|
// @ts-ignore
|
||||||
const lastDate = (lastUpdated ? DateTime.fromISO(lastUpdated) : DateTime.now().minus({ days: 1 })).toRelative({
|
const lastDate = (lastUpdated ? DateTime.fromISO(lastUpdated) : DateTime.now().minus({ days: 1 })).toRelative({
|
||||||
unit: 'days'
|
unit: 'days'
|
||||||
});
|
});
|
||||||
@ -110,7 +111,7 @@ function TagCard(props) {
|
|||||||
}}
|
}}
|
||||||
onClick={() => setOpen(!open)}
|
onClick={() => setOpen(!open)}
|
||||||
>
|
>
|
||||||
{!open ? 'See digests' : 'Hide digests'}
|
{!open ? 'See digest' : 'Hide digest'}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
<Collapse in={open} timeout="auto" unmountOnExit>
|
||||||
<Box>
|
<Box>
|
||||||
|
@ -15,8 +15,7 @@ const useStyles = makeStyles(() => ({
|
|||||||
},
|
},
|
||||||
container: {
|
container: {
|
||||||
paddingTop: 5,
|
paddingTop: 5,
|
||||||
paddingBottom: 5,
|
paddingBottom: 5
|
||||||
backgroundColor: '#FFFFFF'
|
|
||||||
},
|
},
|
||||||
parentWrapper: {
|
parentWrapper: {
|
||||||
height: '100vh'
|
height: '100vh'
|
||||||
|
@ -15,8 +15,7 @@ const useStyles = makeStyles(() => ({
|
|||||||
},
|
},
|
||||||
container: {
|
container: {
|
||||||
paddingTop: 5,
|
paddingTop: 5,
|
||||||
paddingBottom: 5,
|
paddingBottom: 5
|
||||||
backgroundColor: '#FFFFFF'
|
|
||||||
},
|
},
|
||||||
parentWrapper: {
|
parentWrapper: {
|
||||||
height: '100vh'
|
height: '100vh'
|
||||||
|
Loading…
Reference in New Issue
Block a user