Skip to content

Commit a4ccaee

Browse files
🪟 Add catalog changes modal on schema refresh (#14074)
* WIP - types, props, components * logic tweaks * moving around * begin styling and content * modal formatting, section header * client update, add/removed streams works * theme tweaks * WIP -- adding accordion * hook for modal display logic * display logic, row/accordion progress * fix atrocities of table rendering, move header to own component * headers cleanup * headers cleanup * imageblock more flexible * progress on table todo: consolidate, complete * styling good, animation TODO * self review pt. 1 * cleanup * note * note * accessibility and i18n improvements * fix typo in scss * missig i18l things * move icon to /icons * Update airbyte-webapp/src/views/Connection/CatalogDiffModal/CatalogDiffModal.tsx Co-authored-by: Edmundo Ruiz Ghanem <[email protected]> * Update airbyte-webapp/src/views/Connection/CatalogDiffModal/components/DiffAccordion.tsx Co-authored-by: Edmundo Ruiz Ghanem <[email protected]> * spacing, use ModalFooter * Update airbyte-webapp/src/views/Connection/CatalogDiffModal/components/StreamRow.tsx Co-authored-by: Edmundo Ruiz Ghanem <[email protected]> * begin moving to memoized reducer function * memoize diff sorter and remove extra divs * cleanup * modal body padding * up0date to use modal service * move calculated string mode out of component * respond to review * add accordionheader component * catalog can be undefined * cleanup cell rendering * cleanup and make storybook work again * move table styles within a parent class * subheading alignment consistency * more padding/spacing adjustments * cleanup from review * mixup from rebase * set width on modal level not content level * Update airbyte-webapp/src/views/Connection/CatalogDiffModal/utils.tsx Co-authored-by: Edmundo Ruiz Ghanem <[email protected]> * Update airbyte-webapp/src/views/Connection/CatalogDiffModal/utils.tsx Co-authored-by: Edmundo Ruiz Ghanem <[email protected]> * linting and unused class cleanup Co-authored-by: Edmundo Ruiz Ghanem <[email protected]>
1 parent d3d60c1 commit a4ccaee

34 files changed

+901
-21
lines changed

airbyte-webapp/.storybook/withProvider.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,17 @@ import { FeatureService } from "../src/hooks/services/Feature";
1313
import { ConfigServiceProvider, defaultConfig } from "../src/config";
1414
import { DocumentationPanelProvider } from "../src/views/Connector/ConnectorDocumentationLayout/DocumentationPanelContext";
1515
import { ServicesProvider } from "../src/core/servicesProvider";
16-
import {
17-
analyticsServiceContext,
18-
AnalyticsServiceProviderValue,
19-
} from "../src/hooks/services/Analytics";
16+
import { analyticsServiceContext, AnalyticsServiceProviderValue } from "../src/hooks/services/Analytics";
2017

21-
const AnalyticsContextMock: AnalyticsServiceProviderValue = ({
18+
const AnalyticsContextMock: AnalyticsServiceProviderValue = {
2219
analyticsContext: {},
2320
setContext: () => {},
2421
addContextProps: () => {},
2522
removeContextProps: () => {},
2623
service: {
2724
track: () => {},
2825
},
29-
} as unknown) as AnalyticsServiceProviderValue;
26+
} as unknown as AnalyticsServiceProviderValue;
3027

3128
const queryClient = new QueryClient({
3229
defaultOptions: {
@@ -45,12 +42,9 @@ export const withProviders = (getStory) => (
4542
<MemoryRouter>
4643
<IntlProvider messages={messages} locale={"en"}>
4744
<ThemeProvider theme={theme}>
48-
<ConfigServiceProvider
49-
defaultConfig={defaultConfig}
50-
providers={[]}
51-
>
45+
<ConfigServiceProvider defaultConfig={defaultConfig} providers={[]}>
5246
<DocumentationPanelProvider>
53-
<FeatureService>
47+
<FeatureService features={[]}>
5448
<GlobalStyle />
5549
{getStory()}
5650
</FeatureService>

airbyte-webapp/package-lock.json

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

airbyte-webapp/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@fortawesome/free-solid-svg-icons": "^6.1.1",
2929
"@fortawesome/react-fontawesome": "^0.1.18",
3030
"@fullstory/browser": "^1.5.1",
31+
"@headlessui/react": "^1.6.5",
3132
"@monaco-editor/react": "^4.4.5",
3233
"@sentry/react": "^6.19.6",
3334
"@sentry/tracing": "^6.19.6",

airbyte-webapp/src/components/ImageBlock/ImageBlock.module.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@
2121
&.darkBlue {
2222
background: colors.$dark-blue-100;
2323
}
24+
&.green {
25+
background: colors.$green;
26+
color: colors.$white;
27+
}
28+
29+
&.red {
30+
background: colors.$red;
31+
color: colors.$white;
32+
}
33+
34+
&.blue {
35+
background: colors.$blue;
36+
color: colors.$white;
37+
}
2438
}
2539

2640
.small {
@@ -39,4 +53,8 @@
3953
font-size: 10px;
4054
color: colors.$white;
4155
padding: 3px 0 3px;
56+
57+
&.light {
58+
font-weight: 500;
59+
}
4260
}

airbyte-webapp/src/components/ImageBlock/ImageBlock.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,28 @@ interface ImageBlockProps {
99
img?: string;
1010
num?: number;
1111
small?: boolean;
12+
color?: string;
13+
light?: boolean;
14+
ariaLabel?: string;
1215
}
1316

14-
export const ImageBlock: React.FC<ImageBlockProps> = ({ img, num, small }) => {
17+
export const ImageBlock: React.FC<ImageBlockProps> = ({ img, num, small, color, light, ariaLabel }) => {
1518
const imageCircleClassnames = classnames({
1619
[styles.circle]: num,
1720
[styles.iconContainer]: !num || num === undefined,
1821
[styles.small]: small && !num,
19-
[styles.darkBlue]: !small && num,
22+
[styles.darkBlue]: !small && num && !color,
23+
[styles.green]: color === "green",
24+
[styles.red]: color === "red",
25+
[styles.blue]: color === "blue",
26+
[styles.light]: light,
2027
});
28+
29+
const numberStyles = classnames(styles.number, { [styles.light]: light });
30+
2131
return (
22-
<div className={imageCircleClassnames}>
23-
{num ? <div className={styles.number}>{num}</div> : <div className={styles.icon}>{getIcon(img)}</div>}
32+
<div className={imageCircleClassnames} aria-label={ariaLabel}>
33+
{num ? <div className={numberStyles}>{num}</div> : <div className={styles.icon}>{getIcon(img)}</div>}
2434
</div>
2535
);
2636
};

airbyte-webapp/src/components/Modal/ModalBody.module.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@
44
padding: variables.$spacing-lg variables.$spacing-xl;
55
overflow: auto;
66
max-width: 100%;
7+
&.paddingNone {
8+
padding: 0;
9+
}
710
}

airbyte-webapp/src/components/Modal/ModalBody.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
import classnames from "classnames";
2+
13
import styles from "./ModalBody.module.scss";
24

35
interface ModalBodyProps {
46
maxHeight?: number | string;
7+
padded?: boolean;
58
}
69

7-
export const ModalBody: React.FC<ModalBodyProps> = ({ children, maxHeight }) => {
10+
export const ModalBody: React.FC<ModalBodyProps> = ({ children, maxHeight, padded = true }) => {
11+
const modalStyles = classnames(styles.modalBody, {
12+
[styles.paddingNone]: !padded,
13+
});
814
return (
9-
<div className={styles.modalBody} style={{ maxHeight }}>
15+
<div className={modalStyles} style={{ maxHeight }}>
1016
{children}
1117
</div>
1218
);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export const ModificationIcon: React.FC = () => {
2+
return (
3+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
4+
<path
5+
fillRule="evenodd"
6+
clipRule="evenodd"
7+
d="M10.8332 9.16663L14.1665 6.66663L10.8332 4.16663V5.83329H4.1665V7.49996H10.8332V9.16663Z"
8+
fill="#CBC8FF"
9+
/>
10+
<path
11+
fillRule="evenodd"
12+
clipRule="evenodd"
13+
d="M9.16683 15.8334L5.8335 13.3334L9.16683 10.8334V12.5H15.8335V14.1667H9.16683V15.8334Z"
14+
fill="#CBC8FF"
15+
/>
16+
</svg>
17+
);
18+
};

airbyte-webapp/src/hooks/services/Modal/ModalService.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const ModalServiceProvider: React.FC = ({ children }) => {
4343
<Modal
4444
title={modalOptions.title}
4545
size={modalOptions.size}
46-
onClose={() => resultSubjectRef.current?.next({ type: "canceled" })}
46+
onClose={modalOptions.preventCancel ? undefined : () => resultSubjectRef.current?.next({ type: "canceled" })}
4747
>
4848
<modalOptions.content
4949
onCancel={() => resultSubjectRef.current?.next({ type: "canceled" })}

airbyte-webapp/src/hooks/services/Modal/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ModalProps } from "components/Modal/Modal";
55
export interface ModalOptions<T> {
66
title: ModalProps["title"];
77
size?: ModalProps["size"];
8+
preventCancel?: boolean;
89
content: React.ComponentType<ModalContentProps<T>>;
910
}
1011

0 commit comments

Comments
 (0)