Change for demo

This commit is contained in:
mr 2024-09-23 16:59:21 +02:00
parent 0b294a782c
commit 40a44848a8
3 changed files with 16 additions and 8 deletions

View File

@ -78,6 +78,8 @@ 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

@ -68,7 +68,7 @@ class AppRouter {
description: "Manage & monitor your datacenter.", help: "not implemented for now",
factory: DatacenterFactory()),
RouterItem(icon: Icons.public_outlined, label: "localisations", route: "map", factory: MapFactory()),
RouterItem(icon: Icons.share_rounded, label: "shared spaces", route: "shared", factory: SharedFactory()),
RouterItem(icon: Icons.share_rounded, label: "collaborative area", route: "shared", factory: SharedFactory()),
workflowIDItem,
catalogItem,
];

View File

@ -17,8 +17,7 @@ import 'package:oc_front/widgets/forms/scheduler_forms.dart';
import 'package:oc_front/widgets/items/item_row.dart';
import 'package:oc_front/widgets/inputs/shallow_dropdown_input.dart';
Dashboard dash = Dashboard(
name: "workflow_${DateTime.now().toString().replaceAll(" ", "_").substring(0, DateTime.now().toString().length - 7)}");
Dashboard dash = Dashboard(name: "");
class WorkflowFactory implements AbstractFactory {
static GlobalKey<WorkflowPageWidgetState> key = GlobalKey<WorkflowPageWidgetState>();
@override bool searchFill() { return false; }
@ -66,17 +65,23 @@ final WorflowService _service = WorflowService();
Future<void> loadDash(String selected) async {
dash.shouldSave = false;
dash.name = "";
var name = "";
if (selected.split("~").length > 1) {
dash.name = selected.split("~")[1];
name = selected.split("~")[1];
dash.id = selected.split("~")[0];
} else {
dash.name = selected;
name = selected;
}
await _service.get(context, dash.id ?? "").then((value) {
if (value.data != null) {
dash.clear();
dash.deserialize(value.data!.toDashboard());
Future.delayed(const Duration(seconds: 1), () => dash.shouldSave = true);
Future.delayed(const Duration(seconds: 1), () {
dash.name = name;
dash.shouldSave = true;
dash.selectedMenuKey.currentState?.setState(() { });
});
}
});
}
@ -203,6 +208,9 @@ final WorflowService _service = WorflowService();
dash.notifyListeners();
WorkspaceLocal.init(context, true);
dash.isOpened = true;
Future.delayed(const Duration(seconds: 1), () {
dash.load!("${dash.id}~${dash.name}");
});
}
),
maptoDropdown: (e) => DropdownMenuItem<String>(
@ -230,8 +238,6 @@ final WorflowService _service = WorflowService();
dash.infoItemWidget = getForms;
dash.infoWidget = getDashInfoForms;
var quart = MediaQuery.of(context).size.width / 6;
dash.defaultName = "workflow_${DateTime.now().toString().replaceAll(" ", "_"
).substring(0, DateTime.now().toString().length - 7)}";
return FlowChart<AbstractItem>(
onDashboardAlertOpened: onDashboardAlertOpened,
dashboard: dash,