Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function activateMetadataUI(
app: JupyterFrontEnd,
activeDataset: IActiveDataset,
palette: ICommandPalette,
comments: IMetadataCommentsService,
datasets: IMetadataDatasetsService,
people: IMetadataPeopleService,
labShell: ILabShell,
converters: IConverterRegistry
): void {
console.log('JupyterLab extension jupyterlab-metadata-service is activated!');
// Create a single widget
const widget = ReactWidget.create(
{(sender, args) => {
try {
let URL = activeDataset.active.pathname;
return (
);
} catch {
return ;
}
}}
function activate(
lab: JupyterFrontEnd,
labShell: ILabShell,
registry: Registry,
restorer: ILayoutRestorer,
active: IActiveDataset
): IDataExplorer {
const displayedURLs = new ObservableSet();
displayedURLs.add(ACTIVE_URL);
displayedURLs.add(new URL('file:').toString());
// Create a dataset with this URL
const widget = ReactWidget.create(
);
widget.id = '@jupyterlab-dataRegistry/explorer';
widget.title.iconClass = 'jp-SpreadsheetIcon jp-SideBar-tabIcon';
widget.title.caption = 'Data Explorer';
restorer.add(widget, widget.id);
labShell.add(widget, 'left');
return { widget, addURL: displayedURLs.add, removeURL: displayedURLs.remove };
}
execute: async () => {
if (!widget) {
// Create a new widget if one does not exist
const content = ReactWidget.create();
widget = new MainAreaWidget({ content });
widget.id = 'todo';
widget.title.label = 'TODO';
widget.title.closable = true;
}
if (!tracker.has(widget)) {
// Track the state of the widget for later restoration
await tracker.add(widget);
}
if (!widget.isAttached) {
// Attach the widget to the main work area if it's not there
app.shell.add(widget, 'main');
}
widget.content.update();
// Activate the widget
private _handleClick(): void {
if (this._popup) {
this._popup.dispose();
}
const body = ReactWidget.create(
this._handleSubmit(val)}
currentLine={this.model!.line}
maxLine={this.model!.editor!.lineCount}
/>
);
this._popup = showPopup({
body: body,
anchor: this,
align: 'right'
});
}
function onClick() {
if (panel.context.model.readOnly) {
return showDialog({
title: 'Cannot Save',
body: 'Document is read-only',
buttons: [Dialog.okButton()]
});
}
void panel.context.save().then(() => {
if (!panel.isDisposed) {
return panel.context.createCheckpoint();
}
});
}
return addToolbarButtonClass(
ReactWidget.create(
{() => (
)}
options: createSearchOverlay.IOptions
): Widget {
const {
widgetChanged,
overlayState,
onCaseSensitiveToggled,
onRegexToggled,
onHightlightNext,
onHighlightPrevious,
onStartQuery,
onReplaceCurrent,
onReplaceAll,
onEndSearch,
isReadOnly
} = options;
const widget = ReactWidget.create(
{(_, args) => {
return (
);
constructor(options: Debugger.IOptions) {
super();
this.addClass(DEBUGGER_WIDGET_CLASS);
const { tracker } = options;
this.debugger = new Debugger({ tracker });
const debuggerComponent = ReactWidget.create(
);
let layout = new PanelLayout();
layout.addWidget(debuggerComponent);
this.layout = layout;
}
options: createSearchOverlay.IOptions
): Widget {
const {
widgetChanged,
overlayState,
onCaseSensitiveToggled,
onRegexToggled,
onHightlightNext,
onHighlightPrevious,
onStartQuery,
onReplaceCurrent,
onReplaceAll,
onEndSearch,
isReadOnly
} = options;
const widget = ReactWidget.create(
{(_, args) => {
return (
);