Skip to content

Commit 58f5f09

Browse files
committed
add advanced options override logic
1 parent 5156cb3 commit 58f5f09

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

src/index.tsx

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,24 @@ const schedulerPlugin: JupyterFrontEndPlugin<void> = {
8282
INotebookTracker,
8383
ITranslator,
8484
ILayoutRestorer,
85-
Scheduler.IAdvancedOptions,
8685
Scheduler.TelemetryHandler
8786
],
88-
optional: [ILauncher],
87+
optional: [
88+
ILauncher,
89+
Scheduler.IAdvancedOptionsOverride,
90+
Scheduler.IAdvancedOptions
91+
],
8992
autoStart: true,
9093
activate: activatePlugin
9194
};
92-
93-
// Disable this plugin and replace with custom plugin to change the advanced options UI
9495
const advancedOptions: JupyterFrontEndPlugin<Scheduler.IAdvancedOptions> = {
95-
id: '@jupyterlab/scheduler:IAdvancedOptions',
96+
id: '@jupyterlab/scheduler:IAdvancedOptions',
9697
autoStart: true,
9798
provides: Scheduler.IAdvancedOptions,
9899
activate: (app: JupyterFrontEnd) => {
100+
console.log('🔄 DEFAULT jupyter-scheduler advanced options plugin is activating');
101+
console.log(' Plugin ID: @jupyterlab/scheduler:IAdvancedOptions');
102+
console.log(' Note: This should be disabled by K8s extension via disabledExtensions');
99103
return AdvancedOptions;
100104
}
101105
};
@@ -190,10 +194,20 @@ function activatePlugin(
190194
notebookTracker: INotebookTracker,
191195
translator: ITranslator,
192196
restorer: ILayoutRestorer,
193-
advancedOptions: Scheduler.IAdvancedOptions,
194197
telemetryHandler: Scheduler.TelemetryHandler,
195-
launcher: ILauncher | null
198+
launcher: ILauncher | null,
199+
advancedOptionsOverride: Scheduler.IAdvancedOptions | null,
200+
advancedOptionsDefault: Scheduler.IAdvancedOptions | null
196201
): void {
202+
console.log('🔍 SCHEDULER PLUGIN ADVANCED OPTIONS RESOLUTION:');
203+
console.log(' Override token expected:', Scheduler.IAdvancedOptionsOverride);
204+
console.log(' Override received:', advancedOptionsOverride);
205+
console.log(' Default received:', advancedOptionsDefault);
206+
207+
// Use override if available, otherwise use default
208+
const advancedOptions = advancedOptionsOverride || advancedOptionsDefault;
209+
console.log(' Using:', advancedOptions);
210+
197211
const trans = translator.load('jupyterlab');
198212
const api = new SchedulerService({});
199213
verifyServerExtension({ api, translator });
@@ -237,7 +251,7 @@ function activatePlugin(
237251
app,
238252
translator,
239253
eventLogger,
240-
advancedOptions: advancedOptions
254+
advancedOptions: advancedOptions || AdvancedOptions
241255
});
242256
// Create new main area widget
243257
mainAreaWidget = new MainAreaWidget<NotebookJobsPanel>({
@@ -372,6 +386,9 @@ function activatePlugin(
372386
}
373387
}
374388

389+
console.log('📦 DEFAULT jupyter-scheduler extension is being loaded...');
390+
console.log(' Plugins: schedulerPlugin, advancedOptions, telemetry');
391+
375392
const plugins: JupyterFrontEndPlugin<any>[] = [
376393
schedulerPlugin,
377394
advancedOptions,

src/tokens.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ export namespace Scheduler {
4646
'@jupyterlab/scheduler:IAdvancedOptions'
4747
);
4848

49+
// Override token for extensions that want to provide custom advanced options
50+
export const IAdvancedOptionsOverride = new Token<IAdvancedOptions>(
51+
'@jupyterlab/scheduler:IAdvancedOptionsOverride'
52+
);
53+
4954
export interface IEvent {
5055
name: string;
5156
}

0 commit comments

Comments
 (0)