Skip to content

Commit

Permalink
#6214 rename BeakerXTreeWidget => TreeWidget; introduce isLab and Cod…
Browse files Browse the repository at this point in the history
…eCell options; move BeakerXApi creation into TreeWidget
  • Loading branch information
piorek committed Feb 6, 2018
1 parent 44894e0 commit ed1c73e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
12 changes: 7 additions & 5 deletions js/lab/src/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import { JSONExt } from "@phosphor/coreutils";
import { PageConfig } from "@jupyterlab/coreutils";

const BeakerXTreeLib = require("../lib/tree.js").default;
const BeakerXTreeWidget = BeakerXTreeLib.BeakerXTreeWidget;
const BeakerXApi = BeakerXTreeLib.BeakerXApi;
const TreeWidget = BeakerXTreeLib.TreeWidget;

function activate(app: JupyterLab, palette: ICommandPalette, restorer: ILayoutRestorer) {
let widget:any;
Expand All @@ -34,9 +33,12 @@ function activate(app: JupyterLab, palette: ICommandPalette, restorer: ILayoutRe
label: 'BeakerX Options',
execute: () => {
if (!widget) {
widget = new BeakerXTreeWidget(
new BeakerXApi(PageConfig.getBaseUrl())
);
let options = {
baseUrl: PageConfig.getBaseUrl(),
isLab: true,
CodeCell: null,
};
widget = new TreeWidget(options);
widget.update();
}
if (!tracker.has(widget)) {
Expand Down
22 changes: 18 additions & 4 deletions js/notebook/src/tree-lab.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
import BeakerXTreeWidget from './tree/TreeWidget';
import BeakerXApi from "./tree/BeakerXApi";
/*
* Copyright 2017 TWO SIGMA OPEN SOURCE, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import TreeWidget from "./tree/TreeWidget";

export default {
BeakerXTreeWidget: BeakerXTreeWidget,
BeakerXApi: BeakerXApi,
TreeWidget: TreeWidget,
}
11 changes: 7 additions & 4 deletions js/notebook/src/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ define([
var Widget = require('@phosphor/widgets').Widget;

function load() {
var base_url = (Jupyter.notebook_list || Jupyter.notebook).base_url;
var BeakerXTreeWidget = require('./tree/TreeWidget').default;
var BeakerxApi = require('./tree/BeakerXApi').default;
var bxWidget = new BeakerXTreeWidget(new BeakerxApi(base_url));
var TreeWidget = require('./tree/TreeWidget').default;
var options = {
baseUrl: (Jupyter.notebook_list || Jupyter.notebook).base_url,
isLab: false,
CodeCell: Jupyter.CodeCell,
};
var bxWidget = new TreeWidget(options);

Widget.attach(bxWidget, $('.tab-content').get(0));
$('#tabs').append(
Expand Down

0 comments on commit ed1c73e

Please sign in to comment.