Rules on dashboard + Permissions
This commit is contained in:
@@ -25,10 +25,7 @@ class SchedulerPageWidget extends StatefulWidget {
|
||||
static void search(BuildContext context) { }
|
||||
static Widget factory() { return SchedulerPageWidget(); }
|
||||
}
|
||||
class SchedulerPageWidgetState extends State<SchedulerPageWidget> {
|
||||
List<Color> colors = [Colors.blue, Colors.orange, redColor, Colors.green, redColor];
|
||||
List<String> titles = ["SCHEDULED", "RUNNING", "FAILURE", "SUCCESS", "FORGOTTEN"];
|
||||
|
||||
class SchedulerPageWidgetState extends State<SchedulerPageWidget> {
|
||||
@override Widget build(BuildContext context) {
|
||||
GlobalKey<ScheduleWidgetState> k = GlobalKey<ScheduleWidgetState>();
|
||||
return Column( children: [
|
||||
|
||||
@@ -290,6 +290,38 @@ final WorflowService _service = WorflowService();
|
||||
dash.infoItemWidget = getForms;
|
||||
dash.infoWidget = getDashInfoForms;
|
||||
dash.widthOffset = 50;
|
||||
dash.saveRules = [
|
||||
(dash) {
|
||||
dash.error = null;
|
||||
if (dash.scheduleActive) {
|
||||
if (dash.elements.isEmpty || dash.elements.where((element) => element.element is ProcessingItem).isEmpty) {
|
||||
dash.error = "You need at least one processing element";
|
||||
dash.scheduleActive = false;
|
||||
}
|
||||
var processings = dash.elements.where((element) => element.element is ProcessingItem).map((e) => e.element as ProcessingItem);
|
||||
var computes = dash.elements.where((element) => element.element is ComputeItem).map((e) => e.element as ComputeItem);
|
||||
if (processings.length != computes.length) {
|
||||
dash.error = "You need the same number of processing and compute elements";
|
||||
dash.scheduleActive = false;
|
||||
}
|
||||
for (var p in processings) {
|
||||
var links = dash.arrows.where((element) => element.fromID.contains(p.getID()) || element.toID.contains(p.getID()));
|
||||
try {
|
||||
computes.firstWhere( (e) => links.first.toID.contains(e.getID()) || links.first.fromID.contains(e.getID()) );
|
||||
} catch (e) {
|
||||
dash.error = "You need to link each processing element to a compute element";
|
||||
dash.scheduleActive = false;
|
||||
}
|
||||
}
|
||||
if (dash.error != null) {
|
||||
print(dash.error);
|
||||
setState(() {});
|
||||
}
|
||||
return dash.scheduleActive;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
];
|
||||
return FlowChart<AbstractItem>(
|
||||
key: dash.flutterChartKey,
|
||||
itemLeftBottomBadges: getBottomLeftBadge,
|
||||
|
||||
Reference in New Issue
Block a user