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

Settings backend #2585

Merged
merged 51 commits into from Jul 17, 2017
Merged

Settings backend #2585

merged 51 commits into from Jul 17, 2017

Conversation

@blink1073
Copy link
Member

@blink1073 blink1073 commented Jul 5, 2017

Adds a backend for the settings system.

  • Handle schemas for built in extensions
  • Add handlers for /lab/api/settings
  • Add a configurable user settings directory
  • Handle schemas for installed extensions
  • Update the client side code to use the new handler
  • Convert codemirror and file editor to use schema
  • Update docs
  • Add tests
  • Create settings schema for keyboard shortcuts

Server API Specification

Fetching data

HTTP GET request:

GET /lab/api/settings/jupyter.services.codemirror-commands HTTP/1.1

Server response:

{
  "id": "jupyter.services.codemirror-command",
  "data": {
    "user": {}
  },
  "schema": {
    "jupyter.lab.setting-icon-class": "jp-ImageTextEditor",
    "jupyter.lab.setting-icon-label": "CodeMirror",
    "title": "CodeMirror",
    "description": "Text editor settings for all CodeMirror editors.",
    "properties": {
      "keyMap": { "type": "string", "title": "Key Map", "default": "default" },
      "theme": { "type": "string", "title": "Theme", "default": "default" }
    },
    "type": "object"
  }
}

The schema value comes directly from the extension's JSON schema file. The user value is the saved user settings.

Saving data

HTTP PATCH request:

PATCH /lab/api/settings/jupyter.services.codemirror-commands HTTP/1.1

{
  "keyMap": "emacs",
  "theme": "jupyter"
}

Fetch updated data

HTTP GET request:

GET /lab/api/settings/jupyter.services.codemirror-commands HTTP/1.1

Server response:

{
  "id": "jupyter.services.codemirror-command",
  "data": {
    "user": {
      "keyMap": "emacs",
      "theme": "jupyter"
    }
  },
  "schema": {
    "jupyter.lab.setting-icon-class": "jp-ImageTextEditor",
    "jupyter.lab.setting-icon-label": "CodeMirror",
    "title": "CodeMirror",
    "description": "Text editor settings for all CodeMirror editors.",
    "properties": {
      "keyMap": { "type": "string", "title": "Key Map", "default": "default" },
      "theme": { "type": "string", "title": "Theme", "default": "default" }
    },
    "type": "object"
  }
}
function newConnector(manager: IServiceManager): IDataConnector<ISettingRegistry.IPlugin, JSONObject> {
return {
function newConnector(manager: IServiceManager): Promise<IDataConnector<ISettingRegistry.IPlugin, JSONObject>> {
return manager.ready.then(() => ({
Copy link
Member Author

@blink1073 blink1073 Jul 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want the app to wait for the service manager to be ready, it could be a while if there are a lot of kernel specs on a slow connection.

Copy link
Member

@afshin afshin Jul 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll use the promises in the requests.

@afshin afshin force-pushed the settings-backend branch 3 times, most recently from fef84be to 906e470 Jul 15, 2017
@afshin afshin force-pushed the settings-backend branch from 906e470 to 2621535 Jul 15, 2017
@afshin afshin changed the title [WIP] Settings backend Settings backend Jul 15, 2017
@afshin
Copy link
Member

@afshin afshin commented Jul 15, 2017

cc: @ian-r-rose @gnestor @ellisonbg ... pinging since you are writing extensions and might want to start saving some settings.

@blink1073
Copy link
Member Author

@blink1073 blink1073 commented Jul 17, 2017

In it goes!

@blink1073 blink1073 merged commit b1af1db into jupyterlab:master Jul 17, 2017
2 checks passed
@blink1073 blink1073 deleted the settings-backend branch Jul 17, 2017
@blink1073 blink1073 mentioned this pull request Jul 21, 2017
@jasongrout jasongrout removed this from the 1.0 milestone Feb 1, 2019
@jasongrout jasongrout added this to the 0.26 milestone Feb 1, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants