Skip to content

Commit 0bc93b5

Browse files
committed
fix: improved debug output for codeflare dashboard command
1 parent b11c790 commit 0bc93b5

File tree

1 file changed

+12
-2
lines changed
  • plugins/plugin-codeflare-dashboard/src/controller/dashboard

1 file changed

+12
-2
lines changed

Diff for: plugins/plugin-codeflare-dashboard/src/controller/dashboard/index.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
import Debug from "debug"
1718
import type { Arguments } from "@kui-shell/core"
1819

1920
import tailf from "./tailf.js"
@@ -128,6 +129,9 @@ async function allGridsFor(
128129
}
129130

130131
export default async function dashboard(args: Arguments<Options>, cmd: "db" | "dashboard") {
132+
const debug = Debug("plugin-codeflare-dashboard/controller/dashboard")
133+
debug("setup")
134+
131135
const { demo, theme, events } = args.parsedOptions
132136

133137
const scale = args.parsedOptions.s || 1
@@ -137,6 +141,9 @@ export default async function dashboard(args: Arguments<Options>, cmd: "db" | "d
137141
const kind = args.argvNoOptions[args.argvNoOptions.indexOf(cmd) + kindOffset] || "all"
138142
const { jobId, profile } = await jobIdFrom(args, cmd, jobIdOffset)
139143

144+
debug("jobId", jobId)
145+
debug("profile", profile)
146+
140147
if (!isValidKindA(kind)) {
141148
throw new Error(usage(cmd, ["all"]))
142149
} else if (!jobId) {
@@ -160,14 +167,17 @@ export default async function dashboard(args: Arguments<Options>, cmd: "db" | "d
160167
width: args.parsedOptions.u ? 1000 * args.parsedOptions.u : 5000,
161168
}
162169

163-
const db = dashboardUI(profile, jobId, await gridForA(kind, historyConfig), { scale })
170+
const grids = await gridForA(kind, historyConfig)
171+
debug("grids", grids)
172+
173+
const db = dashboardUI(profile, jobId, grids, { scale })
164174

165175
if (!db) {
166176
throw new Error(usage(cmd))
167177
} else {
168178
const { render } = await import("ink")
169179

170-
if (process.env.ALT !== "false") {
180+
if (process.env.ALT !== "false" && !debug.enabled) {
171181
enterAltBufferMode()
172182
}
173183

0 commit comments

Comments
 (0)