@@ -63,6 +63,9 @@ import {
63
63
POSTMAN_CONTAINER
64
64
} from './utils/constants' ;
65
65
import { useDockerDesktopClient } from './utils/ddclient' ;
66
+ import InitializingView from './components/views/InitializingView' ;
67
+ import NotRunningView from './components/views/NotRunningView' ;
68
+ import RunningView from './components/views/RunningView' ;
66
69
67
70
const isWindows = ( ) => {
68
71
const platform = useDockerDesktopClient ( ) . host . platform ;
@@ -763,203 +766,21 @@ const App = () => {
763
766
return (
764
767
< Container >
765
768
{ status === 'INITIALIZING' ? (
766
- < Stack
767
- sx = { {
768
- display : 'flex' ,
769
- flexGrow : 1 ,
770
- height : '90vh' ,
771
- alignItems : 'center' ,
772
- justifyContent : 'center' ,
773
- } }
774
- spacing = { 5 }
775
- >
776
- < CircularProgress color = "primary" />
777
- </ Stack >
769
+ < InitializingView />
778
770
) : status == 'NOT_RUNNING' ? (
779
- < >
780
- < Stack
781
- sx = { {
782
- display : 'flex' ,
783
- flexGrow : 1 ,
784
- height : '90vh' ,
785
- alignItems : 'center' ,
786
- justifyContent : 'center' ,
787
- } }
788
- >
789
- < Box
790
- m = { 4 }
791
- sx = { {
792
- width : 450 ,
793
- maxWidth : { xs : 450 , md : 350 } ,
794
- } }
795
- component = "img"
796
- src = {
797
- uiMode === 'light'
798
- ? 'assets/images/microcks-logo-blue-baseline-tweet.png'
799
- : 'assets/images/microcks-logo-white-baseline-tweet.png'
800
- }
801
- alt = "Microcks Logo"
802
- />
803
- < Paper
804
- elevation = { 3 }
805
- sx = { {
806
- margin : 4 ,
807
- padding : 2 ,
808
- width : '100%' ,
809
- display : 'flex' ,
810
- flexDirection : 'row' ,
811
- } }
812
- >
813
- { ! appStatus . isRunning && (
814
- < Chip variant = "outlined" color = "error" label = "STOPPED" />
815
- ) }
816
- < Box
817
- alignContent = "center"
818
- display = "flex"
819
- alignItems = "center"
820
- mx = { 1 }
821
- >
822
- < RocketLaunchIcon />
823
- </ Box >
824
- < Box
825
- flexGrow = { 1 }
826
- alignContent = "center"
827
- display = "flex"
828
- alignItems = "center"
829
- >
830
- < Typography variant = "subtitle1" >
831
- Microcks is not running. First launch can take some time while
832
- we're pulling the container images.
833
- </ Typography >
834
- </ Box >
835
- < Box
836
- flexGrow = { 1 }
837
- alignContent = "center"
838
- display = "flex"
839
- alignItems = "center"
840
- > </ Box >
841
- </ Paper >
842
- < Stack m = { 2 } spacing = { 2 } direction = "row" >
843
- < Button
844
- variant = "outlined"
845
- size = "large"
846
- startIcon = { < SettingsIcon /> }
847
- onClick = { handleOpenSettings }
848
- >
849
- Settings
850
- </ Button >
851
- < Button variant = "contained" size = "large" onClick = { launchMicrocks } >
852
- Launch Microcks
853
- </ Button >
854
- </ Stack >
855
- </ Stack >
856
- < Footer >
857
- { appStatus . exists && (
858
- < Link onClick = { deleteMicrocksDialog } component = "button" >
859
- Delete Microcks
860
- </ Link >
861
- ) }
862
- </ Footer >
863
- </ >
771
+ < NotRunningView
772
+ uiMode = { uiMode }
773
+ appStatus = { appStatus }
774
+ onLaunchMicrocks = { launchMicrocks }
775
+ onOpenSettings = { handleOpenSettings }
776
+ onDeleteMicrocks = { deleteMicrocksDialog }
777
+ />
864
778
) : (
865
- < Box
866
- display = "flex"
867
- flexDirection = "column"
868
- justifyContent = "flex-start"
869
- height = "95vh"
870
- >
871
- < Box
872
- sx = { { display : 'flex' , width : '100%' , alignItems : 'center' } }
873
- my = { 1 }
874
- >
875
- < Box alignContent = "flex-start" textAlign = "left" flexGrow = { 1 } >
876
- < Typography sx = { { fontWeight : 'bolder' } } variant = "h5" >
877
- Microcks
878
- </ Typography >
879
- < Typography variant = "subtitle1" color = "InactiveCaptionText" >
880
- API Mocking and Testing for REST, GraphQL, gRPC and AsyncAPI
881
- </ Typography >
882
- </ Box >
883
- < Box >
884
- < Tooltip title = "Settings" >
885
- < IconButton onClick = { handleOpenSettings } >
886
- < SettingsIcon />
887
- </ IconButton >
888
- </ Tooltip >
889
- </ Box >
890
- < Box m = { 2 } >
891
- < Button variant = "contained" color = "error" onClick = { stopMicrocks } >
892
- Stop Microcks
893
- </ Button >
894
- </ Box >
895
- </ Box >
896
- < Paper
897
- elevation = { 3 }
898
- sx = { {
899
- marginTop : 4 ,
900
- padding : 2 ,
901
- width : '100%' ,
902
- display : 'flex' ,
903
- flexDirection : 'row' ,
904
- } }
905
- >
906
- < Chip variant = "filled" color = "success" label = "RUNNING" />
907
- < Box
908
- alignContent = "center"
909
- display = "flex"
910
- alignItems = "center"
911
- mx = { 1 }
912
- >
913
- < DoneOutlinedIcon />
914
- </ Box >
915
- < Box
916
- flexGrow = { 1 }
917
- alignContent = "center"
918
- display = "flex"
919
- alignItems = "center"
920
- >
921
- < Typography variant = "subtitle1" component = "span" >
922
- Microcks is running. To access the UI navigate to:{ ' ' }
923
- < Link
924
- onClick = { ( ) =>
925
- ddClient . host . openExternal (
926
- `http://localhost:${ 8080 + config . portOffset } /#/` ,
927
- )
928
- }
929
- variant = "subtitle1"
930
- component = "span"
931
- >
932
- http://localhost:{ 8080 + config . portOffset }
933
- </ Link >
934
- < IconButton
935
- onClick = { ( ) =>
936
- ddClient . host . openExternal (
937
- `http://localhost:${ 8080 + config . portOffset } /#/` ,
938
- )
939
- }
940
- component = "span"
941
- size = "small"
942
- >
943
- < OpenInNewIcon
944
- fontSize = "small"
945
- />
946
- </ IconButton >
947
- < ClipboardCopy
948
- copyText = { `http://localhost:${ 8080 + config . portOffset } /#/` }
949
- size = "small"
950
- />
951
- </ Typography >
952
- </ Box >
953
- </ Paper >
954
- < Services config = { config } />
955
- < Footer >
956
- { appStatus . exists && (
957
- < Link onClick = { deleteMicrocksDialog } component = "button" >
958
- Delete Microcks
959
- </ Link >
960
- ) }
961
- </ Footer >
962
- </ Box >
779
+ < RunningView
780
+ appStatus = { appStatus }
781
+ onOpenSettings = { handleOpenSettings }
782
+ onDeleteMicrocks = { deleteMicrocksDialog } config = { config } onStopMicrocks = { stopMicrocks }
783
+ />
963
784
) }
964
785
< SettingsDialog
965
786
config = { config }
0 commit comments