Skip to content

Commit

Permalink
Merge pull request #2893 from bakdata/fix/revert-develop-merge
Browse files Browse the repository at this point in the history
Fix/revert develop merge
  • Loading branch information
thoniTUB authored Jan 19, 2023
2 parents 4b93ddb + 44ee890 commit 716c326
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 190 deletions.
2 changes: 0 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"build": "INLINE_RUNTIME_CHUNK=false react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-scripts eject",
"format": "prettier --eslint-config-path ./.eslintrc.js --write '**/*.{js,jsx,ts,tsx,json,css}'",
"heroku-postbuild": "yarn run build",
"lint": "eslint --ext .ts --ext .tsx src/",
"checkformat": "prettier --check \"src/**/*.{js,jsx,ts,tsx,json,css}\"",
Expand Down Expand Up @@ -44,7 +43,6 @@
"compression": "^1.7.4",
"date-fns": "^2.28.0",
"downshift": "^6.1.7",
"express-rate-limit": "^6.7.0",
"file-saver": "^2.0.5",
"helmet": "^5.0.2",
"i18next": "^21.6.11",
Expand Down
11 changes: 0 additions & 11 deletions frontend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ const compression = require("compression");
const helmet = require("helmet");
const cors = require("cors");
const path = require("path");
const rateLimit = require('express-rate-limit');

const PORT = process.env.PORT || 8000;
// Maximum requests per minute
const requestsPerMinute = process.env.REQUESTS_PER_MINUTE || 1000;

app.use(
helmet({
Expand All @@ -23,14 +20,6 @@ app.disable("x-powered-by");
app.use(compression());
app.use(cors());

// set up rate limiter: default maximum of 1000 requests per minute
app.use(
rateLimit({
windowMs: 60 * 1000, // 1 minute
max: requestsPerMinute
})
);

app.use(express.static(path.resolve(__dirname, "build")));
app.get("*", (req, res) =>
res.sendFile(path.join(__dirname, "build", "index.html"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useTranslation } from "react-i18next";

import { getWidthAndHeight } from "../../app/DndProvider";
import IconButton from "../../button/IconButton";
import { HoverNavigatable } from "../../small-tab-navigation/HoverNavigatable";
import { getRootNodeLabel } from "../../standard-query-editor/helper";
import type { DragItemConceptTreeNode } from "../../standard-query-editor/types";
import WithTooltip from "../../tooltip/WithTooltip";
Expand Down Expand Up @@ -122,44 +121,40 @@ const FormConceptNode: FC<PropsT> = ({
: undefined;

return (
<HoverNavigatable triggerNavigate={onClick}>
<Root
ref={(instance) => {
ref.current = instance;
drag(instance);
}}
active={hasNonDefaultSettings || hasFilterValues}
onClick={onClick}
>
<div>
<WithTooltip text={tooltipText}>
<>
{rootNodeLabel && <RootNode>{rootNodeLabel}</RootNode>}
<Label>{conceptNode && conceptNode.label}</Label>
{conceptNode && !!conceptNode.description && (
<Description>{conceptNode.description}</Description>
)}
</>
<Root
ref={(instance) => {
ref.current = instance;
drag(instance);
}}
active={hasNonDefaultSettings || hasFilterValues}
onClick={onClick}
>
<div>
<WithTooltip text={tooltipText}>
<>
{rootNodeLabel && <RootNode>{rootNodeLabel}</RootNode>}
<Label>{conceptNode && conceptNode.label}</Label>
{conceptNode && !!conceptNode.description && (
<Description>{conceptNode.description}</Description>
)}
</>
</WithTooltip>
</div>
<Right>
{expand && expand.expandable && (
<WithTooltip text={t("externalForms.common.concept.expand")}>
<SxIconButton
icon={expand.active ? "compress-arrows-alt" : "expand-arrows-alt"}
tiny
onClick={(e) => {
e.stopPropagation();
expand.onClick();
}}
/>
</WithTooltip>
</div>
<Right>
{expand && expand.expandable && (
<WithTooltip text={t("externalForms.common.concept.expand")}>
<SxIconButton
icon={
expand.active ? "compress-arrows-alt" : "expand-arrows-alt"
}
tiny
onClick={(e) => {
e.stopPropagation();
expand.onClick();
}}
/>
</WithTooltip>
)}
</Right>
</Root>
</HoverNavigatable>
)}
</Right>
</Root>
);
};

Expand Down
27 changes: 9 additions & 18 deletions frontend/src/js/pane/TabNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import styled from "@emotion/styled";
import { FC } from "react";

import FaIcon from "../icon/FaIcon";
import { HoverNavigatable } from "../small-tab-navigation/HoverNavigatable";
import WithTooltip from "../tooltip/WithTooltip";

const Root = styled("div")`
Expand Down Expand Up @@ -69,28 +68,20 @@ const TabNavigation: FC<PropsT> = ({
onClickTab,
dataTestId,
}) => {
function createClickHandler(key: string) {
return () => {
if (key !== activeTab) {
onClickTab(key);
}
};
}

return (
<Root data-test-id={dataTestId}>
{tabs.map(({ key, label, tooltip, loading }) => {
return (
<SxWithTooltip text={tooltip} lazy key={key}>
<HoverNavigatable triggerNavigate={createClickHandler(key)}>
<Headline
active={activeTab === key}
onClick={createClickHandler(key)}
>
{label}
{loading && <SxFaIcon icon="spinner" />}
</Headline>
</HoverNavigatable>
<Headline
active={activeTab === key}
onClick={() => {
if (key !== activeTab) onClickTab(key);
}}
>
{label}
{loading && <SxFaIcon icon="spinner" />}
</Headline>
</SxWithTooltip>
);
})}
Expand Down
60 changes: 0 additions & 60 deletions frontend/src/js/small-tab-navigation/HoverNavigatable.tsx

This file was deleted.

24 changes: 10 additions & 14 deletions frontend/src/js/small-tab-navigation/SmallTabNavigationButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { useTheme, Theme, css } from "@emotion/react";
import styled from "@emotion/styled";
import { forwardRef } from "react";

import { HoverNavigatable } from "./HoverNavigatable";

const bottomBorderBase = css`
content: "";
position: absolute;
Expand Down Expand Up @@ -78,18 +76,16 @@ const SmallTabNavigationButton = forwardRef<HTMLButtonElement, PropsT>(
const highlightColor = valueToColor(theme, value);

return (
<HoverNavigatable triggerNavigate={onClick}>
<Button
ref={ref}
highlightColor={highlightColor}
type="button"
size={size}
selected={isSelected}
onClick={onClick}
>
{children}
</Button>
</HoverNavigatable>
<Button
ref={ref}
highlightColor={highlightColor}
type="button"
size={size}
selected={isSelected}
onClick={onClick}
>
{children}
</Button>
);
},
);
Expand Down
73 changes: 32 additions & 41 deletions frontend/src/js/standard-query-editor/QueryNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,20 @@ import {
nodeIsConceptQueryNode,
} from "../model/node";
import { isQueryExpandable } from "../model/query";
import { HoverNavigatable } from "../small-tab-navigation/HoverNavigatable";
import AdditionalInfoHoverable from "../tooltip/AdditionalInfoHoverable";

import QueryNodeActions from "./QueryNodeActions";
import QueryNodeContent from "./QueryNodeContent";
import { getRootNodeLabel } from "./helper";
import { StandardQueryNodeT } from "./types";

const FlexHoverNavigatable = styled(HoverNavigatable)`
display: flex;
width: 100%;
`;

const Root = styled("div")<{
active?: boolean;
}>`
position: relative;
width: 100%;
margin: 0 auto;
background-color: white;
display: grid;
grid-template-columns: 1fr auto;
Expand Down Expand Up @@ -175,8 +170,6 @@ const QueryNode = ({
onExpandClick(node.query);
}, [onExpandClick, node]);

const onClick = !!node.error ? () => {} : () => onEditClick(andIdx, orIdx);

const label = nodeIsConceptQueryNode(node)
? node.label
: node.label || node.id;
Expand All @@ -187,39 +180,37 @@ const QueryNode = ({
: undefined;

const QueryNodeRoot = (
<FlexHoverNavigatable triggerNavigate={onClick}>
<Root
ref={(instance) => {
ref.current = instance;
drag(instance);
}}
active={hasNonDefaultSettings || hasFilterValues}
onClick={node.error ? undefined : () => onEditClick(andIdx, orIdx)}
>
<QueryNodeContent
error={node.error}
isConceptQueryNode={nodeIsConceptQueryNode(node)}
tooltipText={tooltipText}
label={label}
description={description}
rootNodeLabel={rootNodeLabel}
/>
<QueryNodeActions
andIdx={andIdx}
orIdx={orIdx}
excludeTimestamps={node.excludeTimestamps}
isExpandable={isQueryExpandable(node)}
hasActiveSecondaryId={hasActiveSecondaryId}
excludeFromSecondaryId={node.excludeFromSecondaryId}
onDeleteNode={onDeleteNode}
onToggleTimestamps={onToggleTimestamps}
onToggleSecondaryIdExclude={onToggleSecondaryIdExclude}
onExpandClick={expandClick}
previousQueryLoading={node.loading}
error={node.error}
/>
</Root>
</FlexHoverNavigatable>
<Root
ref={(instance) => {
ref.current = instance;
drag(instance);
}}
active={hasNonDefaultSettings || hasFilterValues}
onClick={node.error ? undefined : () => onEditClick(andIdx, orIdx)}
>
<QueryNodeContent
error={node.error}
isConceptQueryNode={nodeIsConceptQueryNode(node)}
tooltipText={tooltipText}
label={label}
description={description}
rootNodeLabel={rootNodeLabel}
/>
<QueryNodeActions
andIdx={andIdx}
orIdx={orIdx}
excludeTimestamps={node.excludeTimestamps}
isExpandable={isQueryExpandable(node)}
hasActiveSecondaryId={hasActiveSecondaryId}
excludeFromSecondaryId={node.excludeFromSecondaryId}
onDeleteNode={onDeleteNode}
onToggleTimestamps={onToggleTimestamps}
onToggleSecondaryIdExclude={onToggleSecondaryIdExclude}
onExpandClick={expandClick}
previousQueryLoading={node.loading}
error={node.error}
/>
</Root>
);

if (nodeIsConceptQueryNode(node)) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/js/standard-query-editor/QueryNodeActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const StyledFaIcon = styled(FaIcon)`
`;

const StyledIconButton = styled(IconButton)`
padding: 4px 6px 4px;
padding: 0px 6px 4px;
`;

const RelativeContainer = styled.div`
Expand Down
Loading

0 comments on commit 716c326

Please sign in to comment.