From b75b438d7b4f4762a1d08dac7dbb2658eb33a0e4 Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Mon, 15 Jun 2020 12:44:43 +0200 Subject: [PATCH 1/4] show changeset parents on changeset details view --- scm-ui/ui-webapp/public/locales/de/repos.json | 4 ++ scm-ui/ui-webapp/public/locales/en/repos.json | 4 ++ .../changesets/ChangesetDetails.tsx | 39 +++++++++++++++++-- .../src/repos/containers/ChangesetView.tsx | 6 +++ 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/scm-ui/ui-webapp/public/locales/de/repos.json b/scm-ui/ui-webapp/public/locales/de/repos.json index a4be334204..83734035b2 100644 --- a/scm-ui/ui-webapp/public/locales/de/repos.json +++ b/scm-ui/ui-webapp/public/locales/de/repos.json @@ -87,6 +87,10 @@ "shortSummary": "Committet <0/> <1/>", "tags": "Tags", "diffNotSupported": "Diff des Changesets wird von diesem Repositorytyp nicht unterstützt", + "parents": { + "label" : "Parent", + "label_plural": "Parents" + }, "contributors": { "mailto": "Mail senden an", "list": "Liste der Mitwirkenden", diff --git a/scm-ui/ui-webapp/public/locales/en/repos.json b/scm-ui/ui-webapp/public/locales/en/repos.json index e7884bff57..3d585da048 100644 --- a/scm-ui/ui-webapp/public/locales/en/repos.json +++ b/scm-ui/ui-webapp/public/locales/en/repos.json @@ -91,6 +91,10 @@ "details": "Details", "sources": "Sources" }, + "parents": { + "label" : "Parent", + "label_plural": "Parents" + }, "contributors": { "mailto": "Send mail to", "list": "List of contributors", diff --git a/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetDetails.tsx b/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetDetails.tsx index fbd192111a..da612af998 100644 --- a/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetDetails.tsx +++ b/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetDetails.tsx @@ -26,7 +26,7 @@ import { Trans, useTranslation, WithTranslation, withTranslation } from "react-i import classNames from "classnames"; import styled from "styled-components"; import { ExtensionPoint } from "@scm-manager/ui-extensions"; -import { Changeset, Repository, Tag } from "@scm-manager/ui-types"; +import { Changeset, Repository, Tag, Link } from "@scm-manager/ui-types"; import { AvatarImage, AvatarWrapper, @@ -41,6 +41,7 @@ import { Icon } from "@scm-manager/ui-components"; import ContributorTable from "./ContributorTable"; +import { Link as ReactLink } from "react-router-dom"; type Props = WithTranslation & { changeset: Changeset; @@ -51,6 +52,11 @@ type State = { collapsed: boolean; }; +type Parent = { + id: string; + _links: Link[]; +}; + const RightMarginP = styled.p` margin-right: 1em; `; @@ -102,6 +108,18 @@ const ContributorToggleLine = styled.p` margin-bottom: 0.5rem !important; `; +const ChangesetSummary = styled.div` + display: flex; + justify-content: space-between; +` + +const SeparatedParents = styled.div` + a + a:before { + content: ",\\00A0"; + color: #4a4a4a; + } +`; + const Contributors: FC<{ changeset: Changeset }> = ({ changeset }) => { const [t] = useTranslation("repos"); const [open, setOpen] = useState(false); @@ -148,6 +166,11 @@ class ChangesetDetails extends React.Component { const description = changesets.parseDescription(changeset.description); const id = ; const date = ; + const parents = changeset._embedded.parents.map((parent: Parent) => ( + + {parent.id.substring(0, 7)} + + )); return ( <> @@ -172,9 +195,17 @@ class ChangesetDetails extends React.Component {
-

- -

+ +

+ +

+ {parents?.length > 0 && ( + + {t("changeset.parents.label", { count: parents?.length }) + ": "} + {parents} + + )} +
{this.renderTags()}
diff --git a/scm-ui/ui-webapp/src/repos/containers/ChangesetView.tsx b/scm-ui/ui-webapp/src/repos/containers/ChangesetView.tsx index d04bd144b6..cbd5e38666 100644 --- a/scm-ui/ui-webapp/src/repos/containers/ChangesetView.tsx +++ b/scm-ui/ui-webapp/src/repos/containers/ChangesetView.tsx @@ -53,6 +53,12 @@ class ChangesetView extends React.Component { fetchChangesetIfNeeded(repository, id); } + componentDidUpdate() { + const { fetchChangesetIfNeeded, repository } = this.props; + const id = this.props.match.params.id; + fetchChangesetIfNeeded(repository, id); + } + render() { const { changeset, loading, error, t, repository } = this.props; From a83e8fd9c60b422d80bb95196d40e82bcdd0c4cf Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Tue, 16 Jun 2020 10:44:27 +0200 Subject: [PATCH 2/4] update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19fd735042..c2c8011586 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Option to configure jvm parameter of docker container with env JAVA_OPTS or with arguments ([#1175](https://github.com/scm-manager/scm-manager/pull/1175)) - Added links in diff views to expand the gaps between "hunks" ([#1178](https://github.com/scm-manager/scm-manager/pull/1178)) - Show commit contributors in table on changeset details view ([#1169](https://github.com/scm-manager/scm-manager/pull/1169)) +- Show changeset parents on changeset details view ([#1189](https://github.com/scm-manager/scm-manager/pull/1189)) ### Fixed - Avoid caching of detected browser language ([#1176](https://github.com/scm-manager/scm-manager/pull/1176)) From 667911f30a835aad22f9d581e86c5c57cc93802d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Pfeuffer?= Date: Tue, 16 Jun 2020 17:06:27 +0200 Subject: [PATCH 3/4] Fix type --- .../src/repos/components/changesets/ChangesetDetails.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetDetails.tsx b/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetDetails.tsx index da612af998..86fddf6897 100644 --- a/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetDetails.tsx +++ b/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetDetails.tsx @@ -26,7 +26,7 @@ import { Trans, useTranslation, WithTranslation, withTranslation } from "react-i import classNames from "classnames"; import styled from "styled-components"; import { ExtensionPoint } from "@scm-manager/ui-extensions"; -import { Changeset, Repository, Tag, Link } from "@scm-manager/ui-types"; +import { Changeset, Repository, Tag, ParentChangeset } from "@scm-manager/ui-types"; import { AvatarImage, AvatarWrapper, @@ -52,11 +52,6 @@ type State = { collapsed: boolean; }; -type Parent = { - id: string; - _links: Link[]; -}; - const RightMarginP = styled.p` margin-right: 1em; `; @@ -166,7 +161,7 @@ class ChangesetDetails extends React.Component { const description = changesets.parseDescription(changeset.description); const id = ; const date = ; - const parents = changeset._embedded.parents.map((parent: Parent) => ( + const parents = changeset._embedded.parents.map((parent: ParentChangeset) => ( {parent.id.substring(0, 7)} From ad405fe95dc0948e267d24037b75d1abefd23dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Pfeuffer?= Date: Tue, 16 Jun 2020 17:18:48 +0200 Subject: [PATCH 4/4] Add small gap between date and parents --- .../src/repos/components/changesets/ChangesetDetails.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetDetails.tsx b/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetDetails.tsx index 86fddf6897..f2a278b5f0 100644 --- a/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetDetails.tsx +++ b/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetDetails.tsx @@ -109,6 +109,7 @@ const ChangesetSummary = styled.div` ` const SeparatedParents = styled.div` + margin-left: 1em; a + a:before { content: ",\\00A0"; color: #4a4a4a;