debug workflow

This commit is contained in:
mr
2025-06-13 11:54:13 +02:00
parent 76821e757f
commit c4ea1541c4
12 changed files with 177 additions and 112 deletions

View File

@@ -335,7 +335,7 @@ class Graph extends SerializerDeserializer<Graph> {
// should find arrow env info and add it to the env
List<Param> extParams = [];
var arrows = links.where( (e) => (e.source?.id?.contains(item.id ?? "") ?? false) || (e.destination?.id?.contains(item.id ?? "") ?? false));
for (var arrow in arrows) {
/*for (var arrow in arrows) {
for (var info in arrow.infos) {
var i = info as Map<String, dynamic>;
for (var entry in i.entries) {
@@ -352,7 +352,7 @@ class Graph extends SerializerDeserializer<Graph> {
}
}
}
}
}*/
for ( var param in what) {
if (param.attr == null) { continue; }
var varName = param.name != null && (param.name!.contains("LINK_")

View File

@@ -66,7 +66,8 @@ final WorflowService _service = WorflowService();
var from = dash.getElement(arrow.fromID);
var to = dash.getElement(arrow.toID);
if ((from?.element?.getType() == "storage" && to?.element?.getType() == "processing")
|| (from?.element?.getType() == "processing" && to?.element?.getType() == "storage")) {
|| (from?.element?.getType() == "processing" && to?.element?.getType() == "storage")
|| (from?.element?.getType() == "processing" && to?.element?.getType() == "processing")) {
return StorageProcessingLinkFormsWidget( dash: dash, item: arrow);
}
return Container();

View File

@@ -20,14 +20,25 @@ class ContainerFormsWidgetState extends State<ContainerFormsWidget> {
List<Widget> widgets = [];
var instance = widget.item.getSelectedInstance();
if (instance != null && instance is ProcessingInstance && instance.access?.container != null) {
List<SubExposeFormsWidget> exposes = [];
var container = instance.access!.container!;
for (var expose in container.exposes) {
exposes.add(SubExposeFormsWidget(
readOnly: false,
width: 180,
dash: widget.dash,
empty: false,
item: expose,
elementID: widget.elementID
));
}
widgets.add(Container(
padding: const EdgeInsets.only(bottom: 10),
width: 180,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("<CONTAINER>", style: const TextStyle(fontSize: 13, fontWeight: FontWeight.bold), textAlign: TextAlign.center),
const Text("<CONTAINER>", style: TextStyle(fontSize: 13, fontWeight: FontWeight.bold), textAlign: TextAlign.center),
SubTextInputWidget(subkey: "image", width: 180, empty: false, change: (value) { },
initialValue: container.image, readOnly: true),
SubTextInputWidget(subkey: "command", width: 180, empty: false, change: (value) {
@@ -39,7 +50,7 @@ class ContainerFormsWidgetState extends State<ContainerFormsWidget> {
}
}
widget.dash.saveDash(widget.dash.id, context);
}, initialValue: container.command, readOnly: false,),
}, initialValue: container.command, readOnly: false),
SubTextInputWidget(subkey: "args", width: 180, empty: false, change: (value) {
container.args = value;
for (var el in widget.dash.elements) {
@@ -54,7 +65,7 @@ class ContainerFormsWidgetState extends State<ContainerFormsWidget> {
],)
));
widgets.add(Container(
width: 200, decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))),
width: 200, decoration: const BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))),
));
widgets.add(Container(
padding: const EdgeInsets.symmetric(vertical: 10),
@@ -86,19 +97,19 @@ class ContainerFormsWidgetState extends State<ContainerFormsWidget> {
setState(() {});
}, child:
Container( margin: const EdgeInsets.only(left: 5, top: 5),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.grey, width: 1)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
border: Border.all(color: Colors.grey, width: 1)
),
width: 45, height: 30,
child: const Row( mainAxisAlignment: MainAxisAlignment.center,
children: [ Icon(Icons.delete, color: Colors.black) ]),
)
)
]),
],)
)
]),
...exposes
])
));
for (var expose in container.exposes) {
widgets.add(SubExposeFormsWidget( readOnly: true, width: 180, dash: widget.dash, empty: widgets.isEmpty,
item: expose, elementID: widget.elementID));
}
}
return Column(children: widgets);
}

View File

@@ -19,8 +19,8 @@ class CredentialsFormsWidgetState extends State<CredentialsFormsWidget> {
var instance = widget.item.getSelectedInstance();
if (instance != null && instance.credential != null) {
var creds = instance.credential!;
widgets.add(Container( margin: EdgeInsets.only(bottom: 15),
width: 200, decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))),
widgets.add(Container( margin: const EdgeInsets.only(bottom: 15),
width: 200, decoration: const BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))),
));
widgets.add(Container(
padding: const EdgeInsets.only(bottom: 10),
@@ -28,9 +28,9 @@ class CredentialsFormsWidgetState extends State<CredentialsFormsWidget> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("<CREDENTIALS>", style: const TextStyle(fontSize: 13, fontWeight: FontWeight.bold), textAlign: TextAlign.center),
const Text("<CREDENTIALS>", style: TextStyle(fontSize: 13, fontWeight: FontWeight.bold), textAlign: TextAlign.center),
SubTextInputWidget(subkey: "login", width: 180, empty: false, change: (value) {
creds.password = value;
creds.login = value;
for (var el in widget.dash.elements) {
if (el.id == widget.elementID) {
el.element = widget.item;

View File

@@ -1,6 +1,5 @@
import 'package:oc_front/main.dart';
import 'package:flutter/material.dart';
import 'package:oc_front/models/workflow.dart';
import 'package:oc_front/models/resources/resources.dart';
import 'package:oc_front/core/services/perms_service.dart';
import 'package:oc_front/widgets/forms/credentials_forms.dart';
@@ -37,7 +36,7 @@ class ResourceFormsWidgetState extends State<ResourceFormsWidget> {
}
}
if (widgets.isNotEmpty) {
widgets.add(SizedBox( width: 200, height: 15) );
widgets.add(const SizedBox( width: 200, height: 15) );
}
return widgets;
}
@@ -55,6 +54,7 @@ class ResourceFormsWidgetState extends State<ResourceFormsWidget> {
@override Widget build(BuildContext context) {
print("STATE");
List<Widget> instancesCat = [];
List<Widget> childrenReadOnly = getWidgets(widget.item.infos());
List<DropdownMenuItem<String>> dpItems = [];
@@ -62,11 +62,11 @@ class ResourceFormsWidgetState extends State<ResourceFormsWidget> {
dpItems.add(DropdownMenuItem(value: '$i', child: Text('${instance.name}', overflow: TextOverflow.ellipsis,)));
}
if (dpItems.isNotEmpty) {
childrenReadOnly.add(Padding( padding: EdgeInsets.only(top: 20),
childrenReadOnly.add(Padding( padding: const EdgeInsets.only(top: 20),
child : Container(
width: 200, decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))),
width: 200, decoration: const BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))),
)));
childrenReadOnly.add(Padding(padding: EdgeInsets.only(bottom: 15), child:
childrenReadOnly.add(Padding(padding: const EdgeInsets.only(bottom: 15), child:
SubDropdownInputWidget( dropdownMenuEntries: dpItems, subkey: "", width: 180, empty: false,
initialValue: "${widget.item.selectedInstance}", change: (value) {
if (value != null) { setState(() { widget.item.selectedInstance = int.parse(value); }); }
@@ -81,7 +81,7 @@ class ResourceFormsWidgetState extends State<ResourceFormsWidget> {
instancesCat.add(CredentialsFormsWidget(dash: widget.dash, item: widget.item, elementID: widget.elementID));
if (instancesCat.isNotEmpty) {
instancesCat.add(Container(
width: 200, decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))),
width: 200, decoration: const BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))),
));
}
bool readOnly = !PermsService.getPerm(Perms.WORKFLOW_EDIT);

View File

@@ -38,7 +38,7 @@ class StorageProcessingLinkFormsWidgetState extends State<StorageProcessingLinkF
@override Widget build(BuildContext context) {
List<Widget> children = [
Padding( padding: const EdgeInsets.only(top: 10),
const Padding( padding: const EdgeInsets.only(top: 10),
child: Text("<ENV VARIABLES>",
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.bold), textAlign: TextAlign.center)),
];
@@ -54,9 +54,9 @@ class StorageProcessingLinkFormsWidgetState extends State<StorageProcessingLinkF
int count = 0;
for(var info in widget.item.infos) {
count++;
inf.add(Padding( padding: EdgeInsets.only(top: 10, bottom: 5),
inf.add(Padding( padding: const EdgeInsets.only(top: 10, bottom: 5),
child : Row( crossAxisAlignment: CrossAxisAlignment.center, children: [
Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Text("$count")),
Padding(padding: const EdgeInsets.only(left: 10, right: 10), child: Text("$count")),
Container(width: 140, decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))))
])));
for (var key in (info as Map<String, dynamic>).keys) {
@@ -112,7 +112,7 @@ class StorageProcessingLinkFormsWidgetState extends State<StorageProcessingLinkF
...children,
Row( mainAxisAlignment: MainAxisAlignment.center, children: [
InkWell( onTap: () {
widget.item.infos.add({
widget.item.infos.add(<String, dynamic> {
"write": false,
"source": null,
"destination": null,
@@ -125,7 +125,7 @@ class StorageProcessingLinkFormsWidgetState extends State<StorageProcessingLinkF
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5),
border: Border.all(color: Colors.grey, width: 1)),
width: 125, height: 30,
child: Row( mainAxisAlignment: MainAxisAlignment.center,
child: const Row( mainAxisAlignment: MainAxisAlignment.center,
children: [ Padding( padding: EdgeInsets.only(right: 5), child: Icon(Icons.add, color: Colors.black,)),
Text("link infos",
style: TextStyle( color: Colors.black))]),

View File

@@ -18,14 +18,38 @@ class SubExposeFormsWidget extends StatefulWidget {
}
class SubExposeFormsWidgetState extends State<SubExposeFormsWidget> {
@override Widget build(BuildContext context) {
print("qsfqs");
try {
var w = SubTextInputWidget(subkey: "reference port", readOnly: widget.readOnly,
initialValue: widget.item.port != null ? '${widget.item.port}' : null,
width: widget.width,
empty: widget.empty,
change: (value) {
try {
widget.item.port = int.parse(value);
Future.delayed(const Duration(seconds: 2), () {
if (widget.item.port == int.parse(value) && int.parse(value) != 0) {
widget.dash.saveDash(widget.dash.id, context);
}
});
} catch (e) { widget.item.port = null; }
var el = widget.dash.getElement(widget.elementID);
el!.element = widget.item as dynamic;
});
} catch (e,s) {
print(e);
print(s);
}
return Column( children : [
Container( margin: const EdgeInsets.only(left: 10, right: 10, top: 5),
decoration: BoxDecoration(border: Border.all(color: Colors.grey, width: 1)),
Container( margin: const EdgeInsets.only(left: 10, right: 10, top: 15),
decoration: const BoxDecoration(border: Border( top: BorderSide(color: Colors.grey, width: 1))),
width: 180
),
SubTextInputWidget(subkey: "reference port", readOnly: widget.readOnly,
initialValue: widget.item.port != null ? '${widget.item.port}' : null,
width: widget.width, empty: widget.empty, change: (value) {
width: 180,
empty: widget.empty,
change: (value) {
try {
widget.item.port = int.parse(value);
Future.delayed(const Duration(seconds: 2), () {

View File

@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:oc_front/widgets/dialog/alert.dart';
// ignore: must_be_immutable
class SubTextInputWidget extends StatefulWidget {
String subkey;
String? initialValue;
@@ -12,10 +13,9 @@ class SubTextInputWidget extends StatefulWidget {
bool readOnly = false;
bool copyLabel = false;
void Function(String) change = (value) {};
SubTextInputWidget ({ Key? key,
SubTextInputWidget ({ super.key,
required this.subkey, this.readOnly = false, this.noLabel = false, this.copyLabel = false,
this.initialValue, required this.width, required this.empty, required this.change }):
super(key: key);
this.initialValue, required this.width, required this.empty, required this.change });
@override SubTextInputWidgetState createState() => SubTextInputWidgetState();
}
class SubTextInputWidgetState extends State<SubTextInputWidget> {
@@ -24,12 +24,13 @@ class SubTextInputWidgetState extends State<SubTextInputWidget> {
if (widget.readOnly && widget.initialValue == null) {
return Container();
}
TextEditingController ctrl = TextEditingController(text: widget.initialValue);
return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Tooltip( message: widget.subkey,
child: Container( margin: EdgeInsets.only(top: widget.empty ? 0 : 15),
width: widget.width - (widget.readOnly ? 40 : 0), height: 30,
child: TextFormField( textAlign: TextAlign.start,
enabled: !widget.readOnly,
initialValue: widget.initialValue,
controller: ctrl,
onChanged: widget.change,
style: const TextStyle(fontSize: 12),
decoration: InputDecoration(