Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b832f12
Added toggleDialog state to PackageBar
marisaaquilina Oct 25, 2019
ae7fc56
Added switchToggle UI
marisaaquilina Oct 25, 2019
1d5789f
Integrating new panel
marisaaquilina Oct 28, 2019
9a50a32
Added new panel with myComponent
marisaaquilina Oct 28, 2019
1d7599d
Exported both pkginstall and panel-extension
marisaaquilina Oct 28, 2019
2f4a786
Dialog toggle changes state
marisaaquilina Oct 30, 2019
b19b3f2
On kernel change, consolelog shows kernel name
marisaaquilina Oct 30, 2019
171206b
Added styling to new layout
marisaaquilina Oct 31, 2019
3f177c9
WIP
marisaaquilina Oct 31, 2019
69a5007
Working with sessions in ReactWidget
marisaaquilina Nov 6, 2019
42613be
Changed PackageInstaller's exported comp to PInstallerWidget
marisaaquilina Nov 6, 2019
aa4dac6
Updates kernelId and kernelName asynchronously
marisaaquilina Nov 13, 2019
c520163
Dialog not working
marisaaquilina Nov 14, 2019
f1ed8d5
Remove borderTop from container, add snackbar, resolve kernelId lag
marisaaquilina Nov 21, 2019
c626f97
Styling snackbar
marisaaquilina Dec 3, 2019
95b04db
Debugging model
marisaaquilina Dec 4, 2019
324099b
Model works through PackageTool
marisaaquilina Dec 4, 2019
eab6e90
Prints errors
marisaaquilina Dec 4, 2019
923804c
Removed KernelSpyView
marisaaquilina Dec 4, 2019
71fe0fd
Removed unecess plugin
marisaaquilina Dec 5, 2019
f4c4805
Simplified imports
marisaaquilina Dec 5, 2019
c8725fc
Consolidated initializations in index.ts
marisaaquilina Dec 5, 2019
fddc268
Added object deconstructed notation to index, model, logs
marisaaquilina Dec 5, 2019
6edae3c
Added more obj decons notation
marisaaquilina Dec 5, 2019
6970102
PI width styled
marisaaquilina Dec 5, 2019
b675492
Using fe
marisaaquilina Dec 6, 2019
f5dc175
Adding card
marisaaquilina Dec 6, 2019
774d3d3
Added material card
marisaaquilina Dec 6, 2019
73ee989
Styled card
marisaaquilina Dec 6, 2019
8f8d6ee
Removed collapse
marisaaquilina Dec 6, 2019
e26272e
Restyled menu
marisaaquilina Dec 6, 2019
037fabb
Added padding
marisaaquilina Dec 6, 2019
88e18c0
Merged component
marisaaquilina Dec 6, 2019
27e7e10
Removed unecess Async comp
marisaaquilina Dec 6, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Untitled.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'asdasd'",
"evalue": "No module named 'asdasdasd'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-1-7ad967ca1c65>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0masdasd\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'asdasd'"
"\u001b[0;31m------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0mTraceback (most recent call last)",
"\u001b[0;32m<ipython-input-1-1d4ffe1b4dbd>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0masdasdasd\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'asdasdasd'"
]
}
],
"source": [
"import asdasd"
"import asdasdasd"
]
},
{
Expand Down Expand Up @@ -52,9 +52,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Go Bears (Python 3.7)",
"display_name": "Python (myenv)",
"language": "python",
"name": "python-3.7"
"name": "myenv"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -66,7 +66,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
6 changes: 6 additions & 0 deletions Untitled1.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}
1,161 changes: 724 additions & 437 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"dependencies": {
"@jupyterlab/application": "^1.0.2",
"@jupyterlab/notebook": "^1.0.2",
"@material-ui/core": "^4.5.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-inspector": "^3.0.2",
Expand Down
71 changes: 22 additions & 49 deletions src/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,18 @@
import React, { useState } from 'react';

import Async from 'react-select';
import React from 'react';

import StyleClasses from './style';

const PackageBarStyleClasses = StyleClasses.PackageBarStyleClasses;
import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent";

const customStyles = {
option: (provided: JSON, state: JSON) => ({
...provided,
backgroundColor: 'transparent',
color: 'var(--jp-ui-font-color1)',
fontSize: 'var(--jp-ui-font-size1)',
wordWrap: 'break-word',
}),
menu: () => ({
border: 'none',
borderRadius: 'var(--jp-border-radius)',
boxShadow: 'inset 0 0 3px var(--jp-border-width) var(--jp-input-active-box-shadow-color)',
marginTop: 40,
position: 'relative',
backgroundColor: 'var(--jp-ui-inverse-font-color0)',
}),
control: () => ({
height: 0,
width: 0,
}),
container: (provided: JSON, state: JSON) => ({
...provided,
position: 'initial',
})
const compStyle = {
border: 'none',
borderRadius: 'var(--jp-border-radius)',
boxShadow: 'inset 0 0 3px var(--jp-border-width) var(--jp-input-active-box-shadow-color)',
backgroundColor: 'var(--jp-ui-inverse-font-color0)',
maxHeight: 200,
overflow: 'auto'
}

interface DropdownProps {
stdOut: Array<string>;
}
Expand All @@ -40,29 +21,21 @@ interface DropdownProps {
* Render a toggleable dropdown of stdout logs from the installation process.
*/
export function Dropdown(props: DropdownProps) {
const [isVisible, setIsVisible] = useState(false);
function toggleVisibility() {
setIsVisible(!isVisible);
}
const [expanded, setExpanded] = React.useState(false);
const handleExpandClick = () => {
setExpanded(!expanded);
};
return (
<div>
<button className={PackageBarStyleClasses.logsButton}
onClick={() => toggleVisibility()}>
See logs
</button>
<Async
key={JSON.stringify(props.stdOut)}
options={props.stdOut}
defaultValue={{ label: '', value: '' }}
maxMenuHeight={100}
isOptionDisabled={() => true}
styles={customStyles}
isClearable={false}
backspaceRemovesValue={false}
isSearchable={false}
components={{ DropdownIndicator: null }}
menuIsOpen={isVisible}
/>
onClick={handleExpandClick}
>See logs
</button>
<Card style={{boxShadow: 'none'}}>
{expanded && <CardContent style={compStyle}>
{props.stdOut.map(e => <p style={{wordBreak: 'break-word', fontSize: 10, padding: '4px 0px'}}>{Object.values(e)[0].toString()}</p>)}
</CardContent>}
</Card>
</div>
);
}
63 changes: 63 additions & 0 deletions src/Logs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { each } from '@phosphor/algorithm';

import { VDomRenderer } from '@jupyterlab/apputils';

import * as React from 'react';

import { KernelSpyModel, ThreadIterator } from './Model';

import { PackageInstaller } from './PackageInstaller';

import '../style/index.css';

/**
* Return a PackageSearcher aware of the uninstalled package to process.
*/
function Message(props: any) {
const parsedPackage = props.message.content.evalue.split("'")[1];
const { ename } = props.message.content;
return (
<PackageInstaller
kernelId={props.kernelId}
kernelName={props.kernelName}
uninstalledPackage={parsedPackage}
moduleError={ename == "ModuleNotFoundError"}
nb={null}
/>
);
}

/**
* Render a PackageSearcher that responds to the current state of errorModule.
*/
export class MessageLogView extends VDomRenderer<KernelSpyModel> {
constructor(model: KernelSpyModel, kernelId: string, kernelName: string){
super();
this.model = model;
this.kernelId = kernelId;
this.kernelName = kernelName;
}
protected render(): React.ReactElement<any> {
const model = this.model!;
let errorMessage: React.ReactElement<any>;
let threads = new ThreadIterator(model.tree, this.collapsed);

each(threads, ({args, hasChildren}) => {
let { msg_type } = args.msg.header;
if (msg_type == "error") {
console.log("ERROR OCCURED");
errorMessage = Message({
message: args.msg,
kernelName: this.kernelName,
kernelId: this.kernelId,
moduleError: null
});
}
});
return errorMessage;
}
protected collapsed: {[key: string]: boolean} = {};
protected kernelId: string;
protected kernelName: string;
}

21 changes: 5 additions & 16 deletions src/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export type MessageThread = {
function isHeader(candidate: {[key: string]: undefined} | KernelMessage.IHeader): candidate is KernelMessage.IHeader {
return candidate.msg_id !== undefined;
}
export
class ThreadIterator implements IIterator<ThreadIterator.IElement> {

export class ThreadIterator implements IIterator<ThreadIterator.IElement> {
constructor(threads: MessageThread[], collapsed: {[key: string]: boolean}) {
this._threads = threads;
this._collapsed = collapsed;
Expand All @@ -39,14 +39,12 @@ class ThreadIterator implements IIterator<ThreadIterator.IElement> {
}
this._child = null;
}
// Move to next thread
++this._index;
if (this._index >= this._threads.length) {
return undefined;
}
const entry = this._threads[this._index];
if (entry.children.length > 0 && !this._collapsed[entry.args.msg.header.msg_id]) {
// Iterate over children after this
this._child = new ThreadIterator(entry.children, this._collapsed);
}
return {args: entry.args, hasChildren: entry.children.length > 0};
Expand All @@ -63,15 +61,12 @@ class ThreadIterator implements IIterator<ThreadIterator.IElement> {

private _index: number;
private _child: ThreadIterator | null;

private _threads: MessageThread[];
private _collapsed: {[key: string]: boolean};
}

export
namespace ThreadIterator {
export
interface IElement {
export namespace ThreadIterator {
export interface IElement {
args: Kernel.IAnyMessageArgs;
hasChildren: boolean;
}
Expand All @@ -80,8 +75,7 @@ namespace ThreadIterator {
/**
* Construct a model that monitors kernel messages.
*/
export
class KernelSpyModel extends VDomModel {
export class KernelSpyModel extends VDomModel {
constructor(kernel: Kernel.IKernel) {
super();
this._kernel = kernel;
Expand Down Expand Up @@ -126,15 +120,13 @@ class KernelSpyModel extends VDomModel {
getThread(msgId: string, ancestors=true): MessageThread {
const args = this._messages[msgId];
if (ancestors) {
// Work up to root, then work downwards
let root = args;
let candidate;
while (candidate = this._findParent(root)) {
root = candidate;
}
return this.getThread(root.msg.header.msg_id, false);
}

const childMessages = this._childLUT[msgId] || [];
let childThreads = childMessages.map((childId) => {
return this.getThread(childId, false);
Expand Down Expand Up @@ -167,11 +159,8 @@ class KernelSpyModel extends VDomModel {
}
return null;
}

private _log: Kernel.IAnyMessageArgs[] = [];

private _kernel: Kernel.IKernel;

private _messages: {[key: string]: Kernel.IAnyMessageArgs} = {};
private _childLUT: {[key: string]: string[]} = {};
private _roots: string[] = [];
Expand Down
Loading