Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Workspace StatusBar#1362

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
presleyp merged 52 commits intomainfromstatusbar/presleyp/1032
May 16, 2022
Merged
Changes from1 commit
Commits
Show all changes
52 commits
Select commitHold shift + click to select a range
b1cc9d6
Move component and prep
presleypMay 5, 2022
0da5e7e
Make WorkspaceSection more reusable
presleypMay 5, 2022
580e801
Lay out elements
presleypMay 5, 2022
b995f4a
Layout tweaks
presleypMay 6, 2022
e7dc082
Add outdated to Workspace type
presleypMay 6, 2022
7f6bbda
Fill out status bar component
presleypMay 6, 2022
08b01c0
Merge branch 'main' into statusbar/presleyp/1032
presleypMay 6, 2022
1bc3e35
Format
presleypMay 6, 2022
ccbf527
Add transition to types
presleypMay 6, 2022
f6bcbaa
Add api handlers for build toggle
presleypMay 9, 2022
db348a6
Format
presleypMay 9, 2022
8d5fcfd
Parallelize machine
presleypMay 9, 2022
62c40f4
Lay out basics of build submachine
presleypMay 9, 2022
eaa353d
Pipe start and stop events through - needs status
presleypMay 9, 2022
399390e
Attempt at a machine
presleypMay 10, 2022
c100ec5
Update mock
presleypMay 10, 2022
903e8ee
Render status and buttons
presleypMay 10, 2022
e8e81ce
Fix type error on template page
presleypMay 10, 2022
2226fea
Move Settings
presleypMay 10, 2022
df0bc5b
Format
presleypMay 10, 2022
14bd598
Keep refreshed workspace
presleypMay 10, 2022
c93dde3
Merge branch 'main' into statusbar/presleyp/1032
presleypMay 10, 2022
1093103
Make it switch workspaces
presleypMay 10, 2022
478db51
Lint
presleypMay 10, 2022
40a62a8
Fix relative api path
presleypMay 10, 2022
bd3a026
Test
presleypMay 10, 2022
9786f6c
Fix polling
presleypMay 10, 2022
7727a1b
Add loading workspace state
presleypMay 10, 2022
4a57152
Format
presleypMay 10, 2022
e3ae1b8
Add stub settings page
presleypMay 11, 2022
2695a29
Format
presleypMay 11, 2022
44e4552
Merge branch 'main' into statusbar/presleyp/1032
presleypMay 11, 2022
d83e5ac
Lint
presleypMay 11, 2022
f909a86
Get rid of let
presleypMay 11, 2022
5dcec61
Merge branch 'main' into statusbar/presleyp/1032
presleypMay 11, 2022
be86750
Add update
presleypMay 12, 2022
992ee0c
Make start use version id
presleypMay 12, 2022
9903c96
Merge branch 'main' into statusbar/presleyp/1032
presleypMay 12, 2022
91d5811
Merge branch 'main' into statusbar/presleyp/1032
presleypMay 12, 2022
9cd386e
Fix imports
presleypMay 12, 2022
1a09166
Add polling for outdated
presleypMay 12, 2022
aee54a0
Merge branch 'main' into statusbar/presleyp/1032
presleypMay 12, 2022
e9758c7
Rely on context instead of finite state for status
presleypMay 12, 2022
87fee06
Handle canceling
presleypMay 13, 2022
b3f6b8c
Fix tests
presleypMay 13, 2022
39e84d9
Format
presleypMay 13, 2022
06abf62
Display errors so users know when button presses didn't work
presleypMay 13, 2022
8552ea2
Fix api typo, remove logging
presleypMay 13, 2022
72c856e
Lint
presleypMay 13, 2022
259d517
Merge branch 'main' into statusbar/presleyp/1032
presleypMay 13, 2022
24829be
Simplify type
presleypMay 16, 2022
542d865
Add type, extract helper
presleypMay 16, 2022
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
PrevPrevious commit
NextNext commit
Lay out basics of build submachine
  • Loading branch information
@presleyp
presleyp committedMay 9, 2022
commit62c40f4d0bc218cd65cd76d6a9038dee585a5e2e
82 changes: 77 additions & 5 deletionssite/src/xServices/workspace/workspaceXService.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
import { assign, createMachine } from "xstate"
import * as API from "../../api"
import * as Types from "../../api/types"
import * as TypesGen from "../../api/typesGenerated"

interface WorkspaceContext {
workspace?: Types.Workspace
Expand All@@ -11,7 +12,7 @@ interface WorkspaceContext {
getOrganizationError?: Error | unknown
}

type WorkspaceEvent = { type: "GET_WORKSPACE"; workspaceId: string }
type WorkspaceEvent = { type: "GET_WORKSPACE"; workspaceId: string } | { type: "START" } | {type: "STOP"} | { type: "RETRY" }

export const workspaceMachine = createMachine(
{
Expand All@@ -29,6 +30,15 @@ export const workspaceMachine = createMachine(
getOrganization: {
data: Types.Organization
}
startWorkspace: {
data: TypesGen.WorkspaceBuild
}
stopWorkspace: {
data: TypesGen.WorkspaceBuild
}
pollBuild: {
data: Types.Workspace
}
},
},
id: "workspaceState",
Expand DownExpand Up@@ -97,10 +107,58 @@ export const workspaceMachine = createMachine(
build: {
initial: "idle",
states: {
idle: {},
requesting: {},
building: {},
error: {}
idle: {
on: {
START: "requestingStart",
STOP: "requestingStop"
}
},
requestingStart: {
invoke: {
id: "startWorkspace",
src: "startWorkspace",
onDone: "building",
onError: {
target: "error",
actions: ["assignFailedTransition", "assignEnqueueError"]
}
}
},
requestingStop: {
invoke: {
id: "stopWorkspace",
src: "stopWorkspace",
onDone: "building",
onError: {
target: "error",
actions: ["assignFailedTransition", "assignEnqueueError"]
}
}
},
building: {
invoke: {
id: "building",
src: "pollBuild",
onDone: "idle",
onError: {
target: "error",
actions: ["assignFailedTransition", "assignBuildError"]
}
}
},
error: {
on: {
RETRY: [
{
cond: "failedToStart",
target: "requestingStart"
},
{
target: "requestingStop"
}
]
}
}
}
}
},
Expand DownExpand Up@@ -154,6 +212,20 @@ export const workspaceMachine = createMachine(
throw Error("Cannot get organization without template")
}
},
startWorkspace: async (context) => {
if (context.workspace) {
return await API.startWorkspace(context.workspace.id)
} else {
throw Error("Cannot start workspace without workspace id")
}
},
stopWorkspace: async (context) => {
if (context.workspace) {
return await API.stopWorkspace(context.workspace.id)
} else {
throw Error("Cannot stop workspace without workspace id")
}
}
},
},
)

[8]ページ先頭

©2009-2025 Movatter.jp