Skip to content

Commit

Permalink
Merge pull request #2886 from bakdata/fix/missing_manual_email_ref
Browse files Browse the repository at this point in the history
Fix: missing manual & email links
  • Loading branch information
thoniTUB authored Jan 17, 2023
2 parents bea802e + 851f6a6 commit 4b93ddb
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
package com.bakdata.conquery.apiv1.frontend;

import java.net.URL;

import com.bakdata.conquery.models.config.FrontendConfig;
import com.bakdata.conquery.models.config.IdColumnConfig;

/**
* API Response for the dynamic configuration of the frontend
*
* @param version backend version
* @param currency currency representation
* @param queryUpload identifier specific column configuration for the query upload
* @param version backend version
* @param currency currency representation
* @param queryUpload identifier specific column configuration for the query upload
* @param manualUrl url to a user manual
* @param contactEmail typical a mailto-url
*/
public record FrontendConfiguration(String version, FrontendConfig.CurrencyConfig currency, IdColumnConfig queryUpload) {
public record FrontendConfiguration(
String version,
FrontendConfig.CurrencyConfig currency,
IdColumnConfig queryUpload,
URL manualUrl,
String contactEmail
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.bakdata.conquery.apiv1.frontend.FrontendConfiguration;
import com.bakdata.conquery.models.config.ColumnConfig;
import com.bakdata.conquery.models.config.ConqueryConfig;
import com.bakdata.conquery.models.config.FrontendConfig;
import com.bakdata.conquery.models.config.IdColumnConfig;
import com.bakdata.conquery.util.VersionInfo;
import lombok.RequiredArgsConstructor;
Expand All @@ -30,7 +31,14 @@ public FrontendConfiguration getFrontendConfig() {
.filter(ColumnConfig::isResolvable)
.toList());

return new FrontendConfiguration(VersionInfo.INSTANCE.getProjectVersion(), config.getFrontend().getCurrency(), idColumns);
final FrontendConfig frontendConfig = config.getFrontend();
return new FrontendConfiguration(
VersionInfo.INSTANCE.getProjectVersion(),
frontendConfig.getCurrency(),
idColumns,
frontendConfig.getManualUrl(),
frontendConfig.getContactEmail()
);
}

}
19 changes: 19 additions & 0 deletions cypress/integration/test_3_openHelpMenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/// <reference types="cypress" />
import { visitWithToken } from "../integration-helpers/visitWithToken";

const USER_TOKEN_WITH_PERMISSIONS = "user.user2";

describe("Visit Form Editor", () => {
before(() => {
visitWithToken(USER_TOKEN_WITH_PERMISSIONS);
});

it("Can open help menu", () => {

cy.get('[data-test-id="help-menu"]').click()

cy.get('[data-test-id="help-manual"]').should("have.attr", "href", "https://example.org");

cy.get('[data-test-id="help-email"]').should("have.attr", "href", "mailto:test@example.org");
});
});
7 changes: 6 additions & 1 deletion cypress/support/backend_config.json
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
{}
{
"frontend": {
"manualUrl": "https://example.org",
"contactEmail": "test@example.org"
}
}
15 changes: 12 additions & 3 deletions frontend/src/js/header/HelpMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,21 @@ export const HelpMenu = ({ contactEmail, manualUrl }: Props) => {
const Dropdown = useMemo(
() => (
<List>
<a href={`mailto:${contactEmail}`} rel="noopener noreferrer">
<a
href={`mailto:${contactEmail}`}
rel="noopener noreferrer"
data-test-id="help-email"
>
<DropdownItemButton bgHover fixedIconWidth={14} icon="paper-plane">
{t("common.contact")}
</DropdownItemButton>
</a>
<a href={manualUrl} target="_blank" rel="noopener noreferrer">
<a
href={manualUrl}
target="_blank"
rel="noopener noreferrer"
data-test-id="help-manual"
>
<DropdownItemButton bgHover fixedIconWidth={14} icon="book">
{t("common.manual")}
</DropdownItemButton>
Expand All @@ -57,7 +66,7 @@ export const HelpMenu = ({ contactEmail, manualUrl }: Props) => {
html={Dropdown}
offset={dropdownOffset}
>
<SxIconButton icon="question" frame />
<SxIconButton icon="question" frame data-test-id="help-menu" />
</WithTooltip>
);
};

0 comments on commit 4b93ddb

Please sign in to comment.