Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion client/src/Components/App/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {useState} from 'react';
import './App.css';
import ParameterView from "../ParameterView/ParameterView";
import TreeView from "../TreeView/TreeView";
Expand All @@ -8,6 +8,7 @@ function App() {

return (
<div className="App">

<TreeView setParameters={setParameters}/>
<ParameterView inputParameters={parameters}/>
</div>
Expand Down
6 changes: 4 additions & 2 deletions client/src/Components/Tree/ClassNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ type ClassNodeProps = {
pythonClass: PythonClass,
selection: string,
setSelection: (newValue: string) => void,
moduleName: string
moduleName: string,
setParameters: any,
}

const ClassNode = ({pythonClass, selection, setSelection, moduleName}: ClassNodeProps) => {
const ClassNode = ({pythonClass, selection, setSelection, moduleName, setParameters}: ClassNodeProps) => {
const [childVisible, setChildVisibility] = useState(false);

const hasMethods = isEmptyList(pythonClass.methods);
Expand Down Expand Up @@ -52,6 +53,7 @@ const ClassNode = ({pythonClass, selection, setSelection, moduleName}: ClassNode
selection={selection}
setSelection={setSelection}
isMethod={true}
setParameters={setParameters}
/>
))}
</>
Expand Down
8 changes: 4 additions & 4 deletions client/src/Components/Tree/FunctionNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ type FunctionNodeProps = {
pythonFunction: PythonFunction,
selection: string,
setSelection: (newValue: string) => void,
setParameters: any,
isMethod?: boolean,
/** A parent of a Python class can be a class or a Python module. */
parentFullQualifiedName: string
parentFullQualifiedName: string,
}

const FunctionNode = ({pythonFunction, selection, setSelection, parentFullQualifiedName, isMethod=false}:FunctionNodeProps) => {
const FunctionNode = ({pythonFunction, selection, setSelection, setParameters, parentFullQualifiedName, isMethod=false}:FunctionNodeProps) => {

const fullQualifiedName = parentFullQualifiedName + "." + pythonFunction.name;

Expand All @@ -29,8 +30,7 @@ const FunctionNode = ({pythonFunction, selection, setSelection, parentFullQualif
<div className={cssClasses}
onClick={() => {
setSelection(fullQualifiedName);
console.log(fullQualifiedName + " has been selected.");
console.log(pythonFunction.parameters);
setParameters(pythonFunction.parameters)
}}>
<span className="indicator">
𝑓
Expand Down
8 changes: 6 additions & 2 deletions client/src/Components/Tree/ModuleNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ type ModuleNodeProps = {
pythonModule: PythonModule,
selection: string,
setSelection: (newValue: string) => void,
setParameters: any,
}

const ModuleNode = ({pythonModule, selection, setSelection}: ModuleNodeProps) => {
const ModuleNode = ({pythonModule, selection, setSelection, setParameters}: ModuleNodeProps) => {
const [childVisible, setChildVisibility] = useState(false);

let hasClasses = isEmptyList(pythonModule.classes);
Expand Down Expand Up @@ -55,6 +56,7 @@ const ModuleNode = ({pythonModule, selection, setSelection}: ModuleNodeProps) =>
selection={selection}
setSelection={setSelection}
moduleName={pythonModule.name}
setParameters={setParameters}
/>
))}
</div>
Expand All @@ -67,7 +69,9 @@ const ModuleNode = ({pythonModule, selection, setSelection}: ModuleNodeProps) =>
key={moduleFunction.name}
pythonFunction={moduleFunction}
selection={selection}
setSelection={setSelection}/>
setSelection={setSelection}
setParameters={setParameters}
/>
))}
</div>
}
Expand Down
6 changes: 4 additions & 2 deletions client/src/Components/Tree/Tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import PythonPackage from "../../model/PythonPackage";

type TreeProps = {
pythonPackage: PythonPackage,
setParameters: any,
}

const Tree = ({pythonPackage}: TreeProps) => {
const Tree = ({pythonPackage, setParameters}: TreeProps) => {

const [selection, setSelection ] = useState("");

Expand All @@ -16,7 +17,8 @@ const Tree = ({pythonPackage}: TreeProps) => {
<ModuleNode key={module.name}
pythonModule={module}
selection={selection}
setSelection={setSelection}/>
setSelection={setSelection}
setParameters={setParameters}/>
))}
</div>
);
Expand Down
7 changes: 5 additions & 2 deletions client/src/Components/TreeView/TreeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ import './tree-view.css';
import packageJson from "../../sklearn.json";
import PythonPackageBuilder from "../../model/PythonPackageBuilder";

const TreeView = () => {
type TreeViewProps = {
setParameters: any,
}
const TreeView = ({setParameters}:TreeViewProps) => {
let pythonPackage = PythonPackageBuilder.make(packageJson);
return(
<div className="tree-view">
<h2 className="package-name">{pythonPackage.name}</h2>
<Tree pythonPackage={pythonPackage}/>
<Tree pythonPackage={pythonPackage} setParameters={setParameters}/>
</div>
)
}
Expand Down