Skip to content

Commit 3f6832b

Browse files
committed
chore: refactor madwizard-specific logic and ui into plugin-madwizard
1 parent 4d3cb9a commit 3f6832b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+644
-369
lines changed

package-lock.json

Lines changed: 20 additions & 18 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ execute: now
1313
outputOnly: true
1414
maximize: true
1515
---
16-
codeflare designer
16+
madwizard designer
1717
```

plugins/plugin-codeflare/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"@patternfly/react-core": "^4.267.6",
2929
"allotment": "^1.17.1",
3030
"asciinema-player": "^3.0.1",
31-
"chalk": "^5.2.0",
3231
"chokidar": "^3.5.3",
3332
"json-diff": "^1.0.0",
3433
"needle": "^3.2.0",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import React from "react"
18-
import { openWindow } from "../controller/profile/actions"
18+
import { openWindow } from "@kui-shell/plugin-madwizard/watch"
1919
import { Select, SelectOption, SelectOptionObject } from "@patternfly/react-core"
2020

2121
type Props = {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import { Prompts, Tree } from "madwizard"
1919
import { cli } from "madwizard/dist/fe/cli"
2020
import { Loading } from "@kui-shell/plugin-client-common"
2121

22-
import AskUI, { Ask } from "./Ask"
23-
import { guidebookStore } from "../controller/respawn"
22+
import { AskUI, Ask } from "@kui-shell/plugin-madwizard/components"
23+
import { guidebookStore } from "@kui-shell/plugin-madwizard/watch"
2424

2525
type Props = {
2626
guidebook: string

plugins/plugin-codeflare/src/controller/catchall.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import { version } from "@kui-shell/client/package.json"
18-
import { doMadwizard, MadWizardOptions } from "@kui-shell/plugin-madwizard"
18+
import { doMadwizard, MadWizardOptions } from "@kui-shell/plugin-madwizard/do"
1919

2020
import comIBMResearchFM from "../teams/com/ibm/research/fm"
2121
import comIBMResearchNASA from "../teams/com/ibm/research/nasa"

plugins/plugin-codeflare/src/controller/dashboard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async function dashboardcli(args: Arguments<DashboardOptions>) {
5454
}
5555

5656
async function dashboardui(args: Arguments<DashboardOptions>) {
57-
const { setTabReadonly } = await import("@kui-shell/plugin-madwizard")
57+
const { setTabReadonly } = await import("@kui-shell/plugin-madwizard/do")
5858
setTabReadonly(args)
5959

6060
const filepath = args.argvNoOptions[2]

plugins/plugin-codeflare/src/controller/guide.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
*/
1616

1717
import { Arguments } from "@kui-shell/core"
18-
import { doExecWithPty } from "@kui-shell/plugin-bash-like"
19-
import { setTabReadonly } from "@kui-shell/plugin-madwizard"
20-
21-
import respawnCommand from "./respawn"
2218

2319
/**
2420
* Entrypoint for madwizard tasks from tray.ts. We could improve the
@@ -28,9 +24,15 @@ import respawnCommand from "./respawn"
2824
* see bin/codeflare; we are mostly copying bits from there
2925
*/
3026
export default async function guide(args: Arguments) {
27+
const [{ doExecWithPty }, { respawn }, { setTabReadonly }] = await Promise.all([
28+
import("@kui-shell/plugin-bash-like"),
29+
import("@kui-shell/plugin-madwizard/watch"),
30+
import("@kui-shell/plugin-madwizard/do"),
31+
])
32+
3133
setTabReadonly(args)
3234

33-
const { argv, env } = await respawnCommand(
35+
const { argv, env } = await respawn(
3436
args.command.replace(/--type=renderer/, "").replace(/^codeflare\s+gui\s+guide/, "codeflare")
3537
)
3638

plugins/plugin-codeflare/src/controller/index.ts

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import { KResponse, Registrar } from "@kui-shell/core"
18-
import { MadWizardOptions, flags } from "@kui-shell/plugin-madwizard"
18+
import { MadWizardOptions, flags } from "@kui-shell/plugin-madwizard/do"
1919

2020
import { width, height } from "@kui-shell/client/config.d/style.json"
2121

@@ -64,49 +64,41 @@ export default function registerCodeflareCommands(registrar: Registrar) {
6464
height,
6565
})
6666

67-
registrar.listen("/codeflare/reset/profile", (args) => import("./profile/reset").then((_) => _.default(args)))
68-
registrar.listen("/codeflare/delete/profile", (args) => import("./profile/delete").then((_) => _.default(args)))
69-
registrar.listen("/codeflare/rename/profile", (args) => import("./profile/rename").then((_) => _.default(args)))
70-
71-
registrar.listen("/codeflare/get/profile", () => import("./profile/get").then((_) => _.default()), {
72-
needsUI: true,
73-
})
7467
registrar.listen("/codeflare/get/run", (args) => import("./run/get").then((_) => _.default(args)), {
7568
needsUI: true,
7669
outputOnly: true,
7770
})
7871

7972
// launch our explore guidebook
8073
;["ui", "explore", "explorer", "hello"].forEach((explore) =>
81-
registrar.listen(`/codeflare/${explore}`, (args) => import("./hello").then((_) => _.default(args)), {
82-
needsUI: true,
83-
outputOnly: true,
84-
width,
85-
height,
86-
})
74+
registrar.listen(
75+
`/codeflare/${explore}`,
76+
(args) => import("@kui-shell/plugin-madwizard").then((_) => _.hello(args)),
77+
{
78+
needsUI: true,
79+
outputOnly: true,
80+
width,
81+
height,
82+
}
83+
)
8784
)
8885

8986
/**
9087
* Launch the gallery with asciinema plays
9188
*/
92-
registrar.listen("/codeflare/gallery", () => import("./hello").then((_) => _.gallery()), {
89+
/* registrar.listen("/codeflare/gallery", () => import("./hello").then((_) => _.gallery()), {
9390
outputOnly: true,
94-
})
91+
}) */
9592

9693
/**
9794
* Launch a gallery with the example dashboards
9895
*/
99-
registrar.listen("/codeflare/dashboard-gallery", (args) => import("./hello").then((_) => _.dashboardGallery(args)))
100-
101-
/** UI for running profile-related tasks */
102-
registrar.listen("/codeflare/designer", (args) => import("./terminal").then((_) => _.designer(args)), {
103-
needsUI: true,
104-
})
96+
// registrar.listen("/codeflare/dashboard-gallery", (args) => import("./hello").then((_) => _.dashboardGallery(args)))
10597

10698
/** Open a plain terminal */
107-
registrar.listen("/codeflare/terminal/shell", (args) => import("./terminal").then((_) => _.shell(args)), {
99+
/* registrar.listen("/codeflare/terminal/shell", (args) => import("./terminal").then((_) => _.shell(args)), {
108100
needsUI: true,
109-
})
101+
}) */
110102

111103
/**
112104
* Register a catch-all command handler: any `/^codeflare/` command

plugins/plugin-codeflare/src/controller/run/get.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { Profiles } from "madwizard"
1919
import { basename, join } from "path"
2020
import prettyMilliseconds from "pretty-ms"
2121
import { Arguments, Table } from "@kui-shell/core"
22-
import { setTabReadonly } from "@kui-shell/plugin-madwizard"
2322

2423
import { productName } from "@kui-shell/client/config.d/name.json"
2524

@@ -78,6 +77,8 @@ function getRunTime(start: number, end: number): string {
7877
}
7978

8079
export default async function getRuns(args: Arguments) {
80+
const [{ setTabReadonly }] = await Promise.all([import("@kui-shell/plugin-madwizard/do")])
81+
8182
setTabReadonly(args)
8283
const profile = args.parsedOptions.p || args.parsedOptions.profile
8384

0 commit comments

Comments
 (0)