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

Commitf6b9fce

Browse files
committed
Fix startup component overflow gap
1 parent3762e8d commitf6b9fce

File tree

3 files changed

+87
-56
lines changed

3 files changed

+87
-56
lines changed

‎site/src/components/Resources/AgentRow.stories.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
MockWorkspaceAgentConnecting,
66
MockWorkspaceAgentOff,
77
MockWorkspaceAgentOutdated,
8+
MockWorkspaceAgentReady,
89
MockWorkspaceAgentShutdownError,
910
MockWorkspaceAgentShutdownTimeout,
1011
MockWorkspaceAgentShuttingDown,
@@ -114,6 +115,29 @@ Starting.args = {
114115
})),
115116
}
116117

118+
exportconstStarted=Template.bind({})
119+
Started.args={
120+
agent:{
121+
...MockWorkspaceAgentReady,
122+
startup_logs_length:1,
123+
},
124+
workspace:MockWorkspace,
125+
applicationsHost:"",
126+
showApps:true,
127+
128+
storybookStartupLogs:[
129+
"Cloning Git repository...",
130+
"Starting Docker Daemon...",
131+
"Adding some 🧙magic🧙...",
132+
"Starting VS Code...",
133+
].map((line,index)=>({
134+
id:index,
135+
level:"info",
136+
output:line,
137+
time:"",
138+
})),
139+
}
140+
117141
exportconstStartTimeout=Template.bind({})
118142
StartTimeout.args={
119143
agent:MockWorkspaceAgentStartTimeout,

‎site/src/components/Resources/AgentRow.tsx

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ export const AgentRow: FC<AgentRowProps> = ({
8383
const[startupScriptOpen,setStartupScriptOpen]=useState(false)
8484

8585
consthasStartupFeatures=
86-
Boolean(agent.startup_script)||
8786
Boolean(agent.startup_logs_length)||
8887
Boolean(logsMachine.context.startupLogs?.length)
88+
8989
const[showStartupLogs,setShowStartupLogs]=useState(
9090
agent.lifecycle_state!=="ready"&&hasStartupFeatures,
9191
)
@@ -205,13 +205,13 @@ export const AgentRow: FC<AgentRowProps> = ({
205205
</Maybe>
206206
</Stack>
207207

208-
<Stack
209-
direction="row"
210-
alignItems="baseline"
211-
spacing={1}
212-
className={styles.startupLinks}
213-
>
214-
{hasStartupFeatures&&(
208+
{hasStartupFeatures&&(
209+
<Stack
210+
direction="row"
211+
alignItems="baseline"
212+
spacing={1}
213+
className={styles.startupLinks}
214+
>
215215
<Link
216216
className={styles.startupLink}
217217
variant="body2"
@@ -226,57 +226,57 @@ export const AgentRow: FC<AgentRowProps> = ({
226226
)}
227227
{showStartupLogs ?"Hide" :"Show"} Startup Logs
228228
</Link>
229-
)}
230-
231-
{agent.startup_script&&(
232-
<Link
233-
className={styles.startupLink}
234-
variant="body2"
235-
ref={startupScriptAnchorRef}
236-
onClick={()=>{
237-
setStartupScriptOpen(!startupScriptOpen)
238-
}}
239-
>
240-
<PlayCircleOutlined/>
241-
View Startup Script
242-
</Link>
243-
)}
244229

245-
<Popover
246-
classes={{
247-
paper:styles.startupScriptPopover,
248-
}}
249-
open={startupScriptOpen}
250-
onClose={()=>setStartupScriptOpen(false)}
251-
anchorEl={startupScriptAnchorRef.current}
252-
anchorOrigin={{
253-
vertical:"bottom",
254-
horizontal:"left",
255-
}}
256-
transformOrigin={{
257-
vertical:"top",
258-
horizontal:"left",
259-
}}
260-
>
261-
<div>
262-
<SyntaxHighlighter
263-
style={darcula}
264-
language="shell"
265-
showLineNumbers
266-
// Use inline styles does not work correctly
267-
// https://github.com/react-syntax-highlighter/react-syntax-highlighter/issues/329
268-
codeTagProps={{style:{}}}
269-
customStyle={{
270-
background:theme.palette.background.default,
271-
maxWidth:600,
272-
margin:0,
230+
{agent.startup_script&&(
231+
<Link
232+
className={styles.startupLink}
233+
variant="body2"
234+
ref={startupScriptAnchorRef}
235+
onClick={()=>{
236+
setStartupScriptOpen(!startupScriptOpen)
273237
}}
274238
>
275-
{agent.startup_script||""}
276-
</SyntaxHighlighter>
277-
</div>
278-
</Popover>
279-
</Stack>
239+
<PlayCircleOutlined/>
240+
View Startup Script
241+
</Link>
242+
)}
243+
244+
<Popover
245+
classes={{
246+
paper:styles.startupScriptPopover,
247+
}}
248+
open={startupScriptOpen}
249+
onClose={()=>setStartupScriptOpen(false)}
250+
anchorEl={startupScriptAnchorRef.current}
251+
anchorOrigin={{
252+
vertical:"bottom",
253+
horizontal:"left",
254+
}}
255+
transformOrigin={{
256+
vertical:"top",
257+
horizontal:"left",
258+
}}
259+
>
260+
<div>
261+
<SyntaxHighlighter
262+
style={darcula}
263+
language="shell"
264+
showLineNumbers
265+
// Use inline styles does not work correctly
266+
// https://github.com/react-syntax-highlighter/react-syntax-highlighter/issues/329
267+
codeTagProps={{style:{}}}
268+
customStyle={{
269+
background:theme.palette.background.default,
270+
maxWidth:600,
271+
margin:0,
272+
}}
273+
>
274+
{agent.startup_script||""}
275+
</SyntaxHighlighter>
276+
</div>
277+
</Popover>
278+
</Stack>
279+
)}
280280
</div>
281281
</Stack>
282282

‎site/src/testHelpers/entities.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,13 @@ export const MockWorkspaceAgentStarting: TypesGen.WorkspaceAgent = {
472472
lifecycle_state:"starting",
473473
}
474474

475+
exportconstMockWorkspaceAgentReady:TypesGen.WorkspaceAgent={
476+
...MockWorkspaceAgent,
477+
id:"test-workspace-agent-ready",
478+
name:"a-ready-workspace-agent",
479+
lifecycle_state:"ready",
480+
}
481+
475482
exportconstMockWorkspaceAgentStartTimeout:TypesGen.WorkspaceAgent={
476483
...MockWorkspaceAgent,
477484
id:"test-workspace-agent-start-timeout",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp