14
14
* limitations under the License.
15
15
*/
16
16
17
+ import Debug from "debug"
17
18
import type { Arguments } from "@kui-shell/core"
18
19
19
20
import tailf from "./tailf.js"
@@ -128,6 +129,9 @@ async function allGridsFor(
128
129
}
129
130
130
131
export default async function dashboard ( args : Arguments < Options > , cmd : "db" | "dashboard" ) {
132
+ const debug = Debug ( "plugin-codeflare-dashboard/controller/dashboard" )
133
+ debug ( "setup" )
134
+
131
135
const { demo, theme, events } = args . parsedOptions
132
136
133
137
const scale = args . parsedOptions . s || 1
@@ -137,6 +141,9 @@ export default async function dashboard(args: Arguments<Options>, cmd: "db" | "d
137
141
const kind = args . argvNoOptions [ args . argvNoOptions . indexOf ( cmd ) + kindOffset ] || "all"
138
142
const { jobId, profile } = await jobIdFrom ( args , cmd , jobIdOffset )
139
143
144
+ debug ( "jobId" , jobId )
145
+ debug ( "profile" , profile )
146
+
140
147
if ( ! isValidKindA ( kind ) ) {
141
148
throw new Error ( usage ( cmd , [ "all" ] ) )
142
149
} else if ( ! jobId ) {
@@ -160,14 +167,17 @@ export default async function dashboard(args: Arguments<Options>, cmd: "db" | "d
160
167
width : args . parsedOptions . u ? 1000 * args . parsedOptions . u : 5000 ,
161
168
}
162
169
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 } )
164
174
165
175
if ( ! db ) {
166
176
throw new Error ( usage ( cmd ) )
167
177
} else {
168
178
const { render } = await import ( "ink" )
169
179
170
- if ( process . env . ALT !== "false" ) {
180
+ if ( process . env . ALT !== "false" && ! debug . enabled ) {
171
181
enterAltBufferMode ( )
172
182
}
173
183
0 commit comments