Skip to content

Commit 6216133

Browse files
committed
feat: update codeflare explorer to use adjustable split pane for cli portion
Also - places the profile selector in the profile card header - refactors to have a separate ProfileCard component
1 parent b1fe879 commit 6216133

File tree

8 files changed

+225
-72
lines changed

8 files changed

+225
-72
lines changed

package-lock.json

Lines changed: 103 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/plugin-client-default/notebooks/hello.md

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,6 @@ layout:
55
1:
66
position: default
77
maximized: true
8-
2:
9-
position: default
10-
maximized: true
11-
---
12-
13-
=== "Your Profiles"
14-
```shell
15-
---
16-
execute: now
17-
outputOnly: true
18-
---
19-
codeflare get profile
20-
```
21-
228
---
239

2410
=== "Use the CodeFlare CLI"
@@ -28,7 +14,7 @@ layout:
2814
outputOnly: true
2915
maximize: true
3016
---
31-
codeflare terminal codeflare -p ${SELECTED_PROFILE}
17+
codeflare terminal task
3218
```
3319

3420
=== "Gallery"
@@ -52,13 +38,13 @@ layout:
5238
codeflare dashboard-gallery
5339
```
5440

55-
=== "Terminal"
41+
=== "Local Terminal"
5642
```shell
5743
---
5844
execute: now
5945
outputOnly: true
6046
maximize: true
6147
---
62-
codeflare terminal $SHELL -l
48+
codeflare terminal shell
6349
```
6450

plugins/plugin-codeflare/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@logdna/tail-file": "^3.0.0",
2727
"@patternfly/react-charts": "^6.77.1",
2828
"@patternfly/react-core": "^4.224.1",
29+
"allotment": "^1.15.0",
2930
"asciinema-player": "^3.0.1",
3031
"chokidar": "^3.5.3",
3132
"needle": "^3.1.0",

plugins/plugin-codeflare/src/components/ProfileExplorer.tsx

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ export default class ProfileExplorer extends React.PureComponent<Props, State> {
7878
emitSelectProfile(selectedProfile)
7979
}
8080

81-
private readonly _handleBoot = () => handleBoot(this.state.selectedProfile)
82-
private readonly _handleShutdown = () => handleShutdown(this.state.selectedProfile)
83-
8481
private updateDebouncer: null | ReturnType<typeof setTimeout> = null
8582

8683
private readonly updateFn = () => {
@@ -139,20 +136,47 @@ export default class ProfileExplorer extends React.PureComponent<Props, State> {
139136
}
140137
}
141138

139+
public render() {
140+
if (this.state && this.state.catastrophicError) {
141+
return "Internal Error"
142+
} else if (!this.state || !this.state.profiles || !this.state.selectedProfile) {
143+
return <Loading />
144+
} else {
145+
return (
146+
<div className="codeflare--profile-explorer flex-fill top-pad left-pad right-pad bottom-pad">
147+
<ProfileCard
148+
profile={this.state.selectedProfile}
149+
profiles={this.state.profiles}
150+
onSelectProfile={this._handleProfileSelection}
151+
/>
152+
</div>
153+
)
154+
}
155+
}
156+
}
157+
158+
class ProfileCard extends React.PureComponent<{
159+
profile: string
160+
profiles: Profiles.Profile[]
161+
onSelectProfile: (profile: string) => void
162+
}> {
163+
private readonly _handleBoot = () => handleBoot(this.props.profile)
164+
private readonly _handleShutdown = () => handleShutdown(this.props.profile)
165+
142166
private title() {
143167
return (
144168
<Title headingLevel="h2" size="xl">
145-
{this.state.selectedProfile}
169+
<ProfileSelect
170+
selectedProfile={this.props.profile}
171+
profiles={this.props.profiles}
172+
onSelect={this.props.onSelectProfile}
173+
/>
146174
</Title>
147175
)
148176
}
149177

150178
private actions() {
151-
return (
152-
<Title headingLevel="h2" size="md">
153-
Status: pending
154-
</Title>
155-
)
179+
return "Status: pending"
156180
}
157181

158182
private body() {
@@ -196,41 +220,23 @@ export default class ProfileExplorer extends React.PureComponent<Props, State> {
196220
</Button>
197221
</FlexItem>
198222
<FlexItem flex={{ default: "flex_1" }}>
199-
<DashboardSelect selectedProfile={this.state.selectedProfile} />
223+
<DashboardSelect selectedProfile={this.props.profile} />
200224
</FlexItem>
201225
</Flex>
202226
)
203227
}
204228

205229
public render() {
206-
if (this.state && this.state.catastrophicError) {
207-
return "Internal Error"
208-
} else if (!this.state || !this.state.profiles) {
209-
return <Loading />
210-
} else {
211-
return (
212-
<Flex className="codeflare--profile-explorer flex-fill" direction={{ default: "column" }}>
213-
<FlexItem>
214-
<ProfileSelect
215-
selectedProfile={this.state.selectedProfile}
216-
profiles={this.state.profiles}
217-
onSelect={this._handleProfileSelection}
218-
/>
219-
</FlexItem>
220-
221-
<FlexItem>
222-
<Card className="top-pad left-pad right-pad bottompad" isSelectableRaised isSelected>
223-
<CardHeader>
224-
<CardTitle>{this.title()}</CardTitle>
225-
<CardActions hasNoOffset>{this.actions()}</CardActions>
226-
</CardHeader>
227-
<CardBody>{this.body()}</CardBody>
228-
<Divider />
229-
<CardFooter>{this.footer()}</CardFooter>
230-
</Card>
231-
</FlexItem>
232-
</Flex>
233-
)
234-
}
230+
return (
231+
<Card className="top-pad left-pad right-pad bottompad" isSelectableRaised isSelected>
232+
<CardHeader>
233+
<CardTitle>{this.title()}</CardTitle>
234+
<CardActions hasNoOffset>{this.actions()}</CardActions>
235+
</CardHeader>
236+
<CardBody>{this.body()}</CardBody>
237+
<Divider />
238+
<CardFooter>{this.footer()}</CardFooter>
239+
</Card>
240+
)
235241
}
236242
}

plugins/plugin-codeflare/src/components/Terminal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export default class XTerm extends React.PureComponent<Props, State> {
9696
}
9797

9898
public componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
99-
console.error("catastrophic error in Scalar", error, errorInfo)
99+
console.error("catastrophic error", error, errorInfo)
100100
}
101101

102102
public componentDidMount() {

0 commit comments

Comments
 (0)