1
1
import React from "react" ;
2
2
import { DisposableCollection , WorkspaceInstance } from "@gitpod/gitpod-protocol" ;
3
- import { GitpodHostUrl } from "@gitpod/gitpod-protocol/lib/util/gitpod-host-url" ;
4
- import { getGitpodService } from "../service/service" ;
3
+ import { getGitpodService , gitpodHostUrl } from "../service/service" ;
5
4
import { StartPage , StartPhase } from "./StartPage" ;
6
5
7
6
export interface StartWorkspaceProps {
@@ -117,7 +116,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
117
116
118
117
async ensureWorkspaceAuth ( instanceID : string ) {
119
118
if ( ! document . cookie . includes ( `${ instanceID } _owner_` ) ) {
120
- const authURL = new GitpodHostUrl ( window . location . toString ( ) ) . asWorkspaceAuth ( instanceID ) ;
119
+ const authURL = gitpodHostUrl . asWorkspaceAuth ( instanceID ) ;
121
120
const response = await fetch ( authURL . toString ( ) ) ;
122
121
if ( response . redirected ) {
123
122
this . redirectTo ( response . url ) ;
@@ -144,8 +143,8 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
144
143
}
145
144
146
145
render ( ) {
147
- let phase = StartPhase . Checking ;
148
- let statusMessage = undefined ;
146
+ let phase = StartPhase . Preparing ;
147
+ let statusMessage = < p className = "text-base text-gray-400" > Preparing workspace … </ p > ;
149
148
150
149
switch ( this . state ?. workspaceInstance ?. status . phase ) {
151
150
// unknown indicates an issue within the system in that it cannot determine the actual phase of
@@ -156,31 +155,31 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
156
155
// Preparing means that we haven't actually started the workspace instance just yet, but rather
157
156
// are still preparing for launch. This means we're building the Docker image for the workspace.
158
157
case "preparing" :
159
- phase = StartPhase . Building ;
160
- statusMessage = < p className = "text-base text-gray-400" > Building Image …</ p > ;
158
+ phase = StartPhase . Preparing ;
159
+ statusMessage = < p className = "text-base text-gray-400" > Building image …</ p > ;
161
160
break ;
162
161
163
162
// Pending means the workspace does not yet consume resources in the cluster, but rather is looking for
164
163
// some space within the cluster. If for example the cluster needs to scale up to accomodate the
165
164
// workspace, the workspace will be in Pending state until that happened.
166
165
case "pending" :
167
166
phase = StartPhase . Preparing ;
168
- statusMessage = < p className = "text-base text-gray-400" > Allocating Resources …</ p > ;
167
+ statusMessage = < p className = "text-base text-gray-400" > Allocating resources …</ p > ;
169
168
break ;
170
169
171
170
// Creating means the workspace is currently being created. That includes downloading the images required
172
171
// to run the workspace over the network. The time spent in this phase varies widely and depends on the current
173
172
// network speed, image size and cache states.
174
173
case "creating" :
175
- phase = StartPhase . Preparing ;
176
- statusMessage = < p className = "text-base text-gray-400" > Pulling Container Image …</ p > ;
174
+ phase = StartPhase . Creating ;
175
+ statusMessage = < p className = "text-base text-gray-400" > Pulling container image …</ p > ;
177
176
break ;
178
177
179
178
// Initializing is the phase in which the workspace is executing the appropriate workspace initializer (e.g. Git
180
179
// clone or backup download). After this phase one can expect the workspace to either be Running or Failed.
181
180
case "initializing" :
182
181
phase = StartPhase . Starting ;
183
- statusMessage = < p className = "text-base text-gray-400" > Cloning Repository …</ p > ; // TODO Loading Prebuild ...
182
+ statusMessage = < p className = "text-base text-gray-400" > Cloning repository …</ p > ; // TODO Loading prebuild ...
184
183
break ;
185
184
186
185
// Running means the workspace is able to actively perform work, either by serving a user through Theia,
@@ -194,17 +193,39 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
194
193
// When in this state, we expect it to become running or stopping anytime soon.
195
194
case "interrupted" :
196
195
phase = StartPhase . Running ;
197
- statusMessage = < p className = "text-base text-gray-400" > Checking On Workspace …</ p > ;
196
+ statusMessage = < p className = "text-base text-gray-400" > Checking workspace …</ p > ;
198
197
break ;
199
198
200
199
// Stopping means that the workspace is currently shutting down. It could go to stopped every moment.
201
200
case "stopping" :
202
- statusMessage = < p className = "text-base text-gray-400" > Stopping …</ p > ;
201
+ phase = StartPhase . Stopping ;
202
+ statusMessage = < div >
203
+ < div className = "flex space-x-3 items-center rounded-xl py-2 px-4 h-16 w-72 mt-4 bg-gray-100" >
204
+ < div className = "rounded-full w-3 h-3 text-sm bg-gitpod-kumquat" > </ div >
205
+ < div >
206
+ < p className = "text-gray-700 font-semibold" > { this . state . workspaceInstance . workspaceId } </ p >
207
+ < p > { this . state . contextUrl } </ p >
208
+ </ div >
209
+ </ div >
210
+ </ div > ;
203
211
break ;
204
212
205
213
// Stopped means the workspace ended regularly because it was shut down.
206
214
case "stopped" :
207
- statusMessage = < p className = "text-base text-gray-400" > Stopped</ p > ;
215
+ phase = StartPhase . Stopped ;
216
+ statusMessage = < div >
217
+ < div className = "flex space-x-3 items-center rounded-xl py-2 px-4 h-16 w-72 mt-4 bg-gray-100" >
218
+ < div className = "rounded-full w-3 h-3 text-sm bg-gray-300" > </ div >
219
+ < div >
220
+ < p className = "text-gray-700 font-semibold" > { this . state . workspaceInstance . workspaceId } </ p >
221
+ < p > { this . state . contextUrl } </ p >
222
+ </ div >
223
+ </ div >
224
+ < div className = "mt-10 flex space-x-2" >
225
+ < button className = "px-4 py-2 text-gray-500 bg-white font-semibold border-gray-500" onClick = { ( ) => this . redirectTo ( gitpodHostUrl . asDashboard ( ) . toString ( ) ) } > Go to Dashboard</ button >
226
+ < button className = "px-4 py-2 text-gray-50 bg-green-600 font-semibold border-green-800" onClick = { ( ) => this . redirectTo ( gitpodHostUrl . asStart ( this . state . workspaceInstance ?. workspaceId ) . toString ( ) ) } > Open Workspace</ button >
227
+ </ div >
228
+ </ div > ;
208
229
break ;
209
230
}
210
231
0 commit comments