Skip to content

Add progress bar #9983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions airbyte-webapp/src/components/LoadingSchema/LoadingSchema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { FormattedMessage } from "react-intl";
import styled from "styled-components";

import Spinner from "components/Spinner";
import { ProgressBar } from "components";

const SpinnerBlock = styled.div`
padding: 40px;
Expand All @@ -17,9 +17,12 @@ const FetchMessage = styled.div`
white-space: pre-line;
`;

// Progress Bar runs 4min for discoveries schema
const PROGRESS_BAR_TIME = 60 * 4;

const LoadingSchema: React.FC = () => (
<SpinnerBlock>
<Spinner />
<ProgressBar runTime={PROGRESS_BAR_TIME} />
<FetchMessage>
<FormattedMessage id="onboarding.fetchingSchema" />
</FetchMessage>
Expand Down
71 changes: 71 additions & 0 deletions airbyte-webapp/src/components/ProgressBar/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import React from "react";
import styled, { keyframes } from "styled-components";
import { FormattedMessage } from "react-intl";

type ProgressBarProps = {
runTime?: number;
text?: React.ReactNode;
};

export const GrowAnimation = keyframes`
0% {
width: 0;
}
100% {
width: 100%;
}
`;
export const fadeInAnimation = keyframes`
0% {
opacity: 0;
}
100% {
opacity: 1;
}
`;

const Bar = styled.div`
width: 100%;
max-width: 370px;
height: 19px;
border: 1px solid ${({ theme }) => theme.greyColor20};
border-radius: 4px;
overflow: hidden;
position: relative;
display: inline-block;
`;

const Progress = styled.div<{ runTime: number }>`
width: 100%;
height: 100%;
background: ${({ theme }) => theme.primaryColor25};
animation: ${GrowAnimation} ${({ runTime }) => runTime}s linear 0s;
`;

const Text = styled.div<{ delay: number }>`
text-align: center;
position: absolute;
width: 100%;
top: 0;
left: 0;
color: ${({ theme }) => theme.whiteColor};
font-size: 12px;
font-weight: bold;
animation: ${fadeInAnimation} 1s linear ${({ delay }) => delay + 0.5}s
forwards;
opacity: 0;
`;

const ProgressBar: React.FC<ProgressBarProps> = ({ runTime, text }) => {
const animationRunTime = runTime || 20;
return (
<Bar>
<Progress runTime={animationRunTime} />
<Text delay={animationRunTime}>
{text || <FormattedMessage id="form.wait" />}
</Text>
</Bar>
);
};

export default ProgressBar;
4 changes: 4 additions & 0 deletions airbyte-webapp/src/components/ProgressBar/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import ProgressBar from "./ProgressBar";

export default ProgressBar;
export { ProgressBar };
1 change: 1 addition & 0 deletions airbyte-webapp/src/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ export * from "./ContentCard";
export * from "./ImageBlock";
export * from "./LabeledRadioButton";
export * from "./Modal";
export * from "./ProgressBar";
1 change: 1 addition & 0 deletions airbyte-webapp/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"form.pkSelected": "{count, plural, =0 { } one {{items}} other {# keys selected}}",
"form.url.error": "field must be a valid URL",
"form.setupGuide": "Setup Guide",
"form.wait": "Please wait a little bit more…",

"connectionForm.validation.error": "The form is invalid. Please make sure that all fields are correct.",
"connectionForm.normalization.title": "Normalization",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
import React from "react";
import styled from "styled-components";
import { FormattedMessage } from "react-intl";

import { Spinner } from "components";
import { ProgressBar } from "components";

const LoadingContainer = styled.div`
font-weight: 600;
font-size: 14px;
line-height: 17px;
color: ${({ theme }) => theme.darkPrimaryColor};
margin-top: 34px;
margin: 34px 0 9px;
display: flex;
align-items: center;
justify-content: center;
`;

const Loader = styled.div`
margin-right: 10px;
`;
// Progress Bar runs 2min for checking connections
const PROGRESS_BAR_TIME = 60 * 2;

const TestingConnectionSpinner: React.FC = () => {
return (
<LoadingContainer>
<Loader>
<Spinner />
</Loader>
<FormattedMessage id="form.testingConnection" />
<ProgressBar runTime={PROGRESS_BAR_TIME} />
</LoadingContainer>
);
};
Expand Down