Added loading component to indicate that more buttons are loading.
This commit is contained in:
parent
c6b7f4f0be
commit
d4002fd7b5
|
@ -5,6 +5,7 @@ import {faCloud} from '@fortawesome/free-solid-svg-icons';
|
||||||
import AWSRunInstances from './AWSRunInstances';
|
import AWSRunInstances from './AWSRunInstances';
|
||||||
import NextSelectionButton from '../../ui-components/inline-selection/NextSelectionButton';
|
import NextSelectionButton from '../../ui-components/inline-selection/NextSelectionButton';
|
||||||
import {Alert, Button} from 'react-bootstrap';
|
import {Alert, Button} from 'react-bootstrap';
|
||||||
|
import LoadingIcon from '../../ui-components/LoadingIcon';
|
||||||
|
|
||||||
|
|
||||||
function AWSRunButton(props) {
|
function AWSRunButton(props) {
|
||||||
|
@ -14,6 +15,7 @@ function AWSRunButton(props) {
|
||||||
const [isOnAWS, setIsOnAWS] = useState(false);
|
const [isOnAWS, setIsOnAWS] = useState(false);
|
||||||
const [AWSInstances, setAWSInstances] = useState([]);
|
const [AWSInstances, setAWSInstances] = useState([]);
|
||||||
const [awsMachineCollectionError, setAwsMachineCollectionError] = useState('');
|
const [awsMachineCollectionError, setAwsMachineCollectionError] = useState('');
|
||||||
|
const [componentLoading, setComponentLoading] = useState(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
checkIsOnAWS();
|
checkIsOnAWS();
|
||||||
|
@ -24,7 +26,7 @@ function AWSRunButton(props) {
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(res => {
|
.then(res => {
|
||||||
let isAws = res['is_aws'];
|
let isAws = res['is_aws'];
|
||||||
|
setComponentLoading(false);
|
||||||
if (isAws) {
|
if (isAws) {
|
||||||
// On AWS!
|
// On AWS!
|
||||||
// Checks if there was an error while collecting the aws machines.
|
// Checks if there was an error while collecting the aws machines.
|
||||||
|
@ -64,6 +66,9 @@ function AWSRunButton(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let displayed = '';
|
let displayed = '';
|
||||||
|
if (componentLoading) {
|
||||||
|
displayed = LoadingIcon();
|
||||||
|
}
|
||||||
if (awsMachineCollectionError !== '') {
|
if (awsMachineCollectionError !== '') {
|
||||||
displayed = getErrorDisplay();
|
displayed = getErrorDisplay();
|
||||||
} else if (isOnAWS) {
|
} else if (isOnAWS) {
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
||||||
|
import {faSync} from '@fortawesome/free-solid-svg-icons';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
function LoadingIcon() {
|
||||||
|
return <FontAwesomeIcon icon={faSync} className={`spinning-icon loading-icon`} />
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LoadingIcon;
|
|
@ -1,3 +1,10 @@
|
||||||
|
.loading-icon {
|
||||||
|
color: $monkey-yellow;
|
||||||
|
font-size: 20px;
|
||||||
|
margin-left: 50%;
|
||||||
|
margin-right: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
.spinning-icon {
|
.spinning-icon {
|
||||||
animation: spin-animation 0.5s infinite;
|
animation: spin-animation 0.5s infinite;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
Loading…
Reference in New Issue