diff --git a/docs/de/user/repo/assets/repository-code-changesetDetails.png b/docs/de/user/repo/assets/repository-code-changesetDetails.png index d014a8c7e8..83c52c853f 100644 Binary files a/docs/de/user/repo/assets/repository-code-changesetDetails.png and b/docs/de/user/repo/assets/repository-code-changesetDetails.png differ diff --git a/docs/de/user/repo/code.md b/docs/de/user/repo/code.md index f3ef602bf0..0661babba0 100644 --- a/docs/de/user/repo/code.md +++ b/docs/de/user/repo/code.md @@ -52,9 +52,9 @@ Die Diffs können durch Klicken auf den blauen Balken schrittweise oder vollstä Falls sich Commit Links im Format "namespace/name@commitId" in der Changeset Beschreibung befinden, werden die zu relativen SCM-Manager Links erweitert. Beispielsweise wird der Text hitchhiker/HeartOfGold@1a2b3c4 zu einem Link zu dem Commit 1a2b3c4 im Repository hitchhiker/HeartOfGold umgewandelt. -Für das Changeset gibt es zwei Buttons: -- Mit dem ersten Button können die Whitespaces-Änderungen ein- und ausgeblendet werden. -- Der zweite ermöglicht das Ein- und Ausblenden aller Changesets. +Für das Changeset gibt es ein Dropdown Menu mit zwei Optionen: +- Mit der ersten Checkbox können die Whitespaces-Änderungen ein- und ausgeblendet werden. +- Die zweite Checkbox ermöglicht das Ein- und Ausblenden aller Changesets. Jeder Changeset Diff hat mehrere Buttons: - Der erste Button von Links ermöglicht einen direkten Vergleich der Änderungen. diff --git a/docs/en/user/repo/assets/repository-code-changesetDetails.png b/docs/en/user/repo/assets/repository-code-changesetDetails.png index d014a8c7e8..7cdaace5c3 100644 Binary files a/docs/en/user/repo/assets/repository-code-changesetDetails.png and b/docs/en/user/repo/assets/repository-code-changesetDetails.png differ diff --git a/docs/en/user/repo/code.md b/docs/en/user/repo/code.md index 9af97b2274..789b03f408 100644 --- a/docs/en/user/repo/code.md +++ b/docs/en/user/repo/code.md @@ -54,9 +54,9 @@ You can expand the diffs gradually or completely by clicking on the blue bars. If commit links formatted like "namespace/name@commitId" are used in the changeset description they will be rendered to internal links. For example the text hitchhiker/HeartOfGold@1a2b3c4 will be transformed to a link directing to the commit 1a2b3c4 of the repository hitchhiker/heartOfGold. -There are two buttons for the changeset: -- The first button show and hide the whitespace changes. -- The second button can collapse all changesets. +There is a dropdown menu for the changeset: +- With the first checkbox you can show and hide the whitespace changes. +- The second checkbox can collapse all changesets. Every changeset diff has several buttons: - The first button on the left allows a direct comparison of the changes. diff --git a/gradle/changelog/changesetdetails_cogwheeldropdown.yml b/gradle/changelog/changesetdetails_cogwheeldropdown.yml new file mode 100644 index 0000000000..399bf3010e --- /dev/null +++ b/gradle/changelog/changesetdetails_cogwheeldropdown.yml @@ -0,0 +1,2 @@ +- type: Added + description: A cogwheel menu to the changesetdetails diff --git a/scm-ui/ui-components/src/repos/DiffDropDown.tsx b/scm-ui/ui-components/src/repos/DiffDropDown.tsx new file mode 100644 index 0000000000..6956376227 --- /dev/null +++ b/scm-ui/ui-components/src/repos/DiffDropDown.tsx @@ -0,0 +1,76 @@ +/* + * MIT License + * + * Copyright (c) 2020-present Cloudogu GmbH and Contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +import React, { FC, useEffect, useState } from "react"; +import { useTranslation } from "react-i18next"; +import { Checkbox } from "@scm-manager/ui-core"; +type DiffDropDownProps = { + collapseDiffs: () => void; + ignoreWhitespaces: () => void; + renderOnMount: boolean; +}; +const DiffDropDown: FC = ({ collapseDiffs, ignoreWhitespaces, renderOnMount }) => { + const [t] = useTranslation("repos"); + const [isOpen, setOpen] = useState(false); + + // This is a hack and it needs to be here until we fix the re rendering problem upon changing the whitespaces in the diffs + useEffect(() => { + if (renderOnMount) { + ignoreWhitespaces(); + ignoreWhitespaces(); + } + }, [ignoreWhitespaces, renderOnMount]); + + const handleOpen = () => { + setOpen(!isOpen); + }; + return ( +
+
+ +
+ +
+ ); +}; +export default DiffDropDown; diff --git a/scm-ui/ui-components/src/repos/index.ts b/scm-ui/ui-components/src/repos/index.ts index 11d659f827..208a844fb0 100644 --- a/scm-ui/ui-components/src/repos/index.ts +++ b/scm-ui/ui-components/src/repos/index.ts @@ -53,6 +53,7 @@ export { default as JumpToFileButton } from "./JumpToFileButton"; export { default as CommitAuthor } from "./CommitAuthor"; export { default as HealthCheckFailureDetail } from "./HealthCheckFailureDetail"; export { default as RepositoryFlags } from "./RepositoryFlags"; +export { default as DiffDropDown } from "./DiffDropDown"; export { File, diff --git a/scm-ui/ui-webapp/public/locales/de/repos.json b/scm-ui/ui-webapp/public/locales/de/repos.json index 7bf59122cf..ecaf18af9a 100644 --- a/scm-ui/ui-webapp/public/locales/de/repos.json +++ b/scm-ui/ui-webapp/public/locales/de/repos.json @@ -264,6 +264,10 @@ "branchSelectorLabel": "Branches", "collapseDiffs": "Auf-/Zuklappen", "ignoreWhitespace": "Whitespace-Änderungen ignorieren", + "checkBoxHeadingWhitespaces": "Umgang mit Leerzeichen", + "checkBoxHeadingOtherSettings": "Weitere Einstellungen", + "checkBoxCollapseOption": "Alle Diffs einklappen", + "checkBoxHideWhitespaceChanges": "Ignoriere Diffs die nur Whitespace Änderungen enthalten", "activateWhitespace": "Whitespace-Änderungen einblenden", "moreDiffsAvailable": "Es sind weitere Diffs verfügbar", "loadMore": "Weitere laden" diff --git a/scm-ui/ui-webapp/public/locales/en/repos.json b/scm-ui/ui-webapp/public/locales/en/repos.json index ae130493f0..dac3cf9842 100644 --- a/scm-ui/ui-webapp/public/locales/en/repos.json +++ b/scm-ui/ui-webapp/public/locales/en/repos.json @@ -264,6 +264,10 @@ "branchSelectorLabel": "Branches", "collapseDiffs": "Collapse", "ignoreWhitespace": "Ignore whitespaces changes", + "checkBoxHeadingWhitespaces": "Whitespace Settings", + "checkBoxHeadingOtherSettings": "Other Settings", + "checkBoxCollapseOption": "Collapse all Diffs", + "checkBoxHideWhitespaceChanges": "Hide Diffs which only contain whitespace changes", "activateWhitespace": "Show whitespaces changes", "moreDiffsAvailable": "There are more diffs available", "loadMore": "Load more" 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 b35436fdd9..9ac125bcac 100644 --- a/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetDetails.tsx +++ b/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetDetails.tsx @@ -39,6 +39,7 @@ import { DateFromNow, FileControlFactory, SignatureIcon, + DiffDropDown } from "@scm-manager/ui-components"; import { Tooltip, SubSubtitle } from "@scm-manager/ui-core"; import { Button, Icon } from "@scm-manager/ui-buttons"; @@ -280,14 +281,7 @@ const ChangesetDetails: FC = ({ changeset, repository, fileControlFactory
- - +