draft booking scheduler page

This commit is contained in:
mr
2024-11-13 08:12:37 +01:00
parent 1ca77b6611
commit 062042b590
15 changed files with 288 additions and 72 deletions

View File

@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_box_transform/flutter_box_transform.dart';
import 'package:oc_front/core/sections/header/header.dart';
import 'package:oc_front/main.dart';
import 'package:oc_front/models/logs.dart';
import 'package:oc_front/models/workflow.dart';
@@ -19,7 +18,9 @@ class ScheduleWidget extends StatefulWidget {
bool loading = true;
Map<String, List<WorkflowExecution>> data;
bool isList = true;
ScheduleWidget ({ super.key, required this.data, required this.start, required this.end, this.isList = true, this.loading = false});
bool isBox = true;
ScheduleWidget ({ super.key, required this.data, required this.start, required this.end,
this.isBox =true, this.isList = true, this.loading = false});
@override ScheduleWidgetState createState() => ScheduleWidgetState();
}
String? selected;
@@ -27,8 +28,8 @@ String? selectedReal;
class ScheduleWidgetState extends State<ScheduleWidget> {
String search = "";
String? level;
List<Color> colors = [Colors.blue, Colors.orange, redColor, Colors.green];
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS"];
List<Color> colors = [Colors.blue, Colors.orange, redColor, Colors.green, redColor];
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS", "FORGOTTEN"];
DateTime getFocusedDay() {
if (selected != null) { return DateTime.parse(selected!); }
@@ -36,8 +37,8 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
}
@override Widget build(BuildContext context) {
bool isInfo = getMainWidth(context) <= 600 && selected != null;
double w = selected != null ? getMainWidth(context) - menuSize : getMainWidth(context);
bool isInfo = getMainWidth(context) <= 600 && selected != null && widget.isBox;
double w = selected != null && widget.isBox ? getMainWidth(context) - menuSize : getMainWidth(context);
List<Widget> children = [];
if (selected != null) {
for (var wf in widget.data[selected!] ?? (<WorkflowExecution>[])) {
@@ -94,7 +95,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
: SchedulerCalendarWidget(data: widget.data, start: widget.start,
end: widget.end, parent: this, focusedDay: getFocusedDay(),)
),
fork.TransformableBox(
!widget.isBox ? Container() : fork.TransformableBox(
rect: rect, constraints: BoxConstraints(
maxWidth: isInfo ? getMainWidth(context) : (selected != null ? getMainWidth(context) / 2 : 0),
minWidth: selected != null ? 300 : 0),

View File

@@ -24,8 +24,8 @@ class SchedulerCalendarWidget extends StatefulWidget {
@override SchedulerCalendarWidgetState createState() => SchedulerCalendarWidgetState();
}
class SchedulerCalendarWidgetState extends State<SchedulerCalendarWidget> {
List<Color> colors = [Colors.blue, Colors.orange, redColor, Colors.green];
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS"];
List<Color> colors = [Colors.blue, Colors.orange, redColor, Colors.green, redColor];
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS", "FORGOTTEN"];
bool isEvent(Map<String, List<WorkflowExecution>> data, DateTime day) {
if (data[day.toIso8601String()] == null || data[day.toIso8601String()]!.isEmpty) { return false; }
return true;

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_box_transform/flutter_box_transform.dart';
import 'package:oc_front/core/sections/header/header.dart';
import 'package:oc_front/main.dart';
import 'package:oc_front/models/workflow.dart';
import 'package:oc_front/widgets/sheduler_items/schedule.dart';
@@ -17,8 +18,8 @@ class SchedulerItemWidget extends StatefulWidget {
@override SchedulerItemWidgetState createState() => SchedulerItemWidgetState();
}
class SchedulerItemWidgetState extends State<SchedulerItemWidget> {
List<Color> colors = [Colors.blue, Colors.orange, Colors.red, Colors.green];
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS"];
List<Color> colors = [Colors.blue, Colors.orange, redColor, Colors.green, redColor];
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS", "FORGOTTEN"];
@override Widget build(BuildContext context) {
List<Widget> children = [];
@@ -42,8 +43,7 @@ class SchedulerItemWidgetState extends State<SchedulerItemWidget> {
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 50),
decoration: BoxDecoration(
border: selectedReal == ev.executionData ?
Border.all(color: const Color.fromRGBO(38, 166, 154, 1), width: 2)
: Border(top: BorderSide(color: Colors.grey.shade300)),
Border.all(color: lightColor, width: 2) : Border(top: BorderSide(color: midColor)),
),
child: Row(children: [
Container( width: 110,
@@ -64,7 +64,7 @@ class SchedulerItemWidgetState extends State<SchedulerItemWidget> {
)),
SizedBox( width: (widget.width - 340) / 2,
child: Padding(
padding: const EdgeInsets.only(left: 20),
padding: const EdgeInsets.only(left: 17),
child: Container( padding: const EdgeInsets.symmetric(horizontal: 20),
child: Text(d3 != null ? "killed at ${d3.day}/${d3.month}/${d3.year} ${d3.hour}:${d3.minute}:${d3.second}"
: "infinite run till process end", overflow: TextOverflow.ellipsis,
@@ -72,7 +72,7 @@ class SchedulerItemWidgetState extends State<SchedulerItemWidget> {
)),
SizedBox(
child: Padding(
padding: const EdgeInsets.only(left: 20),
padding: const EdgeInsets.only(left: 17),
child: Text("${d2.hour > 9 ? d2.hour : "0${d2.hour}"}:${d2.minute > 9 ? d2.minute : "0${d2.minute}"}:${d2.second > 9 ? d2.second : "0${d2.second}"}", overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 25,
color: Colors.grey, fontWeight: FontWeight.w500))))
@@ -81,12 +81,12 @@ class SchedulerItemWidgetState extends State<SchedulerItemWidget> {
}
var date = DateTime.parse(element);
children.add(Container(
decoration: const BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.black)),
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.grey.shade300)),
),
child: Column( children: [ExpansionTile(
child: Column( children: [ ExpansionTile(
enabled: widget.enabled,
shape: const ContinuousRectangleBorder(),
shape: const ContinuousRectangleBorder(side : BorderSide(color: Colors.grey)),
iconColor: Colors.grey,
initiallyExpanded: true,
title: SizedBox(
@@ -110,11 +110,15 @@ class SchedulerItemWidgetState extends State<SchedulerItemWidget> {
}
});
return Container(
decoration: BoxDecoration(
color: children.isNotEmpty ? Colors.transparent : midColor,
border: Border( right: BorderSide( color: children.isNotEmpty ? Colors.transparent : Colors.white) ),
),
alignment: children.isNotEmpty ? Alignment.topLeft : Alignment.center,
color: children.isNotEmpty ? Colors.transparent : Colors.white,
width: children.isNotEmpty ? MediaQuery.of(context).size.width : null,
height: MediaQuery.of(context).size.height - HeaderConstants.height - 50,
child: children.isNotEmpty ? SingleChildScrollView( child: Column( children: children)) : const Text("NO DATA FOUND", style: TextStyle(color: Colors.grey, fontSize: 30))
width: children.isNotEmpty ? getMainWidth(context) : null,
height: getMainHeight(context) - 50,
child: children.isNotEmpty ? SingleChildScrollView( child: Column( children: children)) : const Text(
"NO DATA FOUND", style: TextStyle(color: Colors.grey, fontSize: 30))
);
}
}