This commit is contained in:
mr 2024-09-24 11:42:12 +02:00
parent 40a44848a8
commit dacda3b3a6
13 changed files with 32 additions and 30 deletions

View File

@ -42,7 +42,6 @@ class WorkspaceLocal {
} else { } else {
WorkspaceLocal.createWorkspace("main", null); WorkspaceLocal.createWorkspace("main", null);
} }
print("qsdqsd $current");
}); });
} }
@ -103,7 +102,6 @@ class WorkspaceLocal {
} }
static void changeWorkspace(String id) { static void changeWorkspace(String id) {
print("WORKSPACES ID $id");
_service.put(null, id, { "active" : true }, {}); _service.put(null, id, { "active" : true }, {});
current = id; current = id;
fill(); fill();

View File

@ -78,8 +78,6 @@ class APIService<T extends SerializerDeserializer> {
_dio.options.headers["authorization"] = auth; _dio.options.headers["authorization"] = auth;
_dio.interceptors.clear(); _dio.interceptors.clear();
var response = await _request(url, method, body, options); var response = await _request(url, method, body, options);
print(response.data);
print(url);
if (response.statusCode != null && response.statusCode! < 400) { if (response.statusCode != null && response.statusCode! < 400) {
if (method == "delete") { cache.remove(url); return APIResponse<T>(); } if (method == "delete") { cache.remove(url); return APIResponse<T>(); }
APIResponse<T> resp = APIResponse<T>().deserialize(response.data); APIResponse<T> resp = APIResponse<T>().deserialize(response.data);

View File

@ -15,7 +15,6 @@ abstract class AbstractService<T extends SerializerDeserializer> {
return service.get("$subPath$id", true, context); return service.get("$subPath$id", true, context);
} }
Future<APIResponse<T>> post(BuildContext? context, Map<String, dynamic> body, Map<String, String> params) { Future<APIResponse<T>> post(BuildContext? context, Map<String, dynamic> body, Map<String, String> params) {
print("Creating workspace $body");
return service.post(subPath, body, context); return service.post(subPath, body, context);
} }
Future<APIResponse<T>> put(BuildContext? context, String id, Map<String, dynamic> body, Map<String, String> params) { Future<APIResponse<T>> put(BuildContext? context, String id, Map<String, dynamic> body, Map<String, String> params) {

View File

@ -76,11 +76,13 @@ class WorkflowExecution extends SerializerDeserializer<WorkflowExecution> {
@override deserialize(dynamic json) { @override deserialize(dynamic json) {
try { json = json as Map<String, dynamic>; try { json = json as Map<String, dynamic>;
} catch (e) { return WorkflowExecution(); } } catch (e) { return WorkflowExecution(); }
print("qsdqdqssd");
print(json);
return WorkflowExecution( return WorkflowExecution(
id: json.containsKey("id") ? json["id"] : "", id: json.containsKey("id") ? json["id"] : "",
endDate: json.containsKey("end_date") ? json["end_date"] : "", endDate: json.containsKey("end_date") ? json["end_date"] : "",
executionData: json.containsKey("execution_date") ? json["execution_date"] : "", executionData: json.containsKey("execution_date") ? json["execution_date"] : "",
status: json.containsKey("status") ? json["status"] : 1, status: json.containsKey("state") ? json["state"] : 1,
workflowId: json.containsKey("workflow_id") ? json["workflow_id"] : "", workflowId: json.containsKey("workflow_id") ? json["workflow_id"] : "",
name: json.containsKey("name") ? json["name"] : "", name: json.containsKey("name") ? json["name"] : "",
); );

View File

@ -50,13 +50,15 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
GlobalKey<FormFieldState>(), GlobalKey<FormFieldState>()]; GlobalKey<FormFieldState>(), GlobalKey<FormFieldState>()];
var shallow = ShallowTextInputWidget( var shallow = ShallowTextInputWidget(
width: 250 - 1, width: 250 - 1,
current: dash.name, current: widget.item.name,
type: SharedWorkspaceType.workflow, type: SharedWorkspaceType.workflow,
canRemove: (p0) => p0 != null && p0.isEmpty, canRemove: (p0) => p0 != null && p0.isNotEmpty,
remove: (p0) async { remove: (p0) async {
await WorflowService().delete(context, widget.item.id ?? "", {}).then((value) { await WorflowService().delete(context, widget.item.id ?? "", {}).then((value) {
dash.clear(); dash.id = null;
dash.name = "";
dash.isOpened = false; dash.isOpened = false;
dash.clear();
dash.chartKey.currentState?.widget.flowChart.setState(() { }); dash.chartKey.currentState?.widget.flowChart.setState(() { });
}); });
}, },
@ -75,7 +77,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
Text("WORKFLOW INFO", style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), textAlign: TextAlign.center), Text("WORKFLOW INFO", style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), textAlign: TextAlign.center),
Text("<general>", style: TextStyle(fontSize: 12), textAlign: TextAlign.center), Text("<general>", style: TextStyle(fontSize: 12), textAlign: TextAlign.center),
])), ])),
Container( widget.item.name == "" ? Container() : Container(
decoration: BoxDecoration( border: Border( decoration: BoxDecoration( border: Border(
left: BorderSide(color: Colors.grey.shade300, width: 1), left: BorderSide(color: Colors.grey.shade300, width: 1),
bottom: const BorderSide(color: Colors.grey))), bottom: const BorderSide(color: Colors.grey))),

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:oc_front/models/response.dart'; import 'package:oc_front/models/response.dart';
import 'package:oc_front/pages/shared.dart'; import 'package:oc_front/pages/shared.dart';
class ShallowDropdownInputWidget extends StatefulWidget { class ShallowDropdownInputWidget extends StatefulWidget {
double? width; double? width;
SharedWorkspaceType type = SharedWorkspaceType.workspace; SharedWorkspaceType type = SharedWorkspaceType.workspace;
@ -50,7 +51,7 @@ class ShallowDropdownInputWidgetState extends State<ShallowDropdownInputWidget>
Tooltip( message: widget.hint ?? "current $t", child: Tooltip( message: widget.hint ?? "current $t", child:
Theme( Theme(
data: Theme.of(context).copyWith( data: Theme.of(context).copyWith(
canvasColor: Colors.grey.shade300, canvasColor: widget.filled ??Colors.white,
), ),
child: Container( height: 50, width: (widget.width ?? MediaQuery.of(context).size.width) - (widget.load == null ? 0 : 50) - (widget.remove == null ? 0 : 50), child: Container( height: 50, width: (widget.width ?? MediaQuery.of(context).size.width) - (widget.load == null ? 0 : 50) - (widget.remove == null ? 0 : 50),
decoration: const BoxDecoration( decoration: const BoxDecoration(

View File

@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:oc_front/models/response.dart';
import 'package:oc_front/pages/shared.dart'; import 'package:oc_front/pages/shared.dart';
class ShallowTextInputWidget extends StatefulWidget { class ShallowTextInputWidget extends StatefulWidget {
double? width; double? width;
SharedWorkspaceType type = SharedWorkspaceType.workspace; SharedWorkspaceType type = SharedWorkspaceType.workspace;
@ -69,9 +69,7 @@ class ShallowTextInputWidgetState extends State<ShallowTextInputWidget> {
canvasColor: Colors.grey.shade300, canvasColor: Colors.grey.shade300,
), ),
child: Container( height: 50, width: (widget.width ?? MediaQuery.of(context).size.width) - (widget.load == null ? 0 : 50) - (widget.remove == null ? 0 : 50), child: Container( height: 50, width: (widget.width ?? MediaQuery.of(context).size.width) - (widget.load == null ? 0 : 50) - (widget.remove == null ? 0 : 50),
decoration: BoxDecoration( decoration: const BoxDecoration( color: Colors.white ),
color: Colors.white,
),
child: TextFormField( child: TextFormField(
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {

View File

@ -1,8 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_box_transform/flutter_box_transform.dart'; import 'package:flutter_box_transform/flutter_box_transform.dart';
import 'package:oc_front/core/sections/header/header.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/models/logs.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';
@ -26,7 +24,6 @@ class ScheduleWidget extends StatefulWidget {
String? selected; String? selected;
String? selectedReal; String? selectedReal;
class ScheduleWidgetState extends State<ScheduleWidget> { class ScheduleWidgetState extends State<ScheduleWidget> {
LogsService _service = LogsService();
String search = ""; String search = "";
String? level; String? level;
List<Color> colors = [Colors.blue, Colors.orange, Colors.red, Colors.green]; List<Color> colors = [Colors.blue, Colors.orange, Colors.red, Colors.green];

View File

@ -34,8 +34,7 @@ class Dashboard extends ChangeNotifier {
Map<String, dynamic> info = {}; Map<String, dynamic> info = {};
bool scheduleActive = false; bool scheduleActive = false;
String? id; String? id;
String name; String name = "";
String defaultName = "";
bool isMenu = true; bool isMenu = true;
bool isInfo = true; bool isInfo = true;
bool isOpened = false; bool isOpened = false;
@ -76,7 +75,6 @@ class Dashboard extends ChangeNotifier {
// This is a workaround to set the handlerFeedbackOffset // This is a workaround to set the handlerFeedbackOffset
// to improve the user experience on devices with touch screens // to improve the user experience on devices with touch screens
// This will prevent the handler being covered by user's finger // This will prevent the handler being covered by user's finger
defaultName = name;
if (loadedGraph != null) { deserialize(loadedGraph!); } if (loadedGraph != null) { deserialize(loadedGraph!); }
if (handlerFeedbackOffset != null) { if (handlerFeedbackOffset != null) {
this.handlerFeedbackOffset = handlerFeedbackOffset; this.handlerFeedbackOffset = handlerFeedbackOffset;
@ -266,6 +264,7 @@ class Dashboard extends ChangeNotifier {
} catch (e) { print(e); } } catch (e) { print(e); }
elements.add(flow); elements.add(flow);
} }
print("DASH " + name);
selectedMenuKey.currentState?.setState(() { }); selectedMenuKey.currentState?.setState(() { });
chartMenuKey.currentState?.setState(() { }); chartMenuKey.currentState?.setState(() { });
addToHistory(); addToHistory();
@ -336,7 +335,10 @@ class Dashboard extends ChangeNotifier {
if (tempHistory.length >= 50) { tempHistory.removeAt(0); } if (tempHistory.length >= 50) { tempHistory.removeAt(0); }
tempHistory.add(toMap()); tempHistory.add(toMap());
history = tempHistory.map((e) => e).toList(); history = tempHistory.map((e) => e).toList();
chartMenuKey.currentState?.setState(() { }); Future.delayed(Duration(seconds: 1), () {
chartMenuKey.currentState?.setState(() { });
});
;
} }
bool isBack = false; bool isBack = false;
void back() { void back() {

View File

@ -107,7 +107,6 @@ class FlowElement<T extends FlowData> extends ChangeNotifier {
return false; return false;
} }
factory FlowElement.fromMap(Dashboard dashboard, Map<String, dynamic> map) { factory FlowElement.fromMap(Dashboard dashboard, Map<String, dynamic> map) {
print("FlowElement.fromMap ${map}");
final e = FlowElement<T>( final e = FlowElement<T>(
element: (dashboard.transformToData != null element: (dashboard.transformToData != null
? dashboard.transformToData!(map['element'] ?? {}) ? dashboard.transformToData!(map['element'] ?? {})

View File

@ -36,8 +36,15 @@ class FlowChartLeftMenuState<T extends FlowData> extends State<FlowChartLeftMenu
child: Stack( children: [ child: Stack( children: [
widget.dashboard.isMenu && widget.innerMenuWidth < 200 ? Wrap( alignment: WrapAlignment.start, widget.dashboard.isMenu && widget.innerMenuWidth < 200 ? Wrap( alignment: WrapAlignment.start,
children: widget.getDraggable(items)) children: widget.getDraggable(items))
: ExpansionTile( : Theme(
shape: const ContinuousRectangleBorder(side: BorderSide(color: Colors.transparent)), data: Theme.of(context).copyWith(dividerColor: Colors.grey.shade300),
child: ExpansionTile(
collapsedShape: RoundedRectangleBorder(
side: BorderSide.none,
),
shape: RoundedRectangleBorder(
side: BorderSide.none,
),
initiallyExpanded: true, initiallyExpanded: true,
title: SizedBox( title: SizedBox(
child : Row( children: [ child : Row( children: [
@ -57,7 +64,7 @@ class FlowChartLeftMenuState<T extends FlowData> extends State<FlowChartLeftMenu
child : Wrap( alignment: WrapAlignment.center, child : Wrap( alignment: WrapAlignment.center,
children: widget.getDraggable(items)) children: widget.getDraggable(items))
)], )],
) ))
] ]
)) ))
); );

View File

@ -35,7 +35,7 @@ class FlowChartMenuState extends State<FlowChartMenu> {
Padding( padding: EdgeInsets.only(right: 15), Padding( padding: EdgeInsets.only(right: 15),
child: InkWell( mouseCursor: SystemMouseCursors.click, child: InkWell( mouseCursor: SystemMouseCursors.click,
onTap: () { onTap: () {
widget.dashboard.defaultName = "graph_${DateTime.now().toString().replaceAll(" ", "_").substring(0, DateTime.now().toString().length - 7)}"; widget.dashboard.name = "graph_${DateTime.now().toString().replaceAll(" ", "_").substring(0, DateTime.now().toString().length - 7)}";
widget.dashboard.isOpened = true; widget.dashboard.isOpened = true;
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,

View File

@ -21,8 +21,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
height: widget.height, height: widget.height,
color: Colors.grey.shade300, color: Colors.grey.shade300,
child: SingleChildScrollView( child: Column( children: [ ...widget.dashboard.infoItemWidget != null ? child: SingleChildScrollView( child: Column( children: [ ...widget.dashboard.infoItemWidget != null ?
widget.dashboard.infoItemWidget!(widget.dashboard.elementSelected.first.element) widget.dashboard.infoItemWidget!(widget.dashboard.elementSelected.first.element) : [],
: [],
widget.dashboard.arrowsSelected.isNotEmpty || widget.dashboard.elementSelected.isNotEmpty ? Container( widget.dashboard.arrowsSelected.isNotEmpty || widget.dashboard.elementSelected.isNotEmpty ? Container(
width: 250, width: 250,
margin: EdgeInsets.only(top: 15), margin: EdgeInsets.only(top: 15),
@ -59,7 +58,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
Future.delayed(Duration(milliseconds: 100), () { Future.delayed(Duration(milliseconds: 100), () {
widget.dashboard.chartKey.currentState?.setState(() { }); widget.dashboard.chartKey.currentState?.setState(() { });
}); });
}, child: Container( margin: EdgeInsets.only(left: 10, right: 10), }, child: Container( margin: EdgeInsets.only(left: 10, right: 10, bottom: 10),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.black, width: 1)), decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.black, width: 1)),
width: 200, height: 30, width: 200, height: 30,
child: Icon(Icons.copy, color: Colors.black), child: Icon(Icons.copy, color: Colors.black),