From 9435aa43fed9752296eecb6bbdb2619ad1e02622 Mon Sep 17 00:00:00 2001 From: Vishnutheep B Date: Sat, 10 Feb 2024 20:00:26 +0000 Subject: [PATCH 1/8] Ignore paths with tree pattern --- packages/application-extension/src/index.ts | 6 ++++++ packages/console-extension/src/index.ts | 5 ++++- packages/terminal-extension/src/index.ts | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/application-extension/src/index.ts b/packages/application-extension/src/index.ts index cd0ddd62a5..0d6c329d82 100644 --- a/packages/application-extension/src/index.ts +++ b/packages/application-extension/src/index.ts @@ -200,11 +200,17 @@ const opener: JupyterFrontEndPlugin = { ): void => { const { commands, docRegistry } = app; + const ignoreTreePattern = new RegExp('/tree/(.*)'); const command = 'router:tree'; commands.addCommand(command, { execute: (args: any) => { const parsed = args as IRouter.ILocation; const matches = parsed.path.match(TREE_PATTERN) ?? []; + const isTreeMatch = parsed.path.match(ignoreTreePattern); + + if(isTreeMatch) + return; + const [, , path] = matches; if (!path) { return; diff --git a/packages/console-extension/src/index.ts b/packages/console-extension/src/index.ts index 1efc124eb4..a780134d3b 100644 --- a/packages/console-extension/src/index.ts +++ b/packages/console-extension/src/index.ts @@ -29,13 +29,16 @@ const opener: JupyterFrontEndPlugin = { activate: (app: JupyterFrontEnd, router: IRouter) => { const { commands } = app; const consolePattern = new RegExp('/consoles/(.*)'); + const ignoreTreePattern = new RegExp('/tree/(.*)'); const command = 'router:console'; commands.addCommand(command, { execute: (args: any) => { const parsed = args as IRouter.ILocation; const matches = parsed.path.match(consolePattern); - if (!matches) { + const isTreeMatch = parsed.path.match(ignoreTreePattern); + + if (isTreeMatch || !matches) { return; } const [, match] = matches; diff --git a/packages/terminal-extension/src/index.ts b/packages/terminal-extension/src/index.ts index 3de0250808..e49cfb11c6 100644 --- a/packages/terminal-extension/src/index.ts +++ b/packages/terminal-extension/src/index.ts @@ -33,13 +33,16 @@ const opener: JupyterFrontEndPlugin = { ) => { const { commands } = app; const terminalPattern = new RegExp('/terminals/(.*)'); + const ignoreTreePattern = new RegExp('/tree/(.*)'); const command = 'router:terminal'; commands.addCommand(command, { execute: (args: any) => { const parsed = args as IRouter.ILocation; const matches = parsed.path.match(terminalPattern); - if (!matches) { + const isTreeMatch = parsed.path.match(ignoreTreePattern); + + if (isTreeMatch || !matches) { return; } const [, name] = matches; From e2cd845174a2145c09c997b959d5c785aee6091e Mon Sep 17 00:00:00 2001 From: Vishnutheep B Date: Sat, 10 Feb 2024 21:44:04 +0000 Subject: [PATCH 2/8] Ignore paths with tree, notebooks, edit pattern --- packages/console-extension/src/index.ts | 2 +- packages/terminal-extension/src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/console-extension/src/index.ts b/packages/console-extension/src/index.ts index a780134d3b..79eeb96cb0 100644 --- a/packages/console-extension/src/index.ts +++ b/packages/console-extension/src/index.ts @@ -29,7 +29,7 @@ const opener: JupyterFrontEndPlugin = { activate: (app: JupyterFrontEnd, router: IRouter) => { const { commands } = app; const consolePattern = new RegExp('/consoles/(.*)'); - const ignoreTreePattern = new RegExp('/tree/(.*)'); + const ignoreTreePattern = new RegExp('/(tree|notebooks|edit)/(.*)'); const command = 'router:console'; commands.addCommand(command, { diff --git a/packages/terminal-extension/src/index.ts b/packages/terminal-extension/src/index.ts index e49cfb11c6..0183eb50c0 100644 --- a/packages/terminal-extension/src/index.ts +++ b/packages/terminal-extension/src/index.ts @@ -33,7 +33,7 @@ const opener: JupyterFrontEndPlugin = { ) => { const { commands } = app; const terminalPattern = new RegExp('/terminals/(.*)'); - const ignoreTreePattern = new RegExp('/tree/(.*)'); + const ignoreTreePattern = new RegExp('/(tree|notebooks|edit)/(.*)'); const command = 'router:terminal'; commands.addCommand(command, { From 4db90fe4d45105e6a234c57e102a2d6d3ba4dda9 Mon Sep 17 00:00:00 2001 From: Vishnutheep B Date: Sun, 11 Feb 2024 08:13:35 +0000 Subject: [PATCH 3/8] Prettier Code for Test Lint check --- packages/application-extension/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/application-extension/src/index.ts b/packages/application-extension/src/index.ts index 0d6c329d82..44ab385816 100644 --- a/packages/application-extension/src/index.ts +++ b/packages/application-extension/src/index.ts @@ -208,8 +208,9 @@ const opener: JupyterFrontEndPlugin = { const matches = parsed.path.match(TREE_PATTERN) ?? []; const isTreeMatch = parsed.path.match(ignoreTreePattern); - if(isTreeMatch) + if(isTreeMatch){ return; + } const [, , path] = matches; if (!path) { From 6d8a7ea485b0eee3ebd6ffa85ce171557ace5a1f Mon Sep 17 00:00:00 2001 From: Vishnutheep B Date: Mon, 12 Feb 2024 13:23:09 +0000 Subject: [PATCH 4/8] Prettier code for Test Lint check --- packages/application-extension/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/application-extension/src/index.ts b/packages/application-extension/src/index.ts index 44ab385816..4a1be2c8ba 100644 --- a/packages/application-extension/src/index.ts +++ b/packages/application-extension/src/index.ts @@ -208,7 +208,7 @@ const opener: JupyterFrontEndPlugin = { const matches = parsed.path.match(TREE_PATTERN) ?? []; const isTreeMatch = parsed.path.match(ignoreTreePattern); - if(isTreeMatch){ + if (isTreeMatch) { return; } From 7f649db7a2eca3e347875a5c1281e45e418ffca0 Mon Sep 17 00:00:00 2001 From: Vishnutheep B Date: Tue, 20 Feb 2024 17:00:42 +0000 Subject: [PATCH 5/8] Modified logic for Ignored patterns --- packages/application-extension/src/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/application-extension/src/index.ts b/packages/application-extension/src/index.ts index 4a1be2c8ba..ffbd1fead6 100644 --- a/packages/application-extension/src/index.ts +++ b/packages/application-extension/src/index.ts @@ -200,20 +200,20 @@ const opener: JupyterFrontEndPlugin = { ): void => { const { commands, docRegistry } = app; - const ignoreTreePattern = new RegExp('/tree/(.*)'); + const ignoredPattern = new RegExp('/tree/(.*)'); const command = 'router:tree'; commands.addCommand(command, { execute: (args: any) => { const parsed = args as IRouter.ILocation; const matches = parsed.path.match(TREE_PATTERN) ?? []; - const isTreeMatch = parsed.path.match(ignoreTreePattern); - if (isTreeMatch) { + const [, , path] = matches; + if (!path) { return; } - const [, , path] = matches; - if (!path) { + const pathSegments: string[] = parsed.path.split('/\bnotebooks\b/|/\bedit\b/'); + if ( pathSegments.length > 1 && pathSegments[0].match(ignoredPattern) ) { return; } From e9bf7e777d6cd6c4342b877774bb86aaa0fe7fde Mon Sep 17 00:00:00 2001 From: Vishnutheep B Date: Tue, 20 Feb 2024 17:42:11 +0000 Subject: [PATCH 6/8] Prettier code for Lint checks --- packages/application-extension/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/application-extension/src/index.ts b/packages/application-extension/src/index.ts index ffbd1fead6..01d8a1c07b 100644 --- a/packages/application-extension/src/index.ts +++ b/packages/application-extension/src/index.ts @@ -201,6 +201,7 @@ const opener: JupyterFrontEndPlugin = { const { commands, docRegistry } = app; const ignoredPattern = new RegExp('/tree/(.*)'); + const pathSegmentPattern = new RegExp('\\bnotebooks\\b|\\bedit\\b'); const command = 'router:tree'; commands.addCommand(command, { execute: (args: any) => { @@ -212,8 +213,8 @@ const opener: JupyterFrontEndPlugin = { return; } - const pathSegments: string[] = parsed.path.split('/\bnotebooks\b/|/\bedit\b/'); - if ( pathSegments.length > 1 && pathSegments[0].match(ignoredPattern) ) { + const pathSegments: string[] = parsed.path.split(pathSegmentPattern); + if (pathSegments.length > 1 && pathSegments[0].match(ignoredPattern)) { return; } From 43504d666df8e58b9ba8bad7bd0c03d6840a8c17 Mon Sep 17 00:00:00 2001 From: Vishnutheep B Date: Tue, 20 Feb 2024 18:04:09 +0000 Subject: [PATCH 7/8] Updated logic for ignored pattern --- packages/application-extension/src/index.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/application-extension/src/index.ts b/packages/application-extension/src/index.ts index 01d8a1c07b..669721f32a 100644 --- a/packages/application-extension/src/index.ts +++ b/packages/application-extension/src/index.ts @@ -200,8 +200,7 @@ const opener: JupyterFrontEndPlugin = { ): void => { const { commands, docRegistry } = app; - const ignoredPattern = new RegExp('/tree/(.*)'); - const pathSegmentPattern = new RegExp('\\bnotebooks\\b|\\bedit\\b'); + const ignoredPattern = new RegExp('/tree(.*)'); const command = 'router:tree'; commands.addCommand(command, { execute: (args: any) => { @@ -213,7 +212,7 @@ const opener: JupyterFrontEndPlugin = { return; } - const pathSegments: string[] = parsed.path.split(pathSegmentPattern); + const pathSegments: string[] = parsed.path.split(TREE_PATTERN); if (pathSegments.length > 1 && pathSegments[0].match(ignoredPattern)) { return; } From b9a0f13add3be0091767b7b354cdbef3950bc78d Mon Sep 17 00:00:00 2001 From: Vishnutheep B Date: Sun, 25 Feb 2024 04:48:58 +0000 Subject: [PATCH 8/8] Updated logic for quick Regex match --- packages/application-extension/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/application-extension/src/index.ts b/packages/application-extension/src/index.ts index 669721f32a..01d8a1c07b 100644 --- a/packages/application-extension/src/index.ts +++ b/packages/application-extension/src/index.ts @@ -200,7 +200,8 @@ const opener: JupyterFrontEndPlugin = { ): void => { const { commands, docRegistry } = app; - const ignoredPattern = new RegExp('/tree(.*)'); + const ignoredPattern = new RegExp('/tree/(.*)'); + const pathSegmentPattern = new RegExp('\\bnotebooks\\b|\\bedit\\b'); const command = 'router:tree'; commands.addCommand(command, { execute: (args: any) => { @@ -212,7 +213,7 @@ const opener: JupyterFrontEndPlugin = { return; } - const pathSegments: string[] = parsed.path.split(TREE_PATTERN); + const pathSegments: string[] = parsed.path.split(pathSegmentPattern); if (pathSegments.length > 1 && pathSegments[0].match(ignoredPattern)) { return; }