Skip to content

Commit 0aed33e

Browse files
authored
Combine admin and settings (#4525)
* Add side menu component * Add side menu to settings page. Remove admin link from sidebar * Move NotificationPage * Move ConfigurationPage * Add Sources and Destinations pages to Settings. Delete Admin page * Add MetricsPage * Edit Notifications and Metrics pages * Update feedback for metrics and notification pages * Add update icons data to side menu * Add AccountPage
1 parent 830fac6 commit 0aed33e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1465
-370
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import React from "react";
2+
import styled from "styled-components";
3+
4+
import MenuItem from "./components/MenuItem";
5+
6+
export type SideMenuItem = {
7+
id: string;
8+
name: string | React.ReactNode;
9+
indicatorCount?: number;
10+
};
11+
12+
type SideMenuProps = {
13+
data: SideMenuItem[];
14+
activeItem?: string;
15+
onSelect: (id: string) => void;
16+
};
17+
18+
const Content = styled.nav`
19+
min-width: 147px;
20+
`;
21+
22+
const SideMenu: React.FC<SideMenuProps> = ({ data, onSelect, activeItem }) => {
23+
return (
24+
<Content>
25+
{data.map((item) => (
26+
<MenuItem
27+
key={item.id}
28+
name={item.name}
29+
isActive={item.id === activeItem}
30+
count={item.indicatorCount}
31+
onClick={() => onSelect(item.id)}
32+
/>
33+
))}
34+
</Content>
35+
);
36+
};
37+
38+
export default SideMenu;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import React from "react";
2+
import styled from "styled-components";
3+
4+
type IProps = {
5+
name: string | React.ReactNode;
6+
isActive?: boolean;
7+
count?: number;
8+
onClick: () => void;
9+
};
10+
11+
const Item = styled.div<{
12+
isActive?: boolean;
13+
}>`
14+
width: 100%;
15+
padding: 6px 8px 7px;
16+
border-radius: 4px;
17+
cursor: pointer;
18+
background: ${({ theme, isActive }) =>
19+
isActive ? theme.primaryColor12 : "none"};
20+
font-style: normal;
21+
font-weight: 500;
22+
font-size: 12px;
23+
line-height: 15px;
24+
color: ${({ theme, isActive }) =>
25+
isActive ? theme.primaryColor : theme.greyColor60};
26+
`;
27+
28+
const Counter = styled.div`
29+
min-width: 12px;
30+
height: 12px;
31+
padding: 0 3px;
32+
text-align: center;
33+
border-radius: 15px;
34+
background: ${({ theme }) => theme.dangerColor};
35+
font-size: 8px;
36+
line-height: 13px;
37+
color: ${({ theme }) => theme.whiteColor};
38+
display: inline-block;
39+
margin-left: 5px;
40+
`;
41+
42+
const MenuItem: React.FC<IProps> = ({ name, isActive, count, onClick }) => {
43+
return (
44+
<Item isActive={isActive} onClick={onClick}>
45+
{name}
46+
{count ? <Counter>{count}</Counter> : null}
47+
</Item>
48+
);
49+
};
50+
51+
export default MenuItem;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import SideMenu from "./SideMenu";
2+
3+
export default SideMenu;
4+
export { SideMenu };

airbyte-webapp/src/components/hooks/services/useConnector.tsx

+21
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ type ConnectorService = {
99
hasNewVersions: boolean;
1010
hasNewSourceVersion: boolean;
1111
hasNewDestinationVersion: boolean;
12+
countNewSourceVersion: number;
13+
countNewDestinationVersion: number;
1214
updateAllSourceVersions: () => void;
1315
updateAllDestinationVersions: () => void;
1416
};
@@ -57,6 +59,23 @@ const useConnector = (): ConnectorService => {
5759
[hasNewSourceVersion, hasNewDestinationVersion]
5860
);
5961

62+
const countNewSourceVersion = useMemo(
63+
() =>
64+
sourceDefinitions.filter(
65+
(source) => source.latestDockerImageTag !== source.dockerImageTag
66+
).length,
67+
[sourceDefinitions]
68+
);
69+
70+
const countNewDestinationVersion = useMemo(
71+
() =>
72+
destinationDefinitions.filter(
73+
(destination) =>
74+
destination.latestDockerImageTag !== destination.dockerImageTag
75+
).length,
76+
[destinationDefinitions]
77+
);
78+
6079
const updateAllSourceVersions = async () => {
6180
const updateList = sourceDefinitions.filter(
6281
(source) => source.latestDockerImageTag !== source.dockerImageTag
@@ -100,6 +119,8 @@ const useConnector = (): ConnectorService => {
100119
hasNewDestinationVersion,
101120
updateAllSourceVersions,
102121
updateAllDestinationVersions,
122+
countNewSourceVersion,
123+
countNewDestinationVersion,
103124
};
104125
};
105126

airbyte-webapp/src/components/hooks/services/useWorkspaceHook.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ const useWorkspace = (): {
7878
workspaceId: config.ui.workspaceId,
7979
initialSetupComplete: workspace.initialSetupComplete,
8080
displaySetupWizard: workspace.displaySetupWizard,
81+
notifications: workspace.notifications,
8182
...data,
8283
}
8384
);

airbyte-webapp/src/components/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ export * from "./ContentCard";
1717
export * from "./ImageBlock";
1818
export * from "./LabeledRadioButton";
1919
export * from "./Modal";
20+
export * from "./SideMenu";

airbyte-webapp/src/locales/en.json

+8
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,14 @@
322322
"settings.webhookTestText": "Testing the Webhook will send a “Hello World”. ",
323323
"settings.yourWebhook": "Your Webhook URL",
324324
"settings.test": "Test",
325+
"settings.notifications": "Notifications",
326+
"settings.metrics": "Metrics",
327+
"settings.notificationSettings": "Notification Settings",
328+
"settings.metricsSettings": "Metrics Settings",
329+
"settings.emailNotifications": "Email notifications",
330+
"settings.securityUpdates": "Security updates (recommended)",
331+
"settings.newsletter": "Newsletter with feature updates.",
332+
"settings.account": "Account",
325333

326334
"connector.requestConnectorBlock": "+ Request a new connector",
327335
"connector.requestConnector": "Request a new connector",

airbyte-webapp/src/pages/AdminPage/AdminPage.tsx

-83
This file was deleted.

0 commit comments

Comments
 (0)