Skip to content

Commit 3571e5d

Browse files
committed
feat: update ProfileExplorer to have a reset button
this will reset the profile to its initial state. this PR also removes (for now) the Boot, Shutdown, and Dashboard buttons
1 parent b9aade6 commit 3571e5d

File tree

4 files changed

+29
-15
lines changed

4 files changed

+29
-15
lines changed

Diff for: package-lock.json

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: plugins/plugin-codeflare/src/components/ProfileExplorer.tsx

+13-6
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ import {
3939
} from "@patternfly/react-core"
4040

4141
import ProfileSelect from "./ProfileSelect"
42-
import DashboardSelect from "./DashboardSelect"
42+
// import DashboardSelect from "./DashboardSelect"
4343
import ProfileWatcher from "../tray/watchers/profile/list"
4444
import ProfileStatusWatcher from "../tray/watchers/profile/status"
4545
import UpdateFunction from "../tray/update"
46-
import { handleBoot, handleShutdown } from "../controller/profile/actions"
46+
import { handleReset } from "../controller/profile/actions"
4747

4848
import "../../web/scss/components/Dashboard/Description.scss"
4949
import "../../web/scss/components/ProfileExplorer/_index.scss"
@@ -210,8 +210,9 @@ class ProfileCard extends React.PureComponent<ProfileCardProps, ProfileCardState
210210
isOpen: false,
211211
}
212212
}
213-
private readonly _handleBoot = () => handleBoot(this.props.profile)
214-
private readonly _handleShutdown = () => handleShutdown(this.props.profile)
213+
private readonly _handleReset = () => handleReset(this.props.profile)
214+
// private readonly _handleBoot = () => handleBoot(this.props.profile)
215+
// private readonly _handleShutdown = () => handleShutdown(this.props.profile)
215216
private readonly _onToggle = () => this.setState({ isOpen: !this.state.isOpen })
216217

217218
private title() {
@@ -384,8 +385,14 @@ class ProfileCard extends React.PureComponent<ProfileCardProps, ProfileCardState
384385
private footer() {
385386
return (
386387
<Flex>
388+
<FlexItem flex={{ default: "flex_1" }}></FlexItem>
387389
<FlexItem>
388-
<Button variant="link" isSmall className="codeflare--profile-explorer--boot-btn" onClick={this._handleBoot}>
390+
<Button variant="link" isSmall className="codeflare--profile-explorer--reset-btn" onClick={this._handleReset}>
391+
Reset
392+
</Button>
393+
</FlexItem>
394+
{/*<FlexItem>
395+
<Button variant="link" isSmall className="codeflare--profile-explorer--boot-btn" onClick={this._handleBoot}>
389396
Boot
390397
</Button>
391398
<Button
@@ -399,7 +406,7 @@ class ProfileCard extends React.PureComponent<ProfileCardProps, ProfileCardState
399406
</FlexItem>
400407
<FlexItem flex={{ default: "flex_1" }}>
401408
<DashboardSelect selectedProfile={this.props.profile} />
402-
</FlexItem>
409+
</FlexItem>*/}
403410
</Flex>
404411
)
405412
}

Diff for: plugins/plugin-codeflare/src/controller/profile/actions.ts

+7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ export async function openWindow(title: string, initialTabTitle: string, argv: (
3232
)
3333
}
3434

35+
export async function handleReset(selectedProfile: string | undefined) {
36+
if (selectedProfile) {
37+
const { Profiles } = await import("madwizard")
38+
await Profiles.reset({}, selectedProfile)
39+
}
40+
}
41+
3542
export function handleBoot(selectedProfile: string | undefined) {
3643
openWindow(`Booting ${selectedProfile}`, "Booting", [
3744
"codeflare",

Diff for: plugins/plugin-madwizard/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"access": "public"
2424
},
2525
"dependencies": {
26-
"madwizard": "^1.1.0",
26+
"madwizard": "^1.2.0",
2727
"@guidebooks/store": "^0.14.3"
2828
}
2929
}

0 commit comments

Comments
 (0)