Skip to content

Commit cd8061c

Browse files
author
Ubuntu
committed
minor changes
1 parent ecb28eb commit cd8061c

File tree

3 files changed

+53
-12
lines changed

3 files changed

+53
-12
lines changed

packages/gui/assets/tailwind.css

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
'Noto Color Emoji';
88
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
99
monospace;
10+
--color-red-500: oklch(63.7% 0.237 25.331);
11+
--color-green-200: oklch(92.5% 0.084 155.995);
1012
--color-green-500: oklch(72.3% 0.219 149.579);
1113
--spacing: 0.25rem;
1214
--radius-lg: 0.5rem;
@@ -163,15 +165,28 @@
163165
.my-5 {
164166
margin-block: calc(var(--spacing) * 5);
165167
}
168+
.table {
169+
display: table;
170+
}
171+
.border-collapse {
172+
border-collapse: collapse;
173+
}
166174
.transform {
167175
transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
168176
}
169177
.cursor-pointer {
170178
cursor: pointer;
171179
}
180+
.resize {
181+
resize: both;
182+
}
172183
.rounded-lg {
173184
border-radius: var(--radius-lg);
174185
}
186+
.border {
187+
border-style: var(--tw-border-style);
188+
border-width: 1px;
189+
}
175190
.bg-green-500 {
176191
background-color: var(--color-green-500);
177192
}
@@ -181,6 +196,13 @@
181196
.py-1 {
182197
padding-block: calc(var(--spacing) * 1);
183198
}
199+
.underline {
200+
text-decoration-line: underline;
201+
}
202+
.outline {
203+
outline-style: var(--tw-outline-style);
204+
outline-width: 1px;
205+
}
184206
}
185207
@property --tw-rotate-x {
186208
syntax: "*";
@@ -202,6 +224,16 @@
202224
syntax: "*";
203225
inherits: false;
204226
}
227+
@property --tw-border-style {
228+
syntax: "*";
229+
inherits: false;
230+
initial-value: solid;
231+
}
232+
@property --tw-outline-style {
233+
syntax: "*";
234+
inherits: false;
235+
initial-value: solid;
236+
}
205237
@layer properties {
206238
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
207239
*, ::before, ::after, ::backdrop {
@@ -210,6 +242,8 @@
210242
--tw-rotate-z: initial;
211243
--tw-skew-x: initial;
212244
--tw-skew-y: initial;
245+
--tw-border-style: solid;
246+
--tw-outline-style: solid;
213247
}
214248
}
215249
}

packages/gui/src/graph.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
use std::{collections::HashMap, path::Path};
2-
3-
use commonwl::{StringOrDocument, load_doc, prelude::*};
1+
use commonwl::{StringOrDocument, load_doc, load_workflow, prelude::*};
42
use petgraph::{graph::NodeIndex, prelude::StableDiGraph};
3+
use std::{collections::HashMap, path::Path};
54

65
#[derive(Debug, Clone)]
76
pub enum Node {
@@ -19,14 +18,26 @@ pub struct Edge {
1918

2019
type WorkflowGraph = StableDiGraph<Node, Edge>;
2120

21+
pub fn load_workflow_graph(path: impl AsRef<Path>) -> anyhow::Result<WorkflowGraph> {
22+
let workflow = load_workflow(path.as_ref()).map_err(|e| anyhow::anyhow!("{e}"))?;
23+
let wgb = WorkflowGraphBuilder::from_workflow(&workflow, path)?;
24+
Ok(wgb.graph)
25+
}
26+
2227
#[derive(Default)]
23-
pub struct WorkflowGraphBuilder {
28+
struct WorkflowGraphBuilder {
2429
pub graph: WorkflowGraph,
2530
node_map: HashMap<String, NodeIndex>,
2631
}
2732

2833
impl WorkflowGraphBuilder {
29-
pub fn from_workflow(&mut self, workflow: &Workflow, path: impl AsRef<Path>) -> anyhow::Result<()> {
34+
fn from_workflow(workflow: &Workflow, path: impl AsRef<Path>) -> anyhow::Result<Self> {
35+
let mut builder = Self::default();
36+
builder.load_workflow(workflow, path)?;
37+
Ok(builder)
38+
}
39+
40+
fn load_workflow(&mut self, workflow: &Workflow, path: impl AsRef<Path>) -> anyhow::Result<()> {
3041
for input in &workflow.inputs {
3142
let node_id = self.graph.add_node(Node::Input(input.clone()));
3243
self.node_map.insert(input.id.clone(), node_id);

packages/gui/src/main.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
use commonwl::load_workflow;
21
use dioxus::prelude::*;
3-
use gui::graph::{Edge, Node, WorkflowGraphBuilder};
2+
use gui::graph::{Edge, Node, load_workflow_graph};
43
use petgraph::prelude::StableDiGraph;
54

65
#[derive(Default, Clone)]
@@ -44,12 +43,9 @@ pub fn Load_Btn() -> Element {
4443
button {
4544
class: "rounded-lg bg-green-500 px-3 py-1 my-5 cursor-pointer",
4645
onclick: move |_| {
47-
let path = "testdata/hello_world/workflows/main/main.cwl";
48-
let workflow = load_workflow(path).unwrap();
49-
let mut wgb = WorkflowGraphBuilder::default();
50-
wgb.from_workflow(&workflow, path).unwrap();
51-
let graph = wgb.graph;
46+
let graph = load_workflow_graph("testdata/hello_world/workflows/main/main.cwl")?;
5247
use_app_state().write().graph = graph;
48+
Ok(())
5349
},
5450
"Load CWL"
5551
}

0 commit comments

Comments
 (0)