Latest Front with debug

This commit is contained in:
mr
2024-08-30 12:52:32 +02:00
parent 8beddba367
commit 0b294a782c
42 changed files with 1367 additions and 925 deletions

View File

@@ -6,13 +6,13 @@ import 'package:oc_front/pages/workflow.dart';
Map<String, Map<String, AbstractItem>> proxyWfItem = {};
class ProxyFormsWidget extends StatefulWidget {
class ProcessingFormsWidget extends StatefulWidget {
AbstractItem item;
Dashboard dash;
ProxyFormsWidget ({ super.key, required this.item, required this.dash });
@override ProxyFormsWidgetState createState() => ProxyFormsWidgetState();
ProcessingFormsWidget ({ super.key, required this.item, required this.dash });
@override ProcessingFormsWidgetState createState() => ProcessingFormsWidgetState();
}
class ProxyFormsWidgetState extends State<ProxyFormsWidget> {
class ProcessingFormsWidgetState extends State<ProcessingFormsWidget> {
@override Widget build(BuildContext context) {
List<Widget> children = [];
var l = widget.item.model?.model?.keys ?? [];

View File

@@ -1,15 +1,18 @@
import 'package:alert_banner/exports.dart';
import 'package:cron/cron.dart';
import 'package:flutter/widgets.dart';
import 'package:intl/intl.dart' as intl;
import 'package:flutter/material.dart';
import 'package:flutter_flow_chart/flutter_flow_chart.dart';
import 'package:flutter_advanced_switch/flutter_advanced_switch.dart';
import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';
import 'package:oc_front/core/models/shared_workspace_local.dart';
import 'package:oc_front/core/services/specialized_services/workflow_service.dart';
import 'package:oc_front/core/services/specialized_services/check_service.dart';
import 'package:oc_front/pages/shared.dart';
import 'package:oc_front/pages/workflow.dart';
import 'package:oc_front/widgets/dialog/alert.dart';
import 'package:oc_front/widgets/inputs/shallow_text_input.dart';
class SchedulerFormsWidget extends StatefulWidget {
Dashboard item;
@@ -45,6 +48,26 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
}
List<GlobalKey<FormFieldState>> formKeys = [GlobalKey<FormFieldState>(), GlobalKey<FormFieldState>(),
GlobalKey<FormFieldState>(), GlobalKey<FormFieldState>()];
var shallow = ShallowTextInputWidget(
width: 250 - 1,
current: dash.name,
type: SharedWorkspaceType.workflow,
canRemove: (p0) => p0 != null && p0.isEmpty,
remove: (p0) async {
await WorflowService().delete(context, widget.item.id ?? "", {}).then((value) {
dash.clear();
dash.isOpened = false;
dash.chartKey.currentState?.widget.flowChart.setState(() { });
});
},
);
shallow.change =(p0) => Future.delayed( const Duration(seconds: 2), () async {
if (shallow.compare == p0) {
await WorflowService().put(context, widget.item.id ?? "", { "name" : p0 }, {});
} else {
shallow.compare = p0;
}
});
return Column( children: [
Container( padding: const EdgeInsets.all(10), width: 250, height: 60,
decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
@@ -52,9 +75,12 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
Text("WORKFLOW INFO", style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), textAlign: TextAlign.center),
Text("<general>", style: TextStyle(fontSize: 12), textAlign: TextAlign.center),
])),
Container(height: 20,
width: 250,
),
Container(
decoration: BoxDecoration( border: Border(
left: BorderSide(color: Colors.grey.shade300, width: 1),
bottom: const BorderSide(color: Colors.grey))),
child: shallow ),
const SizedBox(height: 20, width: 250 ),
AdvancedSwitch(
width: 140,
initialValue: widget.item.scheduler["mode"] == 1,
@@ -67,6 +93,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
setState(() {
widget.item.scheduler["mode"] = value == true ? 1 : 0;
if ((widget.item.scheduler["mode"] == 1 )) { widget.item.scheduler.remove("cron"); }
widget.item.save!(widget.item.id);
}));
},),
Container(height: 5),
@@ -334,7 +361,11 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
Container(
width: 250,
height: 20,
decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.black, width: 1))),
decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
),
const SizedBox(
width: 250,
height: 10,
),
Tooltip( message: "check booking",
child: InkWell( mouseCursor: SystemMouseCursors.click,
@@ -367,13 +398,13 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
setState(() {});
}
);
}, child: Container( margin: const EdgeInsets.all(10),
}, child: Container( margin: const EdgeInsets.only(bottom: 5),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5),
border: Border.all(color: widget.booking == null && !dash.scheduleActive ? Colors.grey : (widget.booking == true || dash.scheduleActive ? Colors.green : Colors.red), width: 1)),
border: Border.all(color: widget.booking == null && !dash.scheduleActive ? Colors.black : (widget.booking == true || dash.scheduleActive ? Colors.green : Colors.red), width: 1)),
width: 200, height: 30,
child: Icon(
Icons.verified_outlined,
color: widget.booking == null && !dash.scheduleActive ? Colors.grey : (widget.booking == true || dash.scheduleActive ? Colors.green : Colors.red)),
color: widget.booking == null && !dash.scheduleActive ? Colors.black : (widget.booking == true || dash.scheduleActive ? Colors.green : Colors.red)),
))
),
Tooltip( message: dash.scheduleActive ? "unbook" : "book",
@@ -387,7 +418,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
} else { k.currentState!.save();}
}
}
DateTime now = DateTime.now().add(const Duration(minutes: 5));
DateTime now = DateTime.now().add(const Duration(minutes: 1));
if (dash.scheduler["start"] == null || DateTime.parse(dash.scheduler["start"]!).isBefore(now)) {
dash.scheduler["start"] = now.toUtc().toIso8601String();
if (dash.scheduler["end"] != null) {
@@ -396,7 +427,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
}
widget.item.save!(widget.item.id);
setState(() { });
}, child: Container( margin: const EdgeInsets.all(10),
}, child: Container( margin: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5),
border: Border.all(color: dash.scheduleActive ? Colors.green : Colors.black)),
width: 200, height: 30,
@@ -411,16 +442,18 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
decoration: const BoxDecoration(border: Border(top: BorderSide(color: Colors.black))),
),
Container( alignment: Alignment.center, padding: const EdgeInsets.symmetric(horizontal: 20),
child: Text( textAlign: TextAlign.center,
child:Text( textAlign: TextAlign.center, overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 14, color: Colors.black, fontWeight: FontWeight.bold),
"Workflow is shared in ${(widget.item.info["shared"] as List<dynamic>).length} workspace(s)")),
...(widget.item.info["shared"] as List<dynamic>).where( (e) => SharedWorkspaceLocal.getSharedWorkspace(e) != null
).map((e) {
var sw = SharedWorkspaceLocal.getSharedWorkspace(e);
return Container( alignment: Alignment.center, padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 5),
child: Row( children: [
const Padding(padding: EdgeInsets.only(right: 10), child: Icon(Icons.work, color: Colors.grey, size: 15)),
Text(style: const TextStyle(fontSize: 12, color: Colors.grey),
"Workspace: ${SharedWorkspaceLocal.getSharedWorkspace(e)!.name}") ]));
"Workspace: ${sw != null && sw.name != null ?
"${sw.name!.substring(0, sw.name!.length > 15 ? 12 : sw.name!.length)}${sw.name!.length > 15 ? "..." : ""}" : ""}") ]));
},)
]) : Container()
]);