Skip to content

Commit e583e76

Browse files
committed
chore: bump to madwizard 0.10.1
picks up initial profile support
1 parent b02b048 commit e583e76

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

package-lock.json

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

plugins/plugin-madwizard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
"access": "public"
2424
},
2525
"dependencies": {
26-
"madwizard": "^0.9.11"
26+
"madwizard": "^0.10.1"
2727
}
2828
}

plugins/plugin-madwizard/src/components/Guide.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { i18n, Tab } from "@kui-shell/core"
2020
import { Card, CardResponse, Icons, Loading, Markdown } from "@kui-shell/plugin-client-common"
2121
import { ButtonProps, Chip, ChipGroup, Grid, GridItem, Progress, Tile, WizardStep } from "@patternfly/react-core"
2222

23-
import { Graph, CodeBlock, Choices, Wizard as Wiz } from "madwizard"
23+
import { Graph, CodeBlock, Choices, Memoizer, Wizard as Wiz } from "madwizard"
2424

2525
import read from "../read"
2626
import Wizard from "./Wizard/KWizard"
@@ -72,6 +72,7 @@ type State = Choices.Choices & {
7272
export default class Guide extends React.PureComponent<Props, State> {
7373
private readonly choiceIcon1 = (<Icons className="yellow-text" icon="Warning" />)
7474
private readonly choiceIcon2 = (<Icons icon="PlusSquare" />)
75+
private readonly memos = new Memoizer()
7576

7677
public constructor(props: Props) {
7778
super(props)
@@ -87,7 +88,7 @@ export default class Guide extends React.PureComponent<Props, State> {
8788

8889
private async init(props: Props, useTheseChoices?: State["choices"]) {
8990
const choices = useTheseChoices || props.choices
90-
const newGraph = await Graph.compile(props.blocks, choices, undefined, "sequence", props.title, props.description)
91+
const newGraph = await Graph.compile(props.blocks, choices, this.memos, undefined, "sequence", props.title, props.description)
9192
choices.onChoice(this.onChoiceFromAbove)
9293

9394
this.setState((state) => {
@@ -97,7 +98,7 @@ export default class Guide extends React.PureComponent<Props, State> {
9798
const frontier = noChangeToGraph && state && state.frontier ? state.frontier : Graph.findChoiceFrontier(graph)
9899

99100
const startAtStep = state ? state.startAtStep : 1
100-
const wizard = Wiz.wizardify(graph, { previous: state ? state.wizard : undefined })
101+
const wizard = Wiz.wizardify(graph, this.memos, { previous: state ? state.wizard : undefined })
101102
const wizardStepStatus = noChangeToGraph && state ? state.wizardStepStatus : []
102103

103104
const isRunning = state ? state.isRunning : false
@@ -266,7 +267,7 @@ export default class Guide extends React.PureComponent<Props, State> {
266267
Promise.all(
267268
steps.map(async (_, idx) => {
268269
if (!this.state.wizardStepStatus[idx] || this.state.wizardStepStatus[idx] === "blank") {
269-
const status = await Graph.validate(_.graph, {
270+
const status = await Graph.validate(_.graph, this.memos, {
270271
validator: (cmdline: string) => this.props.tab.REPL.qexec(cmdline),
271272
})
272273
if (status !== this.state.wizardStepStatus[idx]) {

plugins/plugin-madwizard/src/components/Plan.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { TreeView, TreeViewProps } from "@patternfly/react-core"
2020
import { encodeComponent, pexecInCurrentTab } from "@kui-shell/core"
2121
import { CardResponse, Icons, Loading, Markdown, SupportedIcon } from "@kui-shell/plugin-client-common"
2222

23-
import { Graph, CodeBlock, Choices, Tree } from "madwizard"
23+
import { Graph, CodeBlock, Choices, Memoizer, Tree } from "madwizard"
2424

2525
import read from "../read"
2626

@@ -145,6 +145,8 @@ type State = Partial<
145145
}
146146

147147
export default class Plan extends React.PureComponent<Props, State> {
148+
private readonly memos = new Memoizer()
149+
148150
public constructor(props: Props) {
149151
super(props)
150152
this.state = {
@@ -155,7 +157,7 @@ export default class Plan extends React.PureComponent<Props, State> {
155157
private async init(props: Props, useTheseChoices?: State["choices"]) {
156158
try {
157159
const choices = useTheseChoices || props.choices
158-
const newGraph = await Graph.compile(props.blocks, choices, undefined, "sequence", props.title, props.description)
160+
const newGraph = await Graph.compile(props.blocks, choices, this.memos, undefined, "sequence", props.title, props.description)
159161
choices.onChoice(this.onChoice)
160162

161163
this.setState((state) => {

0 commit comments

Comments
 (0)