Skip to content

Commit e2c9f91

Browse files
committed
Fix the FE
1 parent 5b6f264 commit e2c9f91

File tree

2 files changed

+6
-66
lines changed

2 files changed

+6
-66
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ export const Example = Template.bind({})
145145
Example.args = {
146146
agent: {
147147
...MockWorkspaceAgent,
148-
startup_script:
149-
'set -eux -o pipefail\n\n# install and start code-server\ncurl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.8.3\n/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &\n\n\nif [ ! -d ~/coder ]; then\n mkdir -p ~/coder\n\n git clone https://github.com/coder/coder ~/coder\nfi\n\nsudo service docker start\nDOTFILES_URI=" "\nrm -f ~/.personalize.log\nif [ -n "${DOTFILES_URI// }" ]; then\n coder dotfiles "$DOTFILES_URI" -y 2>&1 | tee -a ~/.personalize.log\nfi\nif [ -x ~/personalize ]; then\n ~/personalize 2>&1 | tee -a ~/.personalize.log\nelif [ -f ~/personalize ]; then\n echo "~/personalize is not executable, skipping..." | tee -a ~/.personalize.log\nfi\n',
150148
},
151149
workspace: MockWorkspace,
152150
showApps: true,

site/src/components/Resources/AgentRow.tsx

Lines changed: 6 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import Popover from "@mui/material/Popover"
2-
import { makeStyles, useTheme } from "@mui/styles"
1+
import Collapse from "@mui/material/Collapse"
32
import Skeleton from "@mui/material/Skeleton"
3+
import { makeStyles } from "@mui/styles"
44
import { useMachine } from "@xstate/react"
5-
import CodeOutlined from "@mui/icons-material/CodeOutlined"
65
import {
76
CloseDropdown,
87
OpenDropdown,
98
} from "components/DropdownArrows/DropdownArrows"
109
import { LogLine, logLineHeight } from "components/Logs/Logs"
11-
import { PortForwardButton } from "./PortForwardButton"
1210
import { VSCodeDesktopButton } from "components/VSCodeDesktopButton/VSCodeDesktopButton"
11+
import { useProxy } from "contexts/ProxyContext"
1312
import {
1413
FC,
1514
useCallback,
@@ -19,8 +18,6 @@ import {
1918
useRef,
2019
useState,
2120
} from "react"
22-
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"
23-
import { darcula } from "react-syntax-highlighter/dist/cjs/styles/prism"
2421
import AutoSizer from "react-virtualized-auto-sizer"
2522
import { FixedSizeList as List, ListOnScrollProps } from "react-window"
2623
import { colors } from "theme/colors"
@@ -40,10 +37,9 @@ import { Stack } from "../Stack/Stack"
4037
import { TerminalLink } from "../TerminalLink/TerminalLink"
4138
import { AgentLatency } from "./AgentLatency"
4239
import { AgentMetadata } from "./AgentMetadata"
43-
import { AgentVersion } from "./AgentVersion"
4440
import { AgentStatus } from "./AgentStatus"
45-
import Collapse from "@mui/material/Collapse"
46-
import { useProxy } from "contexts/ProxyContext"
41+
import { AgentVersion } from "./AgentVersion"
42+
import { PortForwardButton } from "./PortForwardButton"
4743

4844
export interface AgentRowProps {
4945
agent: WorkspaceAgent
@@ -86,9 +82,6 @@ export const AgentRow: FC<AgentRowProps> = ({
8682
}
8783
: undefined,
8884
})
89-
const theme = useTheme()
90-
const startupScriptAnchorRef = useRef<HTMLButtonElement>(null)
91-
const [startupScriptOpen, setStartupScriptOpen] = useState(false)
9285
const hasAppsToDisplay = !hideVSCodeDesktopButton || agent.apps.length > 0
9386
const shouldDisplayApps =
9487
showApps &&
@@ -132,6 +125,7 @@ export const AgentRow: FC<AgentRowProps> = ({
132125
level: "error",
133126
output: "Startup logs exceeded the max size of 1MB!",
134127
time: new Date().toISOString(),
128+
source_id: "",
135129
})
136130
}
137131
return logs
@@ -348,47 +342,6 @@ export const AgentRow: FC<AgentRowProps> = ({
348342
Show startup logs
349343
</button>
350344
)}
351-
352-
<button
353-
className={combineClasses([
354-
styles.logsPanelButton,
355-
styles.scriptButton,
356-
])}
357-
ref={startupScriptAnchorRef}
358-
onClick={() => {
359-
setStartupScriptOpen(!startupScriptOpen)
360-
}}
361-
>
362-
<CodeOutlined />
363-
Startup script
364-
</button>
365-
366-
<Popover
367-
classes={{
368-
paper: styles.startupScriptPopover,
369-
}}
370-
open={startupScriptOpen}
371-
onClose={() => setStartupScriptOpen(false)}
372-
anchorEl={startupScriptAnchorRef.current}
373-
>
374-
<div>
375-
<SyntaxHighlighter
376-
style={darcula}
377-
language="shell"
378-
showLineNumbers
379-
// Use inline styles does not work correctly
380-
// https://github.com/react-syntax-highlighter/react-syntax-highlighter/issues/329
381-
codeTagProps={{ style: {} }}
382-
customStyle={{
383-
background: theme.palette.background.default,
384-
maxWidth: 600,
385-
margin: 0,
386-
}}
387-
>
388-
{agent.startup_script || ""}
389-
</SyntaxHighlighter>
390-
</div>
391-
</Popover>
392345
</div>
393346
</div>
394347
)}
@@ -510,10 +463,6 @@ const useStyles = makeStyles((theme) => ({
510463
},
511464
},
512465

513-
startupScriptPopover: {
514-
backgroundColor: theme.palette.background.default,
515-
},
516-
517466
agentNameAndStatus: {
518467
display: "flex",
519468
alignItems: "center",
@@ -602,13 +551,6 @@ const useStyles = makeStyles((theme) => ({
602551
color: theme.palette.warning.light,
603552
},
604553

605-
scriptButton: {
606-
"& svg": {
607-
width: theme.spacing(2),
608-
height: theme.spacing(2),
609-
},
610-
},
611-
612554
agentOS: {
613555
textTransform: "capitalize",
614556
},

0 commit comments

Comments
 (0)