Autoload yay
This commit is contained in:
parent
d522a44029
commit
2ceab090fd
@ -16,6 +16,7 @@ class LogsService extends AbstractService<LogsResult> {
|
|||||||
if (p == "start" || p == "end") { continue; }
|
if (p == "start" || p == "end") { continue; }
|
||||||
v.add("$p=\"${params[p]}\"");
|
v.add("$p=\"${params[p]}\"");
|
||||||
}
|
}
|
||||||
|
print("${subPath}query_range?query={${v.join(", ")}}&start=${params["start"].toString().substring(0, 10)}&end=${params["end"].toString().substring(0, 10)}");
|
||||||
return service.get("${subPath}query_range?query={${v.join(", ")}}&start=${params["start"].toString().substring(0, 10)}&end=${params["end"].toString().substring(0, 10)}", false, context);
|
return service.get("${subPath}query_range?query={${v.join(", ")}}&start=${params["start"].toString().substring(0, 10)}&end=${params["end"].toString().substring(0, 10)}", false, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ class WorkflowExecutionService extends AbstractService<WorkflowExecutions> {
|
|||||||
@override String subPath = "/";
|
@override String subPath = "/";
|
||||||
|
|
||||||
@override Future<APIResponse<WorkflowExecutions>> search(BuildContext? context, List<String> words, Map<String, dynamic> params) {
|
@override Future<APIResponse<WorkflowExecutions>> search(BuildContext? context, List<String> words, Map<String, dynamic> params) {
|
||||||
|
print("${subPath}search/${words.join("/")}");
|
||||||
return service.get("${subPath}search/${words.join("/")}", false, context);
|
return service.get("${subPath}search/${words.join("/")}", false, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,49 +32,7 @@ class ComputePageWidgetState extends State<ComputePageWidget> {
|
|||||||
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS", "MISSED"];
|
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS", "MISSED"];
|
||||||
|
|
||||||
@override Widget build(BuildContext context) {
|
@override Widget build(BuildContext context) {
|
||||||
return FutureBuilder(
|
|
||||||
future: widget._service.search(context, [
|
|
||||||
"${widget.start.year}-${widget.start.month > 9 ? widget.start.month : "0${widget.start.month}"}-${widget.start.day > 9 ? widget.start.day : "0${widget.start.day}"}",
|
|
||||||
"${widget.end.year}-${widget.end.month > 9 ? widget.end.month : "0${widget.end.month}"}-${widget.end.day > 9 ? widget.end.day : "0${widget.end.day}"}"], {}),
|
|
||||||
builder: (ctx, as) {
|
|
||||||
Map<String, List<WorkflowExecution>> data = {};
|
|
||||||
if (as.hasData && as.data!.data != null) {
|
|
||||||
for (var element in as.data!.data!.executions) {
|
|
||||||
if (element.executionData == null) { continue; }
|
|
||||||
DateTime dateTime = DateTime.parse(element.executionData!);
|
|
||||||
DateTime date = DateTime(dateTime.year, dateTime.month, dateTime.day);
|
|
||||||
var str = "${date.toIso8601String()}Z";
|
|
||||||
if (data[str] == null) { data[str] = []; }
|
|
||||||
data[str]!.add(element);
|
|
||||||
data[str]!.sort((a, b) => DateTime.parse(a.executionData!).compareTo(DateTime.parse(b.executionData!)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GlobalKey<ScheduleWidgetState> k = GlobalKey<ScheduleWidgetState>();
|
GlobalKey<ScheduleWidgetState> k = GlobalKey<ScheduleWidgetState>();
|
||||||
for (var da in data.keys) {
|
|
||||||
for (var exec in data[da]!) {
|
|
||||||
String start = "";
|
|
||||||
String end = "";
|
|
||||||
try {
|
|
||||||
if (exec.endDate != null && exec.endDate != "") {
|
|
||||||
var startD = DateTime.parse(exec.executionData!);
|
|
||||||
var endD = DateTime.parse(exec.endDate!);
|
|
||||||
var diff = endD.difference(startD);
|
|
||||||
if (diff.inDays < 30) {
|
|
||||||
var rest = ((30 - diff.inDays) ~/ 2) - 1;
|
|
||||||
start = (startD.subtract(Duration(days: rest)).microsecondsSinceEpoch).toString();
|
|
||||||
end = (endD.add(Duration(days: rest)).microsecondsSinceEpoch).toString();
|
|
||||||
} else {
|
|
||||||
start = (startD.microsecondsSinceEpoch).toString();
|
|
||||||
end = (startD.add( const Duration(days: 29)).microsecondsSinceEpoch).toString();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
start = (DateTime.parse(exec.executionData!).subtract( const Duration(days: 14)).microsecondsSinceEpoch).toString();
|
|
||||||
end = (DateTime.parse(exec.executionData!).add( const Duration(days: 14)).microsecondsSinceEpoch).toString();
|
|
||||||
}
|
|
||||||
} catch(e) { /* */ }
|
|
||||||
k.currentState?.setState(() { k.currentState?.widget.loading = true; });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Column( children: [
|
return Column( children: [
|
||||||
Container( color: lightColor,
|
Container( color: lightColor,
|
||||||
height: 50, width: getMainWidth(context),
|
height: 50, width: getMainWidth(context),
|
||||||
@ -211,8 +169,7 @@ class ComputePageWidgetState extends State<ComputePageWidget> {
|
|||||||
)
|
)
|
||||||
]))
|
]))
|
||||||
),
|
),
|
||||||
ScheduleWidget( key: k, data: data, start: widget.start, end : widget.end, isList: widget.isList, isBox: false)
|
ScheduleWidget( service: widget._service, key: k, start: widget.start, end : widget.end, isList: widget.isList, isBox: false)
|
||||||
]);
|
]);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,10 +2,8 @@ import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart' as intl;
|
import 'package:intl/intl.dart' as intl;
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:oc_front/core/services/specialized_services/logs_service.dart';
|
|
||||||
import 'package:oc_front/core/services/specialized_services/workflow_execution_service.dart';
|
import 'package:oc_front/core/services/specialized_services/workflow_execution_service.dart';
|
||||||
import 'package:oc_front/main.dart';
|
import 'package:oc_front/main.dart';
|
||||||
import 'package:oc_front/models/workflow.dart';
|
|
||||||
import 'package:oc_front/pages/abstract_page.dart';
|
import 'package:oc_front/pages/abstract_page.dart';
|
||||||
import 'package:oc_front/widgets/sheduler_items/schedule.dart';
|
import 'package:oc_front/widgets/sheduler_items/schedule.dart';
|
||||||
|
|
||||||
@ -29,70 +27,10 @@ class SchedulerPageWidget extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
class SchedulerPageWidgetState extends State<SchedulerPageWidget> {
|
class SchedulerPageWidgetState extends State<SchedulerPageWidget> {
|
||||||
List<Color> colors = [Colors.blue, Colors.orange, redColor, Colors.green, redColor];
|
List<Color> colors = [Colors.blue, Colors.orange, redColor, Colors.green, redColor];
|
||||||
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS", "MISSED"];
|
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS", "FORGOTTEN"];
|
||||||
|
|
||||||
@override Widget build(BuildContext context) {
|
@override Widget build(BuildContext context) {
|
||||||
return FutureBuilder(
|
|
||||||
future: widget._service.search(context, [
|
|
||||||
"${widget.start.year}-${widget.start.month > 9 ? widget.start.month : "0${widget.start.month}"}-${widget.start.day > 9 ? widget.start.day : "0${widget.start.day}"}",
|
|
||||||
"${widget.end.year}-${widget.end.month > 9 ? widget.end.month : "0${widget.end.month}"}-${widget.end.day > 9 ? widget.end.day : "0${widget.end.day}"}"], {}),
|
|
||||||
builder: (ctx, as) {
|
|
||||||
Map<String, List<WorkflowExecution>> data = {};
|
|
||||||
if (as.hasData && as.data!.data != null) {
|
|
||||||
for (var element in as.data!.data!.executions) {
|
|
||||||
if (element.executionData == null) { continue; }
|
|
||||||
DateTime dateTime = DateTime.parse(element.executionData!);
|
|
||||||
DateTime date = DateTime(dateTime.year, dateTime.month, dateTime.day);
|
|
||||||
var str = "${date.toIso8601String()}Z";
|
|
||||||
if (data[str] == null) { data[str] = []; }
|
|
||||||
data[str]!.add(element);
|
|
||||||
data[str]!.sort((a, b) => DateTime.parse(a.executionData!).compareTo(DateTime.parse(b.executionData!)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GlobalKey<ScheduleWidgetState> k = GlobalKey<ScheduleWidgetState>();
|
GlobalKey<ScheduleWidgetState> k = GlobalKey<ScheduleWidgetState>();
|
||||||
for (var da in data.keys) {
|
|
||||||
for (var exec in data[da]!) {
|
|
||||||
String start = "";
|
|
||||||
String end = "";
|
|
||||||
try {
|
|
||||||
if (exec.endDate != null && exec.endDate != "") {
|
|
||||||
var startD = DateTime.parse(exec.executionData!);
|
|
||||||
var endD = DateTime.parse(exec.endDate!);
|
|
||||||
var diff = endD.difference(startD);
|
|
||||||
if (diff.inDays < 30) {
|
|
||||||
var rest = ((30 - diff.inDays) ~/ 2) - 1;
|
|
||||||
start = (startD.subtract(Duration(days: rest)).microsecondsSinceEpoch).toString();
|
|
||||||
end = (endD.add(Duration(days: rest)).microsecondsSinceEpoch).toString();
|
|
||||||
} else {
|
|
||||||
start = (startD.microsecondsSinceEpoch).toString();
|
|
||||||
end = (startD.add( const Duration(days: 29)).microsecondsSinceEpoch).toString();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
start = (DateTime.parse(exec.executionData!).subtract( const Duration(days: 14)).microsecondsSinceEpoch).toString();
|
|
||||||
end = (DateTime.parse(exec.executionData!).add( const Duration(days: 14)).microsecondsSinceEpoch).toString();
|
|
||||||
}
|
|
||||||
} catch(e) { /* */ }
|
|
||||||
k.currentState?.setState(() { k.currentState?.widget.loading = true; });
|
|
||||||
LogsService().search(context, [], {
|
|
||||||
"workflow_execution_id": exec.id,
|
|
||||||
"start": start,
|
|
||||||
"end": end
|
|
||||||
}).then((value) {
|
|
||||||
if (value.data != null) {
|
|
||||||
var d = value.data!;
|
|
||||||
for( var r in d.result) {
|
|
||||||
for (var element in r.logs) {
|
|
||||||
element.level = r.level;
|
|
||||||
exec.logs ??= [];
|
|
||||||
exec.logs!.add(element);
|
|
||||||
}
|
|
||||||
exec.logs?.sort((a, b) => a.timestamp!.compareTo(b.timestamp!));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
k.currentState?.setState(() { k.currentState?.widget.loading = false; });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Column( children: [
|
return Column( children: [
|
||||||
Container( color: lightColor,
|
Container( color: lightColor,
|
||||||
height: 50, width: getMainWidth(context),
|
height: 50, width: getMainWidth(context),
|
||||||
@ -229,8 +167,7 @@ class SchedulerPageWidgetState extends State<SchedulerPageWidget> {
|
|||||||
)
|
)
|
||||||
]))
|
]))
|
||||||
),
|
),
|
||||||
ScheduleWidget( key: k, data: data, start: widget.start, end : widget.end, isList: widget.isList, )
|
ScheduleWidget( service: widget._service, key: k, start: widget.start, end : widget.end, isList: widget.isList, )
|
||||||
]);
|
]);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,7 @@ class WorkspaceSharedPageWidgetState extends State<WorkspaceSharedPageWidget> {
|
|||||||
List<Widget> items = [];
|
List<Widget> items = [];
|
||||||
for (var w in data) {
|
for (var w in data) {
|
||||||
List<Widget> badges = [];
|
List<Widget> badges = [];
|
||||||
if (widget.type == CollaborativeAreaType.peer && w.getID(
|
if (w is Peer && w.getID(
|
||||||
) == CollaborativeAreaLocal.workspaces[CollaborativeAreaLocal.current ?? ""]?.rule?.creator) {
|
) == CollaborativeAreaLocal.workspaces[CollaborativeAreaLocal.current ?? ""]?.rule?.creator) {
|
||||||
badges.add(Padding( padding: const EdgeInsets.only(left: 5), child: Icon(Icons.star, color: Colors.orange.shade300 )));
|
badges.add(Padding( padding: const EdgeInsets.only(left: 5), child: Icon(Icons.star, color: Colors.orange.shade300 )));
|
||||||
} else if (widget.type == CollaborativeAreaType.workspace) {
|
} else if (widget.type == CollaborativeAreaType.workspace) {
|
||||||
|
@ -2,28 +2,76 @@ import 'package:alert_banner/exports.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:json_string/json_string.dart';
|
import 'package:json_string/json_string.dart';
|
||||||
import 'package:oc_front/core/sections/header/header.dart';
|
import 'package:oc_front/core/services/specialized_services/logs_service.dart';
|
||||||
import 'package:oc_front/main.dart';
|
import 'package:oc_front/main.dart';
|
||||||
import 'package:oc_front/models/logs.dart';
|
import 'package:oc_front/models/logs.dart';
|
||||||
|
import 'package:oc_front/models/workflow.dart';
|
||||||
import 'package:oc_front/widgets/dialog/alert.dart';
|
import 'package:oc_front/widgets/dialog/alert.dart';
|
||||||
|
|
||||||
class LogsWidget extends StatefulWidget {
|
class LogsWidget extends StatefulWidget {
|
||||||
final List<Log> items;
|
|
||||||
String? level;
|
String? level;
|
||||||
String search = "";
|
String search = "";
|
||||||
LogsWidget ({ Key? key, this.search = "", required this.items, this.level }): super(key: key);
|
|
||||||
|
WorkflowExecution? exec;
|
||||||
|
LogsWidget ({ Key? key, this.search = "", this.level, this.exec }): super(key: key);
|
||||||
@override LogsWidgetState createState() => LogsWidgetState();
|
@override LogsWidgetState createState() => LogsWidgetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class LogsWidgetState extends State<LogsWidget> {
|
class LogsWidgetState extends State<LogsWidget> {
|
||||||
@override Widget build(BuildContext context) {
|
@override Widget build(BuildContext context) {
|
||||||
List<LogWidget> itemRows = widget.items.where((element) => (element.message?.toLowerCase().contains(widget.search.toLowerCase()) ?? true)
|
if (widget.exec == null) {
|
||||||
&& (widget.level?.contains(element.level ?? "") ?? true) ).map((e) => LogWidget(item: e)).toList();
|
return Container();
|
||||||
return Stack( children: [
|
} else {
|
||||||
SingleChildScrollView( child: itemRows.isEmpty ?
|
String start = "";
|
||||||
Container( height: getMainHeight(context) - 100,
|
String end = "";
|
||||||
child: const Center( child: Text("no log registered", style: TextStyle(color: Colors.grey, fontSize: 25 ),)))
|
try {
|
||||||
: Column( children: [...itemRows, Container(height: 50,) ] ) ),
|
if (widget.exec!.endDate != null && widget.exec!.endDate != "") {
|
||||||
]);
|
var startD = DateTime.parse(widget.exec!.executionData!);
|
||||||
|
var endD = DateTime.parse(widget.exec!.endDate!);
|
||||||
|
var diff = endD.difference(startD);
|
||||||
|
if (diff.inDays < 30) {
|
||||||
|
var rest = ((30 - diff.inDays) ~/ 2) - 1;
|
||||||
|
start = (startD.subtract(Duration(days: rest)).microsecondsSinceEpoch).toString();
|
||||||
|
end = (endD.add(Duration(days: rest)).microsecondsSinceEpoch).toString();
|
||||||
|
} else {
|
||||||
|
start = (startD.microsecondsSinceEpoch).toString();
|
||||||
|
end = (startD.add( const Duration(days: 29)).microsecondsSinceEpoch).toString();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
start = (DateTime.parse(widget.exec!.executionData!).subtract( const Duration(days: 14)).microsecondsSinceEpoch).toString();
|
||||||
|
end = (DateTime.parse(widget.exec!.executionData!).add( const Duration(days: 14)).microsecondsSinceEpoch).toString();
|
||||||
|
}
|
||||||
|
} catch(e) { /* */ }
|
||||||
|
return FutureBuilder(future: LogsService().search(context, [], {
|
||||||
|
"workflow_execution_id": widget.exec!.id,
|
||||||
|
"start": start,
|
||||||
|
"end": end
|
||||||
|
}), builder: (a, b) {
|
||||||
|
Future.delayed(const Duration(minutes: 1), () {
|
||||||
|
setState(() {});
|
||||||
|
});
|
||||||
|
List<Log> logs = [];
|
||||||
|
if (b.data != null && b.data!.data != null) {
|
||||||
|
var d = b.data!.data!;
|
||||||
|
for( var r in d.result) {
|
||||||
|
for (var element in r.logs) {
|
||||||
|
element.level = r.level;
|
||||||
|
logs.add(element);
|
||||||
|
}
|
||||||
|
logs.sort((a, b) => a.timestamp!.compareTo(b.timestamp!));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<LogWidget> itemRows = logs.where((element) => (element.message?.toLowerCase().contains(widget.search.toLowerCase()) ?? true)
|
||||||
|
&& (widget.level?.contains(element.level ?? "") ?? true) ).map((e) => LogWidget(item: e)).toList();
|
||||||
|
return Stack( children: [
|
||||||
|
SingleChildScrollView( child: itemRows.isEmpty ?
|
||||||
|
Container( height: getMainHeight(context) - 100,
|
||||||
|
child: const Center( child: Text("no log registered", style: TextStyle(color: Colors.grey, fontSize: 25 ),)))
|
||||||
|
: Column( children: [...itemRows, Container(height: 50,) ] ) ),
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_box_transform/flutter_box_transform.dart';
|
import 'package:flutter_box_transform/flutter_box_transform.dart';
|
||||||
|
import 'package:oc_front/core/services/specialized_services/abstract_service.dart';
|
||||||
|
import 'package:oc_front/core/services/specialized_services/booking_service.dart';
|
||||||
import 'package:oc_front/main.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/models/workflow.dart';
|
||||||
import 'package:oc_front/widgets/logs.dart';
|
import 'package:oc_front/widgets/logs.dart';
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
@ -16,13 +17,14 @@ class ScheduleWidget extends StatefulWidget {
|
|||||||
DateTime end;
|
DateTime end;
|
||||||
bool isDayPlanner = true;
|
bool isDayPlanner = true;
|
||||||
bool loading = true;
|
bool loading = true;
|
||||||
Map<String, List<WorkflowExecution>> data;
|
|
||||||
bool isList = true;
|
bool isList = true;
|
||||||
bool isBox = true;
|
bool isBox = true;
|
||||||
ScheduleWidget ({ super.key, required this.data, required this.start, required this.end,
|
AbstractService<WorkflowExecutions> service;
|
||||||
|
ScheduleWidget ({ super.key, required this.start, required this.end, required this.service,
|
||||||
this.isBox =true, this.isList = true, this.loading = false});
|
this.isBox =true, this.isList = true, this.loading = false});
|
||||||
@override ScheduleWidgetState createState() => ScheduleWidgetState();
|
@override ScheduleWidgetState createState() => ScheduleWidgetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
String? selected;
|
String? selected;
|
||||||
String? selectedReal;
|
String? selectedReal;
|
||||||
class ScheduleWidgetState extends State<ScheduleWidget> {
|
class ScheduleWidgetState extends State<ScheduleWidget> {
|
||||||
@ -37,184 +39,204 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override Widget build(BuildContext context) {
|
@override Widget build(BuildContext context) {
|
||||||
bool isInfo = getMainWidth(context) <= 600 && selected != null && widget.isBox;
|
return FutureBuilder(
|
||||||
double w = selected != null && widget.isBox ? getMainWidth(context) - menuSize : getMainWidth(context);
|
future: widget.service.search(context, [
|
||||||
List<Widget> children = [];
|
"${widget.start.year}-${widget.start.month > 9 ? widget.start.month : "0${widget.start.month}"}-${widget.start.day > 9 ? widget.start.day : "0${widget.start.day}"}",
|
||||||
if (selected != null) {
|
"${widget.end.year}-${widget.end.month > 9 ? widget.end.month : "0${widget.end.month}"}-${widget.end.day > 9 ? widget.end.day : "0${widget.end.day}"}"], {}),
|
||||||
for (var wf in widget.data[selected!] ?? (<WorkflowExecution>[])) {
|
builder: (ctx, as) {
|
||||||
DateTime d2 = DateTime.parse(wf.executionData!).toLocal();
|
Future.delayed(const Duration(minutes: 1), () {
|
||||||
children.add( InkWell(
|
setState(() {});
|
||||||
onTap: () => setState(() { selectedReal = wf.executionData; }),
|
});
|
||||||
child: Container( margin: const EdgeInsets.all(10),
|
Map<String, List<WorkflowExecution>> data = {};
|
||||||
decoration: BoxDecoration(
|
if (as.hasData && as.data!.data != null) {
|
||||||
border: Border.all(color: selectedReal != null && selectedReal == wf.executionData ? lightColor : Colors.transparent, width: 2),
|
for (var element in as.data!.data!.executions) {
|
||||||
borderRadius: BorderRadius.circular(4), color: Colors.white
|
if (element.executionData == null) { continue; }
|
||||||
|
DateTime dateTime = DateTime.parse(element.executionData!);
|
||||||
|
DateTime date = DateTime(dateTime.year, dateTime.month, dateTime.day);
|
||||||
|
var str = "${date.toIso8601String()}Z";
|
||||||
|
if (data[str] == null) { data[str] = []; }
|
||||||
|
data[str]!.add(element);
|
||||||
|
data[str]!.sort((a, b) => DateTime.parse(a.executionData!).compareTo(DateTime.parse(b.executionData!)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 data[selected!] ?? (<WorkflowExecution>[])) {
|
||||||
|
DateTime d2 = DateTime.parse(wf.executionData!).toLocal();
|
||||||
|
children.add( InkWell(
|
||||||
|
onTap: () => setState(() { selectedReal = wf.executionData; }),
|
||||||
|
child: Container( margin: const EdgeInsets.all(10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: selectedReal != null && selectedReal == wf.executionData ? lightColor : Colors.transparent, width: 2),
|
||||||
|
borderRadius: BorderRadius.circular(4), color: Colors.white
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
||||||
|
child: Row(children: [
|
||||||
|
Container( width: 10, height: 10,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: colors[(wf.status ?? 1) - 1],
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox( width: (menuSize - 160),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20),
|
||||||
|
child: Text(wf.name?.toUpperCase() ?? "", overflow: TextOverflow.ellipsis,
|
||||||
|
style: const TextStyle(color: Colors.black, fontSize: 12, fontWeight: FontWeight.w500)),
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20),
|
||||||
|
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: 15,
|
||||||
|
color: Colors.grey, fontWeight: FontWeight.w500))))
|
||||||
|
])
|
||||||
|
))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
String? selectedID;
|
||||||
|
WorkflowExecution? sel;
|
||||||
|
if (selectedReal != null) {
|
||||||
|
try {
|
||||||
|
sel = data[selected!]!.firstWhere((element) => element.executionData == selectedReal);
|
||||||
|
selectedID = sel.id;
|
||||||
|
} catch(e) { /* */ }
|
||||||
|
}
|
||||||
|
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: (getMainHeight(context) - 50) > 0 ? (getMainHeight(context) - 50) : 0);
|
||||||
|
return Row( children: [
|
||||||
|
isInfo ? Container() : SizedBox( width: w,
|
||||||
|
child: widget.isList ? SchedulerItemWidget(data: data, parent: this, focusedDay: getFocusedDay(), width: w)
|
||||||
|
: SchedulerCalendarWidget(data: data, start: widget.start,
|
||||||
|
end: widget.end, parent: this, focusedDay: getFocusedDay(),)
|
||||||
),
|
),
|
||||||
child: Container(
|
!widget.isBox ? Container() : fork.TransformableBox(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
rect: rect, constraints: BoxConstraints(
|
||||||
child: Row(children: [
|
maxWidth: isInfo ? getMainWidth(context) : (selected != null ? getMainWidth(context) / 2 : 0),
|
||||||
Container( width: 10, height: 10,
|
minWidth: selected != null ? 300 : 0),
|
||||||
decoration: BoxDecoration(
|
handleTapSize: 1, handleTapLeftSize: 0, allowFlippingWhileResizing: false, draggable: false, flip: null,
|
||||||
color: colors[(wf.status ?? 1) - 1],
|
resizeModeResolver: () => ResizeMode.freeform,
|
||||||
borderRadius: BorderRadius.circular(4),
|
visibleHandles: const {HandlePosition.left},
|
||||||
),
|
enabledHandles: const {HandlePosition.left},
|
||||||
),
|
clampingRect: Offset.zero & MediaQuery.sizeOf(context),
|
||||||
SizedBox( width: (menuSize - 160),
|
handleAlignment: HandleAlignment.inside,
|
||||||
child: Padding(
|
onChanged: (result, event) { setState(() { menuSize = result.rect.width; }); },
|
||||||
padding: const EdgeInsets.only(left: 20),
|
contentBuilder: (context, rect, flip) { return Container(
|
||||||
child: Text(wf.name?.toUpperCase() ?? "", overflow: TextOverflow.ellipsis,
|
height: getMainHeight(context) - 50,
|
||||||
style: const TextStyle(color: Colors.black, fontSize: 12, fontWeight: FontWeight.w500)),
|
width: isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0),
|
||||||
)),
|
color: midColor,
|
||||||
SizedBox(
|
child: Column(
|
||||||
child: Padding(
|
children: [
|
||||||
padding: const EdgeInsets.only(left: 20),
|
Row( children: [
|
||||||
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,
|
InkWell( onTap: () => setState(() { widget.isDayPlanner = true; }),
|
||||||
style: const TextStyle(fontSize: 15,
|
child: Tooltip( message: "day planning", child:
|
||||||
color: Colors.grey, fontWeight: FontWeight.w500))))
|
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,
|
||||||
}
|
border: Border(bottom: BorderSide(color: Colors.grey.shade400), right: BorderSide(color: Colors.grey.shade400))),
|
||||||
|
child: Icon(Icons.calendar_today_outlined, color: widget.isDayPlanner ? Colors.white : Colors.grey),
|
||||||
}
|
)
|
||||||
List<Log> logs = [];
|
)),
|
||||||
String? selectedID;
|
InkWell( onTap: () => setState(() { widget.isDayPlanner = false; }),
|
||||||
if (selectedReal != null) {
|
child: Tooltip( message: "monitor task", child:
|
||||||
try {
|
Container( height: 50, width: selectedReal == null ? 0 : (
|
||||||
var sel = widget.data[selected!]!.firstWhere((element) => element.executionData == selectedReal);
|
(isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0)) / 2),
|
||||||
selectedID = sel.id;
|
alignment: Alignment.center,
|
||||||
logs = sel.logs ?? [];
|
decoration: BoxDecoration(
|
||||||
} catch(e) { /* */ }
|
color: !widget.isDayPlanner ? Colors.grey : Colors.transparent,
|
||||||
}
|
border: Border(bottom: BorderSide(color: Colors.grey.shade400))
|
||||||
menuSize = isInfo ? getMainWidth(context) : (menuSize > getMainWidth(context) / 2 ? getMainWidth(context) / 2 : menuSize);
|
),
|
||||||
Rect rect = Rect.fromCenter( center: MediaQuery.of(context).size.center(Offset.zero),
|
child: Icon(Icons.monitor_heart_outlined, size: 25,
|
||||||
width: selected != null ? menuSize : 0, height: (getMainHeight(context) - 50) > 0 ? (getMainHeight(context) - 50) : 0);
|
color: !widget.isDayPlanner ? Colors.white : Colors.grey),
|
||||||
return Row( children: [
|
)
|
||||||
isInfo ? Container() : SizedBox( width: w,
|
))
|
||||||
child: widget.isList ? SchedulerItemWidget(data: widget.data, parent: this, focusedDay: getFocusedDay(), width: w)
|
]),
|
||||||
: SchedulerCalendarWidget(data: widget.data, start: widget.start,
|
SizedBox( width: isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0), height: getMainHeight(context) - (!widget.isDayPlanner && !widget.loading ? 150 : 100 ),
|
||||||
end: widget.end, parent: this, focusedDay: getFocusedDay(),)
|
child: Stack( children: [
|
||||||
),
|
SingleChildScrollView( child: Column(
|
||||||
!widget.isBox ? Container() : fork.TransformableBox(
|
mainAxisAlignment: children.isEmpty || widget.loading ? MainAxisAlignment.center : MainAxisAlignment.start,
|
||||||
rect: rect, constraints: BoxConstraints(
|
children: [
|
||||||
maxWidth: isInfo ? getMainWidth(context) : (selected != null ? getMainWidth(context) / 2 : 0),
|
...( widget.isDayPlanner ? children : ( selectedID != null ? [
|
||||||
minWidth: selected != null ? 300 : 0),
|
widget.loading ? const SpinKitCircle(color: Colors.white,) : LogsWidget(exec: sel, search: search, level: level)
|
||||||
handleTapSize: 1, handleTapLeftSize: 0, allowFlippingWhileResizing: false, draggable: false, flip: null,
|
] : [])),
|
||||||
resizeModeResolver: () => ResizeMode.freeform,
|
children.isEmpty ? Container( height: 100, alignment: Alignment.center, child: const Text("No event found", style: TextStyle(color: Colors.grey, fontSize: 20))) : Container()
|
||||||
visibleHandles: const {HandlePosition.left},
|
]),
|
||||||
enabledHandles: const {HandlePosition.left},
|
) ])
|
||||||
clampingRect: Offset.zero & MediaQuery.sizeOf(context),
|
),
|
||||||
handleAlignment: HandleAlignment.inside,
|
!widget.isDayPlanner && !widget.loading ?
|
||||||
onChanged: (result, event) { setState(() { menuSize = result.rect.width; }); },
|
Row( children: [
|
||||||
contentBuilder: (context, rect, flip) { return Container(
|
Container(
|
||||||
height: getMainHeight(context) - 50,
|
width: 150,
|
||||||
width: isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0),
|
height: 50,
|
||||||
color: midColor,
|
decoration: BoxDecoration(
|
||||||
child: Column(
|
border: Border(left: BorderSide(color: midColor)),
|
||||||
children: [
|
),
|
||||||
Row( children: [
|
child: DropdownButtonFormField(
|
||||||
InkWell( onTap: () => setState(() { widget.isDayPlanner = true; }),
|
isExpanded: true,
|
||||||
child: Tooltip( message: "day planning", child:
|
value: level,
|
||||||
Container( height: 50, width: (isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0)) / (selectedReal != null ? 2 : 1 ),
|
style: const TextStyle(fontSize: 12),
|
||||||
alignment: Alignment.center,
|
hint: const Text("by level...", style: TextStyle(fontSize: 12)),
|
||||||
decoration: BoxDecoration(
|
decoration: InputDecoration(
|
||||||
color: widget.isDayPlanner ? Colors.grey : Colors.transparent,
|
filled: true,
|
||||||
border: Border(bottom: BorderSide(color: Colors.grey.shade400), right: BorderSide(color: Colors.grey.shade400))),
|
focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.zero,
|
||||||
child: Icon(Icons.calendar_today_outlined, color: widget.isDayPlanner ? Colors.white : Colors.grey),
|
borderSide: BorderSide(color: lightColor, width: 0),
|
||||||
)
|
),
|
||||||
)),
|
fillColor: Colors.white,
|
||||||
InkWell( onTap: () => setState(() { widget.isDayPlanner = false; }),
|
contentPadding: const EdgeInsets.only(left: 30, right: 30, top: 10, bottom: 30),
|
||||||
child: Tooltip( message: "monitor task", child:
|
enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.zero,
|
||||||
Container( height: 50, width: selectedReal == null ? 0 : (
|
borderSide: BorderSide(color: midColor, width: 0),
|
||||||
(isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0)) / 2),
|
),
|
||||||
alignment: Alignment.center,
|
border: OutlineInputBorder( borderRadius: BorderRadius.zero,
|
||||||
decoration: BoxDecoration(
|
borderSide: BorderSide(color: midColor, width: 0)),
|
||||||
color: !widget.isDayPlanner ? Colors.grey : Colors.transparent,
|
),
|
||||||
border: Border(bottom: BorderSide(color: Colors.grey.shade400))
|
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)) ])),
|
||||||
child: Icon(Icons.monitor_heart_outlined, size: 25,
|
DropdownMenuItem(value: "debug", child: Row( children: [ Container( width: 10, height: 15, color: Colors.blue), Text(" debug", style: TextStyle(fontSize: 12, color: Colors.black)) ])),
|
||||||
color: !widget.isDayPlanner ? Colors.white : Colors.grey),
|
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: 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)) ])),
|
||||||
]),
|
],
|
||||||
SizedBox( width: isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0), height: getMainHeight(context) - (!widget.isDayPlanner && !widget.loading ? 150 : 100 ),
|
onChanged: (value) {
|
||||||
child: Stack( children: [
|
setState(() {
|
||||||
SingleChildScrollView( child: Column(
|
level = value;
|
||||||
mainAxisAlignment: children.isEmpty || widget.loading ? MainAxisAlignment.center : MainAxisAlignment.start,
|
});
|
||||||
children: [
|
})),
|
||||||
...( widget.isDayPlanner ? children : ( selectedID != null ? [
|
Container(
|
||||||
widget.loading ? const SpinKitCircle(color: Colors.white,) : LogsWidget(items: logs, search: search, level: level)
|
width: menuSize - 150,
|
||||||
] : [])),
|
height: 50,
|
||||||
children.isEmpty ? Container( height: 100, alignment: Alignment.center, child: const Text("No event found", style: TextStyle(color: Colors.grey, fontSize: 20))) : Container()
|
decoration: BoxDecoration(
|
||||||
]),
|
border: Border(left: BorderSide(color: midColor)),
|
||||||
) ])
|
),
|
||||||
|
child: TextField(
|
||||||
|
onChanged: (value) { setState(() {
|
||||||
|
search = value;
|
||||||
|
});},
|
||||||
|
style: const TextStyle(fontSize: 12),
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
hintText: "by logs...",
|
||||||
|
fillColor: Colors.white,
|
||||||
|
filled: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(horizontal: 30),
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w300
|
||||||
|
),
|
||||||
|
border: InputBorder.none
|
||||||
|
)
|
||||||
|
)) ]
|
||||||
|
) : Container( ),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
!widget.isDayPlanner && !widget.loading ?
|
); })
|
||||||
Row( children: [
|
]);
|
||||||
Container(
|
});
|
||||||
width: 150,
|
|
||||||
height: 50,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(left: BorderSide(color: midColor)),
|
|
||||||
),
|
|
||||||
child: DropdownButtonFormField(
|
|
||||||
isExpanded: true,
|
|
||||||
value: level,
|
|
||||||
style: const TextStyle(fontSize: 12),
|
|
||||||
hint: const Text("by level...", style: TextStyle(fontSize: 12)),
|
|
||||||
decoration: InputDecoration(
|
|
||||||
filled: true,
|
|
||||||
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: midColor, width: 0),
|
|
||||||
),
|
|
||||||
border: OutlineInputBorder( borderRadius: BorderRadius.zero,
|
|
||||||
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: 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) {
|
|
||||||
setState(() {
|
|
||||||
level = value;
|
|
||||||
});
|
|
||||||
})),
|
|
||||||
Container(
|
|
||||||
width: menuSize - 150,
|
|
||||||
height: 50,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(left: BorderSide(color: midColor)),
|
|
||||||
),
|
|
||||||
child: TextField(
|
|
||||||
onChanged: (value) { setState(() {
|
|
||||||
search = value;
|
|
||||||
});},
|
|
||||||
style: const TextStyle(fontSize: 12),
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
hintText: "by logs...",
|
|
||||||
fillColor: Colors.white,
|
|
||||||
filled: true,
|
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 30),
|
|
||||||
hintStyle: TextStyle(
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.w300
|
|
||||||
),
|
|
||||||
border: InputBorder.none
|
|
||||||
)
|
|
||||||
)) ]
|
|
||||||
) : Container( ),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
); })
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user