Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Property Inspector #7665

Merged
merged 3 commits into from Dec 23, 2019
Merged

Conversation

blink1073
Copy link
Member

@blink1073 blink1073 commented Dec 19, 2019

References

Fixes #7664

Code changes

Adds a property-inspector package and default implementation of the extension in application-extension. The notebook extension is updated to use the inspector.

/**
 * A property inspector interface provided when registering
 * to a property inspector provider.  Allows an owner widget
 * to set the property inspector content for itself.
 */
export interface IPropertyInspector extends IDisposable {
  /*
   * Render the property inspector content.
   *
   * If the owner widget is not the most recently focused,
   * The content will not be shown until that widget
   * is focused.
   *
   * @param content - the widget or react element to render.
   */
  render(content: Widget | React.ReactElement): void;

  /**
   * Show the property inspector panel.
   *
   * If the owner widget is not the most recently focused,
   * this is a no-op.  It should be triggered by a user
   * action.
   */
  showPanel(): void;
}

/**
 * A provider for property inspectors.
 */
export interface IPropertyInspectorProvider {
  /**
   * Register a widget in the property inspector provider.
   *
   * @param widget The owner widget whose properties will be inspected.
   *
   * ## Notes
   * Only one property inspector can be provided for each widget.
   * Registering the same widget twice will result in an error.
   * A widget can be unregistered by disposing of its property
   * inspector.
   */
  register(widget: Widget): IPropertyInspector;
}

User-facing changes

If no other extensions are installed that use the side panel, the use will always see the tool icon even when no notebooks are open, with the text "No properties to inspect.".

I attempted to only show the tab when one or more inspectors are registered, but it conflicts with our logic that allows side bar items to be moved to the opposite side.

image

image

Backwards-incompatible changes

None.

@blink1073 blink1073 added this to the 2.0 milestone Dec 19, 2019
@jupyterlab-dev-mode
Copy link

@jupyterlab-dev-mode jupyterlab-dev-mode bot commented Dec 19, 2019

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

@blink1073 blink1073 force-pushed the property-inspector branch 2 times, most recently from 75d88d9 to 78da7d3 Compare Dec 19, 2019
@jasongrout
Copy link
Contributor

@jasongrout jasongrout commented Dec 23, 2019

The general functionality seems to work well. The notebook inspector needs some CSS/UX work:
Screen Shot 2019-12-23 at 9 15 24 AM

And perhaps the wrench icon should be updated to something to more reflect a property inspector.

Copy link
Contributor

@jasongrout jasongrout left a comment

Approving for the API changes - we can take up the UX issues in another PR after the beta. This does need a rebase before merging, though.

Copy link
Member

@afshin afshin left a comment

Good to merge and iterate on after these changes.

packages/notebook-extension/src/index.ts Outdated Show resolved Hide resolved
packages/property-inspector/src/index.ts Outdated Show resolved Hide resolved
packages/property-inspector/src/token.ts Outdated Show resolved Hide resolved
packages/property-inspector/src/index.ts Outdated Show resolved Hide resolved
packages/property-inspector/src/index.ts Outdated Show resolved Hide resolved
packages/property-inspector/src/index.ts Outdated Show resolved Hide resolved
integrity

finish property inspector

lint

integrity

Strict null handling

unused import

Address review comments
afshin
afshin approved these changes Dec 23, 2019
afshin
afshin approved these changes Dec 23, 2019
@blink1073 blink1073 merged commit 23f8163 into jupyterlab:master Dec 23, 2019
10 checks passed
@lock lock bot added the status:resolved-locked label Jan 24, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 24, 2020
@blink1073 blink1073 deleted the property-inspector branch Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement status:resolved-locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants