Skip to content

Commit

Permalink
pushing to test extensino
Browse files Browse the repository at this point in the history
  • Loading branch information
srirag21 committed Jul 19, 2024
1 parent e70d121 commit 31362d8
Showing 1 changed file with 58 additions and 3 deletions.
61 changes: 58 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@ import {
} from '@jupyterlab/application';

import {
IThemeManager
IThemeManager,
ICommandPalette
} from '@jupyterlab/apputils';

import {
IFileBrowserFactory
} from '@jupyterlab/filebrowser';

import { ILauncher } from '@jupyterlab/launcher';

Check failure on line 15 in src/index.ts

View workflow job for this annotation

GitHub Actions / check_release

Cannot find module '@jupyterlab/launcher' or its corresponding type declarations.

import { LabIcon } from '@jupyterlab/ui-components';

import '../style/index.css';
import ciscoIcon from '../cisco2.png'

Check failure on line 20 in src/index.ts

View workflow job for this annotation

GitHub Actions / check_release

Cannot find module '../cisco2.png' or its corresponding type declarations.

/**
* Activate the Cisco theme extension.
*/
function activate(app: JupyterFrontEnd, themeManager: IThemeManager) {
function activate(app: JupyterFrontEnd, themeManager: IThemeManager, browserFactory: IFileBrowserFactory, launcher: ILauncher | null, palette: ICommandPalette | null) {
console.log('JupyterLab extension cisco_theme_jupyter is activated!');

const style = 'cisco_theme_jupyter/index.css';
Expand All @@ -22,6 +32,50 @@ function activate(app: JupyterFrontEnd, themeManager: IThemeManager) {
load: () => themeManager.loadCSS(style),
unload: () => Promise.resolve(undefined)
});
const commands = [
{
id: 'example:open-ai',
label: 'Cisco AI',
url: 'https://developer.cisco.com/site/ai/'
},
{
id: 'example:open-crosswork',
label: 'Cisco Crosswork Automation',
url: 'https://community.cisco.com/t5/crosswork-automation-hub/ct-p/5672j-dev-nso'
},
{
id: 'example:open-nso',
label: 'Cisco NSO',
url: 'https://developer.cisco.com/site/nso/'
}
];
const icon = new LabIcon({
name: 'custom:ciscoIcon',
svgstr: ciscoIcon
});
commands.forEach(cmd => {
app.commands.addCommand(cmd.id, {
label: cmd.label,
caption: cmd.label,
icon: icon,
execute: () => {
window.open(cmd.url, '_blank');
}
});

if (launcher) {
launcher.add({
command: cmd.id,
category: 'Cisco Modules',
rank: 1
});
}

if (palette) {
palette.addItem({ command: cmd.id, category: 'Cisco Modules' });
}
});

}

/**
Expand All @@ -30,7 +84,8 @@ function activate(app: JupyterFrontEnd, themeManager: IThemeManager) {
const plugin: JupyterFrontEndPlugin<void> = {
id: 'cisco_theme_jupyter',
autoStart: true,
requires: [IThemeManager],
requires: [IThemeManager, IFileBrowserFactory],
optional: [ILauncher, ICommandPalette],
activate: activate
};

Expand Down

0 comments on commit 31362d8

Please sign in to comment.