flow updates
This commit is contained in:
parent
6fb2d62a05
commit
cc78c3e1be
1 changed files with 28 additions and 12 deletions
|
@ -232,20 +232,25 @@ class _FlowInfoPageState extends State<FlowInfoPage> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CreateFlowPage extends StatelessWidget {
|
class CreateFlowPage extends StatefulWidget {
|
||||||
final API.FlowInfo info;
|
final API.FlowInfo info;
|
||||||
final Function refresh;
|
final Function refresh;
|
||||||
|
|
||||||
|
const CreateFlowPage(this.info, this.refresh, {super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<CreateFlowPage> createState() => _CreateFlowPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CreateFlowPageState extends State<CreateFlowPage> {
|
||||||
List<API.Transaction> depends = [];
|
List<API.Transaction> depends = [];
|
||||||
|
|
||||||
CreateFlowPage(this.info, this.refresh, {super.key});
|
|
||||||
|
|
||||||
void _create(BuildContext context) {
|
void _create(BuildContext context) {
|
||||||
// todo : input handling
|
|
||||||
API
|
API
|
||||||
.API()
|
.API()
|
||||||
.startFlow(info.id, input: depends.map((x) => x.uuid).toList())
|
.startFlow(widget.info.id, input: depends.map((x) => x.uuid).toList())
|
||||||
.then((flowID) {
|
.then((flowID) {
|
||||||
refresh();
|
widget.refresh();
|
||||||
API.API().getFlow(flowID).then((flow) {
|
API.API().getFlow(flowID).then((flow) {
|
||||||
Navigator.of(context).pushReplacement(
|
Navigator.of(context).pushReplacement(
|
||||||
MaterialPageRoute(builder: (context) => ActiveFlowPage(flow)));
|
MaterialPageRoute(builder: (context) => ActiveFlowPage(flow)));
|
||||||
|
@ -261,7 +266,9 @@ class CreateFlowPage extends StatelessWidget {
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return TransactionSelectPage(transactions, onSelect: (t) {
|
return TransactionSelectPage(transactions, onSelect: (t) {
|
||||||
if (!depends.contains(t)) {
|
if (!depends.contains(t)) {
|
||||||
depends.add(t);
|
setState(() {
|
||||||
|
depends.add(t);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, exclude: depends);
|
}, exclude: depends);
|
||||||
},
|
},
|
||||||
|
@ -271,7 +278,7 @@ class CreateFlowPage extends StatelessWidget {
|
||||||
|
|
||||||
Widget buildInputSelection(BuildContext context) {
|
Widget buildInputSelection(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
children: info.depends.map((x) {
|
children: widget.info.depends.map((x) {
|
||||||
return ElevatedButton(
|
return ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
selectDependItems(context, x);
|
selectDependItems(context, x);
|
||||||
|
@ -283,7 +290,7 @@ class CreateFlowPage extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: Text("Create new ${info.name} Flow")),
|
appBar: AppBar(title: Text("Create new ${widget.info.name} Flow")),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
buildInputSelection(context),
|
buildInputSelection(context),
|
||||||
|
@ -344,15 +351,24 @@ class TransactionSelectPage extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ActiveFlowPage extends StatelessWidget {
|
class ActiveFlowPage extends StatelessWidget {
|
||||||
late API.Flow flow;
|
final API.Flow flow;
|
||||||
|
|
||||||
ActiveFlowPage(this.flow);
|
const ActiveFlowPage(this.flow, {super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [],
|
children: [
|
||||||
|
Text("ID: ${flow.id}"),
|
||||||
|
Text("Started since: ${tsFormat(flow.started)}"),
|
||||||
|
...flow.input!.map((x) => Text("Input: $x")).toList(),
|
||||||
|
if (flow.done != null) ...[
|
||||||
|
Text("Ended: ${tsFormat(flow.done!.ended)}"),
|
||||||
|
if (flow.done!.next != null) Text("Next: ${flow.done!.next!}"),
|
||||||
|
...flow.done!.produced!.map((x) => Text("Produced: $x")).toList(),
|
||||||
|
]
|
||||||
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue