Skip to content
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

Feature - Add Loading Animation in Deployment Flow #529

Merged
merged 2 commits into from
Aug 31, 2021
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
19 changes: 16 additions & 3 deletions src/components/DeploymentFlow/DeploymentFlow.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import lodash from 'lodash';
import PropTypes from 'prop-types';
import ReactFlow, { Background, Handle } from 'react-flow-renderer';

import LoadingBox from 'components/LoadingBox';
import { LogsButton } from 'components/Buttons';
import { OperatorsEmptyPlaceholder } from 'components/EmptyPlaceholders';
import Vectors, {
nodeTypes,
edgeTypes,
Expand Down Expand Up @@ -117,9 +117,15 @@ const DeploymentFlow = ({
]);

return loading ? (
<LoadingBox siderColor='#FFF2E8' />
<div className='deployment-flow'>
<OperatorsEmptyPlaceholder
className='deployment-flow-empty-operators'
placeholderWhenLoading='Aguarde...'
loading
/>
</div>
) : (
<div className='deployment-flow' style={{ height: '100%' }}>
<div className='deployment-flow'>
<ReactFlow
deleteKeyCode={46}
edgeTypes={edgeTypes}
Expand All @@ -140,6 +146,13 @@ const DeploymentFlow = ({
style={{ backgroundColor: 'white' }}
/>

{!operators?.length && (
<OperatorsEmptyPlaceholder
className='deployment-flow-empty-operators'
placeholder='Crie um fluxo de pré-implantação para visualizar aqui'
/>
)}

<LogsButton
className='deployment-flow-logs-button'
errorCount={numberOfLogs}
Expand Down
8 changes: 8 additions & 0 deletions src/components/DeploymentFlow/DeploymentFlow.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,19 @@
.deployment-flow {
height: 100%;
position: relative;
background: white;

.deployment-flow-logs-button {
position: absolute;
bottom: 16px;
right: 16px;
z-index: 10;
}

.deployment-flow-empty-operators {
position: absolute;
top: 25%;
left: 25%;
z-index: 10;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@ import { OperatorsEmpty } from 'assets';

import './styles.less';

const OperatorsEmptyPlaceholder = ({ className, loading }) => {
const OperatorsEmptyPlaceholder = ({
className,
loading,
placeholder,
placeholderWhenLoading,
}) => {
const animationClass = loading ? 'image-animated' : '';
const placeholderText = loading
? 'Aguarde...'
: 'Para criar um fluxo, arraste e solte as tarefas aqui';
const placeholderText = loading ? placeholderWhenLoading : placeholder;

return (
<div className={`OperatorsEmptyContainer ${className}`}>
<h3>{placeholderText}</h3>
{!!placeholderText && <h3>{placeholderText}</h3>}

<img
className={animationClass}
draggable={false}
src={OperatorsEmpty}
alt='empty operators diagram'
alt='Operators Placeholder'
/>
</div>
);
Expand All @@ -26,11 +31,15 @@ const OperatorsEmptyPlaceholder = ({ className, loading }) => {
OperatorsEmptyPlaceholder.propTypes = {
className: PropTypes.string,
loading: PropTypes.bool,
placeholder: PropTypes.string,
placeholderWhenLoading: PropTypes.string,
};

OperatorsEmptyPlaceholder.defaultProps = {
className: '',
loading: false,
placeholder: '',
placeholderWhenLoading: '',
};

export default OperatorsEmptyPlaceholder;
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.OperatorsEmptyContainer {
user-select: none;

h3 {
opacity: 0.5;
}
Expand Down
46 changes: 0 additions & 46 deletions src/components/LoadingBox/LoadingBox.component.jsx

This file was deleted.

11 changes: 0 additions & 11 deletions src/components/LoadingBox/LoadingBox.md

This file was deleted.

51 changes: 0 additions & 51 deletions src/components/LoadingBox/LoadingBox.style.less

This file was deleted.

3 changes: 0 additions & 3 deletions src/components/LoadingBox/index.js

This file was deleted.

1 change: 0 additions & 1 deletion src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export { default as ExperimentEmpty } from './ExperimentEmpty';
export { default as ExternalDatasetDrawer } from './ExternalDatasetDrawer';
export { default as ImageLightbox } from './ImageLightbox';
export { default as InfoRow } from './InfoRow';
export { default as LoadingBox } from './LoadingBox';
export { default as LogListItem } from './LogListItem';
export { default as LogsDrawer } from './LogsDrawer';
export { default as LogsModal } from './LogsModal';
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Experiments/Experiment/ExperimentFlow/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ const ExperimentFlow = ({

{emptyOperators && (
<OperatorsEmptyPlaceholder
loading={flowLoading}
className='experiment-flow-empty-operators'
loading={flowLoading}
placeholderWhenLoading='Aguarde...'
placeholder='Para criar um fluxo, arraste e solte as tarefas aqui'
/>
)}

Expand Down
1 change: 1 addition & 0 deletions src/pages/Experiments/Experiment/ExperimentFlow/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
right: 16px;
z-index: 10;
}

.experiment-flow-empty-operators {
position: absolute;
top: 25%;
Expand Down