Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Silvester committed Dec 23, 2019
1 parent f214e14 commit d7737d6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
19 changes: 10 additions & 9 deletions packages/notebook-extension/src/index.ts
Expand Up @@ -302,10 +302,9 @@ const tools: JupyterFrontEndPlugin<INotebookTools> = {
requires: [
INotebookTracker,
IEditorServices,
IStateDB,
IPropertyInspectorProvider
IStateDB
],
optional: [ILabShell]
optional: [ILabShell, IPropertyInspectorProvider]
};

/**
Expand Down Expand Up @@ -407,8 +406,8 @@ function activateNotebookTools(
tracker: INotebookTracker,
editorServices: IEditorServices,
state: IStateDB,
inspectorProvider: IPropertyInspectorProvider,
labShell: ILabShell | null
labShell: ILabShell | null,
inspectorProvider: IPropertyInspectorProvider | null
): INotebookTools {
const id = 'notebook-tools';
const notebookTools = new NotebookTools({ tracker });
Expand Down Expand Up @@ -478,10 +477,12 @@ function activateNotebookTools(

MessageLoop.installMessageHook(notebookTools, hook);

tracker.widgetAdded.connect((sender, panel) => {
const inspector = inspectorProvider.register(panel);
inspector.render(notebookTools);
});
if (inspectorProvider) {
tracker.widgetAdded.connect((sender, panel) => {
const inspector = inspectorProvider.register(panel);
inspector.render(notebookTools);
});
}

return notebookTools;
}
Expand Down
11 changes: 7 additions & 4 deletions packages/property-inspector/src/index.ts
Expand Up @@ -21,7 +21,7 @@ export { IPropertyInspector, IPropertyInspectorProvider };
abstract class PropertyInspectorProvider extends Widget
implements IPropertyInspectorProvider {
/**
* Constrcut a new Property Inspector.
* Construct a new Property Inspector.
*/
constructor() {
super();
Expand Down Expand Up @@ -111,7 +111,7 @@ abstract class PropertyInspectorProvider extends Widget
this._inspectors.delete(owner);
}
break;
case 'showPanel':
case 'show-panel':
if (current === owner) {
this.showPanel();
}
Expand Down Expand Up @@ -144,6 +144,9 @@ abstract class PropertyInspectorProvider extends Widget
* JupyterLab sidebar.
*/
export class SideBarPropertyInspectorProvider extends PropertyInspectorProvider {
/**
* Construct a new Side Bar Property Inspector.
*/
constructor(labshell: ILabShell, placeholder?: Widget) {
super();
this._labshell = labshell;
Expand Down Expand Up @@ -210,7 +213,7 @@ namespace Private {
/**
* A type alias for the actions a property inspector can take.
*/
export type PropertyInspectorAction = 'content' | 'dispose' | 'showPanel';
export type PropertyInspectorAction = 'content' | 'dispose' | 'show-panel';

/**
* An implementation of the property inspector used by the
Expand Down Expand Up @@ -259,7 +262,7 @@ namespace Private {
if (this._isDisposed) {
return;
}
this._onAction.emit('showPanel');
this._onAction.emit('show-panel');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/property-inspector/src/token.ts
Expand Up @@ -58,5 +58,5 @@ export interface IPropertyInspectorProvider {
* The property inspector provider token.
*/
export const IPropertyInspectorProvider = new Token<IPropertyInspectorProvider>(
'@sagemaker-ui:IPropertyInspectorProvider'
'@jupyterlab/property-inspector:IPropertyInspectorProvider'
);

0 comments on commit d7737d6

Please sign in to comment.