Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
} else {
widget = new IFrameWidget(path);
app.shell.add(widget);
app.shell.activateById(widget.id);
}
},
isEnabled: () => true,
label: "Open IFrame"
});
// Add the command to the palette.
palette.addItem({ command: open_command, category: "Sites" });
// grab sites from serverextension
request("get", PageConfig.getBaseUrl() + "wandb/").then(
(res: IRequestResult) => {
if (res.ok) {
const jsn = res.json() as { [key: string]: string };
const sites = jsn.sites;
for (const site of sites) {
// tslint:disable-next-line: no-console
console.log("adding quicklink for " + site);
}
}
}
);
// tslint:disable-next-line: no-console
console.log("JupyterLab extension @jupyterlab/wandb is activated!");
}
constructor() {
console.log('Starting MetadataApolloGraphQlConnection ...');
console.log(PageConfig);
// Construct URL of our proxied service
let baseUrl = PageConfig.getBaseUrl();
let serviceUrl = baseUrl + 'metadata/';
console.log('Instatiating Apollo Client at: ' + serviceUrl);
this.client = new ApolloClient({
uri: serviceUrl,
credentials: 'same-origin' // See: https://www.apollographql.com/docs/react/recipes/authentication.html
});
console.log(this.client);
}
function activate(
app: JupyterFrontEnd,
docManager: IDocumentManager,
palette: ICommandPalette,
restorer: ILayoutRestorer
) {
// Declare a widget variable
let widget: IFrameWidget;
const rootEl = document.querySelector("#root");
const dataEl = document.querySelector("#jupyter-config-data");
const config = readConfig(rootEl, dataEl);
config.root = PageConfig.getBaseUrl();
const handshake = new Postmate.Model({
height: () => document.body.offsetHeight,
setContext: (ctx: any) => {
request(
"post",
PageConfig.getBaseUrl() + "wandb/context",
{ token: config.token }, // TODO: maybe using other auth
ctx
).then((res: IRequestResult) => {
if (res.ok) {
console.log("Config set", ctx);
} else {
console.warn(res);
}
});
}
each
} from '@phosphor/algorithm';
*/
import {
Widget, //TabBar, Title
} from '@phosphor/widgets';
// import * as prettyBytes from 'pretty-bytes'
import '../style/index.css';
//const API_URL = 'http://127.0.0.1:8000/example.json'
const COMMITS_API_URL = PageConfig.getBaseUrl() + 'dotscience/commits'
const STATUS_API_URL = PageConfig.getBaseUrl() + 'dotscience/status'
const WIDGET_ID = 'dotscience-manager'
type GenericObject = { [key: string]: any };
type Commit = {
Id: string;
Metadata: GenericObject;
}
var COMMIT_DATA: Commit[] = []
var COMMIT_TOGGLE_STATES: GenericObject = {}
var CURRENT_FETCH_DATA_TIMEOUT_ID: any = null
var STATUS_DATA: any = {}
var LAST_STATUS_JSON_STRING: any = ''
const plugin: JupyterFrontEndPlugin = {
it('should use default settings', () => {
const settings = ServerConnection.makeSettings();
expect(settings.baseUrl).to.equal(PageConfig.getBaseUrl());
expect(settings.wsUrl).to.equal(PageConfig.getWsUrl());
expect(settings.token).to.equal(PageConfig.getOption('token'));
});
it('should be the server settings of the server', () => {
expect(defaultSession.serverSettings.baseUrl).to.equal(
PageConfig.getBaseUrl()
);
});
});
it('should be the server settings', () => {
expect(defaultKernel.serverSettings.baseUrl).to.equal(
PageConfig.getBaseUrl()
);
});
});
const onSpecsChanged = () => {
if (disposables) {
disposables.dispose();
disposables = null;
}
const specs = manager.specs;
if (!specs) {
return;
}
disposables = new DisposableSet();
let baseUrl = PageConfig.getBaseUrl();
for (let name in specs.kernelspecs) {
let rank = name === specs.default ? 0 : Infinity;
let kernelIconUrl = specs.kernelspecs[name].resources['logo-64x64'];
if (kernelIconUrl) {
let index = kernelIconUrl.indexOf('kernelspecs');
kernelIconUrl = baseUrl + kernelIconUrl.slice(index);
}
disposables.add(
launcher.add({
command: CommandIDs.create,
args: { isLauncher: true, kernelPreference: { name } },
category: 'Console',
rank,
kernelIconUrl
})
);
async function connectKernel(baseUrl, kernelId) {
baseUrl = baseUrl || PageConfig.getBaseUrl();
kernelId = kernelId || PageConfig.getOption('kernelId');
const connectionInfo = ServerConnection.makeSettings({ baseUrl });
let model = await Kernel.findById(kernelId, connectionInfo);
let kernel = await Kernel.connectTo(model, connectionInfo);
return kernel;
}
services.ready.then(() => {
const specs = services.specs;
const baseUrl = PageConfig.getBaseUrl();
for (let name in specs.kernelspecs) {
let displayName = specs.kernelspecs[name].display_name;
let rank = name === specs.default ? 0 : Infinity;
let kernelIconUrl = specs.kernelspecs[name].resources['logo-64x64'];
if (kernelIconUrl) {
let index = kernelIconUrl.indexOf('kernelspecs');
kernelIconUrl = baseUrl + kernelIconUrl.slice(index);
}
launcher.add({
displayName,
category: 'Notebook',
name,
iconClass: 'jp-NotebookRunningIcon',
callback: createNew,
rank,