-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move todo to #16 * TODO has been done * Move searchreplace to utils/ * Make selected step its own hook * Move array manipulation to utils/ * Renamed step 2 node + Generalize movestep to moveitem Where nodes from the catalog and workflow conflicted renamed to catalog.nodes * Move workflow upload/download to their own components * Make linter happy + fail ci when linter finds problems * Make store dummer * Move toast to component + use errorboundary when catalog fails to load * Add ErrorBoundary component * Use toast during archive creation * todo is done * TODOs moved to #20 and #21 * mimetype is already being added to data url * Forget files that are not mentioned in parameters. * Describe catalog format better * Moved dropUnusedFiles()
- Loading branch information
1 parent
f1f2a1a
commit f3069ac
Showing
40 changed files
with
633 additions
and
412 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,5 +43,10 @@ | |
}, | ||
"engines": { | ||
"node": "~16" | ||
}, | ||
"ts-standard": { | ||
"ignore": [ | ||
"vite.config.ts" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react' | ||
import { ValidationError } from './validate' | ||
|
||
interface State { | ||
error: Error | null | ||
} | ||
|
||
export class ErrorBoundary extends React.Component<{}, State> { | ||
static getDerivedStateFromError (error: Error): State { | ||
return { error } | ||
} | ||
|
||
state: State = { | ||
error: null | ||
} | ||
|
||
render (): React.ReactNode { | ||
if (this.state.error !== null) { | ||
if (this.state.error instanceof ValidationError) { | ||
console.error(this.state.error.errors) | ||
} | ||
return ( | ||
<div> | ||
<h1>Something went terribly wrong.</h1> | ||
<span>{this.state.error.message}</span> | ||
</div> | ||
) | ||
} | ||
|
||
return this.props.children | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,39 @@ | ||
import { toast } from 'react-toastify' | ||
import { useWorkflow } from './store' | ||
|
||
interface IProps { | ||
name: string | ||
workflow: string | ||
} | ||
|
||
export const Example = ({ name, workflow }: IProps) => { | ||
export const Example = ({ name, workflow }: IProps): JSX.Element => { | ||
const { loadWorkflowArchive } = useWorkflow() | ||
return <li><button className='btn btn-light' onClick={async () => await loadWorkflowArchive(workflow)} title={workflow}>{name}</button></li> | ||
|
||
async function onClick (): Promise<void> { | ||
await toast.promise( | ||
loadWorkflowArchive(workflow), | ||
{ | ||
pending: 'Loading workfow ...', | ||
success: 'Workflow loaded', | ||
error: { | ||
render ({ data }) { | ||
console.error(data) | ||
return 'Workflow archive failed to load. See DevTools (F12) console for errors.' | ||
} | ||
} | ||
} | ||
) | ||
} | ||
|
||
return ( | ||
<li> | ||
<button | ||
className='btn btn-light' | ||
onClick={onClick} | ||
title={workflow} | ||
> | ||
{name} | ||
</button> | ||
</li> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { useFiles, useSelectedCatalogNode, useSelectedNode, useWorkflow } from './store' | ||
import { internalizeDataUrls } from './dataurls' | ||
import { Form } from './Form' | ||
|
||
export const NodeForm = (): JSX.Element => { | ||
// TODO move setParameters to useSelectedNode | ||
const { setNodeParameters } = useWorkflow() | ||
const files = useFiles() | ||
const node = useSelectedNode() | ||
const catalogNode = useSelectedCatalogNode() | ||
|
||
if (node === undefined) { | ||
return <div>No node selected</div> | ||
} | ||
if (catalogNode === undefined) { | ||
return <div>Unable to find schema belonging to node</div> | ||
} | ||
const parametersWithDataUrls = internalizeDataUrls(node.parameters, files) | ||
|
||
const uiSchema = (catalogNode?.uiSchema != null) ? catalogNode.uiSchema : {} | ||
return ( | ||
<> | ||
<h4>{catalogNode.label} ({node.id})</h4> | ||
<div> | ||
{catalogNode.description} | ||
</div> | ||
<Form schema={catalogNode.schema} uiSchema={uiSchema} formData={parametersWithDataUrls} onSubmit={({ formData }) => setNodeParameters(formData)} /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { GlobalForm } from './GlobalForm' | ||
import { NodeForm } from './NodeForm' | ||
import { useSelectNodeIndex, useWorkflow } from './store' | ||
|
||
export const NodePanel = (): JSX.Element => { | ||
const selectedNodeIndex = useSelectNodeIndex() | ||
const { editingGlobal } = useWorkflow() | ||
let form = <div>No node or global parameters selected for configuration.</div> | ||
let legend = 'Node' | ||
if (editingGlobal) { | ||
form = <GlobalForm /> | ||
legend = 'Global parameters' | ||
} | ||
if (selectedNodeIndex !== -1) { | ||
form = <NodeForm /> | ||
} | ||
return ( | ||
<fieldset> | ||
<legend>{legend}</legend> | ||
{form} | ||
</fieldset> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.