From 89386928b6b18ffb6bf9ff4a35bfe9454c21c199 Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Tue, 27 Sep 2022 16:18:03 +0200 Subject: [PATCH] Add feedback links to footer (#2125) Add feedback links in "Support" section of the footer. The links refer to the creation of a new topic in the SCMM section of the forum. --- gradle/changelog/footer_feedback_links.yaml | 2 + .../src/__snapshots__/storyshots.test.ts.snap | 80 +++++++++++++++++++ scm-ui/ui-components/src/layout/Footer.tsx | 16 +++- scm-ui/ui-types/src/Feedback.ts | 29 +++++++ scm-ui/ui-types/src/index.ts | 1 + .../ui-webapp/public/locales/de/commons.json | 4 +- .../ui-webapp/public/locales/en/commons.json | 4 +- .../scm/api/v2/resources/FeedbackDto.java | 35 ++++++++ .../api/v2/resources/IndexDtoGenerator.java | 2 + 9 files changed, 170 insertions(+), 3 deletions(-) create mode 100644 gradle/changelog/footer_feedback_links.yaml create mode 100644 scm-ui/ui-types/src/Feedback.ts create mode 100644 scm-webapp/src/main/java/sonia/scm/api/v2/resources/FeedbackDto.java diff --git a/gradle/changelog/footer_feedback_links.yaml b/gradle/changelog/footer_feedback_links.yaml new file mode 100644 index 0000000000..79be8782f2 --- /dev/null +++ b/gradle/changelog/footer_feedback_links.yaml @@ -0,0 +1,2 @@ +- type: added + description: Feedback links to footer ([#2125](https://github.com/scm-manager/scm-manager/pull/2125)) diff --git a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap index bdf7daec5f..1794e1b250 100644 --- a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap +++ b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap @@ -1677,6 +1677,26 @@ exports[`Storyshots Footer Default 1`] = ` footer.support.enterprise +
  • + + footer.support.bugReport + +
  • +
  • + + footer.support.featureRequest + +
  • @@ -1843,6 +1863,26 @@ exports[`Storyshots Footer Full 1`] = ` footer.support.enterprise +
  • + + footer.support.bugReport + +
  • +
  • + + footer.support.featureRequest + +
  • +
  • + + footer.support.bugReport + +
  • +
  • + + footer.support.featureRequest + +
  • @@ -2148,6 +2208,26 @@ exports[`Storyshots Footer With Plugin Links 1`] = ` footer.support.enterprise +
  • + + footer.support.bugReport + +
  • +
  • + + footer.support.featureRequest + +
  • = ({ me }) => ( const Footer: FC = ({ me, version, links }) => { const [t] = useTranslation("commons"); const binder = useBinder(); + const index = useIndex(); const extensionProps = { me, url: "/me", links }; let meSectionTile; @@ -124,6 +126,18 @@ const Footer: FC = ({ me, version, links }) => { to="https://cloudogu.com/en/scm-manager-enterprise/" label={t("footer.support.enterprise")} /> + {!(index.data?._embedded?.feedback as Feedback)?.disabled ? ( + <> + + + + ) : null} diff --git a/scm-ui/ui-types/src/Feedback.ts b/scm-ui/ui-types/src/Feedback.ts new file mode 100644 index 0000000000..6d7cff4221 --- /dev/null +++ b/scm-ui/ui-types/src/Feedback.ts @@ -0,0 +1,29 @@ +/* + * 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 { HalRepresentation } from "./hal"; + +export type Feedback = HalRepresentation & { + disabled: boolean; +}; diff --git a/scm-ui/ui-types/src/index.ts b/scm-ui/ui-types/src/index.ts index ab9558a71a..587e1f3fcd 100644 --- a/scm-ui/ui-types/src/index.ts +++ b/scm-ui/ui-types/src/index.ts @@ -74,3 +74,4 @@ export * from "./GlobalPermissions"; export * from "./Search"; export * from "./General"; export * from "./ContentType"; +export * from "./Feedback"; diff --git a/scm-ui/ui-webapp/public/locales/de/commons.json b/scm-ui/ui-webapp/public/locales/de/commons.json index 54d5e4108c..5a039f59bb 100644 --- a/scm-ui/ui-webapp/public/locales/de/commons.json +++ b/scm-ui/ui-webapp/public/locales/de/commons.json @@ -141,7 +141,9 @@ "support": { "title": "Support", "community": "Community", - "enterprise": "Enterprise" + "enterprise": "Enterprise", + "bugReport": "Bug Report", + "featureRequest": "Feature Request" } }, "commaSeparatedList": { diff --git a/scm-ui/ui-webapp/public/locales/en/commons.json b/scm-ui/ui-webapp/public/locales/en/commons.json index bed26f7b07..8d72828333 100644 --- a/scm-ui/ui-webapp/public/locales/en/commons.json +++ b/scm-ui/ui-webapp/public/locales/en/commons.json @@ -142,7 +142,9 @@ "support": { "title": "Support", "community": "Community", - "enterprise": "Enterprise" + "enterprise": "Enterprise", + "bugReport": "Bug Report", + "featureRequest": "Feature Request" } }, "commaSeparatedList": { diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/FeedbackDto.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/FeedbackDto.java new file mode 100644 index 0000000000..986a4c5d08 --- /dev/null +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/FeedbackDto.java @@ -0,0 +1,35 @@ +/* + * 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. + */ + +package sonia.scm.api.v2.resources; + +import de.otto.edison.hal.HalRepresentation; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class FeedbackDto extends HalRepresentation { + private boolean disabled; +} diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/IndexDtoGenerator.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/IndexDtoGenerator.java index 0cd1aa6516..e29e1687ba 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/IndexDtoGenerator.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/IndexDtoGenerator.java @@ -86,6 +86,8 @@ public class IndexDtoGenerator extends HalAppenderMapper { builder.self(resourceLinks.index().self()); builder.single(link("uiPlugins", resourceLinks.uiPluginCollection().self())); + embeddedBuilder.with("feedback", new FeedbackDto(Boolean.getBoolean("sonia.scm.disableFeedback"))); + if (initializationFinisher.isFullyInitialized()) { return handleNormalIndex(builder, embeddedBuilder); } else {