1414 * limitations under the License.
1515 */
1616
17+ import Debug from "debug"
1718import type { Arguments } from "@kui-shell/core"
1819
1920import type Options from "./job/options.js"
@@ -117,7 +118,9 @@ type Model = Record<string, Record<string, Record<string, PodRec>>>
117118// host job name
118119
119120export default async function jobsController ( args : Arguments < MyOptions > ) {
120- const ns = args . parsedOptions . A ? "-A" : args . parsedOptions . n ? `-n ${ args . parsedOptions . n } ` : ""
121+ const debug = Debug ( "plugin-codeflare-dashboard/controller/top" )
122+ const ns = args . parsedOptions . A ? "--all-namespaces" : args . parsedOptions . n ? `-n ${ args . parsedOptions . n } ` : ""
123+ debug ( "ns" , ns || "using namespace from user current context" )
121124
122125 if ( process . env . ALT !== "false" ) {
123126 enterAltBufferMode ( )
@@ -126,6 +129,7 @@ export default async function jobsController(args: Arguments<MyOptions>) {
126129 // To help us parse out one "record's" worth of output from kubectl
127130 const recordSeparator = "-----------"
128131
132+ debug ( "spawning watcher..." )
129133 const { spawn } = await import ( "child_process" )
130134 const child = spawn (
131135 "bash" ,
@@ -135,6 +139,7 @@ export default async function jobsController(args: Arguments<MyOptions>) {
135139 ] ,
136140 { shell : "/bin/bash" , stdio : [ "ignore" , "pipe" , "inherit" ] }
137141 )
142+ debug ( "spawned watcher" )
138143
139144 const jobIndices : Record < string , number > = { } // lookup
140145 const jobOcc : ( undefined | string ) [ ] = [ ] // occupancy vector
@@ -171,6 +176,7 @@ export default async function jobsController(args: Arguments<MyOptions>) {
171176 }
172177
173178 const initWatcher = ( cb : OnData ) => {
179+ debug ( "init watcher callbacks" )
174180 const me = process . env . USER || "NOUSER"
175181
176182 child . on ( "error" , ( err ) => console . error ( err ) )
@@ -257,13 +263,19 @@ export default async function jobsController(args: Arguments<MyOptions>) {
257263 } )
258264 }
259265
266+ debug ( "loading UI dependencies" )
260267 const [ { render } , { createElement } , { default : Top } ] = await Promise . all ( [
261268 import ( "ink" ) ,
262269 import ( "react" ) ,
263270 import ( "../../components/Top/index.js" ) ,
264271 ] )
272+
273+ debug ( "rendering" )
265274 const { waitUntilExit } = await render ( createElement ( Top , { initWatcher } ) )
275+ debug ( "initial render done" )
276+
266277 await waitUntilExit ( )
278+ debug ( "exiting" )
267279 return true
268280}
269281
0 commit comments