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

View File

@ -78,8 +78,6 @@ class APIService<T extends SerializerDeserializer> {
_dio.options.headers["authorization"] = auth;
_dio.interceptors.clear();
var response = await _request(url, method, body, options);
print(response.data);
print(url);
if (response.statusCode != null && response.statusCode! < 400) {
if (method == "delete") { cache.remove(url); return APIResponse<T>(); }
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);
}
Future<APIResponse<T>> post(BuildContext? context, Map<String, dynamic> body, Map<String, String> params) {
print("Creating workspace $body");
return service.post(subPath, body, context);
}
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) {
try { json = json as Map<String, dynamic>;
} catch (e) { return WorkflowExecution(); }
print("qsdqdqssd");
print(json);
return WorkflowExecution(
id: json.containsKey("id") ? json["id"] : "",
endDate: json.containsKey("end_date") ? json["end_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"] : "",
name: json.containsKey("name") ? json["name"] : "",
);

View File

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

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:oc_front/models/response.dart';
import 'package:oc_front/pages/shared.dart';
class ShallowDropdownInputWidget extends StatefulWidget {
double? width;
SharedWorkspaceType type = SharedWorkspaceType.workspace;
@ -50,7 +51,7 @@ class ShallowDropdownInputWidgetState extends State<ShallowDropdownInputWidget>
Tooltip( message: widget.hint ?? "current $t", child:
Theme(
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),
decoration: const BoxDecoration(

View File

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:oc_front/models/response.dart';
import 'package:oc_front/pages/shared.dart';
class ShallowTextInputWidget extends StatefulWidget {
double? width;
SharedWorkspaceType type = SharedWorkspaceType.workspace;
@ -69,9 +69,7 @@ class ShallowTextInputWidgetState extends State<ShallowTextInputWidget> {
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),
decoration: BoxDecoration(
color: Colors.white,
),
decoration: const BoxDecoration( color: Colors.white ),
child: TextFormField(
onChanged: (value) {
setState(() {

View File

@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_box_transform/flutter_box_transform.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/workflow.dart';
import 'package:oc_front/widgets/logs.dart';
@ -26,7 +24,6 @@ class ScheduleWidget extends StatefulWidget {
String? selected;
String? selectedReal;
class ScheduleWidgetState extends State<ScheduleWidget> {
LogsService _service = LogsService();
String search = "";
String? level;
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 = {};
bool scheduleActive = false;
String? id;
String name;
String defaultName = "";
String name = "";
bool isMenu = true;
bool isInfo = true;
bool isOpened = false;
@ -76,7 +75,6 @@ class Dashboard extends ChangeNotifier {
// This is a workaround to set the handlerFeedbackOffset
// to improve the user experience on devices with touch screens
// This will prevent the handler being covered by user's finger
defaultName = name;
if (loadedGraph != null) { deserialize(loadedGraph!); }
if (handlerFeedbackOffset != null) {
this.handlerFeedbackOffset = handlerFeedbackOffset;
@ -266,6 +264,7 @@ class Dashboard extends ChangeNotifier {
} catch (e) { print(e); }
elements.add(flow);
}
print("DASH " + name);
selectedMenuKey.currentState?.setState(() { });
chartMenuKey.currentState?.setState(() { });
addToHistory();
@ -336,7 +335,10 @@ class Dashboard extends ChangeNotifier {
if (tempHistory.length >= 50) { tempHistory.removeAt(0); }
tempHistory.add(toMap());
history = tempHistory.map((e) => e).toList();
chartMenuKey.currentState?.setState(() { });
Future.delayed(Duration(seconds: 1), () {
chartMenuKey.currentState?.setState(() { });
});
;
}
bool isBack = false;
void back() {

View File

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

View File

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

View File

@ -35,7 +35,7 @@ class FlowChartMenuState extends State<FlowChartMenu> {
Padding( padding: EdgeInsets.only(right: 15),
child: InkWell( mouseCursor: SystemMouseCursors.click,
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;
showDialog(
barrierDismissible: false,

View File

@ -21,8 +21,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
height: widget.height,
color: Colors.grey.shade300,
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(
width: 250,
margin: EdgeInsets.only(top: 15),
@ -59,7 +58,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
Future.delayed(Duration(milliseconds: 100), () {
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)),
width: 200, height: 30,
child: Icon(Icons.copy, color: Colors.black),