From 5cbf9e4b325520e213d95ebe8ed73239fbeab89f Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Wed, 2 Feb 2022 16:13:10 +0100 Subject: [PATCH] Link directly to file sources from file history view (#1945) Link directly to the selected file with the file history sources link instead of the root dir. --- .../changelog/file_history_source_link.yaml | 2 + .../repos/changesets/ChangesetButtonGroup.tsx | 37 +++++++++---------- .../src/repos/changesets/ChangesetList.tsx | 21 +++++------ .../src/repos/changesets/ChangesetRow.tsx | 9 +++-- .../src/repos/changesets/changesets.ts | 13 +++++-- .../repos/sources/containers/HistoryView.tsx | 2 +- 6 files changed, 44 insertions(+), 40 deletions(-) create mode 100644 gradle/changelog/file_history_source_link.yaml diff --git a/gradle/changelog/file_history_source_link.yaml b/gradle/changelog/file_history_source_link.yaml new file mode 100644 index 0000000000..9fa9495457 --- /dev/null +++ b/gradle/changelog/file_history_source_link.yaml @@ -0,0 +1,2 @@ +- type: changed + description: Link directly to file with file history sources link ([#1945](https://github.com/scm-manager/scm-manager/pull/1945)) diff --git a/scm-ui/ui-components/src/repos/changesets/ChangesetButtonGroup.tsx b/scm-ui/ui-components/src/repos/changesets/ChangesetButtonGroup.tsx index de9f728108..56f68e0424 100644 --- a/scm-ui/ui-components/src/repos/changesets/ChangesetButtonGroup.tsx +++ b/scm-ui/ui-components/src/repos/changesets/ChangesetButtonGroup.tsx @@ -21,29 +21,28 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -import React from "react"; -import { Changeset, Repository } from "@scm-manager/ui-types"; -import { ButtonAddons, Button } from "../../buttons"; +import React, { FC } from "react"; +import { Changeset, File, Repository } from "@scm-manager/ui-types"; +import { Button, ButtonAddons } from "../../buttons"; import { createChangesetLink, createSourcesLink } from "./changesets"; -import { WithTranslation, withTranslation } from "react-i18next"; +import { useTranslation } from "react-i18next"; -type Props = WithTranslation & { +type Props = { repository: Repository; changeset: Changeset; + file?: File; }; -class ChangesetButtonGroup extends React.Component { - render() { - const { repository, changeset, t } = this.props; - const changesetLink = createChangesetLink(repository, changeset); - const sourcesLink = createSourcesLink(repository, changeset); - return ( - -