1414 * limitations under the License.
1515 */
1616
17+ import Debug from "debug"
1718import type { Arguments } from "@kui-shell/core"
1819
1920import tailf from "./tailf.js"
@@ -128,6 +129,9 @@ async function allGridsFor(
128129}
129130
130131export 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