This commit is contained in:
mr
2024-11-08 13:59:22 +01:00
parent 685badc59a
commit 1ca77b6611
69 changed files with 1601 additions and 1337 deletions

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:oc_front/core/models/workspace_local.dart';
import 'package:oc_front/main.dart';
import 'package:oc_front/models/search.dart';
import 'package:oc_front/widgets/items/item_row.dart';
@@ -15,7 +16,7 @@ class CatalogWidgetState extends State<CatalogWidget> {
var items = widget.items ?? WorkspaceLocal.items;
List<ItemRowWidget> itemRows = items.map((e) => ItemRowWidget(
readOnly: widget.readOnly,
contextWidth: widget.itemWidth ?? MediaQuery.of(context).size.width, item: e)).toList();
contextWidth: widget.itemWidth ?? getMainWidth(context), item: e)).toList();
return Column( children: itemRows);
}
}

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:oc_front/main.dart';
class InfoAlertBannerChild extends StatelessWidget {
final String text;
@@ -9,7 +10,7 @@ class InfoAlertBannerChild extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
width: double.infinity,
constraints: BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.8),
constraints: BoxConstraints(maxWidth: getMainWidth(context) * 0.8),
decoration: const BoxDecoration(
color: Colors.greenAccent,
borderRadius: BorderRadius.all(Radius.circular(5)),
@@ -38,9 +39,9 @@ class AlertAlertBannerChild extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
width: double.infinity,
constraints: BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.8),
decoration: const BoxDecoration(
color: Colors.redAccent,
constraints: BoxConstraints(maxWidth: getMainWidth(context) * 0.8),
decoration: BoxDecoration(
color: redColor,
borderRadius: BorderRadius.all(
Radius.circular(5),
),

View File

@@ -1,74 +1,105 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:go_router/go_router.dart';
import 'package:oc_front/core/services/auth.service.dart';
import 'package:oc_front/main.dart';
class LoginWidget extends StatefulWidget {
LoginWidget ({ Key? key }): super(key: key);
@override LoginWidgetState createState() => LoginWidgetState();
}
class LoginWidgetState extends State<LoginWidget> {
TextEditingController usernameCtrl = TextEditingController();
TextEditingController passwordCtrl = TextEditingController();
String? error;
bool loading = false;
@override Widget build(BuildContext context) {
return AlertDialog(
backgroundColor: Colors.white,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(0))),
content: Padding(padding: const EdgeInsets.all(20), child: Column(mainAxisSize: MainAxisSize.min, children: [
const Center(child: Padding( padding: EdgeInsets.only(bottom: 10),
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)),)),
Container(
padding: const EdgeInsets.symmetric(vertical: 20),
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Colors.black))),
),
return Padding(padding: const EdgeInsets.all(50), child: Column(mainAxisSize: MainAxisSize.min, children: [
const Center(child: Icon(Icons.person_search, size: 150, color: Colors.grey,)),
Center(child: Padding( padding: const EdgeInsets.only(top: 5, bottom: 20),
child: Text("WELCOME ON OPENCLOUD", style: TextStyle(fontSize: 25, fontWeight: FontWeight.w600,
color: lightColor ) ))),
Container( margin: const EdgeInsets.only(bottom: 10), child: Center(child: Row( mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: MediaQuery.of(context).size.width / 3,
width: getMainWidth(context) / 3,
alignment : Alignment.center,
child: TextField(
controller: usernameCtrl,
onChanged: (v) => setState(() {}),
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey.shade300), borderRadius: BorderRadius.zero),
border: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey.shade300), borderRadius: BorderRadius.zero),
focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey.shade300), borderRadius: BorderRadius.zero),
enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: midColor), borderRadius: BorderRadius.zero),
border: OutlineInputBorder(borderSide: BorderSide(color: midColor), borderRadius: BorderRadius.zero),
focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: midColor), borderRadius: BorderRadius.zero),
hintText: "username...",
contentPadding: const EdgeInsets.symmetric(horizontal: 20),
fillColor: Colors.grey.shade300,
fillColor: midColor,
filled: true,
hintStyle: const TextStyle(fontSize: 12.5, color: Colors.grey)),
style: const TextStyle(fontSize: 12.5, color: Colors.grey)),),
style: const TextStyle(fontSize: 12.5, color: Colors.black)),),
Container(width: 50, height: 50, color: Colors.black, child: const Icon(Icons.person, color: Colors.white))
]))),
Container( margin: const EdgeInsets.only(bottom: 20), child: Center(child: Row( mainAxisAlignment: MainAxisAlignment.center,
Center(child: Row( mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: MediaQuery.of(context).size.width / 3,
width: getMainWidth(context) / 3,
alignment : Alignment.center,
child: TextField(
controller: passwordCtrl,
obscureText: true,
onChanged: (value) {
setState(() {});
},
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey.shade300), borderRadius: BorderRadius.zero),
enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey.shade300), borderRadius: BorderRadius.zero),
border: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey.shade300), borderRadius: BorderRadius.zero),
focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: midColor), borderRadius: BorderRadius.zero),
enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: midColor), borderRadius: BorderRadius.zero),
border: OutlineInputBorder(borderSide: BorderSide(color: midColor), borderRadius: BorderRadius.zero),
hintText: "password...",
contentPadding: const EdgeInsets.symmetric(horizontal: 20),
fillColor: Colors.grey.shade300,
fillColor: midColor,
filled: true,
hintStyle: const TextStyle(fontSize: 12.5, color: Colors.grey)),
style: const TextStyle(fontSize: 12.5, color: Colors.grey)),),
style: const TextStyle(fontSize: 12.5, color: Colors.black)),),
Container(width: 50, height: 50, color: Colors.black, child: const Icon(Icons.password, color: Colors.white))
]))),
Row( mainAxisAlignment: MainAxisAlignment.center, children: [
Padding( padding: const EdgeInsets.only(right: 10), child:
InkWell(onTap: () { context.pop(); },
mouseCursor: SystemMouseCursors.click,
child: Container(
margin: const EdgeInsets.only(top: 20),
width: MediaQuery.of(context).size.width / 3,
padding: const EdgeInsets.symmetric(vertical: 20),
color: const Color.fromRGBO(38, 166, 154, 1),
child: const Center( child: Text("LOGIN", style: TextStyle(color: Colors.white, fontSize: 15),))))),
])
],)));
])),
Column( children: [
Center( child: Padding( padding: EdgeInsets.only(bottom: 10, top: error == null ? 27 : 10), child:
error == null ? Container() : Text(error ?? "", style: TextStyle(color: redColor, fontSize: 12.5)))),
Row( mainAxisAlignment: MainAxisAlignment.center, children: [
Padding( padding: const EdgeInsets.only(right: 10, bottom: 30), child:
InkWell(onTap: () async {
if (usernameCtrl.text == "" || passwordCtrl.text == "") { return; }
error = null;
setState(() {
loading = true;
});
await AuthService.login(usernameCtrl.text, passwordCtrl.text).catchError( (e) {
setState(() {
loading = false;
error = "Invalid username or password";
});
});
if (error == null) {
// ignore: use_build_context_synchronously
setState(() {
loading = true;
});
context.pop();
}
},
mouseCursor: SystemMouseCursors.click,
child: Container(
width: getMainWidth(context) / 3,
padding: const EdgeInsets.symmetric(vertical: 20),
color: usernameCtrl.text == "" || passwordCtrl.text == "" ? Colors.grey : lightColor,
child: Center( child: loading ? SpinKitWave(color: Colors.white, size: 20) : Text("LOGIN", style: TextStyle(
color: usernameCtrl.text == "" || passwordCtrl.text == "" ? midColor :Colors.white,
fontSize: 15) ))))),
])
]),
],));
}
}

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:oc_front/main.dart';
import 'package:oc_front/models/response.dart';
import 'package:oc_front/core/services/router.dart';
import 'package:oc_front/pages/shared.dart';
@@ -9,7 +10,7 @@ class ShallowCreationDialogWidget extends StatefulWidget {
GlobalKey<ShallowTextInputWidgetState>? formKey;
BuildContext context;
bool Function()? canClose;
SharedWorkspaceType type = SharedWorkspaceType.workspace;
CollaborativeAreaType type = CollaborativeAreaType.workspace;
Future<List<Shallow>> Function()? all;
Future<void> Function(String)? load;
Future<void> Function(Map<String,dynamic>)? create;
@@ -25,7 +26,7 @@ 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"));
var t = widget.type == CollaborativeAreaType.workspace ? "workspace" : (widget.type == CollaborativeAreaType.workflow ? "workflow" : (widget.type == CollaborativeAreaType.collaborative_area ? "collaborative area" :"peer"));
return Container(
color: Colors.white,
padding: const EdgeInsets.only( top: 0, bottom: 20, left: 20, right: 20),
@@ -57,7 +58,8 @@ class ShallowCreationDialogState extends State<ShallowCreationDialogWidget> {
ShallowDropdownInputWidget(
all: widget.all,
type: widget.type,
width: MediaQuery.of(context).size.width <= 540 ? MediaQuery.of(context).size.width - 140 : 400,
hint: "select a $t",
width: getMainWidth(context) <= 540 ? getMainWidth(context) - 140 : 400,
load: (e) async {
await widget.load!(e);
Navigator.pop(widget.context);
@@ -71,13 +73,14 @@ class ShallowCreationDialogState extends State<ShallowCreationDialogWidget> {
deletion: true,
color: Colors.black,
hintColor: Colors.grey,
filled: Colors.grey.shade300,
filled: midColor,
),
Container( height: 10),
ShallowTextInputWidget(
widget.create != null ? ShallowTextInputWidget(
key: widget.formKey,
type: widget.type,
width: MediaQuery.of(context).size.width <= 540 ? MediaQuery.of(context).size.width - 140 : 400,
hint: "create a new $t",
width: getMainWidth(context) <= 540 ? getMainWidth(context) - 140 : 400,
load: (e) async {
await widget.create!(e);
Navigator.pop(widget.context);
@@ -86,9 +89,9 @@ class ShallowCreationDialogState extends State<ShallowCreationDialogWidget> {
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)),
filled: midColor,
) : Container(),
...(widget.create != null ? widget.form.map( (e) => Container( margin: const EdgeInsets.only(top: 10), child: e)) : []),
]
)
);

View File

@@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
import 'package:oc_front/widgets/inputs/sub_text_input.dart';
class ComputeFormsWidget extends StatefulWidget {
dynamic item;
ComputeFormsWidget ({ super.key, required this.item });
@override ComputeFormsWidgetState createState() => ComputeFormsWidgetState();
}
class ComputeFormsWidgetState extends State<ComputeFormsWidget> {
@override Widget build(BuildContext context) {
return Column( children: [
SubTextInputWidget(subkey: "technology", width: 180, empty: false, change: (value) {
}, initialValue: widget.item.getTechnology(), readOnly: true,),
SubTextInputWidget(subkey: "architecture", width: 180, empty: false, change: (value) {
}, initialValue: widget.item.architecture, readOnly: true,),
SubTextInputWidget(subkey: "access", width: 180, empty: false, change: (value) {
}, initialValue: widget.item.getAccess(), readOnly: true,),
SubTextInputWidget(subkey: "localisation", width: 180, empty: false, change: (value) {
}, initialValue: widget.item.localisation, readOnly: true,),
]);
}
}

View File

@@ -11,7 +11,6 @@ class DataFormsWidget extends StatefulWidget {
}
class DataFormsWidgetState extends State<DataFormsWidget> {
@override Widget build(BuildContext context) {
print(widget.item.serialize());
return Column( children: [
WebReferenceFormsWidget(item: widget.item),
]);

View File

@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_flow_chart/flutter_flow_chart.dart';
import 'package:oc_front/core/services/perms_service.dart';
import 'package:oc_front/main.dart';
import 'package:oc_front/models/search.dart';
import 'package:oc_front/models/workflow.dart';
import 'package:oc_front/pages/workflow.dart';
@@ -18,7 +20,7 @@ class ProcessingFormsWidget extends StatefulWidget {
@override ProcessingFormsWidgetState createState() => ProcessingFormsWidgetState();
}
class ProcessingFormsWidgetState extends State<ProcessingFormsWidget> {
Widget getInputAndOutputVariableForms() {
Widget getInputAndOutputVariableForms(bool readOnly) {
var inList = widget.dash.GetArrowByElementID(widget.elementID, true);
var outList = widget.dash.GetArrowByElementID(widget.elementID, false);
List<Widget> res = [];
@@ -40,16 +42,17 @@ class ProcessingFormsWidgetState extends State<ProcessingFormsWidget> {
}
if (inItems.isNotEmpty) {
res.add(SubKeysMapFormsWidget(dash: widget.dash, isInput: true, item: widget.item, elementID: widget.elementID,
categoryKey: "container", varKey: "env", graphItems: inItems));
categoryKey: "container", varKey: "env", graphItems: inItems, readOnly: readOnly));
}
if (outItems.isNotEmpty) {
res.add(SubKeysMapFormsWidget(dash: widget.dash, isInput: false, item: widget.item, elementID: widget.elementID,
categoryKey: "container", varKey: "env", graphItems: outItems));
categoryKey: "container", varKey: "env", graphItems: outItems, readOnly: readOnly));
}
return Column( children: res );
}
@override Widget build(BuildContext context) {
bool readOnly = !PermsService.getPerm(Perms.WORKFLOW_EDIT);
List<Widget> categories = [];
var l = widget.item.model?.model?.keys ?? [];
for (var child in l) {
@@ -59,11 +62,14 @@ class ProcessingFormsWidgetState extends State<ProcessingFormsWidget> {
if (sub[st]!.type?.contains("map") ?? false) {
children.add(
SubMapFormsWidget(dash: dash, empty: children.isEmpty, item: widget.item,
readOnly: readOnly,
elementID: widget.elementID, categoryKey: child, varKey: st)
);
} else if (sub[st]!.type == "string") {
children.add(SubTextInputWidget(subkey: st, initialValue: widget.item.getVariable([child, st], widget.item.serialize()),
width: 200, empty: children.isEmpty, change: (value) {
children.add(SubTextInputWidget(subkey: st,
readOnly: readOnly,
initialValue: widget.item.getVariable([child, st], widget.item.serialize()),
width: 180, empty: children.isEmpty, change: (value) {
widget.item.model ?? Model();
Future.delayed(const Duration(seconds: 2), () {
if (widget.item.getVariable([child, st], widget.item.serialize()) == value) {
@@ -78,41 +84,40 @@ class ProcessingFormsWidgetState extends State<ProcessingFormsWidget> {
}
}
categories.add(Container(
padding: const EdgeInsets.all(10),
width: 250,
padding: const EdgeInsets.symmetric(vertical: 10),
width: 180,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("<${child.toUpperCase()}>", style: const TextStyle(fontSize: 13, fontWeight: FontWeight.bold), textAlign: TextAlign.center),
Padding(padding: const EdgeInsets.only(bottom: 10), child: SubTextInputWidget(subkey: "image", width: 200, empty: false, change: (value) {},
Padding(padding: const EdgeInsets.only(bottom: 10), child: SubTextInputWidget(subkey: "image", width: 180, empty: false, change: (value) {},
initialValue: widget.item.container?.image, readOnly: true,)),
...children,
getInputAndOutputVariableForms(),
getInputAndOutputVariableForms(readOnly),
],)
));
}
// EXPOSE
categories.add(Container(
padding: const EdgeInsets.all(10),
width: 250,
decoration: const BoxDecoration(border: Border(top: BorderSide(color: Colors.grey, width: 1))),
padding: const EdgeInsets.symmetric(vertical: 10),
width: 180,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Padding(padding: EdgeInsets.only(bottom: 5), child: Text("<EXPOSE>",
style: TextStyle(fontSize: 13, fontWeight: FontWeight.bold), textAlign: TextAlign.center)),
Row( children: [
readOnly ? Container() : Row( children: [
InkWell( onTap: () {
widget.item.expose.add(Expose());
var el = dash.getElement(widget.elementID);
el!.element = widget.item as dynamic;
setState(() {});
}, child:
Container( margin: const EdgeInsets.only(left: 15, top: 5),
Container( margin: const EdgeInsets.only(top: 5),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.grey, width: 1)),
width: 150, height: 30,
width: 125, height: 30,
child: const Row( mainAxisAlignment: MainAxisAlignment.center,
children: [ Padding( padding: EdgeInsets.only(right: 5), child: Icon(Icons.add)), Text("add exposure")]),
children: [ Padding( padding: EdgeInsets.only(right: 5), child: Icon(Icons.add)), Text("add expose")]),
)
),
InkWell( onTap: () {
@@ -122,7 +127,7 @@ class ProcessingFormsWidgetState extends State<ProcessingFormsWidget> {
el!.element = widget.item as dynamic;
setState(() {});
}, child:
Container( margin: const EdgeInsets.only(left: 5, right: 10, top: 5),
Container( margin: const EdgeInsets.only(left: 5, top: 5),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.grey, width: 1)),
width: 45, height: 30,
child: const Row( mainAxisAlignment: MainAxisAlignment.center,
@@ -133,10 +138,10 @@ class ProcessingFormsWidgetState extends State<ProcessingFormsWidget> {
],)
));
for (var expose in widget.item.expose) {
categories.add(SubExposeFormsWidget( width: 200, dash: dash, empty: categories.isEmpty,
categories.add(SubExposeFormsWidget( readOnly: readOnly, width: 180, dash: dash, empty: categories.isEmpty,
item: expose, elementID: widget.elementID));
}
return SizedBox( height: MediaQuery.of(context).size.height - 330, child: SingleChildScrollView( child: Column(
return SizedBox( height: getHeight(context) - 330, child: SingleChildScrollView( child: Column(
children: categories )) );
}
}

View File

@@ -3,12 +3,12 @@ import 'package:cron/cron.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/perms_service.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/main.dart';
import 'package:oc_front/pages/shared.dart';
import 'package:oc_front/pages/workflow.dart';
import 'package:oc_front/widgets/dialog/alert.dart';
@@ -18,6 +18,9 @@ class SchedulerFormsWidget extends StatefulWidget {
Dashboard item;
String purpose = "";
bool? booking;
String? error;
String? errorEndDate;
String? errorCron;
Function validate = () {};
SchedulerFormsWidget ({ super.key, required this.item, });
@override SchedulerFormsWidgetState createState() => SchedulerFormsWidgetState();
@@ -26,9 +29,12 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
CheckService check = CheckService();
void save(List<GlobalKey<FormFieldState>> formKeys) {
dash.scheduleActive = !dash.scheduleActive;
widget.error = null;
widget.errorEndDate = null;
widget.errorCron = null;
for (var k in formKeys) {
if (k.currentState != null) {
if (!k.currentState!.validate()) {
if (!k.currentState!.validate() && dash.scheduleActive) {
dash.scheduleActive = !dash.scheduleActive;
return;
} else { k.currentState!.save();}
@@ -41,7 +47,6 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
dash.scheduler["end"] = now.add(const Duration(minutes: 1)).toUtc().toIso8601String();
}
}
print(widget.item.id);
widget.item.save!(widget.item.id);
}
void checkBooking(List<GlobalKey<FormFieldState>> formKeys, void Function(List<GlobalKey<FormFieldState>> )? f){
@@ -60,9 +65,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
(v) {
if (v.data == null) { return; }
widget.booking = v.data!.is_available;
print(v.data!.is_available);
if (v.data!.is_available) {
print(f);
if (f != null) { f(formKeys);
} else {
showAlertBanner( context, () {},
@@ -80,11 +83,13 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
}
@override Widget build(BuildContext context) {
bool isService = true;
try {
if (widget.item.scheduler["mode"] == null) { widget.item.scheduler["mode"] = 1; }
widget.item.elements.firstWhere((element) => (element.element?.serialize()["is_service"] ?? false) == true);
} catch (e) {
widget.item.scheduler = { "mode": 1 };
isService = false;
}
bool readOnly = !PermsService.getPerm(Perms.WORKFLOW_EDIT);
DateTime? start;
DateTime? end;
if (widget.item.scheduler["start"] != null) {
@@ -101,14 +106,13 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
widget.item.scheduler["end"] = end.toUtc().toIso8601String();
}
}
List<GlobalKey<FormFieldState>> formKeys = [GlobalKey<FormFieldState>(), GlobalKey<FormFieldState>(),
GlobalKey<FormFieldState>(), GlobalKey<FormFieldState>()];
List<GlobalKey<FormFieldState>> formKeys = [GlobalKey<FormFieldState>(), GlobalKey<FormFieldState>(), GlobalKey<FormFieldState>(), GlobalKey<FormFieldState>()];
var shallow = ShallowTextInputWidget(
width: 250 - 1,
width: 200 - 1, readOnly: readOnly,
current: widget.item.name,
type: SharedWorkspaceType.workflow,
canRemove: (p0) => p0 != null && p0.isNotEmpty,
remove: (p0) async {
type: CollaborativeAreaType.workflow,
canRemove: PermsService.getPerm(Perms.WORKFLOW_DELETE) ? (p0) => p0 != null && p0.isNotEmpty : null,
remove: PermsService.getPerm(Perms.WORKFLOW_DELETE) ? (p0) async {
await WorflowService().delete(context, widget.item.id ?? "", {}).then((value) {
dash.id = null;
dash.name = "";
@@ -116,7 +120,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
dash.clear();
dash.chartKey.currentState?.widget.flowChart.setState(() { });
});
},
} : null,
);
shallow.change =(p0) => Future.delayed( const Duration(seconds: 2), () async {
if (shallow.compare == p0) {
@@ -126,7 +130,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
}
});
return Column( children: [
Container( padding: const EdgeInsets.all(10), width: 250, height: 60,
Container( padding: const EdgeInsets.all(10), width: 200, height: 60,
decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
child: const Column( mainAxisAlignment: MainAxisAlignment.center, children: [
Text("WORKFLOW INFO", style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), textAlign: TextAlign.center),
@@ -134,32 +138,17 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
])),
widget.item.name == "" ? Container() : Container(
decoration: BoxDecoration( border: Border(
left: BorderSide(color: Colors.grey.shade300, width: 1),
left: BorderSide(color: midColor, 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,
activeColor: Colors.green, inactiveColor: Colors.green,
activeChild: const Text("simple task", style: TextStyle(color: Colors.white)),
inactiveChild: const Text("cron task", style: TextStyle(color: Colors.white)),
borderRadius: const BorderRadius.all(Radius.circular(15)), height: 30.0, disabledOpacity: 0.5,
onChanged: (value) {
Future.delayed(const Duration(milliseconds: 100), () =>
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),
Tooltip( message: "event name",
const SizedBox(height: 20, width: 200 ),
isService ? Text("Warning a processing is a service, if no end execution it will run forever.") : Container(),
Tooltip( message: "executions name",
child: Container( height: 40, margin: const EdgeInsets.only(top: 5),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 20),
child: TextFormField( key: formKeys[0],
initialValue: "${widget.item.scheduler["mode"] == 1 ? "" : "cron_"}${widget.item.scheduler["name"] ?? "${widget.item.name}_event"}",
enabled: !dash.scheduleActive,
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
child: TextFormField( key: formKeys[0], readOnly: readOnly,
initialValue: "${widget.item.scheduler["name"] ?? "${widget.item.name}_executions"}",
enabled: !dash.scheduleActive && !readOnly,
onChanged: (value) {
Future.delayed(const Duration(seconds: 100), () {
if (widget.item.scheduler["name"] == value) {
@@ -169,30 +158,36 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
widget.item.scheduler["name"] = value;
},
onSaved: (value) {
widget.item.scheduler["name"] = value ?? "${widget.item.scheduler["mode"] == 1 ? "" : "cron_"}${widget.item.scheduler["name"] ?? "${widget.item.name}_event"}";
widget.item.scheduler["name"] = value ?? "${widget.item.scheduler["name"] ?? "${widget.item.name}_executions"}";
},
validator: (value) {
if (value == null || value.isEmpty) {
setState(() { widget.error = 'missing name'; });
}
return value == null || value.isEmpty ? "not empty" : null;
},
validator: (value) => value == null || value.isEmpty ? "not empty" : null,
style: const TextStyle(fontSize: 12),
decoration: const InputDecoration(
decoration: InputDecoration(
floatingLabelBehavior: FloatingLabelBehavior.always,
fillColor: Colors.white,
filled: true,
hintText: "enter event name...",
labelText: "event name*",
errorStyle: TextStyle(fontSize: 0),
hintText: "enter executions name...",
labelText: "executions name*",
hintStyle: TextStyle(fontSize: 10),
labelStyle: TextStyle(fontSize: 10),
error: null,
enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
border: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
focusedErrorBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.error != null ? Colors.red : Colors.black)),
errorBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.error != null ? Colors.red : Colors.black)),
focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.error != null ? Colors.red : Colors.black)),
enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.error != null ? Colors.red : Colors.grey)),
border: OutlineInputBorder(borderSide: BorderSide(color: widget.error != null ? Colors.red : Colors.grey)),
contentPadding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
),
))),
Tooltip( message: "start event",
Tooltip( message: "start executions",
child: Container( height: 40, margin: const EdgeInsets.only(top: 5),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 20),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
child: DateTimeField( key: formKeys[1],
enabled: !dash.scheduleActive,
enabled: !dash.scheduleActive && !readOnly,
resetIcon: null,
onShowPicker: (context, currentValue) async {
var date = await showDatePicker(
@@ -202,7 +197,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
cardTheme: CardTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))),
dialogTheme: DialogTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))),
colorScheme: ColorScheme.light(
background: Colors.grey.shade300,
background: midColor,
tertiary: Colors.grey,
secondary: Colors.grey,
primary: Colors.black),
@@ -236,7 +231,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
cardTheme: CardTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))),
dialogTheme: DialogTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))),
colorScheme: ColorScheme.light(
background: Colors.grey.shade300,
background: midColor,
tertiary: Colors.grey,
secondary: Colors.grey,
primary: Colors.black),
@@ -258,16 +253,17 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
format: intl.DateFormat('y-M-dd HH:mm:ss'),
initialValue: start?.toLocal() ?? DateTime.now(),
onChanged: (value) { },
validator: (value) => value == null ? "not empty" : null,
validator: (value) {
return value == null ? "not empty" : null;
},
style: const TextStyle(fontSize: 12),
decoration: const InputDecoration(
floatingLabelBehavior: FloatingLabelBehavior.always,
fillColor: Colors.white,
filled: true,
alignLabelWithHint: false,
hintText: "enter start event...",
labelText: "start event*",
errorStyle: TextStyle(fontSize: 0),
hintText: "enter start executions...",
labelText: "start executions*",
hintStyle: TextStyle(fontSize: 10),
labelStyle: TextStyle(fontSize: 10),
enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
@@ -275,13 +271,18 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
contentPadding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
),
))),
Tooltip( message: "end event",
Tooltip( message: "end executions",
child: Container( height: 40, margin: const EdgeInsets.only(top: 5),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 20),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
child: DateTimeField( key: formKeys[2],
enabled: !dash.scheduleActive,
enabled: !dash.scheduleActive && !readOnly,
validator: (value) {
return value == null && !(widget.item.scheduler["mode"] == 1 ) ? "not empty" : null;
if (value == null && widget.item.scheduler["cron"] != null && widget.item.scheduler["cron"].isNotEmpty) {
setState(() {
widget.errorEndDate = 'missing start date';
});
}
return value == null && widget.item.scheduler["cron"] != null && widget.item.scheduler["cron"].isNotEmpty ? "not empty" : null;
},
onChanged: (value) {
if (value == null) {
@@ -297,7 +298,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
cardTheme: CardTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))),
dialogTheme: DialogTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))),
colorScheme: ColorScheme.light(
background: Colors.grey.shade300,
background: midColor,
tertiary: Colors.grey,
secondary: Colors.grey,
primary: Colors.black),
@@ -321,11 +322,12 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
while(date!.microsecondsSinceEpoch <= (DateTime.now().microsecondsSinceEpoch)
|| time == null
|| (date.microsecondsSinceEpoch) <= (DateTime.parse(widget.item.scheduler["start"] ?? DateTime.now().toIso8601String()).microsecondsSinceEpoch)) {
if (count > 0) {
showAlertBanner( context, () {},
if (count > 0) {
showAlertBanner( context, () {}, // ignore: use_build_context_synchronously
const AlertAlertBannerChild(text: "must be at least 1 minute from now to let system check info && upper starting date"),// <-- Put any widget here you want!
alertBannerLocation: AlertBannerLocation.bottom,);
}
// ignore: use_build_context_synchronously
time = await showTimePicker(context: context,
initialTime: TimeOfDay(hour: date.hour, minute: date.minute),
builder: (BuildContext context, Widget? child) {
@@ -334,7 +336,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
cardTheme: CardTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))),
dialogTheme: DialogTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))),
colorScheme: ColorScheme.light(
background: Colors.grey.shade300,
background: midColor,
tertiary: Colors.grey,
secondary: Colors.grey,
primary: Colors.black),
@@ -361,21 +363,23 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
floatingLabelBehavior: FloatingLabelBehavior.always,
filled: true,
alignLabelWithHint: false,
hintText: "enter end event...",
labelText: "end event${!(widget.item.scheduler["mode"] == 1) ? "*" : ""}",
errorStyle: const TextStyle(fontSize: 0),
hintText: "enter end executions...",
labelText: "end executions",
hintStyle: const TextStyle(fontSize: 10),
labelStyle: const TextStyle(fontSize: 10),
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
border: const OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
focusedErrorBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.errorEndDate != null ? Colors.red : Colors.black)),
errorBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.errorEndDate != null ? Colors.red : Colors.black)),
focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.errorEndDate != null ? Colors.red : Colors.black)),
enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.errorEndDate != null ? Colors.red : Colors.grey)),
border: OutlineInputBorder(borderSide: BorderSide(color: widget.errorEndDate != null ? Colors.red : Colors.grey)),
contentPadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
),
))),
widget.item.scheduler["mode"] == 1 ? Container() : Tooltip( message: "schedule",
Tooltip( message: "cron command",
child: Container( height: 40, margin: const EdgeInsets.only(top: 5),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 20),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
child: TextFormField( key: formKeys[3],
enabled: !dash.scheduleActive,
enabled: !dash.scheduleActive && !readOnly,
initialValue: widget.item.scheduler["cron"],
onChanged: (value) {
Future.delayed(const Duration(seconds: 100), () {
@@ -392,58 +396,67 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
},
validator: (value) {
var cron = Cron();
try {
cron.schedule(Schedule.parse(value ?? ""), () {});
} catch (e) {
return "invalid cron";
if (value != null && value.isNotEmpty) {
try {
cron.schedule(Schedule.parse(value), () {});
} catch (e) {
setState(() {
widget.errorCron = e.toString();
});
return "invalid cron";
}
}
return value == null || value.isEmpty ? "not empty" : null;
return null;
},
style: const TextStyle(fontSize: 12),
decoration: const InputDecoration(
decoration: InputDecoration(
floatingLabelBehavior: FloatingLabelBehavior.always,
fillColor: Colors.white,
filled: true,
hintText: "enter schedule...",
labelText: "schedule*",
errorStyle: TextStyle(fontSize: 0),
hintText: "enter cron command...",
labelText: "cron",
errorStyle: TextStyle(height: 0),
hintStyle: TextStyle(fontSize: 10),
labelStyle: TextStyle(fontSize: 10),
error: null,
enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
border: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
focusedErrorBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.errorCron != null ? Colors.red : Colors.black)),
errorBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.errorCron != null ? Colors.red : Colors.black)),
focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.errorCron != null ? Colors.red : Colors.black)),
enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.errorCron != null ? Colors.red : Colors.grey)),
border: OutlineInputBorder(borderSide: BorderSide(color: widget.errorCron != null ? Colors.red : Colors.grey)),
contentPadding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
),
))),
Container(
width: 250,
width: 200,
height: 20,
decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
),
const SizedBox(
width: 250,
width: 200,
height: 10,
),
Tooltip( message: "check booking",
child: InkWell( mouseCursor: SystemMouseCursors.click,
onTap: () {
checkBooking(formKeys, null);
}, child: Container( margin: const EdgeInsets.only(bottom: 5),
PermsService.getPerm(Perms.WORKFLOW_BOOKING) ? checkBooking(formKeys, null) : null;
}, child: Container( margin: const EdgeInsets.only(bottom: 5, left: 10, right: 10),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5),
border: Border.all(color: widget.booking == null && !dash.scheduleActive ? Colors.black : (widget.booking == true || dash.scheduleActive ? Colors.green : Colors.red), width: 1)),
border: Border.all(color: widget.booking == null && !dash.scheduleActive ? (
PermsService.getPerm(Perms.WORKFLOW_BOOKING) && PermsService.getPerm(Perms.WORKFLOW_EDIT) ? Colors.black : Colors.grey) : (
widget.booking == true || dash.scheduleActive ? Colors.green : redColor), width: 1)),
width: 200, height: 30,
child: Icon(
Icons.verified_outlined,
color: widget.booking == null && !dash.scheduleActive ? Colors.black : (widget.booking == true || dash.scheduleActive ? Colors.green : Colors.red)),
color: widget.booking == null && !dash.scheduleActive ? Colors.black : (widget.booking == true || dash.scheduleActive ? Colors.green : redColor)),
))
),
Tooltip( message: dash.scheduleActive ? "unbook" : "book",
child: InkWell( mouseCursor: SystemMouseCursors.click,
onTap: () {
dash.scheduleActive ? setState(() { save(formKeys); }) : checkBooking(formKeys, save);
PermsService.getPerm(Perms.WORKFLOW_BOOKING) && PermsService.getPerm(Perms.WORKFLOW_EDIT) ? (dash.scheduleActive ? setState(() { save(formKeys); }) : checkBooking(formKeys, save)) : null;
}, 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)),
border: Border.all(color: dash.scheduleActive ? Colors.green : ( PermsService.getPerm(Perms.WORKFLOW_BOOKING) ?Colors.black : Colors.grey ))),
width: 200, height: 30,
child: Icon(
dash.scheduleActive ? Icons.cancel_schedule_send : Icons.schedule_send, color: dash.scheduleActive ? Colors.green : Colors.black),
@@ -452,17 +465,17 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
widget.item.info["shared"] != null && (widget.item.info["shared"] as List<dynamic>).isNotEmpty ? Column( children: [
Container(
height: 20,
width: 250,
width: 200,
decoration: const BoxDecoration(border: Border(top: BorderSide(color: Colors.black))),
),
Container( alignment: Alignment.center, padding: const EdgeInsets.symmetric(horizontal: 20),
Container( alignment: Alignment.center, padding: const EdgeInsets.symmetric(horizontal: 10),
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
...(widget.item.info["shared"] as List<dynamic>).where( (e) => CollaborativeAreaLocal.getCollaborativeArea(e) != null
).map((e) {
var sw = SharedWorkspaceLocal.getSharedWorkspace(e);
return Container( alignment: Alignment.center, padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 5),
var sw = CollaborativeAreaLocal.getCollaborativeArea(e);
return Container( alignment: Alignment.center, padding: const EdgeInsets.symmetric(horizontal: 10, 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),

View File

@@ -5,12 +5,13 @@ import 'package:oc_front/models/search.dart';
import 'package:oc_front/widgets/inputs/sub_text_input.dart';
class SubExposeFormsWidget extends StatefulWidget {
bool readOnly;
Expose item;
Dashboard dash;
String elementID = "";
double width = 200;
double width = 180;
bool empty = false;
SubExposeFormsWidget ({ super.key, required this.dash,
SubExposeFormsWidget ({ super.key, required this.dash, this.readOnly = false,
this.empty = false, required this.item, required this.elementID, required this.width });
@override SubExposeFormsWidgetState createState() => SubExposeFormsWidgetState();
}
@@ -19,9 +20,10 @@ class SubExposeFormsWidgetState extends State<SubExposeFormsWidget> {
return Column( children : [
Container( margin: const EdgeInsets.only(left: 10, right: 10, top: 5),
decoration: BoxDecoration(border: Border.all(color: Colors.grey, width: 1)),
width: 250
width: 180
),
SubTextInputWidget(subkey: "reference port", initialValue: widget.item.port != null ? '${widget.item.port}' : null,
SubTextInputWidget(subkey: "reference port", readOnly: widget.readOnly,
initialValue: widget.item.port != null ? '${widget.item.port}' : null,
width: widget.width, empty: widget.empty, change: (value) {
try {
widget.item.port = int.parse(value);
@@ -34,7 +36,9 @@ class SubExposeFormsWidgetState extends State<SubExposeFormsWidget> {
var el = widget.dash.getElement(widget.elementID);
el!.element = widget.item as dynamic;
}),
SubTextInputWidget(subkey: "PAT", initialValue: widget.item.PAT != null ? '${widget.item.PAT}' : null,
SubTextInputWidget(
readOnly: widget.readOnly,
subkey: "PAT", initialValue: widget.item.PAT != null ? '${widget.item.PAT}' : null,
width: widget.width, empty: widget.empty, change: (value) {
try {
widget.item.PAT = int.parse(value);
@@ -48,6 +52,7 @@ class SubExposeFormsWidgetState extends State<SubExposeFormsWidget> {
el!.element = widget.item as dynamic;
}),
SubTextInputWidget(subkey: "reverse path", initialValue: widget.item.PAT != null ? '${widget.item.PAT}' : null,
readOnly: widget.readOnly,
width: widget.width, empty: widget.empty, change: (value) {
try {
widget.item.path = value;

View File

@@ -6,6 +6,7 @@ import 'package:oc_front/models/workflow.dart';
import 'package:oc_front/widgets/inputs/sub_text_input.dart';
class SubKeysMapFormsWidget extends StatefulWidget {
bool readOnly = false;
FlowData item;
Dashboard dash;
String varKey = "";
@@ -14,7 +15,7 @@ class SubKeysMapFormsWidget extends StatefulWidget {
String elementID = "";
String categoryKey = "";
List<GraphItem> graphItems = [];
SubKeysMapFormsWidget({ super.key, required this.dash, required this.isInput,
SubKeysMapFormsWidget({ super.key, required this.dash, required this.isInput, this.readOnly = false,
this.empty = false, required this.item, required this.elementID, required this.graphItems,
required this.categoryKey, required this.varKey });
@override SubKeysMapFormsWidgetState createState() => SubKeysMapFormsWidgetState();
@@ -31,7 +32,7 @@ class SubKeysMapFormsWidgetState extends State<SubKeysMapFormsWidget> {
if (el == null || el.model == null) { continue; }
for ( var r in el.model!.refs.keys) {
var env = widget.item.getVariable(["container", "env"], widget.item.serialize());
if (env == null && env is Map<String, dynamic>) { continue; }
if (env == null || env is Map<String, dynamic>) { continue; }
var n = "${el.topic.toUpperCase()}_${el.getName().toUpperCase().replaceAll(" ", "_")}_${r.toUpperCase()}_$count";
if (env[n] == null) {
save = true;
@@ -39,7 +40,8 @@ class SubKeysMapFormsWidgetState extends State<SubKeysMapFormsWidget> {
env[n]= "{{ ${ widget.isInput ? "in" : "out" }_${graphItem.id}_$r }}";
widget.item.setVariable(["container", "env"], env, el.serialize());
children.add( Padding(padding: const EdgeInsets.only(bottom: 10),
child: SubTextInputWidget(subkey: n, width: 200, empty: false, change: (value) {}, initialValue: n, readOnly: true, noLabel: true)));
child: SubTextInputWidget(subkey: n, width: 180, empty: false, change: (value) {},
initialValue: n, readOnly: true, noLabel: true)));
count++;
}
}
@@ -50,7 +52,7 @@ class SubKeysMapFormsWidgetState extends State<SubKeysMapFormsWidget> {
return Container();
}
return Column( children : [
Container(width: 250, padding: const EdgeInsets.only(top: 10, bottom: 10),
Container(width: 200, padding: const EdgeInsets.only(top: 10, bottom: 10),
decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1)))),
Padding( padding: const EdgeInsets.only(top: 10),
child: Text("<${widget.isInput ? "INPUT ENV VARIABLE" : "OUTPUT ENV VARIABLE"}>", style: const TextStyle(fontSize: 13, fontWeight: FontWeight.bold),

View File

@@ -10,6 +10,7 @@ class MapForm {
}
class SubMapFormsWidget extends StatefulWidget {
bool readOnly;
String categoryKey = "";
String varKey = "";
String elementID = "";
@@ -17,7 +18,7 @@ class SubMapFormsWidget extends StatefulWidget {
Dashboard dash;
bool empty = false;
List<MapForm> forms = [];
SubMapFormsWidget ({ super.key, required this.dash,
SubMapFormsWidget ({ super.key, required this.dash, this.readOnly = false,
this.empty = false, required this.item, required this.elementID,
required this.categoryKey, required this.varKey });
@override SubMapFormsWidgetState createState() => SubMapFormsWidgetState();
@@ -44,8 +45,9 @@ class SubMapFormsWidgetState extends State<SubMapFormsWidget> {
continue;
}
widget.forms.add(MapForm(key: key, value: m[key]));
children.add(Padding( padding: const EdgeInsets.symmetric(horizontal: 15), child: Row( children: [
SubTextInputWidget(subkey: "key", initialValue: key, width: 91, empty: widget.empty,
children.add(Row( children: [
SubTextInputWidget(subkey: "key", readOnly: widget.readOnly,
initialValue: key, width: 77.5, empty: widget.empty,
change: (value) {
setState(() {
widget.forms[i].key = value;
@@ -58,8 +60,8 @@ class SubMapFormsWidgetState extends State<SubMapFormsWidget> {
});
}),
const Padding(padding: EdgeInsets.only(left: 5, right: 5, top: 15), child: Text("=", textAlign: TextAlign.center,)),
SubTextInputWidget(subkey: "value", initialValue: widget.forms[i].value, width: 90.8, empty: widget.empty,
change: (value) {
SubTextInputWidget(subkey: "value", initialValue: widget.forms[i].value, width: 77.5, empty: widget.empty,
readOnly: widget.readOnly, change: (value) {
Future.delayed(const Duration(seconds: 2), () {
widget.dash.save!(widget.dash.id);
});
@@ -69,13 +71,13 @@ class SubMapFormsWidgetState extends State<SubMapFormsWidget> {
widget.item.setVariable(l, toMap(), widget.item.serialize())) as dynamic;
el!.element = widget.item as dynamic;
}),
])));
]));
i++;
}
return Column( children : [
Container(width: 250, padding: const EdgeInsets.only(top: 10),
Container(width: 200, padding: const EdgeInsets.only(top: 10),
decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),),
Row( children: [
widget.readOnly ? Container() : Row( children: [
InkWell( onTap: () {
widget.forms.add(MapForm(key: "", value: ""));
var el = widget.dash.getElement(widget.elementID);
@@ -83,9 +85,9 @@ class SubMapFormsWidgetState extends State<SubMapFormsWidget> {
widget.item.setVariable(l, toMap(), widget.item.serialize())) as dynamic;
el!.element = widget.item as dynamic;
setState(() {});
}, child: Container( margin: const EdgeInsets.only(left: 15, top: 10),
}, child: Container( margin: const EdgeInsets.only(top: 10),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.grey, width: 1)),
width: 150, height: 30,
width: 125, height: 30,
child: Row( mainAxisAlignment: MainAxisAlignment.center,
children: [ const Padding( padding: EdgeInsets.only(right: 5), child: Icon(Icons.add)), Text("add ${widget.varKey} vars")]),
),
@@ -99,7 +101,7 @@ class SubMapFormsWidgetState extends State<SubMapFormsWidget> {
el!.element = widget.item as dynamic;
setState(() { widget.dash.save!(widget.dash.id); });
}, child:
Container( margin: const EdgeInsets.only(left: 5, right: 10, top: 10),
Container( margin: const EdgeInsets.only(left: 5, top: 10),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.grey, width: 1)),
width: 45, height: 30,
child: const Row( mainAxisAlignment: MainAxisAlignment.center,

View File

@@ -9,14 +9,14 @@ class WebReferenceFormsWidget extends StatefulWidget {
class WebReferenceFormsWidgetState extends State<WebReferenceFormsWidget> {
@override Widget build(BuildContext context) {
return Column( children: [
SubTextInputWidget(subkey: "path", width: 200, empty: false, change: (value) {
widget.item.protocols = value.split(",");
SubTextInputWidget(subkey: "path", width: 180, empty: false, change: (value) {
widget.item.path = value.split(",");
}, initialValue: widget.item.path, readOnly: true,),
SubTextInputWidget(subkey: "protocol", width: 200, empty: false, change: (value) {
widget.item.protocols = value.split(",");
SubTextInputWidget(subkey: "protocol", width: 180, empty: false, change: (value) {
widget.item.protocol = value.split(",");
}, initialValue: widget.item.protocol, readOnly: true,),
SubTextInputWidget(subkey: "type", width: 200, empty: false, change: (value) {
widget.item.protocols = value.split(",");
SubTextInputWidget(subkey: "type", width: 180, empty: false, change: (value) {
widget.item.type = value.split(",");
}, initialValue: widget.item.type, readOnly: true,),
]);
}

View File

@@ -1,10 +1,11 @@
import 'package:flutter/material.dart';
import 'package:oc_front/main.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;
CollaborativeAreaType type = CollaborativeAreaType.workspace;
Future<List<Shallow>> Function()? all;
Future<void> Function(String)? load;
Future<void> Function(String)? remove;
@@ -13,7 +14,7 @@ class ShallowDropdownInputWidget extends StatefulWidget {
void Function(String?)? change;
DropdownMenuItem Function(Shallow)? maptoDropdown;
String? current;
Widget? prefixIcon;
IconData? iconLoad;
IconData? iconRemove;
@@ -28,7 +29,7 @@ class ShallowDropdownInputWidget extends StatefulWidget {
bool deletion = false;
ShallowDropdownInputWidget ({ Key? key, this.width, this.current, required this.all,
ShallowDropdownInputWidget ({ Key? key, this.width, this.current, required this.all, this.prefixIcon,
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);
@@ -39,7 +40,7 @@ class ShallowDropdownInputWidgetState extends State<ShallowDropdownInputWidget>
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");
var t = widget.type == CollaborativeAreaType.workspace ? "workspace" : (widget.type == CollaborativeAreaType.workflow ? "workflow" : "peer");
return FutureBuilder(future: widget.all!(), builder: (b, s) {
List<DropdownMenuItem> items = [];
if (widget.maptoDropdown != null) {
@@ -53,7 +54,7 @@ class ShallowDropdownInputWidgetState extends State<ShallowDropdownInputWidget>
data: Theme.of(context).copyWith(
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 ?? getMainWidth(context)) - (widget.load == null ? 0 : 50) - (widget.remove == null ? 0 : 50),
decoration: const BoxDecoration(
color: Colors.white,
),
@@ -70,13 +71,15 @@ class ShallowDropdownInputWidgetState extends State<ShallowDropdownInputWidget>
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)),
style: TextStyle(color: widget.hintColor ??midColor, fontSize: 14)),
icon: Icon( // Add this
Icons.arrow_drop_down, // Add this
color: widget.hintColor ?? Colors.grey , // Add this
color: widget.hintColor ?? Colors.grey , // Add thisprefixIcon
),
decoration: InputDecoration(
filled: true,
prefixIconColor: Colors.grey,
prefixIcon: widget.prefixIcon,
suffixIconColor: widget.hintColor ?? Colors.grey ,
focusedBorder: InputBorder.none,
fillColor: widget.filled ??Colors.white,
@@ -114,7 +117,7 @@ class ShallowDropdownInputWidgetState extends State<ShallowDropdownInputWidget>
setState(() { });
},
child: Container( width: 50,height: 50,
decoration: BoxDecoration(color: Colors.black, border: Border(left: BorderSide(color: Colors.grey.shade300))),
decoration: BoxDecoration(color: Colors.black, border: Border(left: BorderSide(color: midColor))),
child: Icon(widget.iconRemove ?? Icons.delete, color: widget.current == null || widget.canRemove == null || !widget.canRemove!(widget.current) ? Colors.grey : Colors.white)) )
),
]); });

View File

@@ -1,9 +1,10 @@
import 'package:flutter/material.dart';
import 'package:oc_front/main.dart';
import 'package:oc_front/pages/shared.dart';
class ShallowTextInputWidget extends StatefulWidget {
double? width;
SharedWorkspaceType type = SharedWorkspaceType.workspace;
CollaborativeAreaType type = CollaborativeAreaType.workspace;
Future<void> Function(Map<String,dynamic>)? load;
Future<void> Function(String)? loadStr;
Future<void> Function(String)? remove;
@@ -12,10 +13,12 @@ class ShallowTextInputWidget extends StatefulWidget {
void Function(String?)? change;
String? current;
String? compare;
bool readOnly;
IconData? iconLoad;
IconData? iconRemove;
MainAxisAlignment alignment = MainAxisAlignment.start;
String? hint;
String? tooltipLoad;
@@ -28,7 +31,7 @@ class ShallowTextInputWidget extends StatefulWidget {
String? attr;
ShallowTextInputWidget ({ Key? key, this.width, this.current, this.attr,
ShallowTextInputWidget ({ Key? key, this.width, this.current, this.attr, this.readOnly = false, this.alignment = MainAxisAlignment.start,
this.iconLoad, this.iconRemove, this.hint, this.forms = const [], this.loadStr,
this.tooltipLoad = "", this.tooltipRemove = "",
this.filled, this.hintColor, this.color,
@@ -61,16 +64,17 @@ class ShallowTextInputWidgetState extends State<ShallowTextInputWidget> {
}
@override Widget build(BuildContext context) {
var t = widget.type == SharedWorkspaceType.workspace ? "workspace" : (widget.type == SharedWorkspaceType.workflow ? "workflow" : "peer");
return Row( children: [
var t = widget.type == CollaborativeAreaType.workspace ? "workspace" : (widget.type == CollaborativeAreaType.workflow ? "workflow" : "peer");
return Row( mainAxisAlignment: widget.alignment, children: [
Tooltip( message: widget.hint ?? "current $t", child:
Theme(
data: Theme.of(context).copyWith(
canvasColor: Colors.grey.shade300,
canvasColor: midColor,
),
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 ?? getMainWidth(context)) - (widget.load == null ? 0 : 50) - (widget.remove == null ? 0 : 50),
decoration: const BoxDecoration( color: Colors.white ),
child: TextFormField(
enabled: !widget.readOnly,
onChanged: (value) {
setState(() {
widget.current = value;
@@ -127,7 +131,7 @@ class ShallowTextInputWidgetState extends State<ShallowTextInputWidget> {
setState(() { });
},
child: Container( width: 50,height: 50,
decoration: BoxDecoration(color: Colors.black, border: Border(left: BorderSide(color: Colors.grey.shade300))),
decoration: BoxDecoration(color: Colors.black, border: Border(left: BorderSide(color: midColor))),
child: Icon(widget.iconRemove ?? Icons.delete, color: widget.current == null || widget.canRemove == null || !widget.canRemove!(widget.current) ? Colors.grey : Colors.white)) )
),
]);

View File

@@ -28,7 +28,6 @@ class SubTextInputWidgetState extends State<SubTextInputWidget> {
width: widget.width - (widget.readOnly ? 40 : 0), height: 30,
child: TextFormField( textAlign: TextAlign.start,
enabled: !widget.readOnly,
readOnly: widget.readOnly,
initialValue: widget.initialValue,
onChanged: widget.change,
style: const TextStyle(fontSize: 12),
@@ -40,7 +39,7 @@ class SubTextInputWidgetState extends State<SubTextInputWidget> {
alignLabelWithHint: false,
errorStyle: const TextStyle(fontSize: 0),
hintStyle: const TextStyle(fontSize: 10),
labelStyle: const TextStyle(fontSize: 10),
labelStyle: const TextStyle(fontSize: 12),
floatingLabelBehavior: FloatingLabelBehavior.always,
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
border: const OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:oc_front/main.dart';
import 'package:oc_front/models/search.dart';
import 'package:oc_front/widgets/items/items_details/data_item.dart';
@@ -13,23 +14,23 @@ class ItemWidgetState extends State<ItemWidget> {
Widget w = Container();
/* if (isData(widget.item.topic)) { w = DataItemWidget(item: widget.item as DataItem); }
else if (isComputing(widget.item.topic)) { w = DataItemWidget(item: widget.item as DataItem); }
else if (isDataCenter(widget.item.topic)) { w = DataItemWidget(item: widget.item as DataItem); }
else if (isCompute(widget.item.topic)) { w = DataItemWidget(item: widget.item as DataItem); }
else if (isStorage(widget.item.topic)) { w = DataItemWidget(item: widget.item as DataItem); } */
return Container(
height: MediaQuery.of(context).size.height - 300,
height: getHeight(context) - 300,
child: SingleChildScrollView(
child: Column( children: [
widget.item.description == null ? Container() : Container(
width: MediaQuery.of(context).size.width,
width: getMainWidth(context),
alignment: Alignment.center,
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey.shade300))),
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: midColor))),
padding: const EdgeInsets.all(30),
child: Text(widget.item.description!,
style: TextStyle(fontSize: 15, color: Colors.grey, fontWeight: FontWeight.w500))),
Container(padding: const EdgeInsets.all(30),
color: Colors.grey.shade300,
width: MediaQuery.of(context).size.width / 2,
color: midColor,
width: getMainWidth(context) / 2,
child: w
)
]

View File

@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:oc_front/main.dart';
import 'package:oc_front/models/search.dart';
import 'package:oc_front/core/models/workspace_local.dart';
import 'package:oc_front/core/services/router.dart';
@@ -19,7 +20,7 @@ class ItemRowWidget extends StatefulWidget {
class ItemRowWidgetState extends State<ItemRowWidget> {
@override Widget build(BuildContext context) {
double imageSize = widget.contextWidth <= 400 ? 0 : 80;
var ratio = MediaQuery.of(context).size.width != widget.contextWidth ? 0.5 : 1; // 2;
var ratio = getMainWidth(context) != widget.contextWidth ? 0.5 : 1; // 2;
var itemWidth = (((widget.contextWidth - imageSize) / 3) - 80) / ratio;
itemWidth = itemWidth > 100 ? 100 : ( itemWidth < 40 ? 40 : itemWidth );
var endWidth = (itemWidth * ratio) + 80;
@@ -31,7 +32,7 @@ class ItemRowWidgetState extends State<ItemRowWidget> {
width: widget.contextWidth,
height: 100,
padding: EdgeInsets.only(left: imageSize == 0 ? 20 : 0),
decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey.shade300)) ),
decoration: BoxDecoration( border: Border(bottom: BorderSide(color: midColor)) ),
child: Row( children: [
widget.low ? Container( padding: const EdgeInsets.only(left: 10),) : Container( padding: const EdgeInsets.all(10),
constraints: BoxConstraints(maxWidth: imageSize, minWidth: imageSize),
@@ -39,7 +40,7 @@ class ItemRowWidgetState extends State<ItemRowWidget> {
height: imageSize, width: imageSize)),
Container(
width: widget.low ? widget.contextWidth - 20 : widget.contextWidth - (imageSize + 20) - endWidth,
child: Padding(padding: widget.contextWidth != MediaQuery.of(context).size.width ?
child: Padding(padding: widget.contextWidth != getMainWidth(context) ?
const EdgeInsets.symmetric(horizontal: 10) : const EdgeInsets.symmetric(horizontal: 20),
child: Column(crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, children: [
@@ -49,11 +50,11 @@ class ItemRowWidgetState extends State<ItemRowWidget> {
decoration: BoxDecoration(
color: isData(widget.item.topic) ? Colors.blue :
isComputing(widget.item.topic) ? Colors.green :
isDataCenter(widget.item.topic) ? Colors.orange :
isStorage(widget.item.topic) ? Colors.red : Colors.grey,
isCompute(widget.item.topic) ? Colors.orange :
isStorage(widget.item.topic) ? redColor : Colors.grey,
borderRadius: BorderRadius.circular(4),
),
child: Text( MediaQuery.of(context).size.width < 600 ? "" : widget.item.topic.toString(),
child: Text( getMainWidth(context) < 600 ? "" : widget.item.topic.toString(),
style: const TextStyle(fontSize: 10, color: Colors.white, fontWeight: FontWeight.w600)),
),
Expanded( child: Text(widget.item.name?.toUpperCase() ?? "",
@@ -85,8 +86,8 @@ class ItemRowWidgetState extends State<ItemRowWidget> {
constraints: const BoxConstraints(maxWidth: 80),
width: itemWidth,
decoration: BoxDecoration(
boxShadow: [BoxShadow(color: Colors.grey.shade300, spreadRadius: 1, blurRadius: 1, offset: const Offset(0, 1))],
color: (WorkspaceLocal.hasItem(widget.item) ? Colors.red : const Color.fromRGBO(38, 166, 154, 1)),
boxShadow: [BoxShadow(color: midColor, spreadRadius: 1, blurRadius: 1, offset: const Offset(0, 1))],
color: (WorkspaceLocal.hasItem(widget.item) ? redColor : lightColor ),
borderRadius: BorderRadius.circular(4),
),
child: Icon(WorkspaceLocal.hasItem(widget.item) ? Icons.remove_shopping_cart : Icons.add_shopping_cart,
@@ -101,8 +102,8 @@ class ItemRowWidgetState extends State<ItemRowWidget> {
constraints: const BoxConstraints(maxWidth: 80, minWidth: 40),
width: itemWidth,
decoration: BoxDecoration(
boxShadow: [BoxShadow(color: Colors.grey.shade300, spreadRadius: 1, blurRadius: 1, offset: const Offset(0, 1))],
color: Colors.grey.shade300,
boxShadow: [BoxShadow(color: midColor, spreadRadius: 1, blurRadius: 1, offset: const Offset(0, 1))],
color: midColor,
borderRadius: BorderRadius.circular(4),
),
child: const Icon(Icons.favorite_border, color: Colors.white, size: 20 ))

View File

@@ -1,6 +1,7 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:oc_front/main.dart';
import 'package:oc_front/models/response.dart';
const List<GlobalKey<State>> _empty = [];
@@ -51,7 +52,7 @@ class ShallowItemRowWidgetState extends State<ShallowItemRowWidget> {
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 ?
child: Padding(padding: widget.contextWidth != getMainWidth(context) ?
const EdgeInsets.symmetric(horizontal: 10) : const EdgeInsets.symmetric(horizontal: 20),
child: Column(crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, children: [

View File

@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:json_string/json_string.dart';
import 'package:oc_front/core/sections/header/header.dart';
import 'package:oc_front/main.dart';
import 'package:oc_front/models/logs.dart';
import 'package:oc_front/widgets/dialog/alert.dart';
@@ -19,7 +20,7 @@ class LogsWidgetState extends State<LogsWidget> {
&& (widget.level?.contains(element.level ?? "") ?? true) ).map((e) => LogWidget(item: e)).toList();
return Stack( children: [
SingleChildScrollView( child: itemRows.isEmpty ?
Container( height: MediaQuery.of(context).size.height - 100 - HeaderConstants.height,
Container( height: getMainHeight(context) - 100,
child: const Center( child: Text("no log registered", style: TextStyle(color: Colors.grey, fontSize: 25 ),)))
: Column( children: [...itemRows, Container(height: 50,) ] ) ),
]);
@@ -47,7 +48,7 @@ class LogWidgetState extends State<LogWidget> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container( width: 10, height: 15, color: widget.item.level?.toLowerCase() == "info" ? Colors.green :
( widget.item.level?.toLowerCase() == "error" ? Colors.red : (
( widget.item.level?.toLowerCase() == "error" ? redColor : (
widget.item.level?.toLowerCase() == "warning" ? Colors.orange : Colors.blue))),
InkWell( mouseCursor: map.isEmpty ? MouseCursor.defer : SystemMouseCursors.click, onTap: () {
if (map.isNotEmpty ) {

View File

@@ -1,17 +0,0 @@
import 'package:flutter/material.dart';
class ArrowClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
Path path = Path();
path.moveTo(0, size.height);
path.lineTo(size.width / 2, size.height / 2);
path.lineTo(size.width, size.height);
return path;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) {
return true;
}
}

View File

@@ -1,218 +0,0 @@
import 'package:flutter/material.dart';
import 'package:oc_front/core/services/router.dart';
import 'package:oc_front/widgets/menus/arrow_clipper.dart';
class TooltipWidget extends StatefulWidget {
int index = -1;
Size? buttonSize;
List<String> labels;
Offset? buttonPosition;
TooltipWidget ({ Key? key,
required this.labels,
required this.index,
required this.buttonSize,
required this.buttonPosition }): super(key: key);
@override TooltipWidgetState createState() => TooltipWidgetState();
}
class TooltipWidgetState extends State<TooltipWidget> {
@override Widget build(BuildContext context) {
double minimal = (widget.index < 0 ? 0 : 7 * widget.labels[widget.index].length).toDouble() + 30;
return Positioned(
top : ((widget.buttonPosition?.dy ?? 1 ) + 11) + (((widget.buttonSize?.height) ?? 1)* 1.5) * (widget.index + 1),
left: (widget.buttonPosition?.dx ?? 1) - minimal,
child: Container(
width: widget.index < 0 ? 0 : (widget.index < 0 ? 0 : minimal),
height: (widget.buttonSize?.height ?? 1) - 2,
color: Colors.black,
child: Text( widget.index < 0 ? "" : widget.labels[widget.index],
style: const TextStyle(
color: Colors.white,
decoration: TextDecoration.none,
fontSize: 14,
fontWeight: FontWeight.w300),
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis
),
));
}
}
GlobalKey<ClipperMenuWidgetState> headerMenuKey = GlobalKey<ClipperMenuWidgetState>();
class ClipperMenuWidget extends StatefulWidget {
final BorderRadius borderRadius;
final Color backgroundColor;
final Color iconColor;
int index = -1;
ClipperMenuWidget({
required this.borderRadius,
this.backgroundColor = const Color.fromRGBO(38, 166, 154, 1),
this.iconColor = Colors.black,
}) : super(key: headerMenuKey);
@override
// ignore: library_private_types_in_public_api
ClipperMenuWidgetState createState() => ClipperMenuWidgetState();
}
class ClipperMenuWidgetState extends State<ClipperMenuWidget> with SingleTickerProviderStateMixin {
late GlobalKey _key;
bool isMenuOpen = false;
Offset? buttonPosition;
Size? buttonSize;
final GlobalKey<TooltipWidgetState> _tooltipKey = GlobalKey<TooltipWidgetState>();
OverlayEntry? _overlayEntry;
BorderRadius? _borderRadius;
AnimationController? _animationController;
@override
void initState() {
_animationController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 250),
);
_borderRadius = widget.borderRadius; // BorderRadius.circular(4)
super.initState();
}
@override
void dispose() {
_animationController?.dispose();
super.dispose();
}
findButton() {
if (_key.currentContext != null) {
RenderBox renderBox = _key.currentContext?.findRenderObject()! as RenderBox;
buttonSize = renderBox.size;
buttonPosition = renderBox.localToGlobal(Offset.zero);
}
}
void closeMenu() {
try {
_overlayEntry?.remove();
_animationController?.reverse();
isMenuOpen = false;
} catch (e) { }
}
void openMenu() {
findButton();
_animationController?.forward();
_overlayEntry = _overlayEntryBuilder();
if (_overlayEntry != null) { Overlay.of(context).insert(_overlayEntry!); }
isMenuOpen = true;
}
@override
Widget build(BuildContext context) {
_key = GlobalKey();
headerMenuKey = GlobalKey<ClipperMenuWidgetState>();
return Container(
key: _key,
padding: const EdgeInsets.all(0),
child: IconButton(
splashRadius: 4,
icon: _animationController == null ?
const Icon(
Icons.close,
) : AnimatedIcon(
icon: AnimatedIcons.menu_close,
progress: _animationController!,
),
onPressed: () {
if (isMenuOpen) { closeMenu();
} else { openMenu(); }
},
),
);
}
OverlayEntry _overlayEntryBuilder() {
var routes = AppRouter.zones.where(
(e) => e.path != AppRouter.currentRoute.path && e.label != null && e.icon != null).toList();
return OverlayEntry(
builder: (context) {
return Stack( children: [
TooltipWidget(
key: _tooltipKey,
labels: routes.map((e) => e.label!).toList(),
buttonPosition: buttonPosition,
buttonSize: buttonSize,
index: widget.index
),
Positioned(
top: (buttonPosition?.dy ?? 1 ) + (buttonSize?.height ?? 1),
left: buttonPosition?.dx,
width: buttonSize?.width,
child: Material(
color: Colors.transparent,
child: Stack(
children: <Widget>[
Align(
alignment: Alignment.topCenter,
child: ClipPath(
clipper: ArrowClipper(),
child: Container(
width: 17,
height: 17,
color: widget.backgroundColor ?? Color(0xFFF),
),
),
),
Padding(
padding: const EdgeInsets.only(top: 15.0),
child: Container(
height: routes.length * ((buttonSize?.height ?? 1) * 1.5),
decoration: BoxDecoration(
boxShadow: const [BoxShadow(color: Colors.black54, spreadRadius: 1, blurRadius: 1, offset: Offset(0, 1))],
color: widget.backgroundColor,
borderRadius: _borderRadius,
),
child: Theme(
data: ThemeData(
iconTheme: IconThemeData( color: widget.iconColor ),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: List.generate(routes.length, (index) {
return GestureDetector(
onTap: () {
if (index >= 0) { routes[index].go(context, {}); }
closeMenu();
},
child: Container(
decoration: index == (routes.length - 1) ? null : const BoxDecoration(
border: Border( bottom: BorderSide(color: Colors.white ), ),
),
width: (buttonSize?.width ?? 1) * 1.5,
height: (buttonSize?.height ?? 1) * 1.5,
child: MouseRegion(
cursor: SystemMouseCursors.click,
onEnter: (state) {
_tooltipKey.currentState?.setState(() {
_tooltipKey.currentState?.widget.index = index;
});
},
onExit: (state) {
_tooltipKey.currentState?.setState(() { _tooltipKey.currentState?.widget.index = -1; });
},
child: Icon( routes[index].icon, size: 19)
),
),
);
}),
),
),
),
),
],
),
),
)
]);
},
);
}
}

View File

@@ -1,6 +1,7 @@
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/models/logs.dart';
import 'package:oc_front/models/workflow.dart';
import 'package:oc_front/widgets/logs.dart';
@@ -26,7 +27,7 @@ String? selectedReal;
class ScheduleWidgetState extends State<ScheduleWidget> {
String search = "";
String? level;
List<Color> colors = [Colors.blue, Colors.orange, Colors.red, Colors.green];
List<Color> colors = [Colors.blue, Colors.orange, redColor, Colors.green];
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS"];
DateTime getFocusedDay() {
@@ -35,8 +36,8 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
}
@override Widget build(BuildContext context) {
bool isInfo = MediaQuery.of(context).size.width <= 600 && selected != null;
double w = selected != null ? MediaQuery.of(context).size.width - menuSize : MediaQuery.of(context).size.width;
bool isInfo = getMainWidth(context) <= 600 && selected != null;
double w = selected != null ? getMainWidth(context) - menuSize : getMainWidth(context);
List<Widget> children = [];
if (selected != null) {
for (var wf in widget.data[selected!] ?? (<WorkflowExecution>[])) {
@@ -45,8 +46,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
onTap: () => setState(() { selectedReal = wf.executionData; }),
child: Container( margin: const EdgeInsets.all(10),
decoration: BoxDecoration(
border: Border.all(color: selectedReal != null && selectedReal == wf.executionData ?
const Color.fromRGBO(38, 166, 154, 1) : Colors.transparent, width: 2),
border: Border.all(color: selectedReal != null && selectedReal == wf.executionData ? lightColor : Colors.transparent, width: 2),
borderRadius: BorderRadius.circular(4), color: Colors.white
),
child: Container(
@@ -85,9 +85,9 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
logs = sel.logs ?? [];
} catch(e) { /* */ }
}
menuSize = isInfo ? MediaQuery.of(context).size.width : (menuSize > MediaQuery.of(context).size.width / 2 ? MediaQuery.of(context).size.width / 2 : menuSize);
menuSize = isInfo ? getMainWidth(context) : (menuSize > getMainWidth(context) / 2 ? getMainWidth(context) / 2 : menuSize);
Rect rect = Rect.fromCenter( center: MediaQuery.of(context).size.center(Offset.zero),
width: selected != null ? menuSize : 0, height: (MediaQuery.of(context).size.height - HeaderConstants.height - 50) > 0 ? (MediaQuery.of(context).size.height - HeaderConstants.height - 50) : 0);
width: selected != null ? menuSize : 0, height: (getMainHeight(context) - 50) > 0 ? (getMainHeight(context) - 50) : 0);
return Row( children: [
isInfo ? Container() : SizedBox( width: w,
child: widget.isList ? SchedulerItemWidget(data: widget.data, parent: this, focusedDay: getFocusedDay(), width: w)
@@ -96,7 +96,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
),
fork.TransformableBox(
rect: rect, constraints: BoxConstraints(
maxWidth: isInfo ? MediaQuery.of(context).size.width : (selected != null ? MediaQuery.of(context).size.width / 2 : 0),
maxWidth: isInfo ? getMainWidth(context) : (selected != null ? getMainWidth(context) / 2 : 0),
minWidth: selected != null ? 300 : 0),
handleTapSize: 1, handleTapLeftSize: 0, allowFlippingWhileResizing: false, draggable: false, flip: null,
resizeModeResolver: () => ResizeMode.freeform,
@@ -106,15 +106,15 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
handleAlignment: HandleAlignment.inside,
onChanged: (result, event) { setState(() { menuSize = result.rect.width; }); },
contentBuilder: (context, rect, flip) { return Container(
height: MediaQuery.of(context).size.height - HeaderConstants.height - 50,
width: isInfo ? MediaQuery.of(context).size.width : (selected != null ? menuSize : 0),
color: Colors.grey.shade300,
height: getMainHeight(context) - 50,
width: isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0),
color: midColor,
child: Column(
children: [
Row( children: [
InkWell( onTap: () => setState(() { widget.isDayPlanner = true; }),
child: Tooltip( message: "day planning", child:
Container( height: 50, width: (isInfo ? MediaQuery.of(context).size.width : (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,
decoration: BoxDecoration(
color: widget.isDayPlanner ? Colors.grey : Colors.transparent,
@@ -125,7 +125,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
InkWell( onTap: () => setState(() { widget.isDayPlanner = false; }),
child: Tooltip( message: "monitor task", child:
Container( height: 50, width: selectedReal == null ? 0 : (
(isInfo ? MediaQuery.of(context).size.width : (selected != null ? menuSize : 0)) / 2),
(isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0)) / 2),
alignment: Alignment.center,
decoration: BoxDecoration(
color: !widget.isDayPlanner ? Colors.grey : Colors.transparent,
@@ -136,7 +136,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
)
))
]),
SizedBox( width: isInfo ? MediaQuery.of(context).size.width : (selected != null ? menuSize : 0), height: MediaQuery.of(context).size.height - HeaderConstants.height - (!widget.isDayPlanner && !widget.loading ? 150 : 100 ),
SizedBox( width: isInfo ? getMainWidth(context) : (selected != null ? menuSize : 0), height: getMainHeight(context) - (!widget.isDayPlanner && !widget.loading ? 150 : 100 ),
child: Stack( children: [
SingleChildScrollView( child: Column(
mainAxisAlignment: children.isEmpty || widget.loading ? MainAxisAlignment.center : MainAxisAlignment.start,
@@ -154,7 +154,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
width: 150,
height: 50,
decoration: BoxDecoration(
border: Border(left: BorderSide(color: Colors.grey.shade300)),
border: Border(left: BorderSide(color: midColor)),
),
child: DropdownButtonFormField(
isExpanded: true,
@@ -163,22 +163,22 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
hint: const Text("by level...", style: TextStyle(fontSize: 12)),
decoration: InputDecoration(
filled: true,
focusedBorder: const OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Color.fromARGB(38, 166, 154, 1), width: 0),
focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: lightColor, width: 0),
),
fillColor: Colors.white,
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),
borderSide: BorderSide(color: midColor, width: 0),
),
border: OutlineInputBorder( borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: Colors.grey.shade300, width: 0)),
borderSide: BorderSide(color: midColor, width: 0)),
),
items: [
DropdownMenuItem(value: "debug,warning,error,info", child: Row( children: [ Container( width: 10, height: 15, color: Colors.grey), Text(" all", style: TextStyle(fontSize: 12, color: Colors.black)) ])),
DropdownMenuItem(value: "debug", child: Row( children: [ Container( width: 10, height: 15, color: Colors.blue), Text(" debug", style: TextStyle(fontSize: 12, color: Colors.black)) ])),
DropdownMenuItem(value: "warning", child: Row( children: [ Container( width: 10, height: 15, color: Colors.orange), Text(" warning", style: TextStyle(fontSize: 12, color: Colors.black)) ])),
DropdownMenuItem(value: "error", child: Row( children: [ Container( width: 10, height: 15, color: Colors.red), Text(" error", style: TextStyle(fontSize: 12, color: Colors.black)) ])),
DropdownMenuItem(value: "error", child: Row( children: [ Container( width: 10, height: 15, color: redColor), Text(" error", style: TextStyle(fontSize: 12, color: Colors.black)) ])),
DropdownMenuItem(value: "info", child: Row( children: [ Container( width: 10, height: 15, color: Colors.green), Text(" info", style: TextStyle(fontSize: 12, color: Colors.black)) ])),
],
onChanged: (value) {
@@ -190,7 +190,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
width: menuSize - 150,
height: 50,
decoration: BoxDecoration(
border: Border(left: BorderSide(color: Colors.grey.shade300)),
border: Border(left: BorderSide(color: midColor)),
),
child: TextField(
onChanged: (value) { setState(() {

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:oc_front/core/sections/header/header.dart';
import 'package:oc_front/main.dart';
import 'package:oc_front/models/workflow.dart';
import 'package:oc_front/widgets/sheduler_items/schedule.dart';
import 'package:table_calendar/table_calendar.dart';
@@ -23,7 +24,7 @@ class SchedulerCalendarWidget extends StatefulWidget {
@override SchedulerCalendarWidgetState createState() => SchedulerCalendarWidgetState();
}
class SchedulerCalendarWidgetState extends State<SchedulerCalendarWidget> {
List<Color> colors = [Colors.blue, Colors.orange, Colors.red, Colors.green];
List<Color> colors = [Colors.blue, Colors.orange, redColor, Colors.green];
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS"];
bool isEvent(Map<String, List<WorkflowExecution>> data, DateTime day) {
if (data[day.toIso8601String()] == null || data[day.toIso8601String()]!.isEmpty) { return false; }
@@ -34,7 +35,7 @@ class SchedulerCalendarWidgetState extends State<SchedulerCalendarWidget> {
widget.focusedDay.isAfter(widget.end) ? widget.end : widget.focusedDay );
return Container(
padding: const EdgeInsets.only(left: 20, right: 20, bottom: 20),
height: MediaQuery.of(context).size.height - HeaderConstants.height - 50,
height: getMainHeight(context) - 50,
child: TableCalendar<Event>(
firstDay: widget.start,
lastDay: widget.end,
@@ -61,7 +62,7 @@ class SchedulerCalendarWidgetState extends State<SchedulerCalendarWidget> {
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Colors.grey.shade300,
color: midColor,
),
child: const Text("...", style: TextStyle(color: Colors.white, fontSize: 10)),
)));
@@ -90,7 +91,7 @@ class SchedulerCalendarWidgetState extends State<SchedulerCalendarWidget> {
alignment: !isEvent(widget.data, date) ? Alignment.center : Alignment.topCenter,
margin:const EdgeInsets.all(2.0),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey.shade300),
border: Border.all(color: midColor),
shape: BoxShape.rectangle,
),
child: !isEvent(widget.data, date) ? Text(
@@ -106,8 +107,8 @@ class SchedulerCalendarWidgetState extends State<SchedulerCalendarWidget> {
alignment: Alignment.center,
margin: const EdgeInsets.all(2.0),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey.shade300),
color: Colors.grey.shade300,
border: Border.all(color: midColor),
color: midColor,
shape: BoxShape.rectangle,
),
child: Text(
@@ -119,7 +120,7 @@ class SchedulerCalendarWidgetState extends State<SchedulerCalendarWidget> {
alignment: !isEvent(widget.data, date) ? Alignment.center : Alignment.topCenter,
margin: const EdgeInsets.all(2.0),
decoration: BoxDecoration(
border: Border.all(color: const Color.fromRGBO(38, 166, 154, 1), width: 2),
border: Border.all(color: lightColor, width: 2),
shape: BoxShape.rectangle,
),
child: !isEvent(widget.data, date) ? Text(