@@ -19,6 +19,7 @@ import { observer } from 'mobx-react'
1919import styled from 'styled-components'
2020
2121import StatusPill from '../../atoms/StatusPill'
22+ import StatusImage from '../../atoms/StatusImage'
2223import CopyValue from '../../atoms/CopyValue'
2324import Button from '../../atoms/Button'
2425import Timeline from '../../molecules/Timeline'
@@ -31,7 +32,16 @@ import DateUtils from '../../../utils/DateUtils'
3132
3233import executionImage from './images/execution.svg'
3334
34- const Wrapper = styled . div `
35+ const Wrapper = styled . div ``
36+ const LoadingWrapper = styled . div `
37+ margin-top: 32px;
38+ display: flex;
39+ flex-direction: column;
40+ align-items: center;
41+ `
42+ const LoadingText = styled . div `
43+ margin-top: 38px;
44+ font-size: 18px;
3545`
3646const ExecutionInfo = styled . div `
3747 background: ${ Palette . grayscale [ 1 ] } ;
@@ -78,6 +88,7 @@ const NoExecutionText = styled.div`
7888
7989type Props = {
8090 item : ?MainItem ,
91+ loading : boolean ,
8192 onCancelExecutionClick : ( execution : ?Execution ) => void ,
8293 onDeleteExecutionClick : ( execution : ?Execution ) => void ,
8394 onExecuteClick : ( ) => void ,
@@ -185,7 +196,24 @@ class Executions extends React.Component<Props, State> {
185196 this . props . onCancelExecutionClick ( this . state . selectedExecution )
186197 }
187198
199+ renderLoading ( ) {
200+ if ( ! this . props . loading ) {
201+ return null
202+ }
203+
204+ return (
205+ < LoadingWrapper >
206+ < StatusImage loading />
207+ < LoadingText > Loading executions...</ LoadingText >
208+ </ LoadingWrapper >
209+ )
210+ }
211+
188212 renderTimeline ( ) {
213+ if ( this . props . loading ) {
214+ return null
215+ }
216+
189217 return (
190218 < Timeline
191219 items = { this . props . item ? this . props . item . executions : null }
@@ -224,7 +252,7 @@ class Executions extends React.Component<Props, State> {
224252 }
225253
226254 renderExecutionInfo ( ) {
227- if ( ! this . state . selectedExecution ) {
255+ if ( ! this . state . selectedExecution || this . props . loading ) {
228256 return null
229257 }
230258
@@ -248,7 +276,8 @@ class Executions extends React.Component<Props, State> {
248276
249277 renderTasks ( ) {
250278 if ( ! this . state . selectedExecution || ! this . state . selectedExecution . tasks
251- || ! this . state . selectedExecution . tasks . length ) {
279+ || ! this . state . selectedExecution . tasks . length
280+ || this . props . loading ) {
252281 return null
253282 }
254283
@@ -258,7 +287,7 @@ class Executions extends React.Component<Props, State> {
258287 }
259288
260289 renderNoExecution ( ) {
261- if ( this . hasExecutions ( this . props ) ) {
290+ if ( this . hasExecutions ( this . props ) || this . props . loading ) {
262291 return null
263292 }
264293
@@ -275,6 +304,7 @@ class Executions extends React.Component<Props, State> {
275304 render ( ) {
276305 return (
277306 < Wrapper >
307+ { this . renderLoading ( ) }
278308 { this . renderTimeline ( ) }
279309 { this . renderExecutionInfo ( ) }
280310 { this . renderTasks ( ) }
0 commit comments