Compare commits
4 Commits
6b362d77f0
...
feature/na
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d6b4bf3b3 | |||
| 313ef43e9c | |||
| 058633742e | |||
| e1968e14b0 |
@@ -8,11 +8,7 @@ class WorkflowExecutionService extends AbstractService<WorkflowExecutions> {
|
|||||||
@override APIService<WorkflowExecutions> service = APIService<WorkflowExecutions>(
|
@override APIService<WorkflowExecutions> service = APIService<WorkflowExecutions>(
|
||||||
baseURL: const String.fromEnvironment('SCHEDULER_HOST', defaultValue: 'http://localhost:8080/scheduler')
|
baseURL: const String.fromEnvironment('SCHEDULER_HOST', defaultValue: 'http://localhost:8080/scheduler')
|
||||||
);
|
);
|
||||||
@override String subPath = "/";
|
@override String subPath = "/execution/";
|
||||||
|
|
||||||
Future<APIResponse<WorkflowExecutions>> schedule(BuildContext? context, String id, Map<String, dynamic> body, Map<String, dynamic> params) {
|
|
||||||
return service.post("${subPath}workflow/$id", body, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@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) {
|
||||||
return service.get("${subPath}search/${words.join("/")}", false, context);
|
return service.get("${subPath}search/${words.join("/")}", false, context);
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:oc_front/core/services/api_service.dart';
|
||||||
|
import 'package:oc_front/core/services/specialized_services/abstract_service.dart';
|
||||||
|
import 'package:oc_front/models/response.dart';
|
||||||
|
import 'package:oc_front/models/workflow.dart';
|
||||||
|
|
||||||
|
class SchedulerService extends AbstractService<WorkflowExecution> {
|
||||||
|
@override APIService<WorkflowExecution> service = APIService<WorkflowExecution>(
|
||||||
|
baseURL: const String.fromEnvironment('SCHEDULER_HOST', defaultValue: 'http://localhost:8080/scheduler')
|
||||||
|
);
|
||||||
|
@override String subPath = "/";
|
||||||
|
|
||||||
|
Future<APIResponse<WorkflowExecution>> schedule(BuildContext? context, String id, Map<String, dynamic> body, Map<String, dynamic> params) {
|
||||||
|
print("$subPath$id");
|
||||||
|
return service.post("$subPath$id", body, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override Future<APIResponse<WorkflowExecution>> search(BuildContext? context, List<String> words, Map<String, dynamic> params) {
|
||||||
|
return throw UnimplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override Future<APIResponse<WorkflowExecution>> post(BuildContext? context, Map<String, dynamic> body, Map<String, String> params) {
|
||||||
|
return throw UnimplementedError();
|
||||||
|
}
|
||||||
|
@override Future<APIResponse<WorkflowExecution>> put(BuildContext? context, String id, Map<String, dynamic> body, Map<String, String> params) {
|
||||||
|
return throw UnimplementedError();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -147,6 +147,34 @@ class Param extends SerializerDeserializer<Param> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Credential extends SerializerDeserializer<Credential> {
|
||||||
|
String? login;
|
||||||
|
String? password;
|
||||||
|
|
||||||
|
Credential({
|
||||||
|
this.login,
|
||||||
|
this.password,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Credential deserialize(json) {
|
||||||
|
try { json = json as Map<String, dynamic>;
|
||||||
|
} catch (e) { return Credential(); }
|
||||||
|
return Credential(
|
||||||
|
login: json.containsKey("login") ? json["login"] : null,
|
||||||
|
password: json.containsKey("password") ? json["password"] : null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> serialize() {
|
||||||
|
return {
|
||||||
|
"login": login,
|
||||||
|
"password": password,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
abstract class AbstractItem<X extends AbstractPricing, Y extends AbstractPartnerShip<X>, S extends AbstractInstance<X,Y>, T extends FlowData> extends FlowData implements SerializerDeserializer<T>, Infos {
|
abstract class AbstractItem<X extends AbstractPricing, Y extends AbstractPartnerShip<X>, S extends AbstractInstance<X,Y>, T extends FlowData> extends FlowData implements SerializerDeserializer<T>, Infos {
|
||||||
String? id;
|
String? id;
|
||||||
String? name;
|
String? name;
|
||||||
@@ -193,7 +221,7 @@ abstract class AbstractItem<X extends AbstractPricing, Y extends AbstractPartner
|
|||||||
|
|
||||||
AbstractInstance<X,Y>? getSelectedInstance() {
|
AbstractInstance<X,Y>? getSelectedInstance() {
|
||||||
if (selectedInstance == -1) { return instances.isEmpty ? null : instances[0]; }
|
if (selectedInstance == -1) { return instances.isEmpty ? null : instances[0]; }
|
||||||
return instances[selectedInstance];
|
return instances.isNotEmpty ? instances[selectedInstance] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override String getID() {
|
@override String getID() {
|
||||||
@@ -303,6 +331,8 @@ abstract class AbstractInstance<X extends AbstractPricing, S extends AbstractPar
|
|||||||
List<Param> env = [];
|
List<Param> env = [];
|
||||||
List<Param> inputs = [];
|
List<Param> inputs = [];
|
||||||
List<Param> outputs = [];
|
List<Param> outputs = [];
|
||||||
|
Credential? credential;
|
||||||
|
|
||||||
|
|
||||||
bool isEnv(String key) {
|
bool isEnv(String key) {
|
||||||
for (var e in env) {
|
for (var e in env) {
|
||||||
@@ -331,6 +361,7 @@ abstract class AbstractInstance<X extends AbstractPricing, S extends AbstractPar
|
|||||||
this.inputs = json.containsKey("inputs") ? fromListJson(json["inputs"], Param()) : [];
|
this.inputs = json.containsKey("inputs") ? fromListJson(json["inputs"], Param()) : [];
|
||||||
this.outputs = json.containsKey("outputs") ? fromListJson(json["outputs"], Param()) : [];
|
this.outputs = json.containsKey("outputs") ? fromListJson(json["outputs"], Param()) : [];
|
||||||
this.location = json.containsKey("location") ? Location().deserialize(json["location"]) : null;
|
this.location = json.containsKey("location") ? Location().deserialize(json["location"]) : null;
|
||||||
|
this.credential = json.containsKey("credential") ? Credential().deserialize(json["credential"]) : null;
|
||||||
this.partnerships = json.containsKey("partnerships") ? fromListJson(json["partnerships"], ex) : [];
|
this.partnerships = json.containsKey("partnerships") ? fromListJson(json["partnerships"], ex) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,6 +374,7 @@ abstract class AbstractInstance<X extends AbstractPricing, S extends AbstractPar
|
|||||||
"env": toListJson(env),
|
"env": toListJson(env),
|
||||||
"inputs": toListJson(inputs),
|
"inputs": toListJson(inputs),
|
||||||
"outputs": toListJson(outputs),
|
"outputs": toListJson(outputs),
|
||||||
|
"credential": credential?.serialize(), // TODO CREDENTIAL FORM
|
||||||
"partnerships": partnerships.map((e) => e.serialize()).toList(),
|
"partnerships": partnerships.map((e) => e.serialize()).toList(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -587,7 +587,6 @@ class WorkspaceSharedItemPageWidgetState extends State<WorkspaceSharedItemPageWi
|
|||||||
await PeerService().all(context).then((value) {
|
await PeerService().all(context).then((value) {
|
||||||
if (value.data != null) {
|
if (value.data != null) {
|
||||||
shals = value.data!.values.where( (e) {
|
shals = value.data!.values.where( (e) {
|
||||||
print("e: $e ${e["id"]} ${current?.creatorID}");
|
|
||||||
return e["id"] != current?.creatorID;
|
return e["id"] != current?.creatorID;
|
||||||
}
|
}
|
||||||
).map((e) => Shallow(id: e["id"], name: e["name"])).toList();
|
).map((e) => Shallow(id: e["id"], name: e["name"])).toList();
|
||||||
|
|||||||
58
lib/widgets/forms/credentials_forms.dart
Normal file
58
lib/widgets/forms/credentials_forms.dart
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_flow_chart/flutter_flow_chart.dart';
|
||||||
|
import 'package:oc_front/models/resources/resources.dart';
|
||||||
|
import 'package:oc_front/widgets/inputs/sub_text_input.dart';
|
||||||
|
|
||||||
|
// ignore: must_be_immutable
|
||||||
|
class CredentialsFormsWidget extends StatefulWidget {
|
||||||
|
int instanceID = 0;
|
||||||
|
Dashboard dash;
|
||||||
|
AbstractItem item;
|
||||||
|
String elementID;
|
||||||
|
CredentialsFormsWidget({ super.key, required this.item, required this.dash, required this.elementID });
|
||||||
|
@override CredentialsFormsWidgetState createState() => CredentialsFormsWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class CredentialsFormsWidgetState extends State<CredentialsFormsWidget> {
|
||||||
|
@override Widget build(BuildContext context) {
|
||||||
|
List<Widget> widgets = [];
|
||||||
|
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(
|
||||||
|
padding: const EdgeInsets.only(bottom: 10),
|
||||||
|
width: 180,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text("<CREDENTIALS>", style: const TextStyle(fontSize: 13, fontWeight: FontWeight.bold), textAlign: TextAlign.center),
|
||||||
|
SubTextInputWidget(subkey: "login", width: 180, empty: false, change: (value) {
|
||||||
|
creds.password = value;
|
||||||
|
for (var el in widget.dash.elements) {
|
||||||
|
if (el.id == widget.elementID) {
|
||||||
|
el.element = widget.item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
widget.dash.saveDash(widget.dash.id, context);
|
||||||
|
}, initialValue: creds.login),
|
||||||
|
SubTextInputWidget(subkey: "password", width: 180, empty: false, change: (value) {
|
||||||
|
creds.password = value;
|
||||||
|
for (var el in widget.dash.elements) {
|
||||||
|
if (el.id == widget.elementID) {
|
||||||
|
el.element = widget.item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
widget.dash.saveDash(widget.dash.id, context);
|
||||||
|
}, initialValue: creds.password, readOnly: false,),
|
||||||
|
],)
|
||||||
|
));
|
||||||
|
widgets.add(Container( padding: EdgeInsets.only(bottom: 15), width: 200 ));
|
||||||
|
}
|
||||||
|
return Column(children: widgets);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:oc_front/models/workflow.dart';
|
import 'package:oc_front/models/workflow.dart';
|
||||||
import 'package:oc_front/models/resources/resources.dart';
|
import 'package:oc_front/models/resources/resources.dart';
|
||||||
import 'package:oc_front/core/services/perms_service.dart';
|
import 'package:oc_front/core/services/perms_service.dart';
|
||||||
|
import 'package:oc_front/widgets/forms/credentials_forms.dart';
|
||||||
import 'package:oc_front/widgets/forms/sub_keys_forms.dart';
|
import 'package:oc_front/widgets/forms/sub_keys_forms.dart';
|
||||||
import 'package:flutter_flow_chart/flutter_flow_chart.dart';
|
import 'package:flutter_flow_chart/flutter_flow_chart.dart';
|
||||||
import 'package:oc_front/widgets/inputs/sub_text_input.dart';
|
import 'package:oc_front/widgets/inputs/sub_text_input.dart';
|
||||||
@@ -77,6 +78,7 @@ class ResourceFormsWidgetState extends State<ResourceFormsWidget> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
instancesCat.add(ContainerFormsWidget(dash: widget.dash, item: widget.item, elementID: widget.elementID));
|
instancesCat.add(ContainerFormsWidget(dash: widget.dash, item: widget.item, elementID: widget.elementID));
|
||||||
|
instancesCat.add(CredentialsFormsWidget(dash: widget.dash, item: widget.item, elementID: widget.elementID));
|
||||||
if (instancesCat.isNotEmpty) {
|
if (instancesCat.isNotEmpty) {
|
||||||
instancesCat.add(Container(
|
instancesCat.add(Container(
|
||||||
width: 200, decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))),
|
width: 200, decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
import 'package:cron/cron.dart';
|
import 'package:cron/cron.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/core/services/specialized_services/workflow_scheduler_service.dart';
|
||||||
import 'package:oc_front/main.dart';
|
import 'package:oc_front/main.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;
|
||||||
@@ -33,13 +34,15 @@ class SchedulerFormsWidget extends StatefulWidget {
|
|||||||
String? errorEndDate;
|
String? errorEndDate;
|
||||||
String? errorCron;
|
String? errorCron;
|
||||||
Function validate = () {};
|
Function validate = () {};
|
||||||
final WorkflowExecutionService _service = WorkflowExecutionService();
|
final SchedulerService _schedulerService = SchedulerService();
|
||||||
|
final WorkflowExecutionService _executionService = WorkflowExecutionService();
|
||||||
SchedulerFormsWidget ({ super.key, required this.item, });
|
SchedulerFormsWidget ({ super.key, required this.item, });
|
||||||
@override SchedulerFormsWidgetState createState() => SchedulerFormsWidgetState();
|
@override SchedulerFormsWidgetState createState() => SchedulerFormsWidgetState();
|
||||||
}
|
}
|
||||||
class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
|
class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
|
||||||
CheckService check = CheckService();
|
CheckService check = CheckService();
|
||||||
void save(List<GlobalKey<FormFieldState>> formKeys) {
|
void save(List<GlobalKey<FormFieldState>> formKeys) {
|
||||||
|
print("save");
|
||||||
widget.error = null;
|
widget.error = null;
|
||||||
widget.errorEndDate = null;
|
widget.errorEndDate = null;
|
||||||
widget.errorCron = null;
|
widget.errorCron = null;
|
||||||
@@ -81,7 +84,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Duration durationBefore = widget.schedule.start!.difference(DateTime.now().toUtc()) + Duration(seconds: 5);
|
Duration durationBefore = widget.schedule.start!.difference(DateTime.now().toUtc()) + Duration(seconds: 5);
|
||||||
widget._service.schedule(context, widget.item.id ?? "", widget.schedule.serialize(), {}).then((value) {
|
widget._schedulerService.schedule(context, widget.item.id ?? "", widget.schedule.serialize(), {}).then((value) {
|
||||||
setState(() { widget.valid = true; });
|
setState(() { widget.valid = true; });
|
||||||
Future.delayed(durationBefore, () {
|
Future.delayed(durationBefore, () {
|
||||||
try {
|
try {
|
||||||
@@ -131,7 +134,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
|
|||||||
@override Widget build(BuildContext context) {
|
@override Widget build(BuildContext context) {
|
||||||
if (widget.shouldSearch && widget.item.name != "") {
|
if (widget.shouldSearch && widget.item.name != "") {
|
||||||
widget.shouldSearch = false;
|
widget.shouldSearch = false;
|
||||||
widget._service.search(null, [widget.item.name], {}).then((value) {
|
widget._executionService.search(null, [widget.item.name], {}).then((value) {
|
||||||
if (value.data != null) {
|
if (value.data != null) {
|
||||||
try {
|
try {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -480,13 +483,14 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
|
|||||||
Container(
|
Container(
|
||||||
width: 200,
|
width: 200,
|
||||||
height: 20,
|
height: 20,
|
||||||
decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
|
decoration: BoxDecoration(border: Border(bottom: BorderSide(color:
|
||||||
|
PermsService.getPerm(Perms.WORKFLOW_BOOKING)? Colors.grey : Colors.transparent, width: 1))),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 200,
|
width: 200,
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
Tooltip( message: "check booking", child: InkWell( mouseCursor: SystemMouseCursors.click,
|
PermsService.getPerm(Perms.WORKFLOW_BOOKING)? Tooltip( message: "check booking", child: InkWell( mouseCursor: SystemMouseCursors.click,
|
||||||
onTap: () { PermsService.getPerm(Perms.WORKFLOW_BOOKING) ? checkBooking(formKeys, null) : null;
|
onTap: () { PermsService.getPerm(Perms.WORKFLOW_BOOKING) ? checkBooking(formKeys, null) : null;
|
||||||
}, child: Container( margin: const EdgeInsets.only(bottom: 5, left: 10, right: 10),
|
}, child: Container( margin: const EdgeInsets.only(bottom: 5, left: 10, right: 10),
|
||||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5),
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5),
|
||||||
@@ -497,17 +501,17 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
|
|||||||
child: Icon( Icons.verified_outlined,
|
child: Icon( Icons.verified_outlined,
|
||||||
color: widget.booking == null ? Colors.black : (widget.booking == true ? Colors.green : redColor)),
|
color: widget.booking == null ? Colors.black : (widget.booking == true ? Colors.green : redColor)),
|
||||||
))
|
))
|
||||||
),
|
): Container(),
|
||||||
Tooltip( message: "book", child: InkWell( mouseCursor: SystemMouseCursors.click,
|
PermsService.getPerm(Perms.WORKFLOW_BOOKING) ? Tooltip( message: "book", child: InkWell( mouseCursor: SystemMouseCursors.click,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
PermsService.getPerm(Perms.WORKFLOW_BOOKING) && PermsService.getPerm(Perms.WORKFLOW_EDIT) ? setState(() { save(formKeys); }) : null;
|
setState(() { save(formKeys); });
|
||||||
}, child: Container( margin: const EdgeInsets.only(top: 5, bottom: 10, left: 10, right: 10),
|
}, child: Container( margin: const EdgeInsets.only(top: 5, bottom: 10, left: 10, right: 10),
|
||||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5),
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5),
|
||||||
border: Border.all(color: dash.error != null ? Colors.red : ( PermsService.getPerm(Perms.WORKFLOW_BOOKING) ?(widget.valid ? Colors.green : Colors.black) : Colors.grey ))),
|
border: Border.all(color: dash.error != null ? Colors.red : ( PermsService.getPerm(Perms.WORKFLOW_BOOKING) ?(widget.valid ? Colors.green : Colors.black) : Colors.grey ))),
|
||||||
width: 200, height: 30,
|
width: 200, height: 30,
|
||||||
child: Icon(Icons.schedule_send, color: dash.error != null ? Colors.red : (widget.valid ? Colors.green : Colors.black)),
|
child: Icon(Icons.schedule_send, color: dash.error != null ? Colors.red : (widget.valid ? Colors.green : Colors.black)),
|
||||||
))
|
))
|
||||||
),
|
) : Container(),
|
||||||
Column( children: [
|
Column( children: [
|
||||||
Container(
|
Container(
|
||||||
height: 15, width: 200,
|
height: 15, width: 200,
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ class ShallowDropdownInputWidgetState extends State<ShallowDropdownInputWidget>
|
|||||||
child:InkWell(
|
child:InkWell(
|
||||||
mouseCursor: SystemMouseCursors.click,
|
mouseCursor: SystemMouseCursors.click,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
print("load ${widget.current}");
|
|
||||||
if (widget.canLoad == null || !widget.canLoad!(widget.current)
|
if (widget.canLoad == null || !widget.canLoad!(widget.current)
|
||||||
|| widget.load == null || widget.current == null) {
|
|| widget.load == null || widget.current == null) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -8,17 +8,28 @@ import 'package:oc_front/widgets/dialog/alert.dart';
|
|||||||
import 'package:json_string/json_string.dart';
|
import 'package:json_string/json_string.dart';
|
||||||
import 'package:oc_front/core/services/specialized_services/logs_service.dart';
|
import 'package:oc_front/core/services/specialized_services/logs_service.dart';
|
||||||
|
|
||||||
|
bool isLoading = true;
|
||||||
|
Map<String, bool> valid = {};
|
||||||
class LogsWidget extends StatefulWidget {
|
class LogsWidget extends StatefulWidget {
|
||||||
String? level;
|
String? level;
|
||||||
String search = "";
|
String search = "";
|
||||||
|
|
||||||
WorkflowExecution? exec;
|
WorkflowExecution? exec;
|
||||||
|
List<Log> logs = [];
|
||||||
LogsWidget ({ Key? key, this.search = "", this.level, this.exec }): super(key: key);
|
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) {
|
||||||
|
if (!isLoading) {
|
||||||
|
isLoading = true;
|
||||||
|
Future.delayed(const Duration(milliseconds: 100), () {
|
||||||
|
try { setState(() { });
|
||||||
|
} catch (e) { /**/ }
|
||||||
|
});
|
||||||
|
return Container( height: getMainHeight(context) - 100,
|
||||||
|
child: Center( child: CircularProgressIndicator()) );
|
||||||
|
}
|
||||||
if (widget.exec == null) {
|
if (widget.exec == null) {
|
||||||
return Container();
|
return Container();
|
||||||
} else {
|
} else {
|
||||||
@@ -42,16 +53,18 @@ class LogsWidgetState extends State<LogsWidget> {
|
|||||||
end = (DateTime.parse(widget.exec!.startDate!).add( const Duration(days: 14)).microsecondsSinceEpoch).toString();
|
end = (DateTime.parse(widget.exec!.startDate!).add( const Duration(days: 14)).microsecondsSinceEpoch).toString();
|
||||||
}
|
}
|
||||||
} catch(e) { /* */ }
|
} catch(e) { /* */ }
|
||||||
|
Future.delayed(const Duration(minutes: 1), () {
|
||||||
|
try { setState(() {});
|
||||||
|
} catch (e) { /**/ }
|
||||||
|
});
|
||||||
return FutureBuilder(future: LogsService().search(context, [], {
|
return FutureBuilder(future: LogsService().search(context, [], {
|
||||||
"workflow_execution_id": widget.exec!.id,
|
"workflow_execution_id": widget.exec!.id,
|
||||||
"start": start,
|
"start": start,
|
||||||
"end": end
|
"end": end
|
||||||
}), builder: (a, b) {
|
}), builder: (a, b) {
|
||||||
Future.delayed(const Duration(minutes: 1), () {
|
|
||||||
setState(() {});
|
|
||||||
});
|
|
||||||
List<Log> logs = [];
|
List<Log> logs = [];
|
||||||
if (b.data != null && b.data!.data != null) {
|
if (b.data != null && b.data!.data != null) {
|
||||||
|
isLoading = false;
|
||||||
var d = b.data!.data!;
|
var d = b.data!.data!;
|
||||||
for( var r in d.result) {
|
for( var r in d.result) {
|
||||||
for (var element in r.logs) {
|
for (var element in r.logs) {
|
||||||
@@ -63,6 +76,10 @@ class LogsWidgetState extends State<LogsWidget> {
|
|||||||
}
|
}
|
||||||
List<LogWidget> itemRows = logs.where((element) => (element.message?.toLowerCase().contains(widget.search.toLowerCase()) ?? true)
|
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();
|
&& (widget.level?.contains(element.level ?? "") ?? true) ).map((e) => LogWidget(item: e)).toList();
|
||||||
|
if (isLoading) {
|
||||||
|
return Container( height: getMainHeight(context) - 100,
|
||||||
|
child: Center( child: CircularProgressIndicator()) );
|
||||||
|
}
|
||||||
return Stack( children: [
|
return Stack( children: [
|
||||||
SingleChildScrollView( child: itemRows.isEmpty ?
|
SingleChildScrollView( child: itemRows.isEmpty ?
|
||||||
Container( height: getMainHeight(context) - 100,
|
Container( height: getMainHeight(context) - 100,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import 'package:oc_front/main.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:oc_front/widgets/logs.dart';
|
import 'package:oc_front/widgets/logs.dart';
|
||||||
import 'package:oc_front/models/workflow.dart';
|
import 'package:oc_front/models/workflow.dart';
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
|
||||||
import 'package:flutter_box_transform/flutter_box_transform.dart';
|
import 'package:flutter_box_transform/flutter_box_transform.dart';
|
||||||
import 'package:oc_front/widgets/lib/tranformablebox.dart' as fork;
|
import 'package:oc_front/widgets/lib/tranformablebox.dart' as fork;
|
||||||
import 'package:oc_front/widgets/sheduler_items/scheduler_item.dart';
|
import 'package:oc_front/widgets/sheduler_items/scheduler_item.dart';
|
||||||
@@ -19,6 +18,7 @@ class ScheduleWidget extends StatefulWidget {
|
|||||||
bool loading = true;
|
bool loading = true;
|
||||||
bool isList = true;
|
bool isList = true;
|
||||||
bool isBox = true;
|
bool isBox = true;
|
||||||
|
String? selectedID;
|
||||||
AbstractService<WorkflowExecutions> service = WorkflowExecutionService();
|
AbstractService<WorkflowExecutions> service = WorkflowExecutionService();
|
||||||
ScheduleWidget ({ super.key, required this.start, required this.end,
|
ScheduleWidget ({ super.key, required this.start, required this.end,
|
||||||
this.isBox =true, this.isList = true, this.loading = false});
|
this.isBox =true, this.isList = true, this.loading = false});
|
||||||
@@ -62,7 +62,9 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
|
|||||||
for (var wf in data[selected!] ?? (<WorkflowExecution>[])) {
|
for (var wf in data[selected!] ?? (<WorkflowExecution>[])) {
|
||||||
DateTime d2 = DateTime.parse(wf.startDate!).toLocal();
|
DateTime d2 = DateTime.parse(wf.startDate!).toLocal();
|
||||||
children.add( InkWell(
|
children.add( InkWell(
|
||||||
onTap: () => setState(() { selectedReal = wf.startDate; }),
|
onTap: () => setState(() {
|
||||||
|
selectedReal = wf.startDate;
|
||||||
|
}),
|
||||||
child: Container( margin: const EdgeInsets.all(10),
|
child: Container( margin: const EdgeInsets.all(10),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: selectedReal != null && selectedReal == wf.startDate ? lightColor : Colors.transparent, width: 2),
|
border: Border.all(color: selectedReal != null && selectedReal == wf.startDate ? lightColor : Colors.transparent, width: 2),
|
||||||
@@ -94,12 +96,12 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String? selectedID;
|
|
||||||
WorkflowExecution? sel;
|
WorkflowExecution? sel;
|
||||||
if (selectedReal != null) {
|
if (selectedReal != null) {
|
||||||
try {
|
try {
|
||||||
sel = data[selected!]!.firstWhere((element) => element.startDate == selectedReal);
|
sel = data[selected!]!.firstWhere((element) => element.startDate == selectedReal);
|
||||||
selectedID = sel.id;
|
widget.selectedID = sel.id;
|
||||||
} catch(e) { /* */ }
|
} catch(e) { /* */ }
|
||||||
}
|
}
|
||||||
menuSize = isInfo ? getMainWidth(context) : (menuSize > getMainWidth(context) / 2 ? getMainWidth(context) / 2 : menuSize);
|
menuSize = isInfo ? getMainWidth(context) : (menuSize > getMainWidth(context) / 2 ? getMainWidth(context) / 2 : menuSize);
|
||||||
@@ -129,7 +131,9 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Row( children: [
|
Row( children: [
|
||||||
InkWell( onTap: () => setState(() { widget.isDayPlanner = true; }),
|
InkWell( onTap: () => setState(() {
|
||||||
|
widget.isDayPlanner = true;
|
||||||
|
}),
|
||||||
child: Tooltip( message: "day planning", child:
|
child: Tooltip( message: "day planning", child:
|
||||||
Container( height: 50, width: (isInfo ? getMainWidth(context) : (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,
|
alignment: Alignment.center,
|
||||||
@@ -139,7 +143,10 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
|
|||||||
child: Icon(Icons.calendar_today_outlined, color: widget.isDayPlanner ? Colors.white : Colors.grey),
|
child: Icon(Icons.calendar_today_outlined, color: widget.isDayPlanner ? Colors.white : Colors.grey),
|
||||||
)
|
)
|
||||||
)),
|
)),
|
||||||
InkWell( onTap: () => setState(() { widget.isDayPlanner = false; }),
|
InkWell( onTap: () => setState(() {
|
||||||
|
widget.isDayPlanner = false;
|
||||||
|
|
||||||
|
}),
|
||||||
child: Tooltip( message: "monitor task", child:
|
child: Tooltip( message: "monitor task", child:
|
||||||
Container( height: 50, width: selectedReal == null ? 0 : (
|
Container( height: 50, width: selectedReal == null ? 0 : (
|
||||||
(isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0)) / 2),
|
(isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0)) / 2),
|
||||||
@@ -158,8 +165,8 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
|
|||||||
SingleChildScrollView( child: Column(
|
SingleChildScrollView( child: Column(
|
||||||
mainAxisAlignment: children.isEmpty || widget.loading ? MainAxisAlignment.center : MainAxisAlignment.start,
|
mainAxisAlignment: children.isEmpty || widget.loading ? MainAxisAlignment.center : MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
...( widget.isDayPlanner ? children : ( selectedID != null ? [
|
...( widget.isDayPlanner ? children : ( widget.selectedID != null ? [
|
||||||
widget.loading ? const SpinKitCircle(color: Colors.white,) : LogsWidget(exec: sel, search: search, level: level)
|
LogsWidget(exec: sel, search: search, level: level)
|
||||||
] : [])),
|
] : [])),
|
||||||
children.isEmpty ? Container( height: 100, alignment: Alignment.center, child: const Text("No event found", style: TextStyle(color: Colors.grey, fontSize: 20))) : Container()
|
children.isEmpty ? Container( height: 100, alignment: Alignment.center, child: const Text("No event found", style: TextStyle(color: Colors.grey, fontSize: 20))) : Container()
|
||||||
]),
|
]),
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
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/main.dart';
|
||||||
import 'package:oc_front/models/workflow.dart';
|
import 'package:oc_front/models/workflow.dart';
|
||||||
import 'package:oc_front/widgets/sheduler_items/schedule.dart';
|
import 'package:oc_front/widgets/sheduler_items/schedule.dart';
|
||||||
@@ -34,7 +32,9 @@ class SchedulerItemWidgetState extends State<SchedulerItemWidget> {
|
|||||||
widgets.add(InkWell(
|
widgets.add(InkWell(
|
||||||
onTap: () => widget.parent?.setState(() {
|
onTap: () => widget.parent?.setState(() {
|
||||||
selected = selected != element || ev.startDate != selectedReal ? element : null;
|
selected = selected != element || ev.startDate != selectedReal ? element : null;
|
||||||
|
widget.parent!.widget.selectedID = selected;
|
||||||
selectedReal = selected == null ? null : ev.startDate;
|
selectedReal = selected == null ? null : ev.startDate;
|
||||||
|
print("there");
|
||||||
if (selectedReal == null) {
|
if (selectedReal == null) {
|
||||||
widget.parent!.widget.isDayPlanner = true;
|
widget.parent!.widget.isDayPlanner = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ class Dashboard extends ChangeNotifier {
|
|||||||
try {
|
try {
|
||||||
var element = elements.firstWhere((element) => element.id == id);
|
var element = elements.firstWhere((element) => element.id == id);
|
||||||
element.element?.addEnv(elInfos[id] ?? []);
|
element.element?.addEnv(elInfos[id] ?? []);
|
||||||
} catch (e) { print("THERE ??? ${id} ${e}"); }
|
} catch (e) { /* */ }
|
||||||
}
|
}
|
||||||
for(var ar in graph['graph']['arrows']) {
|
for(var ar in graph['graph']['arrows']) {
|
||||||
var arr = arrows.where((a) => a.fromID == ar['from']['id'] && a.toID == ar['to']['id']).toList();
|
var arr = arrows.where((a) => a.fromID == ar['from']['id'] && a.toID == ar['to']['id']).toList();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:flutter_flow_chart/src/ui/draw_arrow.dart';
|
|||||||
import 'package:flutter_flow_chart/flutter_flow_chart.dart';
|
import 'package:flutter_flow_chart/flutter_flow_chart.dart';
|
||||||
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
|
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
|
||||||
import 'package:number_text_input_formatter/number_text_input_formatter.dart';
|
import 'package:number_text_input_formatter/number_text_input_formatter.dart';
|
||||||
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
class FlowChartSelectedMenu extends StatefulWidget {
|
class FlowChartSelectedMenu extends StatefulWidget {
|
||||||
Dashboard dashboard;
|
Dashboard dashboard;
|
||||||
@@ -50,6 +51,8 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
|||||||
child: InkWell( mouseCursor: SystemMouseCursors.click,
|
child: InkWell( mouseCursor: SystemMouseCursors.click,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
for (var sel in widget.dashboard.elementSelected) {
|
for (var sel in widget.dashboard.elementSelected) {
|
||||||
|
var el =FlowElement.fromMap(widget.dashboard, sel.toMap());
|
||||||
|
el.id = Uuid().v8();
|
||||||
widget.dashboard.addElement(FlowElement.fromMap(widget.dashboard, sel.toMap()), context);
|
widget.dashboard.addElement(FlowElement.fromMap(widget.dashboard, sel.toMap()), context);
|
||||||
widget.dashboard.elements.last.position += Offset(50, 50);
|
widget.dashboard.elements.last.position += Offset(50, 50);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user