Latest Front with debug

This commit is contained in:
mr
2024-08-30 12:52:32 +02:00
parent 8beddba367
commit 0b294a782c
42 changed files with 1367 additions and 925 deletions

View File

@@ -4,14 +4,18 @@ import 'package:oc_front/models/search.dart';
import 'package:oc_front/widgets/items/item_row.dart';
class CatalogWidget extends StatefulWidget {
double? itemWidth;
bool readOnly = false;
final List<AbstractItem>? items;
CatalogWidget ({ Key? key, this.items }): super(key: key);
CatalogWidget ({ Key? key, this.items, this.itemWidth, this.readOnly = false }): super(key: key);
@override CatalogWidgetState createState() => CatalogWidgetState();
}
class CatalogWidgetState extends State<CatalogWidget> {
@override Widget build(BuildContext context) {
var items = widget.items ?? WorkspaceLocal.items;
List<ItemRowWidget> itemRows = items.map((e) => ItemRowWidget(contextWidth: MediaQuery.of(context).size.width, item: e)).toList();
return SingleChildScrollView( child: Column( children: itemRows) );
List<ItemRowWidget> itemRows = items.map((e) => ItemRowWidget(
readOnly: widget.readOnly,
contextWidth: widget.itemWidth ?? MediaQuery.of(context).size.width, item: e)).toList();
return Column( children: itemRows);
}
}

View File

@@ -17,7 +17,10 @@ class LoginWidgetState extends State<LoginWidget> {
child: Icon(Icons.person_search, size: 80, color: Colors.grey,))),
const Center(child: Text("WELCOME ON OPENCLOUD", style: TextStyle(fontSize: 25, fontWeight: FontWeight.w600,
color: Color.fromRGBO(38, 166, 154, 1)),)),
Padding(padding: const EdgeInsets.symmetric(vertical: 20), child: Divider(color: Colors.grey.shade300,),),
Container(
padding: const EdgeInsets.symmetric(vertical: 20),
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Colors.black))),
),
Container( margin: const EdgeInsets.only(bottom: 10), child: Center(child: Row( mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(

View File

@@ -1,207 +0,0 @@
import 'package:flutter/material.dart';
import 'package:oc_front/models/response.dart';
import 'package:oc_front/core/services/router.dart';
import 'package:oc_front/core/services/specialized_services/shared_service.dart';
class NewBoxSharedWidget extends StatefulWidget {
String? _selected;
SharedService service = SharedService();
final TextEditingController _ctrl = TextEditingController();
final TextEditingController _ctrlDescr = TextEditingController();
NewBoxSharedWidget ({ super.key, });
@override NewBoxSharedWidgetState createState() => NewBoxSharedWidgetState();
}
class NewBoxSharedWidgetState extends State<NewBoxSharedWidget> {
GlobalKey<FormFieldState> key = GlobalKey<FormFieldState>();
GlobalKey<FormFieldState> key2 = GlobalKey<FormFieldState>();
@override Widget build(BuildContext context) {
return Container(
color: Colors.white,
padding: const EdgeInsets.only( top: 0, bottom: 20, left: 20, right: 20),
child: Column(
children: [
Container(
alignment: Alignment.centerRight,
height: 50,
child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [
const Padding(padding: EdgeInsets.symmetric(horizontal: 10), child:
Text("load or create a new shared workspace", style: TextStyle(color: Colors.grey, fontSize: 15)
)),
Padding ( padding: const EdgeInsets.symmetric(horizontal: 10), child:
Tooltip( message: "back", child: InkWell(
mouseCursor: SystemMouseCursors.click,
onTap: () {
AppRouter.catalog.go(context, {});
},
child: const Icon(Icons.arrow_back, color: Colors.black))),
),
Row ( mainAxisAlignment: MainAxisAlignment.end, children: [
Tooltip( message: "close", child: InkWell(
mouseCursor: SystemMouseCursors.click,
onTap: () { Navigator.pop(context); },
child: const Icon(Icons.close, color: Colors.black))),
]),
],),
),
FutureBuilder<APIResponse<RawData>>(
future: widget.service.all(context),
builder: (context, snapshot) {
List<DropdownMenuItem> items = [];
if (snapshot.data != null && snapshot.data!.data != null) {
for (var item in snapshot.data!.data!.values) {
items.add(DropdownMenuItem<String>(
value: item["id"].toString(),
child: Text(item["name"].toString()),
));
}
}
if (widget._selected != null
&& !items.where((element) => element.value == widget._selected).isNotEmpty) {
items.add(DropdownMenuItem<String>(
value: widget._selected.toString(),
child: Text(widget._selected.toString()),
));
}
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children : [
SizedBox( width: MediaQuery.of(context).size.width <= 540 ? MediaQuery.of(context).size.width - 140 : 400, height: 50,
child: DropdownButtonFormField(
value: widget._selected,
isExpanded: true,
hint: const Text("load shared workspace...", style: TextStyle(color: Colors.grey, fontSize: 15)),
decoration: InputDecoration(
filled: true,
focusedBorder: const OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Color.fromARGB(38, 166, 154, 1), width: 0),
),
fillColor: Colors.grey.shade300,
contentPadding: const EdgeInsets.only(left: 30, right: 30, top: 10, bottom: 30),
enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Colors.grey.shade300, width: 0),
),
border: OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Colors.grey.shade300, width: 0)),
),
items: items,
onChanged: (value) {
setState(() {
widget._selected = value.toString();
});
})),
Tooltip(
message: 'empty selection',
child: InkWell(
mouseCursor: widget._selected == null || widget._selected!.isEmpty ? MouseCursor.defer : SystemMouseCursors.click,
onTap: () {
if (widget._selected == null || widget._selected!.isEmpty) { return; }
setState(() { widget._selected = null; });
},
child: Container(
width: 50, height: 50,
decoration: const BoxDecoration( color: Colors.black,
border: Border(right: BorderSide(color: Colors.white))),
child: Icon(Icons.refresh, color: widget._selected == null || widget._selected!.isEmpty ? Colors.grey : Colors.white),
)
)
),
Tooltip(
message: 'load shared workspace selected',
child: InkWell(
mouseCursor: widget._selected == null || widget._selected!.isEmpty
? MouseCursor.defer : SystemMouseCursors.click,
onTap: () async {
},
child: Container(
width: 50, height: 50,
color: Colors.black,
child: Icon(Icons.open_in_browser_outlined,
color: widget._selected == null || widget._selected!.isEmpty ? Colors.grey : Colors.white),
)
)
)
]);}),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
margin: const EdgeInsets.only(top: 10),
width: MediaQuery.of(context).size.width <= 540 ? MediaQuery.of(context).size.width - 90 : 450,
height: 50,
child: TextFormField( key: key,
expands: true,
maxLines: null,
minLines: null,
cursorColor: const Color.fromARGB(38, 166, 154, 1),
controller: widget._ctrl,
onChanged: (value) { widget._ctrl.text = value; },
validator: (value) => value == null || value.isEmpty ? "name is required" : null,
decoration: InputDecoration(
hintText: "name a new shared workspace...",
fillColor: Colors.grey.shade300,
filled: true,
errorStyle: const TextStyle(fontSize: 0),
contentPadding: const EdgeInsets.only(left: 30, right: 30, top: 15, bottom: 5),
hintStyle: const TextStyle(
color: Colors.black,
fontSize: 14,
fontWeight: FontWeight.w300
),
border: InputBorder.none
)
)
),
Tooltip(
message: 'add',
child:InkWell(
mouseCursor: widget._ctrl.value.text.isEmpty ? MouseCursor.defer : SystemMouseCursors.click,
onTap: () async {
if (key.currentState!.validate() && key2.currentState!.validate()) {
await widget.service.post(context, {
"name" :widget._ctrl.value.text,
"description" : widget._ctrlDescr.value.text }, {});
}
},
child: Container(
margin: const EdgeInsets.only(top: 10),
width: 50,
height: 50,
color: Colors.black,
child: Icon(Icons.add, color: widget._ctrl.value.text.isEmpty ? Colors.grey : Colors.white)
)
)
)
]),
Container(
margin: const EdgeInsets.only(top: 10),
width: MediaQuery.of(context).size.width <= 540 ? MediaQuery.of(context).size.width - 40 : 500,
height: 50,
child: TextFormField( key: key2,
expands: true,
maxLines: null,
minLines: null,
cursorColor: const Color.fromARGB(38, 166, 154, 1),
controller: widget._ctrlDescr,
onChanged: (value) { widget._ctrlDescr.text = value; },
validator: (value) => value == null || value.isEmpty ? "name is required" : null,
decoration: InputDecoration(
hintText: "description of a new shared workspace...",
fillColor: Colors.grey.shade300,
filled: true,
errorStyle: const TextStyle(fontSize: 0),
contentPadding: const EdgeInsets.only(left: 30, right: 30, top: 15, bottom: 5),
hintStyle: const TextStyle(
color: Colors.black,
fontSize: 14,
fontWeight: FontWeight.w300
),
border: InputBorder.none
)
)
),
]
)
);
}
}

View File

@@ -1,199 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_flow_chart/flutter_flow_chart.dart';
import 'package:oc_front/core/models/workspace_local.dart';
import 'package:oc_front/core/services/router.dart';
import 'package:oc_front/core/services/specialized_services/abstract_service.dart';
import 'package:oc_front/models/abstract.dart';
import 'package:oc_front/models/response.dart';
abstract class New {
String name = "";
}
class NewBoxWidget<T extends SerializerDeserializer<dynamic>> extends StatefulWidget {
String? _selected;
Dashboard dash;
final TextEditingController _ctrl = TextEditingController();
AbstractService<T> service;
Function validate = () {};
NewBoxWidget ({ super.key, required this.service, required this.dash, this.getItems });
@override NewBoxWidgetState<T> createState() => NewBoxWidgetState<T>();
List<DropdownMenuItem> Function(APIResponse<T>? data)? getItems;
}
class NewBoxWidgetState<T extends SerializerDeserializer<dynamic>> extends State<NewBoxWidget> {
@override Widget build(BuildContext context) {
widget._ctrl.value = TextEditingValue(text: widget.dash.defaultName);
return Container(
color: Colors.white,
padding: const EdgeInsets.only( top: 0, bottom: 20, left: 20, right: 20),
child: Column(
children: [
Container(
alignment: Alignment.centerRight,
height: 50,
child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [
Padding(padding: const EdgeInsets.symmetric(horizontal: 10), child:
Text("load or create a new workflow", style: const TextStyle(color: Colors.grey, fontSize: 15)
)),
Padding ( padding: const EdgeInsets.symmetric(horizontal: 10), child:
Tooltip( message: "back", child: InkWell(
mouseCursor: SystemMouseCursors.click,
onTap: () {
AppRouter.catalog.go(context, {});
},
child: const Icon(Icons.arrow_back, color: Colors.black))),
),
widget.dash.isOpened ? Row ( mainAxisAlignment: MainAxisAlignment.end, children: [
Tooltip( message: "close", child: InkWell(
mouseCursor: SystemMouseCursors.click,
onTap: () { Navigator.pop(context); },
child: const Icon(Icons.close, color: Colors.black))),
]) : Container(),
],),
),
FutureBuilder<APIResponse<RawData>>(
future: (widget.service as AbstractService<T>).all(context),
builder: (context, snapshot) {
List<DropdownMenuItem> items = widget.getItems != null ? widget.getItems!(snapshot.data) : [];
if (widget._selected != null
&& !items.where((element) => element.value == widget._selected).isNotEmpty) {
items.add(DropdownMenuItem<String>(
value: widget._selected.toString(),
child: Text(widget._selected.toString()),
));
}
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children : [
SizedBox( width: MediaQuery.of(context).size.width <= 540 ? MediaQuery.of(context).size.width - 140 : 400, height: 50,
child: DropdownButtonFormField(
value: widget._selected,
isExpanded: true,
hint: const Text("load workflow...", style: TextStyle(color: Colors.grey, fontSize: 15)),
decoration: InputDecoration(
filled: true,
focusedBorder: const OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Color.fromARGB(38, 166, 154, 1), width: 0),
),
fillColor: Colors.grey.shade300,
contentPadding: const EdgeInsets.only(left: 30, right: 30, top: 10, bottom: 30),
enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Colors.grey.shade300, width: 0),
),
border: OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Colors.grey.shade300, width: 0)),
),
items: items,
onChanged: (value) {
setState(() {
widget._selected = value.toString();
});
})),
Tooltip(
message: 'empty selection',
child: InkWell(
mouseCursor: widget._selected == null || widget._selected!.isEmpty ? MouseCursor.defer : SystemMouseCursors.click,
onTap: () {
if (widget._selected == null || widget._selected!.isEmpty) { return; }
setState(() { widget._selected = null; });
},
child: Container(
width: 50, height: 50,
decoration: const BoxDecoration( color: Colors.black,
border: Border(right: BorderSide(color: Colors.white))),
child: Icon(Icons.refresh, color: widget._selected == null || widget._selected!.isEmpty ? Colors.grey : Colors.white),
)
)
),
Tooltip(
message: 'load workflow selected',
child: InkWell(
mouseCursor: widget._selected == null || widget._selected!.isEmpty
? MouseCursor.defer : SystemMouseCursors.click,
onTap: () async {
if (widget._selected == null || widget._selected!.isEmpty) { return; }
widget.dash.isOpened = true;
if (widget._selected != null && widget.dash.load != null) {
WorkspaceLocal.changeWorkspaceByName(widget._selected!.split("~")[1]);
await widget.dash.load!(widget._selected ?? "");
}
widget.dash.notifyListeners();
Navigator.pop(context);
},
child: Container(
width: 50, height: 50,
color: Colors.black,
child: Icon(Icons.open_in_browser_outlined,
color: widget._selected == null || widget._selected!.isEmpty ? Colors.grey : Colors.white),
)
)
)
]);}),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
margin: const EdgeInsets.only(top: 10),
width: MediaQuery.of(context).size.width <= 540 ? MediaQuery.of(context).size.width - 90 : 450,
height: 50,
child: TextFormField(
expands: true,
maxLines: null,
minLines: null,
cursorColor: const Color.fromARGB(38, 166, 154, 1),
controller: widget._ctrl,
onChanged: (value) {},
validator: (value) => value == null || value.isEmpty ? "name is required" : null,
decoration: InputDecoration(
hintText: "name a new workflow...",
fillColor: Colors.grey.shade300,
filled: true,
contentPadding: const EdgeInsets.only(left: 30, right: 30, top: 15, bottom: 5),
hintStyle: const TextStyle(
color: Colors.black,
fontSize: 14,
fontWeight: FontWeight.w300
),
border: InputBorder.none
)
)
),
Tooltip(
message: 'add',
child:InkWell(
mouseCursor: widget._ctrl.value.text.isEmpty ? MouseCursor.defer : SystemMouseCursors.click,
onTap: () async {
if (widget._ctrl.value.text.isNotEmpty) {
await widget.service.post(context, { "name" : widget._ctrl.value.text }, {}).then(
(value) {
widget._selected = widget._ctrl.value.text;
widget._ctrl.value = const TextEditingValue(text: "");
widget.dash.id = value.data?.serialize()["id"];
widget.dash.name = widget._selected ?? "";
widget.dash.notifyListeners();
WorkspaceLocal.init(context, true);
widget.dash.isOpened = true;
// ignore: use_build_context_synchronously
Navigator.pop(context);
}
);
}
},
child: Container(
margin: const EdgeInsets.only(top: 10),
width: 50,
height: 50,
color: Colors.black,
child: Icon(Icons.add, color: widget._ctrl.value.text.isEmpty ? Colors.grey : Colors.white)
)
)
)
])
]
)
);
}
}

View File

@@ -0,0 +1,96 @@
import 'package:flutter/material.dart';
import 'package:oc_front/models/response.dart';
import 'package:oc_front/core/services/router.dart';
import 'package:oc_front/pages/shared.dart';
import 'package:oc_front/widgets/inputs/shallow_dropdown_input.dart';
import 'package:oc_front/widgets/inputs/shallow_text_input.dart';
class ShallowCreationDialogWidget extends StatefulWidget {
GlobalKey<ShallowTextInputWidgetState>? formKey;
BuildContext context;
bool Function()? canClose;
SharedWorkspaceType type = SharedWorkspaceType.workspace;
Future<List<Shallow>> Function()? all;
Future<void> Function(String)? load;
Future<void> Function(Map<String,dynamic>)? create;
bool Function(String?)? canLoad;
DropdownMenuItem Function(Shallow)? maptoDropdown;
List<ShallowTextInputWidget> form = [];
ShallowCreationDialogWidget ({ super.key, required this.type, required this.all, this.load, this.formKey,
required this.create, this.form = const [], this.maptoDropdown, required this.context, this.canClose }) ;
@override ShallowCreationDialogState createState() => ShallowCreationDialogState();
}
class ShallowCreationDialogState extends State<ShallowCreationDialogWidget> {
GlobalKey<FormFieldState> key = GlobalKey<FormFieldState>();
GlobalKey<FormFieldState> key2 = GlobalKey<FormFieldState>();
@override Widget build(BuildContext context) {
var t = widget.type == SharedWorkspaceType.workspace ? "workspace" : (widget.type == SharedWorkspaceType.workflow ? "workflow" : (widget.type == SharedWorkspaceType.shared_workspace ? "shared workspace" :"peer"));
return Container(
color: Colors.white,
padding: const EdgeInsets.only( top: 0, bottom: 20, left: 20, right: 20),
child: Column(
children: [
Container(
alignment: Alignment.centerRight,
height: 50,
child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [
Padding(padding: const EdgeInsets.symmetric(horizontal: 10), child:
Text("load or create a new $t", style: const TextStyle(color: Colors.grey, fontSize: 15)
)),
Padding ( padding: const EdgeInsets.symmetric(horizontal: 10), child:
Tooltip( message: "back", child: InkWell(
mouseCursor: SystemMouseCursors.click,
onTap: () {
AppRouter.catalog.go(context, {});
},
child: const Icon(Icons.arrow_back, color: Colors.black))),
),
widget.canClose != null && !widget.canClose!() ? Container() : Row ( mainAxisAlignment: MainAxisAlignment.end, children: [
Tooltip( message: "close", child: InkWell(
mouseCursor: SystemMouseCursors.click,
onTap: () { Navigator.pop(context); },
child: const Icon(Icons.close, color: Colors.black))),
]),
],),
),
ShallowDropdownInputWidget(
all: widget.all,
type: widget.type,
width: MediaQuery.of(context).size.width <= 540 ? MediaQuery.of(context).size.width - 140 : 400,
load: (e) async {
await widget.load!(e);
Navigator.pop(widget.context);
},
iconLoad: Icons.open_in_browser_outlined,
iconRemove: Icons.refresh,
maptoDropdown: widget.maptoDropdown,
canLoad: (p0) => p0 != null && p0.isNotEmpty,
canRemove: (p0) => p0 != null && p0.isNotEmpty,
tooltipRemove: "refresh selection",
deletion: true,
color: Colors.black,
hintColor: Colors.grey,
filled: Colors.grey.shade300,
),
Container( height: 10),
ShallowTextInputWidget(
key: widget.formKey,
type: widget.type,
width: MediaQuery.of(context).size.width <= 540 ? MediaQuery.of(context).size.width - 140 : 400,
load: (e) async {
await widget.create!(e);
Navigator.pop(widget.context);
},
forms: widget.form,
canLoad: (p0) => p0 != null && p0.isNotEmpty,
color: Colors.black,
hintColor: Colors.grey,
filled: Colors.grey.shade300,
),
...widget.form.map( (e) => Container( margin: const EdgeInsets.only(top: 10), child: e)),
]
)
);
}
}

View File

@@ -6,13 +6,13 @@ import 'package:oc_front/pages/workflow.dart';
Map<String, Map<String, AbstractItem>> proxyWfItem = {};
class ProxyFormsWidget extends StatefulWidget {
class ProcessingFormsWidget extends StatefulWidget {
AbstractItem item;
Dashboard dash;
ProxyFormsWidget ({ super.key, required this.item, required this.dash });
@override ProxyFormsWidgetState createState() => ProxyFormsWidgetState();
ProcessingFormsWidget ({ super.key, required this.item, required this.dash });
@override ProcessingFormsWidgetState createState() => ProcessingFormsWidgetState();
}
class ProxyFormsWidgetState extends State<ProxyFormsWidget> {
class ProcessingFormsWidgetState extends State<ProcessingFormsWidget> {
@override Widget build(BuildContext context) {
List<Widget> children = [];
var l = widget.item.model?.model?.keys ?? [];

View File

@@ -1,15 +1,18 @@
import 'package:alert_banner/exports.dart';
import 'package:cron/cron.dart';
import 'package:flutter/widgets.dart';
import 'package:intl/intl.dart' as intl;
import 'package:flutter/material.dart';
import 'package:flutter_flow_chart/flutter_flow_chart.dart';
import 'package:flutter_advanced_switch/flutter_advanced_switch.dart';
import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';
import 'package:oc_front/core/models/shared_workspace_local.dart';
import 'package:oc_front/core/services/specialized_services/workflow_service.dart';
import 'package:oc_front/core/services/specialized_services/check_service.dart';
import 'package:oc_front/pages/shared.dart';
import 'package:oc_front/pages/workflow.dart';
import 'package:oc_front/widgets/dialog/alert.dart';
import 'package:oc_front/widgets/inputs/shallow_text_input.dart';
class SchedulerFormsWidget extends StatefulWidget {
Dashboard item;
@@ -45,6 +48,26 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
}
List<GlobalKey<FormFieldState>> formKeys = [GlobalKey<FormFieldState>(), GlobalKey<FormFieldState>(),
GlobalKey<FormFieldState>(), GlobalKey<FormFieldState>()];
var shallow = ShallowTextInputWidget(
width: 250 - 1,
current: dash.name,
type: SharedWorkspaceType.workflow,
canRemove: (p0) => p0 != null && p0.isEmpty,
remove: (p0) async {
await WorflowService().delete(context, widget.item.id ?? "", {}).then((value) {
dash.clear();
dash.isOpened = false;
dash.chartKey.currentState?.widget.flowChart.setState(() { });
});
},
);
shallow.change =(p0) => Future.delayed( const Duration(seconds: 2), () async {
if (shallow.compare == p0) {
await WorflowService().put(context, widget.item.id ?? "", { "name" : p0 }, {});
} else {
shallow.compare = p0;
}
});
return Column( children: [
Container( padding: const EdgeInsets.all(10), width: 250, height: 60,
decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
@@ -52,9 +75,12 @@ 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(height: 20,
width: 250,
),
Container(
decoration: BoxDecoration( border: Border(
left: BorderSide(color: Colors.grey.shade300, width: 1),
bottom: const BorderSide(color: Colors.grey))),
child: shallow ),
const SizedBox(height: 20, width: 250 ),
AdvancedSwitch(
width: 140,
initialValue: widget.item.scheduler["mode"] == 1,
@@ -67,6 +93,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
setState(() {
widget.item.scheduler["mode"] = value == true ? 1 : 0;
if ((widget.item.scheduler["mode"] == 1 )) { widget.item.scheduler.remove("cron"); }
widget.item.save!(widget.item.id);
}));
},),
Container(height: 5),
@@ -334,7 +361,11 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
Container(
width: 250,
height: 20,
decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.black, width: 1))),
decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
),
const SizedBox(
width: 250,
height: 10,
),
Tooltip( message: "check booking",
child: InkWell( mouseCursor: SystemMouseCursors.click,
@@ -367,13 +398,13 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
setState(() {});
}
);
}, child: Container( margin: const EdgeInsets.all(10),
}, child: Container( margin: const EdgeInsets.only(bottom: 5),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5),
border: Border.all(color: widget.booking == null && !dash.scheduleActive ? Colors.grey : (widget.booking == true || dash.scheduleActive ? Colors.green : Colors.red), width: 1)),
border: Border.all(color: widget.booking == null && !dash.scheduleActive ? Colors.black : (widget.booking == true || dash.scheduleActive ? Colors.green : Colors.red), width: 1)),
width: 200, height: 30,
child: Icon(
Icons.verified_outlined,
color: widget.booking == null && !dash.scheduleActive ? Colors.grey : (widget.booking == true || dash.scheduleActive ? Colors.green : Colors.red)),
color: widget.booking == null && !dash.scheduleActive ? Colors.black : (widget.booking == true || dash.scheduleActive ? Colors.green : Colors.red)),
))
),
Tooltip( message: dash.scheduleActive ? "unbook" : "book",
@@ -387,7 +418,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
} else { k.currentState!.save();}
}
}
DateTime now = DateTime.now().add(const Duration(minutes: 5));
DateTime now = DateTime.now().add(const Duration(minutes: 1));
if (dash.scheduler["start"] == null || DateTime.parse(dash.scheduler["start"]!).isBefore(now)) {
dash.scheduler["start"] = now.toUtc().toIso8601String();
if (dash.scheduler["end"] != null) {
@@ -396,7 +427,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
}
widget.item.save!(widget.item.id);
setState(() { });
}, child: Container( margin: const EdgeInsets.all(10),
}, child: Container( margin: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5),
border: Border.all(color: dash.scheduleActive ? Colors.green : Colors.black)),
width: 200, height: 30,
@@ -411,16 +442,18 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
decoration: const BoxDecoration(border: Border(top: BorderSide(color: Colors.black))),
),
Container( alignment: Alignment.center, padding: const EdgeInsets.symmetric(horizontal: 20),
child: Text( textAlign: TextAlign.center,
child:Text( textAlign: TextAlign.center, overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 14, color: Colors.black, fontWeight: FontWeight.bold),
"Workflow is shared in ${(widget.item.info["shared"] as List<dynamic>).length} workspace(s)")),
...(widget.item.info["shared"] as List<dynamic>).where( (e) => SharedWorkspaceLocal.getSharedWorkspace(e) != null
).map((e) {
var sw = SharedWorkspaceLocal.getSharedWorkspace(e);
return Container( alignment: Alignment.center, padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 5),
child: Row( children: [
const Padding(padding: EdgeInsets.only(right: 10), child: Icon(Icons.work, color: Colors.grey, size: 15)),
Text(style: const TextStyle(fontSize: 12, color: Colors.grey),
"Workspace: ${SharedWorkspaceLocal.getSharedWorkspace(e)!.name}") ]));
"Workspace: ${sw != null && sw.name != null ?
"${sw.name!.substring(0, sw.name!.length > 15 ? 12 : sw.name!.length)}${sw.name!.length > 15 ? "..." : ""}" : ""}") ]));
},)
]) : Container()
]);

View File

@@ -0,0 +1,121 @@
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;
Future<List<Shallow>> Function()? all;
Future<void> Function(String)? load;
Future<void> Function(String)? remove;
bool Function(String?)? canLoad;
bool Function(String?)? canRemove;
void Function(String?)? change;
DropdownMenuItem Function(Shallow)? maptoDropdown;
String? current;
IconData? iconLoad;
IconData? iconRemove;
String? hint;
String? tooltipLoad;
String? tooltipRemove;
Color? filled;
Color? hintColor;
Color? color;
bool deletion = false;
ShallowDropdownInputWidget ({ Key? key, this.width, this.current, required this.all,
this.iconLoad, this.iconRemove, this.hint, this.filled, this.hintColor, this.color,
this.tooltipLoad, this.tooltipRemove, this.deletion = false, this.maptoDropdown,
required this.type, this.canLoad, this.canRemove, this.load, this.remove, this.change }): super(key: key);
@override ShallowDropdownInputWidgetState createState() => ShallowDropdownInputWidgetState();
}
class ShallowDropdownInputWidgetState extends State<ShallowDropdownInputWidget> {
@override Widget build(BuildContext context) {
if (widget.deletion && widget.remove == null) {
widget.remove =(p0) async => widget.current = null;
}
var t = widget.type == SharedWorkspaceType.workspace ? "workspace" : (widget.type == SharedWorkspaceType.workflow ? "workflow" : "peer");
return FutureBuilder(future: widget.all!(), builder: (b, s) {
List<DropdownMenuItem> items = [];
if (widget.maptoDropdown != null) {
items = s.data?.map((e) => widget.maptoDropdown!(e)).toList() ?? <DropdownMenuItem>[];
} else {
items = s.data?.map((e) => DropdownMenuItem(value: e.id,child: Text(e.name),)).toList() ?? <DropdownMenuItem>[];
}
return Row( children: [
Tooltip( message: widget.hint ?? "current $t", child:
Theme(
data: Theme.of(context).copyWith(
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: const BoxDecoration(
color: Colors.white,
),
child: DropdownButtonFormField(
onChanged: (value) {
setState(() {
widget.current = value;
if (widget.change != null) {
widget.change!(value);
}
});
},
value: widget.current != null && !items.map( ((e) => e.value)).contains(widget.current) ? null : widget.current,
isExpanded: true,
style: TextStyle(color: widget.color ?? Colors.black, fontSize: 15),
hint: Text(widget.hint ?? "load $t...",
style: TextStyle(color: widget.hintColor ??Colors.grey.shade300, fontSize: 14)),
icon: Icon( // Add this
Icons.arrow_drop_down, // Add this
color: widget.hintColor ?? Colors.grey , // Add this
),
decoration: InputDecoration(
filled: true,
suffixIconColor: widget.hintColor ?? Colors.grey ,
focusedBorder: InputBorder.none,
fillColor: widget.filled ??Colors.white,
enabledBorder: InputBorder.none,
border: InputBorder.none,
contentPadding: EdgeInsets.only(left: (widget.width ?? 400) < 200 ? 0 : 30, right: (widget.width ?? 400) < 200 ? 0 : 30, top: 18, bottom: 18),
),
items: items,
)))),
widget.load == null ? Container() : Tooltip(
message: widget.tooltipLoad ?? "load $t",
child:InkWell(
mouseCursor: SystemMouseCursors.click,
onTap: () async {
if (widget.canLoad == null || !widget.canLoad!(widget.current) || widget.load == null || widget.current == null) {
return;
}
await widget.load!(widget.current!);
setState(() { });
},
child: Container( width: 50,height: 50,
color: Colors.black,
child: Icon( widget.iconLoad ?? Icons.add, color: widget.current == null || widget.canLoad == null || !widget.canLoad!(widget.current) ? Colors.grey : Colors.white)
)
)
),
widget.remove == null ? Container() : Tooltip(
message: widget.tooltipRemove ?? "remove $t",
child: InkWell( mouseCursor: SystemMouseCursors.click,
onTap: () async {
if (widget.canRemove == null || !widget.canRemove!(widget.current) || widget.remove == null || widget.current == null) {
return;
}
await widget.remove!(widget.current!);
setState(() { });
},
child: Container( width: 50,height: 50,
decoration: BoxDecoration(color: Colors.black, border: Border(left: BorderSide(color: Colors.grey.shade300))),
child: Icon(widget.iconRemove ?? Icons.delete, color: widget.current == null || widget.canRemove == null || !widget.canRemove!(widget.current) ? Colors.grey : Colors.white)) )
),
]); });
}
}

View File

@@ -0,0 +1,137 @@
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;
Future<void> Function(Map<String,dynamic>)? load;
Future<void> Function(String)? loadStr;
Future<void> Function(String)? remove;
bool Function(String?)? canLoad;
bool Function(String?)? canRemove;
void Function(String?)? change;
String? current;
String? compare;
IconData? iconLoad;
IconData? iconRemove;
String? hint;
String? tooltipLoad;
String? tooltipRemove;
Color? filled;
Color? hintColor;
Color? color;
List<ShallowTextInputWidget> forms = [];
String? attr;
ShallowTextInputWidget ({ Key? key, this.width, this.current, this.attr,
this.iconLoad, this.iconRemove, this.hint, this.forms = const [], this.loadStr,
this.tooltipLoad = "", this.tooltipRemove = "",
this.filled, this.hintColor, this.color,
required this.type, this.canLoad, this.canRemove, this.load, this.remove, this.change }): super(key: key);
@override ShallowTextInputWidgetState createState() => ShallowTextInputWidgetState();
Map<String, dynamic> serialize() {
Map<String, dynamic> map = { "name" : current };
for (var form in forms) {
if (form.attr == null) {
continue;
}
map[form.attr!] = form.current;
}
return map;
}
bool validate() {
return canLoad == null ? true : canLoad!(current);
}
}
class ShallowTextInputWidgetState extends State<ShallowTextInputWidget> {
bool validForms() {
for (var form in widget.forms) {
if (!form.validate()) {
return false;
}
}
return true;
}
@override Widget build(BuildContext context) {
var t = widget.type == SharedWorkspaceType.workspace ? "workspace" : (widget.type == SharedWorkspaceType.workflow ? "workflow" : "peer");
return Row( children: [
Tooltip( message: widget.hint ?? "current $t", child:
Theme(
data: Theme.of(context).copyWith(
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,
),
child: TextFormField(
onChanged: (value) {
setState(() {
widget.current = value;
if (widget.change != null) {
widget.change!(value);
}
});
},
initialValue: widget.current,
style: TextStyle(color: widget.color ?? Colors.black, fontSize: 15),
decoration: InputDecoration(
filled: true,
border: InputBorder.none,
focusedBorder: InputBorder.none,
disabledBorder: InputBorder.none,
enabledBorder: InputBorder.none,
fillColor: widget.filled ?? Colors.white,
hintText: widget.hint ?? "enter $t ${widget.attr ?? "name"}...",
contentPadding: const EdgeInsets.only(left: 30, right: 30, top: 18, bottom: 18),
hintStyle: TextStyle(color: widget.hintColor ??const Color.fromARGB(255, 85, 44, 44), fontSize: 14)),
),
))),
widget.load == null && widget.loadStr == null ? Container() : Tooltip(
message: widget.tooltipLoad ?? "add $t",
child:InkWell(
mouseCursor: SystemMouseCursors.click,
onTap: () async {
if (widget.canLoad == null || !widget.canLoad!(widget.current) || !validForms()
|| (widget.load == null && widget.loadStr == null) || widget.current == null) {
return;
}
if (widget.loadStr != null) {
await widget.loadStr!(widget.current!);
} else {
await widget.load!(widget.serialize());
}
setState(() { });
},
child: Container( width: 50,height: 50,
color: Colors.black,
child: Icon( widget.iconLoad ?? Icons.add, color: widget.current == null || !validForms()
|| widget.canLoad == null || !widget.canLoad!(widget.current) ? Colors.grey : Colors.white)
)
)
),
widget.remove == null ? Container() : Tooltip(
message: widget.tooltipRemove ?? "refresh entry",
child: InkWell( mouseCursor: SystemMouseCursors.click,
onTap: () async {
if (widget.canRemove == null || !widget.canRemove!(widget.current) || widget.remove == null || widget.current == null) {
return;
}
await widget.remove!(widget.current!);
setState(() { });
},
child: Container( width: 50,height: 50,
decoration: BoxDecoration(color: Colors.black, border: Border(left: BorderSide(color: Colors.grey.shade300))),
child: Icon(widget.iconRemove ?? Icons.delete, color: widget.current == null || widget.canRemove == null || !widget.canRemove!(widget.current) ? Colors.grey : Colors.white)) )
),
]);
}
}

View File

@@ -18,7 +18,7 @@ class ItemRowWidget extends StatefulWidget {
}
class ItemRowWidgetState extends State<ItemRowWidget> {
@override Widget build(BuildContext context) {
double imageSize = MediaQuery.of(context).size.width != widget.contextWidth ? 0 : 80;
double imageSize = widget.contextWidth <= 400 ? 0 : 80;
var ratio = MediaQuery.of(context).size.width != widget.contextWidth ? 0.5 : 1; // 2;
var itemWidth = (((widget.contextWidth - imageSize) / 3) - 80) / ratio;
itemWidth = itemWidth > 100 ? 100 : ( itemWidth < 40 ? 40 : itemWidth );
@@ -30,6 +30,7 @@ class ItemRowWidgetState extends State<ItemRowWidget> {
Widget w = Container(
width: widget.contextWidth,
height: 100,
padding: EdgeInsets.only(left: imageSize == 0 ? 20 : 0),
decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey.shade300)) ),
child: Row( children: [
widget.low ? Container( padding: const EdgeInsets.only(left: 10),) : Container( padding: const EdgeInsets.all(10),

View File

@@ -0,0 +1,74 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:oc_front/models/response.dart';
const List<GlobalKey<State>> _empty = [];
// ignore: must_be_immutable
class ShallowItemRowWidget extends StatefulWidget {
bool readOnly = false;
double contextWidth = 0;
ShallowData item;
IconData? icon;
bool low = false;
bool show = false;
List<IconData> badges = [];
void Function(String?)? delete;
void Function(String?)? edit;
List<GlobalKey<State>> keys = [];
ShallowItemRowWidget ({ super.key, this.low = false, this.icon, this.delete, this.edit, this.badges = const [],
required this.contextWidth, this.readOnly = false, required this.item, this.keys = _empty });
@override ShallowItemRowWidgetState createState() => ShallowItemRowWidgetState();
}
class ShallowItemRowWidgetState extends State<ShallowItemRowWidget> {
@override Widget build(BuildContext context) {
Widget w = Tooltip( message: widget.item.getName(), child: MouseRegion(
onHover: (e) => setState(() {
widget.show = true;
}),
onExit: (e) => setState(() {
widget.show = false;
}),
child: Container(
height: widget.contextWidth, width: widget.contextWidth,
padding: const EdgeInsets.all(20),
decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: Colors.white,
boxShadow: const [BoxShadow(color: Colors.grey, spreadRadius: 1, blurRadius: 1, offset: Offset(0, 1))]),
child: Stack( children: [
widget.show ? Positioned( left: 0, top: 0,
child: Row( children: [
Padding( padding: const EdgeInsets.only(right: 5),
child: widget.edit == null ? Container() : InkWell( mouseCursor: SystemMouseCursors.click,
onTap: () => widget.edit!(widget.item.getID() + "~" + widget.item.getName()), child: const Icon(Icons.edit, color: Colors.grey,))),
Padding( padding: const EdgeInsets.only(right: 5),
child: widget.delete == null ? Container() : InkWell( mouseCursor: SystemMouseCursors.click,
onTap: () => widget.delete!(widget.item.getID()), child: const Icon(Icons.delete, color: Colors.grey,))),
] )) : Container(),
Positioned( right: 0, top: 0,
child: Row( children: widget.badges.map( (e) => Padding( padding: const EdgeInsets.only(left: 5), child: Icon(e, color: Colors.orange.shade300,))).toList() )),
Column( children: [
widget.low || widget.icon == null ? Container( padding: const EdgeInsets.only(left: 10),) : Container( padding: const EdgeInsets.all(10),
constraints: BoxConstraints(maxWidth: widget.contextWidth, minWidth: widget.contextWidth),
child: Icon( widget.icon!, size: widget.contextWidth / 1.9, color: const Color(0xFFF67C0B9),)),
Container(
child: Padding(padding: widget.contextWidth != MediaQuery.of(context).size.width ?
const EdgeInsets.symmetric(horizontal: 10) : const EdgeInsets.symmetric(horizontal: 20),
child: Column(crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, children: [
Row( children: [
Expanded( child: Center( child: Text(widget.item.getName().toUpperCase(),
style: const TextStyle(fontSize: 15,
overflow: TextOverflow.ellipsis,
fontWeight: FontWeight.w600, color: Colors.grey)),
))
]),
],)
)
),
])
]))));
return widget.readOnly || widget.low ? w : InkWell( mouseCursor: SystemMouseCursors.click,
onTap: () { },
child: w );
}
}

View File

@@ -60,7 +60,7 @@ class LogWidgetState extends State<LogWidget> {
child: Icon( widget.expanded ? Icons.keyboard_arrow_down_outlined : Icons.arrow_forward_ios, size: widget.expanded ? 25 : 15,
color: map.isEmpty ? Colors.grey : Colors.black, weight: widget.expanded ? 100 : 1000,)))),
Padding( padding: const EdgeInsets.only(right: 10),
child: Text("${widget.item.timestamp?.toString()}",
child: Text("${widget.item.timestamp?.toLocal().toString().substring(3)}",
style: const TextStyle(fontSize: 13, color: Colors.black, fontWeight: FontWeight.w500))),
Tooltip( message : "copy to clipboard", child: InkWell( child: const Icon(Icons.copy, size: 15, color: Colors.grey), onTap: () {
if (widget.item.message != null) {

View File

@@ -1,142 +0,0 @@
import 'package:flutter/material.dart';
import 'package:oc_front/core/models/shared_workspace_local.dart';
import 'package:oc_front/core/services/specialized_services/shared_service.dart';
import 'package:oc_front/models/shared.dart';
import 'package:oc_front/pages/catalog.dart';
import 'package:oc_front/pages/catalog_item.dart';
import 'package:oc_front/pages/workflow.dart';
enum SharedMenuWorkspaceType { workspace, workflow, peer }
class SharedMenuWorkspaceWidget extends StatefulWidget {
List<dynamic> excluded = [];
SharedMenuWorkspaceType type = SharedMenuWorkspaceType.workspace;
double? width;
String contextID;
SharedService service = SharedService();
String? selected;
bool inner = false;
bool reverse = false;
double? topMargin;
String? before;
TextEditingController ctrl = TextEditingController();
SharedMenuWorkspaceWidget ({ Key? key, this.width, required this.contextID, this.selected,
this.type = SharedMenuWorkspaceType.workspace, this.topMargin, this.excluded = const [],
this.inner = false, this.reverse = false, this.before}): super(key: key);
@override SharedMenuWorkspaceWidgetState createState() => SharedMenuWorkspaceWidgetState();
}
class SharedMenuWorkspaceWidgetState extends State<SharedMenuWorkspaceWidget> {
@override Widget build(BuildContext context) {
return Row( children: [
Tooltip( message: "current workspace", child:
Theme(
data: Theme.of(context).copyWith(
canvasColor: Colors.grey,
),
child: Container(
margin: EdgeInsets.only(top: widget.topMargin ?? (widget.inner ? 0 : 10)),
height: 50, width: (widget.width ?? MediaQuery.of(context).size.width) - 100,
decoration: BoxDecoration(
color: widget.reverse ? Colors.white : ( widget.inner ? Color.fromRGBO(38, 166, 154, 1) : Colors.grey.shade300 ),
border: const Border(bottom: BorderSide(color: Colors.transparent, width: 1))
),
padding: EdgeInsets.only(left: (widget.width ?? 400) < 400 ? 20 : 50, right: (widget.width ?? 400) < 400 ? 20 : 0),
child: DropdownButtonFormField(
value: widget.selected,
isExpanded: true,
style: const TextStyle(color:Colors.black, fontSize: 15),
hint: Text("choose shared workspace...", style: TextStyle(color: widget.inner ? Colors.grey.shade300 : Colors.grey, fontSize: 15)),
icon: Icon( // Add this
Icons.arrow_drop_down, // Add this
color: widget.inner ? Colors.white : Colors.grey, // Add this
),
decoration: InputDecoration(
filled: true,
suffixIconColor: widget.inner ? Colors.grey.shade300 : Colors.grey,
focusedBorder: const OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Colors.transparent, width: 0),
),
fillColor: widget.reverse ? Colors.white : (widget.inner ? const Color.fromRGBO(38, 166, 154, 1) : Colors.grey.shade300),
contentPadding: EdgeInsets.only(left: 0 , right: (widget.width ?? 400) < 400 ? 0 : 30, top: 10, bottom: 30),
enabledBorder: const OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Colors.transparent, width: 0),
),
border: const OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Colors.transparent, width: 0)),
),
items: SharedWorkspaceLocal.workspaces.values.where((element) => !widget.excluded.contains(element.id)
).map((e) => DropdownMenuItem(
value: e.id ,child: Text(e.name ?? ""),)).toList(),
onChanged: (value) {
setState(() {
widget.before = widget.selected;
widget.selected = value.toString();
});
})))),
Tooltip(
message: 'share',
child:InkWell(
mouseCursor: widget.selected == null || widget.selected == widget.before ? MouseCursor.defer : SystemMouseCursors.click,
onTap: () async {
if (widget.selected != null && widget.contextID != "" && widget.selected != widget.before) {
if (widget.type == SharedMenuWorkspaceType.peer) {
await widget.service.addPeer(context, widget.selected!, widget.contextID);
} else if (widget.type == SharedMenuWorkspaceType.workflow) {
await widget.service.addWorkflow(context, widget.selected!, widget.contextID);
} else {
await widget.service.addWorkspace(context, widget.selected!, widget.contextID);
}
SharedWorkspaceLocal.init(context, false);
setState(() {});
dash.selectedLeftMenuKey.currentState?.setState(() { });
CatalogFactory.key.currentState?.setState(() {});
CatalogItemFactory.key.currentState?.setState(() {});
WorkflowFactory.key.currentState?.setState(() {});
}
},
child: Container(
margin: EdgeInsets.only(top: widget.topMargin ?? (widget.inner ? 0 : 10)),
width: 50,
height: 50,
color: Colors.black,
child: Icon(Icons.share_rounded,
color: widget.selected == null || widget.selected == widget.before ? Colors.grey : Colors.white)
)
)
),
Tooltip(
message: 'unshare',
child:InkWell(
mouseCursor: widget.selected == null || widget.selected == widget.before ? MouseCursor.defer : SystemMouseCursors.click,
onTap: () async {
if (widget.selected != null && widget.contextID != "" && widget.selected != widget.before) {
if (widget.type == SharedMenuWorkspaceType.peer) {
await widget.service.removePeer(context, widget.selected!, widget.contextID);
} else if (widget.type == SharedMenuWorkspaceType.workflow) {
await widget.service.removeWorkflow(context, widget.selected!, widget.contextID);
} else {
await widget.service.removeWorkspace(context, widget.selected!, widget.contextID);
}
SharedWorkspaceLocal.init(context, false);
setState(() {});
dash.selectedLeftMenuKey.currentState?.setState(() { });
CatalogFactory.key.currentState?.setState(() {});
CatalogItemFactory.key.currentState?.setState(() {});
WorkflowFactory.key.currentState?.setState(() {});
}
},
child: Container(
decoration: const BoxDecoration(
color: Colors.black,
border: Border(left: BorderSide(color: Colors.white, width: 1))
),
margin: EdgeInsets.only( top: widget.topMargin ?? (widget.inner ? 0 : 10 )),
width: 50,
height: 50,
child: Icon(Icons.delete, color: widget.selected == null || widget.selected == widget.before ? Colors.grey : Colors.white)
)
)
)
]);
}
}

View File

@@ -1,119 +0,0 @@
import 'package:flutter/material.dart';
import 'package:oc_front/core/models/workspace_local.dart';
import 'package:oc_front/widgets/menu_clipper/shared_workspace_menu.dart';
class MenuWorkspaceWidget extends StatefulWidget {
bool simpliest = false;
double? width;
void Function()? onWorkspaceChange;
TextEditingController ctrl = TextEditingController();
MenuWorkspaceWidget ({ Key? key, this.simpliest = false, this.width, this.onWorkspaceChange }): super(key: key);
@override MenuWorkspaceWidgetState createState() => MenuWorkspaceWidgetState();
}
class MenuWorkspaceWidgetState extends State<MenuWorkspaceWidget> {
@override Widget build(BuildContext context) {
return Row( children: [
Tooltip( message: "current workspace", child:
Theme(
data: Theme.of(context).copyWith(
canvasColor: widget.simpliest ? Colors.grey.shade300 : Colors.grey,
),
child: Container( height: 50, width: widget.width ?? MediaQuery.of(context).size.width / ( widget.simpliest ? 1 : 3),
decoration: BoxDecoration(
color: widget.simpliest ? Colors.white : const Color.fromRGBO(38, 166, 154, 1),
border: Border(bottom: BorderSide(color: widget.simpliest ? Colors.grey.shade300 : Colors.transparent, width: 1))
),
padding: EdgeInsets.only(left: (widget.width ?? 400) < 400 ? 20 : 50, right: (widget.width ?? 400) < 400 ? 20 : 0),
child: DropdownButtonFormField(
value: WorkspaceLocal.getCurrentWorkspace()?.id,
isExpanded: true,
style: TextStyle(color: widget.simpliest ? Colors.black : Colors.white, fontSize: 15),
hint: Text("load workspace...", style: TextStyle(color: Colors.grey.shade300, fontSize: 15)),
icon: Icon( // Add this
Icons.arrow_drop_down, // Add this
color: widget.simpliest ? Colors.grey : Colors.white, // Add this
),
decoration: InputDecoration(
filled: true,
prefixIconColor: widget.simpliest ? Colors.grey : Colors.white,
icon: Icon(Icons.shopping_cart, color: Colors.grey.shade300),
suffixIconColor: widget.simpliest ? Colors.grey : Colors.white,
focusedBorder: const OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Colors.transparent, width: 0),
),
fillColor: widget.simpliest ? Colors.white : const Color.fromRGBO(38, 166, 154, 1),
contentPadding: EdgeInsets.only(left: (widget.width ?? 400) < 400 ? 0 : 30, right: (widget.width ?? 400) < 400 ? 0 : 30, top: 10, bottom: 30),
enabledBorder: const OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Colors.transparent, width: 0),
),
border: const OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Colors.transparent, width: 0)),
),
items: WorkspaceLocal.getWorkspacesIDS().map((e) => DropdownMenuItem(
value: e.id,child: Text(e.name ?? ""),)).toList(),
onChanged: (value) {
setState(() {
WorkspaceLocal.changeWorkspace(value.toString());
if (widget.onWorkspaceChange != null) {
widget.onWorkspaceChange!();
}
});
})))),
widget.simpliest ? Container() : Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: (MediaQuery.of(context).size.width / 3) - 50,
height: 50,
decoration: const BoxDecoration(border: Border(left: BorderSide(color: Colors.white))),
child: TextFormField(
expands: true,
maxLines: null,
minLines: null,
style: const TextStyle(color: Colors.white, fontSize: 15),
cursorColor: const Color.fromARGB(38, 166, 154, 1),
controller: widget.ctrl,
onChanged: (value) { setState(() { }); },
validator: (value) => value == null || value.isEmpty ? "name is required" : null,
decoration: InputDecoration(
hintText: "name a new workspace...",
fillColor: const Color.fromRGBO(38, 166, 154, 1),
filled: true,
contentPadding: const EdgeInsets.only(left: 30, right: 30, top: 15, bottom: 5),
hintStyle: TextStyle(
color: Colors.grey.shade300,
fontSize: 15,
fontWeight: FontWeight.w400
),
border: InputBorder.none
)
)
),
Tooltip(
message: 'add',
child:InkWell(
mouseCursor: widget.ctrl.value.text.isEmpty ? MouseCursor.defer : SystemMouseCursors.click,
onTap: () async {
if (widget.ctrl.value.text.isNotEmpty) {
WorkspaceLocal.createWorkspace(widget.ctrl.value.text, context);
}
},
child: Container(
width: 50,
height: 50,
color: Colors.black,
child: Icon(Icons.add, color: widget.ctrl.value.text.isEmpty ? Colors.grey : Colors.white)
)
)
)
]),
widget.simpliest ? Container() : SharedMenuWorkspaceWidget( inner: true,
excluded: const[],
before: WorkspaceLocal.workspaces[WorkspaceLocal.current]!.shared,
selected: WorkspaceLocal.workspaces[WorkspaceLocal.current]!.shared,
contextID: WorkspaceLocal.current ?? "", width: (MediaQuery.of(context).size.width / 3))
]);
}
}

View File

@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:oc_front/core/services/router.dart';
import 'package:oc_front/widgets/menu_clipper/arrow_clipper.dart';
import 'package:oc_front/widgets/menus/arrow_clipper.dart';
class TooltipWidget extends StatefulWidget {
int index = -1;

View File

@@ -43,7 +43,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
List<Widget> children = [];
if (selected != null) {
for (var wf in widget.data[selected!] ?? (<WorkflowExecution>[])) {
DateTime d2 = DateTime.parse(wf.executionData!);
DateTime d2 = DateTime.parse(wf.executionData!).toLocal();
children.add( InkWell(
onTap: () => setState(() { selectedReal = wf.executionData; }),
child: Container( margin: const EdgeInsets.all(10),

View File

@@ -1,4 +1,5 @@
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/models/workflow.dart';
import 'package:oc_front/widgets/sheduler_items/schedule.dart';
@@ -25,9 +26,9 @@ class SchedulerItemWidgetState extends State<SchedulerItemWidget> {
List<Widget> widgets = [];
for (var ev in widget.data[element] ?? ([] as List<WorkflowExecution>)) {
widget.keys[ev.executionData!] = GlobalKey();
var d2 = DateTime.parse(ev.executionData!);
var d2 = DateTime.parse(ev.executionData!).toLocal();
DateTime? d3;
try { d3 = DateTime.parse(ev.endDate!);
try { d3 = DateTime.parse(ev.endDate!).toLocal();
} catch (e) { /* */ }
widgets.add(InkWell(
onTap: () => widget.parent?.setState(() {
@@ -79,7 +80,11 @@ class SchedulerItemWidgetState extends State<SchedulerItemWidget> {
)));
}
var date = DateTime.parse(element);
children.add(Column( children: [ExpansionTile(
children.add(Container(
decoration: const BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.black)),
),
child: Column( children: [ExpansionTile(
enabled: widget.enabled,
shape: const ContinuousRectangleBorder(),
iconColor: Colors.grey,
@@ -97,9 +102,7 @@ class SchedulerItemWidgetState extends State<SchedulerItemWidget> {
),
collapsedIconColor: Colors.grey,
children: widgets,
),
Divider(color: Colors.grey.shade300, height: 1)
]));
)])));
}
Future.delayed( const Duration(milliseconds: 100), () {
if (selectedReal != null) {