mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
fix review findings
This commit is contained in:
@@ -33,16 +33,12 @@ type Props = {
|
|||||||
const GitTagInformation: FC<Props> = ({ tag }) => {
|
const GitTagInformation: FC<Props> = ({ tag }) => {
|
||||||
const [t] = useTranslation("plugins");
|
const [t] = useTranslation("plugins");
|
||||||
|
|
||||||
if (!tag) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h4>{t("scm-git-plugin.information.checkoutTag")}</h4>
|
<h4>{t("scm-git-plugin.information.checkoutTag")}</h4>
|
||||||
<pre>
|
<pre>
|
||||||
<code>
|
<code>
|
||||||
git checkout tags/{tag?.name} -b branch/{tag?.name}
|
git checkout tags/{tag.name} -b branch/{tag.name}
|
||||||
</code>
|
</code>
|
||||||
</pre>
|
</pre>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -27,16 +27,12 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { Tag } from "@scm-manager/ui-types";
|
import { Tag } from "@scm-manager/ui-types";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
tag?: Tag;
|
tag: Tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
const HgTagInformation: FC<Props> = ({ tag }) => {
|
const HgTagInformation: FC<Props> = ({ tag }) => {
|
||||||
const [t] = useTranslation("plugins");
|
const [t] = useTranslation("plugins");
|
||||||
|
|
||||||
if (!tag) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h4>{t("scm-hg-plugin.information.checkoutTag")}</h4>
|
<h4>{t("scm-hg-plugin.information.checkoutTag")}</h4>
|
||||||
|
|||||||
@@ -27,6 +27,6 @@ import { Links } from "./hal";
|
|||||||
export type Tag = {
|
export type Tag = {
|
||||||
name: string;
|
name: string;
|
||||||
revision: string;
|
revision: string;
|
||||||
date: Date;
|
date?: Date;
|
||||||
_links: Links;
|
_links: Links;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tag": {
|
"tag": {
|
||||||
"name": "Tag-Name",
|
"name": "Name",
|
||||||
"commit": "Commit",
|
"commit": "Commit",
|
||||||
"sources": "Sources"
|
"sources": "Sources"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tag": {
|
"tag": {
|
||||||
"name": "Tag-Name",
|
"name": "Name",
|
||||||
"commit": "Commit",
|
"commit": "Commit",
|
||||||
"sources": "Sources"
|
"sources": "Sources"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -25,38 +25,44 @@
|
|||||||
import React, { FC } from "react";
|
import React, { FC } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Repository, Tag } from "@scm-manager/ui-types";
|
import { Repository, Tag } from "@scm-manager/ui-types";
|
||||||
import { DateFromNow } from "@scm-manager/ui-components";
|
import { DateFromNow, Level } from "@scm-manager/ui-components";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import TagButtonGroup from "./TagButtonGroup";
|
import TagButtonGroup from "./TagButtonGroup";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
repository: Repository;
|
repository: Repository;
|
||||||
tag?: Tag;
|
tag: Tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const FlexRow = styled.div`
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
`;
|
||||||
|
|
||||||
const Created = styled.div`
|
const Created = styled.div`
|
||||||
margin-top: 0.5rem;
|
margin-left: 0.5rem;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Label = styled.strong`
|
||||||
|
margin-right: 0.3rem;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Date = styled(DateFromNow)`
|
const Date = styled(DateFromNow)`
|
||||||
font-size: 1rem;
|
font-size: 0.8rem;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const TagDetail: FC<Props> = ({ tag, repository }) => {
|
const TagDetail: FC<Props> = ({ tag, repository }) => {
|
||||||
const [t] = useTranslation("repos");
|
const [t] = useTranslation("repos");
|
||||||
|
|
||||||
if (!tag) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="media">
|
<div className="media">
|
||||||
<div className="media-content subtitle">
|
<FlexRow className="media-content subtitle">
|
||||||
<strong>{t("tag.name") + ":"}</strong> {tag?.name}
|
<Label>{t("tag.name") + ": "} </Label> {tag.name}
|
||||||
<Created className="is-ellipsis-overflow">
|
<Created className="is-ellipsis-overflow">
|
||||||
<strong>{t("tags.overview.created") + ":"}</strong> <Date date={tag.date} className="has-text-grey" />
|
{t("tags.overview.created")} <Date date={tag.date} className="has-text-grey" />
|
||||||
</Created>
|
</Created>
|
||||||
</div>
|
</FlexRow>
|
||||||
<div className="media-right">
|
<div className="media-right">
|
||||||
<TagButtonGroup repository={repository} tag={tag} />
|
<TagButtonGroup repository={repository} tag={tag} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import TagDetail from "./TagDetail";
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
repository: Repository;
|
repository: Repository;
|
||||||
tag?: Tag;
|
tag: Tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
const TagView: FC<Props> = ({ repository, tag }) => {
|
const TagView: FC<Props> = ({ repository, tag }) => {
|
||||||
|
|||||||
@@ -37,14 +37,13 @@ type Props = {
|
|||||||
const TagRoot: FC<Props> = ({ repository, baseUrl }) => {
|
const TagRoot: FC<Props> = ({ repository, baseUrl }) => {
|
||||||
const match = useRouteMatch();
|
const match = useRouteMatch();
|
||||||
const [tags, setTags] = useState<Tag[]>([]);
|
const [tags, setTags] = useState<Tag[]>([]);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState<Error | undefined>(undefined);
|
const [error, setError] = useState<Error | undefined>(undefined);
|
||||||
const [tag, setTag] = useState<Tag>();
|
const [tag, setTag] = useState<Tag>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const link = (repository._links?.tags as Link)?.href;
|
const link = (repository._links?.tags as Link)?.href;
|
||||||
if (link) {
|
if (link) {
|
||||||
setLoading(true);
|
|
||||||
apiClient
|
apiClient
|
||||||
.get(link)
|
.get(link)
|
||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
|
|||||||
@@ -69,12 +69,7 @@ const TagsOverview: FC<Props> = ({ repository, baseUrl }) => {
|
|||||||
return <Loading />;
|
return <Loading />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return <>{renderTagsTable()}</>;
|
||||||
<>
|
|
||||||
<Subtitle subtitle={t("tags.overview.title")} />
|
|
||||||
{renderTagsTable()}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default TagsOverview;
|
export default TagsOverview;
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
// sort tags by date beginning with latest first
|
// sort tags by date beginning with latest first
|
||||||
import { Tag } from "@scm-manager/ui-types";
|
import { Tag } from "@scm-manager/ui-types";
|
||||||
|
|
||||||
export default function orderTags(tags: Tag[]) {
|
export default (tags: Tag[]) => {
|
||||||
tags.sort((a, b) => {
|
tags.sort((a, b) => {
|
||||||
return new Date(b.date) - new Date(a.date);
|
return new Date(b.date) - new Date(a.date);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user