This commit is contained in:
mr
2024-11-08 13:59:22 +01:00
parent 685badc59a
commit 1ca77b6611
69 changed files with 1601 additions and 1337 deletions

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/logs.dart';
import 'package:oc_front/models/workflow.dart';
import 'package:oc_front/widgets/logs.dart';
@@ -26,7 +27,7 @@ String? selectedReal;
class ScheduleWidgetState extends State<ScheduleWidget> {
String search = "";
String? level;
List<Color> colors = [Colors.blue, Colors.orange, Colors.red, Colors.green];
List<Color> colors = [Colors.blue, Colors.orange, redColor, Colors.green];
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS"];
DateTime getFocusedDay() {
@@ -35,8 +36,8 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
}
@override Widget build(BuildContext context) {
bool isInfo = MediaQuery.of(context).size.width <= 600 && selected != null;
double w = selected != null ? MediaQuery.of(context).size.width - menuSize : MediaQuery.of(context).size.width;
bool isInfo = getMainWidth(context) <= 600 && selected != null;
double w = selected != null ? getMainWidth(context) - menuSize : getMainWidth(context);
List<Widget> children = [];
if (selected != null) {
for (var wf in widget.data[selected!] ?? (<WorkflowExecution>[])) {
@@ -45,8 +46,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
onTap: () => setState(() { selectedReal = wf.executionData; }),
child: Container( margin: const EdgeInsets.all(10),
decoration: BoxDecoration(
border: Border.all(color: selectedReal != null && selectedReal == wf.executionData ?
const Color.fromRGBO(38, 166, 154, 1) : Colors.transparent, width: 2),
border: Border.all(color: selectedReal != null && selectedReal == wf.executionData ? lightColor : Colors.transparent, width: 2),
borderRadius: BorderRadius.circular(4), color: Colors.white
),
child: Container(
@@ -85,9 +85,9 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
logs = sel.logs ?? [];
} catch(e) { /* */ }
}
menuSize = isInfo ? MediaQuery.of(context).size.width : (menuSize > MediaQuery.of(context).size.width / 2 ? MediaQuery.of(context).size.width / 2 : menuSize);
menuSize = isInfo ? getMainWidth(context) : (menuSize > getMainWidth(context) / 2 ? getMainWidth(context) / 2 : menuSize);
Rect rect = Rect.fromCenter( center: MediaQuery.of(context).size.center(Offset.zero),
width: selected != null ? menuSize : 0, height: (MediaQuery.of(context).size.height - HeaderConstants.height - 50) > 0 ? (MediaQuery.of(context).size.height - HeaderConstants.height - 50) : 0);
width: selected != null ? menuSize : 0, height: (getMainHeight(context) - 50) > 0 ? (getMainHeight(context) - 50) : 0);
return Row( children: [
isInfo ? Container() : SizedBox( width: w,
child: widget.isList ? SchedulerItemWidget(data: widget.data, parent: this, focusedDay: getFocusedDay(), width: w)
@@ -96,7 +96,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
),
fork.TransformableBox(
rect: rect, constraints: BoxConstraints(
maxWidth: isInfo ? MediaQuery.of(context).size.width : (selected != null ? MediaQuery.of(context).size.width / 2 : 0),
maxWidth: isInfo ? getMainWidth(context) : (selected != null ? getMainWidth(context) / 2 : 0),
minWidth: selected != null ? 300 : 0),
handleTapSize: 1, handleTapLeftSize: 0, allowFlippingWhileResizing: false, draggable: false, flip: null,
resizeModeResolver: () => ResizeMode.freeform,
@@ -106,15 +106,15 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
handleAlignment: HandleAlignment.inside,
onChanged: (result, event) { setState(() { menuSize = result.rect.width; }); },
contentBuilder: (context, rect, flip) { return Container(
height: MediaQuery.of(context).size.height - HeaderConstants.height - 50,
width: isInfo ? MediaQuery.of(context).size.width : (selected != null ? menuSize : 0),
color: Colors.grey.shade300,
height: getMainHeight(context) - 50,
width: isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0),
color: midColor,
child: Column(
children: [
Row( children: [
InkWell( onTap: () => setState(() { widget.isDayPlanner = true; }),
child: Tooltip( message: "day planning", child:
Container( height: 50, width: (isInfo ? MediaQuery.of(context).size.width : (selected != null ? menuSize : 0)) / (selectedReal != null ? 2 : 1 ),
Container( height: 50, width: (isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0)) / (selectedReal != null ? 2 : 1 ),
alignment: Alignment.center,
decoration: BoxDecoration(
color: widget.isDayPlanner ? Colors.grey : Colors.transparent,
@@ -125,7 +125,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
InkWell( onTap: () => setState(() { widget.isDayPlanner = false; }),
child: Tooltip( message: "monitor task", child:
Container( height: 50, width: selectedReal == null ? 0 : (
(isInfo ? MediaQuery.of(context).size.width : (selected != null ? menuSize : 0)) / 2),
(isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0)) / 2),
alignment: Alignment.center,
decoration: BoxDecoration(
color: !widget.isDayPlanner ? Colors.grey : Colors.transparent,
@@ -136,7 +136,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
)
))
]),
SizedBox( width: isInfo ? MediaQuery.of(context).size.width : (selected != null ? menuSize : 0), height: MediaQuery.of(context).size.height - HeaderConstants.height - (!widget.isDayPlanner && !widget.loading ? 150 : 100 ),
SizedBox( width: isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0), height: getMainHeight(context) - (!widget.isDayPlanner && !widget.loading ? 150 : 100 ),
child: Stack( children: [
SingleChildScrollView( child: Column(
mainAxisAlignment: children.isEmpty || widget.loading ? MainAxisAlignment.center : MainAxisAlignment.start,
@@ -154,7 +154,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
width: 150,
height: 50,
decoration: BoxDecoration(
border: Border(left: BorderSide(color: Colors.grey.shade300)),
border: Border(left: BorderSide(color: midColor)),
),
child: DropdownButtonFormField(
isExpanded: true,
@@ -163,22 +163,22 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
hint: const Text("by level...", style: TextStyle(fontSize: 12)),
decoration: InputDecoration(
filled: true,
focusedBorder: const OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Color.fromARGB(38, 166, 154, 1), width: 0),
focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: lightColor, width: 0),
),
fillColor: Colors.white,
contentPadding: const EdgeInsets.only(left: 30, right: 30, top: 10, bottom: 30),
enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Colors.grey.shade300, width: 0),
borderSide: BorderSide(color: midColor, width: 0),
),
border: OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Colors.grey.shade300, width: 0)),
borderSide: BorderSide(color: midColor, width: 0)),
),
items: [
DropdownMenuItem(value: "debug,warning,error,info", child: Row( children: [ Container( width: 10, height: 15, color: Colors.grey), Text(" all", style: TextStyle(fontSize: 12, color: Colors.black)) ])),
DropdownMenuItem(value: "debug", child: Row( children: [ Container( width: 10, height: 15, color: Colors.blue), Text(" debug", style: TextStyle(fontSize: 12, color: Colors.black)) ])),
DropdownMenuItem(value: "warning", child: Row( children: [ Container( width: 10, height: 15, color: Colors.orange), Text(" warning", style: TextStyle(fontSize: 12, color: Colors.black)) ])),
DropdownMenuItem(value: "error", child: Row( children: [ Container( width: 10, height: 15, color: Colors.red), Text(" error", style: TextStyle(fontSize: 12, color: Colors.black)) ])),
DropdownMenuItem(value: "error", child: Row( children: [ Container( width: 10, height: 15, color: redColor), Text(" error", style: TextStyle(fontSize: 12, color: Colors.black)) ])),
DropdownMenuItem(value: "info", child: Row( children: [ Container( width: 10, height: 15, color: Colors.green), Text(" info", style: TextStyle(fontSize: 12, color: Colors.black)) ])),
],
onChanged: (value) {
@@ -190,7 +190,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
width: menuSize - 150,
height: 50,
decoration: BoxDecoration(
border: Border(left: BorderSide(color: Colors.grey.shade300)),
border: Border(left: BorderSide(color: midColor)),
),
child: TextField(
onChanged: (value) { setState(() {

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.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';
import 'package:table_calendar/table_calendar.dart';
@@ -23,7 +24,7 @@ class SchedulerCalendarWidget extends StatefulWidget {
@override SchedulerCalendarWidgetState createState() => SchedulerCalendarWidgetState();
}
class SchedulerCalendarWidgetState extends State<SchedulerCalendarWidget> {
List<Color> colors = [Colors.blue, Colors.orange, Colors.red, Colors.green];
List<Color> colors = [Colors.blue, Colors.orange, redColor, Colors.green];
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS"];
bool isEvent(Map<String, List<WorkflowExecution>> data, DateTime day) {
if (data[day.toIso8601String()] == null || data[day.toIso8601String()]!.isEmpty) { return false; }
@@ -34,7 +35,7 @@ class SchedulerCalendarWidgetState extends State<SchedulerCalendarWidget> {
widget.focusedDay.isAfter(widget.end) ? widget.end : widget.focusedDay );
return Container(
padding: const EdgeInsets.only(left: 20, right: 20, bottom: 20),
height: MediaQuery.of(context).size.height - HeaderConstants.height - 50,
height: getMainHeight(context) - 50,
child: TableCalendar<Event>(
firstDay: widget.start,
lastDay: widget.end,
@@ -61,7 +62,7 @@ class SchedulerCalendarWidgetState extends State<SchedulerCalendarWidget> {
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Colors.grey.shade300,
color: midColor,
),
child: const Text("...", style: TextStyle(color: Colors.white, fontSize: 10)),
)));
@@ -90,7 +91,7 @@ class SchedulerCalendarWidgetState extends State<SchedulerCalendarWidget> {
alignment: !isEvent(widget.data, date) ? Alignment.center : Alignment.topCenter,
margin:const EdgeInsets.all(2.0),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey.shade300),
border: Border.all(color: midColor),
shape: BoxShape.rectangle,
),
child: !isEvent(widget.data, date) ? Text(
@@ -106,8 +107,8 @@ class SchedulerCalendarWidgetState extends State<SchedulerCalendarWidget> {
alignment: Alignment.center,
margin: const EdgeInsets.all(2.0),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey.shade300),
color: Colors.grey.shade300,
border: Border.all(color: midColor),
color: midColor,
shape: BoxShape.rectangle,
),
child: Text(
@@ -119,7 +120,7 @@ class SchedulerCalendarWidgetState extends State<SchedulerCalendarWidget> {
alignment: !isEvent(widget.data, date) ? Alignment.center : Alignment.topCenter,
margin: const EdgeInsets.all(2.0),
decoration: BoxDecoration(
border: Border.all(color: const Color.fromRGBO(38, 166, 154, 1), width: 2),
border: Border.all(color: lightColor, width: 2),
shape: BoxShape.rectangle,
),
child: !isEvent(widget.data, date) ? Text(