Revert "Add feedback form (#1967)"

This reverts commit 4407dc6d8a.

# Conflicts:
#	scm-ui/ui-api/src/config.ts
#	scm-ui/ui-api/src/index.ts
#	scm-ui/ui-webapp/public/locales/en/commons.json
#	scm-ui/ui-webapp/src/containers/App.tsx
#	scm-ui/ui-webapp/src/containers/Feedback.tsx
This commit is contained in:
Konstantin Schaper
2022-09-27 09:37:38 +02:00
committed by Konstantin Schaper
parent 9f5a0eeec1
commit 74702591ed
13 changed files with 1 additions and 213 deletions

View File

@@ -85,15 +85,6 @@ public class ScmConfiguration implements Configuration {
public static final String DEFAULT_ALERTS_URL =
"https://alerts.scm-manager.org/api/v1/alerts";
/**
* SCM Manager alerts url.
*
* @since 2.32.0
*/
public static final String DEFAULT_FEEDBACK_URL =
"https://response.cloudogu.com/api/v1/feedback/scm-manager/url";
/**
* SCM Manager release feed url
*/
@@ -190,14 +181,6 @@ public class ScmConfiguration implements Configuration {
@XmlElement(name = "alerts-url")
private String alertsUrl = DEFAULT_ALERTS_URL;
/**
* Url of the alerts api.
*
* @since 2.32.0
*/
@XmlElement(name = "feedback-url")
private String feedbackUrl = DEFAULT_FEEDBACK_URL;
@XmlElement(name = "release-feed-url")
private String releaseFeedUrl = DEFAULT_RELEASE_FEED_URL;
@@ -305,7 +288,6 @@ public class ScmConfiguration implements Configuration {
this.namespaceStrategy = other.namespaceStrategy;
this.loginInfoUrl = other.loginInfoUrl;
this.alertsUrl = other.alertsUrl;
this.feedbackUrl = other.feedbackUrl;
this.releaseFeedUrl = other.releaseFeedUrl;
this.mailDomainName = other.mailDomainName;
this.emergencyContacts = other.emergencyContacts;
@@ -396,17 +378,6 @@ public class ScmConfiguration implements Configuration {
return alertsUrl;
}
/**
* Returns the url of the feedback api.
*
* @return the feedback url.
* @since 2.32.0
*/
public String getFeedbackUrl() {
return feedbackUrl;
}
/**
* Returns the url of the rss release feed.
*
@@ -651,16 +622,6 @@ public class ScmConfiguration implements Configuration {
this.alertsUrl = alertsUrl;
}
/**
* Set the url for the feedback api.
*
* @param feedbackUrl feedbackUrl url
* @since 2.32.0
*/
public void setFeedbackUrl(String feedbackUrl) {
this.feedbackUrl = feedbackUrl;
}
public void setReleaseFeedUrl(String releaseFeedUrl) {
this.releaseFeedUrl = releaseFeedUrl;
}

View File

@@ -58,7 +58,6 @@ describe("Test config hooks", () => {
proxyUser: null,
realmDescription: "",
alertsUrl: "",
feedbackUrl: "",
releaseFeedUrl: "",
skipFailedAuthenticators: false,
_links: {

View File

@@ -50,7 +50,6 @@ export type Config = HalRepresentation & {
namespaceStrategy: string;
loginInfoUrl: string;
alertsUrl: string;
feedbackUrl: string;
releaseFeedUrl: string;
mailDomainName: string;
emergencyContacts: string[];

View File

@@ -174,10 +174,6 @@
"alerts": {
"shieldTitle": "Alerts"
},
"feedback": {
"button": "Feedback",
"modalTitle": "Feedback senden"
},
"cardColumnGroup": {
"showContent": "Inhalt einblenden",
"hideContent": "Inhalt ausblenden"

View File

@@ -69,7 +69,6 @@
},
"skip-failed-authenticators": "Fehlgeschlagene Authentifizierer überspringen",
"alerts-url": "Alerts URL",
"feedback-url": "Feedback URL",
"release-feed-url": "Release Feed URL",
"mail-domain-name": "Fallback E-Mail Domain Name",
"enabled-xsrf-protection": "XSRF Protection aktivieren",
@@ -96,7 +95,6 @@
"pluginUrlHelpText": "Die URL der Plugin Center API. Beschreibung der Platzhalter: version = SCM-Manager Version; os = Betriebssystem; arch = Architektur",
"pluginAuthUrlHelpText": "Die URL der Plugin Center Authentifizierungs API.",
"alertsUrlHelpText": "Die URL der Alerts API. Darüber wird über Alerts die Ihr System betreffen informiert. Um diese Funktion zu deaktivieren lassen Sie dieses Feld leer.",
"feedbackUrlHelpText": "Die URL der Feedback API. Dies ermöglicht es Feedback direkt an das SCM-Manager Team zu senden. Um diese Funktion zu deaktivieren lassen Sie dieses Feld leer.",
"releaseFeedUrlHelpText": "Die URL des RSS Release Feed des SCM-Manager. Darüber wird über die neue SCM-Manager Version informiert. Um diese Funktion zu deaktivieren lassen Sie dieses Feld leer.",
"mailDomainNameHelpText": "Dieser Domain Name wird genutzt, wenn für einen User eine E-Mail-Adresse benötigt wird, für den keine hinterlegt ist. Diese Domain wird nicht zum Versenden von E-Mails genutzt und auch keine anderweitige Verbindung aufgebaut.",
"enableForwardingHelpText": "mod_proxy Port Weiterleitung aktivieren.",

View File

@@ -175,10 +175,6 @@
"alerts": {
"shieldTitle": "Alerts"
},
"feedback": {
"button": "Feedback",
"modalTitle": "Share your feedback"
},
"cardColumnGroup": {
"showContent": "Show content",
"hideContent": "Hide content"

View File

@@ -69,7 +69,6 @@
},
"skip-failed-authenticators": "Skip Failed Authenticators",
"alerts-url": "Alerts URL",
"feedback-url": "Feedback URL",
"release-feed-url": "Release Feed URL",
"mail-domain-name": "Fallback Mail Domain Name",
"enabled-xsrf-protection": "Enabled XSRF Protection",
@@ -96,7 +95,6 @@
"pluginUrlHelpText": "The url of the Plugin Center API. Explanation of the placeholders: version = SCM-Manager Version; os = Operation System; arch = Architecture",
"pluginAuthUrlHelpText": "The url of the Plugin Center authentication API.",
"alertsUrlHelpText": "The url of the alerts api. This provides up-to-date alerts regarding your system. To disable this feature just leave the url blank.",
"feedbackUrlHelpText": "The url of the feedback api. This can be used to send feedback to the SCM-Manager team. To disable this feature just leave the url blank.",
"releaseFeedUrlHelpText": "The url of the RSS Release Feed for SCM-Manager. This provides up-to-date version information. To disable this feature just leave the url blank.",
"mailDomainNameHelpText": "This domain name will be used to create email addresses for users without one when needed. It will not be used to send mails nor will be accessed otherwise.",
"enableForwardingHelpText": "Enable mod_proxy port forwarding.",

View File

@@ -73,7 +73,6 @@ const ConfigForm: FC<Props> = ({
namespaceStrategy: "",
loginInfoUrl: "",
alertsUrl: "",
feedbackUrl: "",
releaseFeedUrl: "",
mailDomainName: "",
emergencyContacts: [],
@@ -154,7 +153,6 @@ const ConfigForm: FC<Props> = ({
enabledApiKeys={innerConfig.enabledApiKeys}
emergencyContacts={innerConfig.emergencyContacts}
namespaceStrategy={innerConfig.namespaceStrategy}
feedbackUrl={innerConfig.feedbackUrl}
onChange={onChange}
hasUpdatePermission={configUpdatePermission}
/>

View File

@@ -42,7 +42,6 @@ type Props = {
anonymousMode: AnonymousMode;
skipFailedAuthenticators: boolean;
alertsUrl: string;
feedbackUrl: string;
releaseFeedUrl: string;
mailDomainName: string;
enabledXsrfProtection: boolean;
@@ -60,7 +59,6 @@ const GeneralSettings: FC<Props> = ({
loginInfoUrl,
anonymousMode,
alertsUrl,
feedbackUrl,
releaseFeedUrl,
mailDomainName,
enabledXsrfProtection,
@@ -96,9 +94,6 @@ const GeneralSettings: FC<Props> = ({
const handleAlertsUrlChange = (value: string) => {
onChange(true, value, "alertsUrl");
};
const handleFeedbackUrlChange = (value: string) => {
onChange(true, value, "feedbackUrl");
};
const handleReleaseFeedUrlChange = (value: string) => {
onChange(true, value, "releaseFeedUrl");
};
@@ -236,17 +231,6 @@ const GeneralSettings: FC<Props> = ({
/>
</div>
</div>
<div className="columns">
<div className="column is-full">
<InputField
label={t("general-settings.feedback-url")}
onChange={handleFeedbackUrlChange}
value={feedbackUrl}
disabled={!hasUpdatePermission}
helpText={t("help.feedbackUrlHelpText")}
/>
</div>
</div>
<div className="columns">
<div className="column is-full">
<MemberNameTagGroup

View File

@@ -25,7 +25,6 @@ import React, { FC } from "react";
import Main from "./Main";
import { useHistory } from "react-router-dom";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
import { useIndex, useSubject } from "@scm-manager/ui-api";
import { ErrorPage, Footer, Header, Loading } from "@scm-manager/ui-components";
import { binder } from "@scm-manager/ui-extensions";
@@ -33,7 +32,7 @@ import usePauseShortcutsWhenModalsActive from "../shortcuts/usePauseShortcutsWhe
import useShortcut from "../shortcuts/useShortcut";
import Login from "./Login";
import NavigationBar from "./NavigationBar";
import Feedback from "./Feedback";
import styled from "styled-components";
const AppWrapper = styled.div`
min-height: 100vh;
@@ -96,7 +95,6 @@ const App: FC = () => {
<NavigationBar links={index._links} />
</Header>
<div className="is-flex-grow-1">{content}</div>
{isAuthenticated ? <Feedback index={index} /> : null}
<Footer me={me} version={index.version} links={index._links} />
</AppWrapper>
);

View File

@@ -1,135 +0,0 @@
/*
* 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, useMemo, useState } from "react";
import styled from "styled-components";
import { apiClient, Button, Modal, devices } from "@scm-manager/ui-components";
import { HalRepresentation, IndexResources, Link } from "@scm-manager/ui-types";
import { useTranslation } from "react-i18next";
import { ApiResult, createQueryString } from "@scm-manager/ui-api";
import { useQuery } from "react-query";
import { useThemeState } from "./Theme";
type Props = {
index: IndexResources;
};
const useFeedbackUrl = (url: string): ApiResult<HalRepresentation> =>
useQuery(["config", "feedback"], () => apiClient.get(url).then(r => r.json()), {
refetchOnWindowFocus: false
});
const createFeedbackFormUrl = (instanceId: string, scmVersion: string, theme: string, data?: HalRepresentation) => {
if (data?._links?.form) {
const formUrl = (data._links.form as Link).href;
return `${formUrl}?${createQueryString({ instanceId, scmVersion, theme })}`;
}
return "";
};
const useFeedback = (index: IndexResources) => {
const feedbackUrl = (index._links.feedback as Link)?.href || "";
const { theme } = useThemeState();
const { data, error, isLoading } = useFeedbackUrl(feedbackUrl);
const formUrl = useMemo(() => createFeedbackFormUrl(index.instanceId, index.version, theme, data), [
theme,
data,
index.instanceId,
index.version
]);
if (!index._links.feedback || error || isLoading || !formUrl) {
return {
isAvailable: false,
formUrl: ""
};
}
return {
isAvailable: true,
formUrl
};
};
const Feedback: FC<Props> = ({ index }) => {
const { isAvailable, formUrl } = useFeedback(index);
const [showModal, setShowModal] = useState(false);
if (isAvailable && !showModal) {
return <FeedbackTriggerButton openModal={() => setShowModal(true)} />;
}
if (showModal) {
return <FeedbackForm close={() => setShowModal(false)} formUrl={formUrl} />;
}
return null;
};
const TriggerButton = styled(Button)`
position: fixed;
z-index: 5;
left: 1rem;
right: unset;
bottom: -1px;
border-radius: 0.2rem 0.2rem 0 0;
@media screen and (min-width: ${devices.desktop.width}px) {
right: 1rem;
left: unset;
}
`;
const ModalWrapper = styled(Modal)`
.modal-card-body {
padding: 0;
}
`;
const FeedbackTriggerButton: FC<{ openModal: () => void }> = ({ openModal }) => {
const [t] = useTranslation("commons");
return <TriggerButton action={openModal} color="info" label={t("feedback.button")} icon="comment" />;
};
type FormProps = {
close: () => void;
formUrl: string;
};
const FeedbackWrapper = styled.div`
height: 45rem;
width: auto;
`;
const FeedbackForm: FC<FormProps> = ({ close, formUrl }) => {
const [t] = useTranslation("commons");
return (
<ModalWrapper title={t("feedback.modalTitle")} active={true} closeFunction={close}>
<FeedbackWrapper>
<iframe src={formUrl} height="100%" width="100%" title="feedback-form" />
</FeedbackWrapper>
</ModalWrapper>
);
};
export default Feedback;

View File

@@ -62,7 +62,6 @@ public class ConfigDto extends HalRepresentation implements UpdateConfigDto {
private String namespaceStrategy;
private String loginInfoUrl;
private String alertsUrl;
private String feedbackUrl;
private String releaseFeedUrl;
private String mailDomainName;
private Set<String> emergencyContacts;

View File

@@ -155,9 +155,6 @@ public class IndexDtoGenerator extends HalAppenderMapper {
if (!Strings.isNullOrEmpty(configuration.getAlertsUrl())) {
builder.single(link("alerts", resourceLinks.alerts().get()));
}
if (!Strings.isNullOrEmpty(configuration.getFeedbackUrl())) {
builder.single(link("feedback", configuration.getFeedbackUrl()));
}
} else {
builder.single(link("login", resourceLinks.authentication().jsonLogin()));
}