oclib
This commit is contained in:
parent
28510d0ba1
commit
863a35b878
File diff suppressed because one or more lines are too long
17
Dockerfile
17
Dockerfile
@ -5,14 +5,15 @@ FROM debian:latest AS build-env
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y curl git unzip
|
||||
|
||||
ARG WORKSPACE_HOST="http://localhost:8089/oc"
|
||||
ARG WORKFLOW_HOST="http://localhost:8088/oc"
|
||||
ARG ITEM_HOST="http://localhost:8087/oc"
|
||||
ARG SCHEDULER_HOST="http://localhost:8090/oc"
|
||||
ARG LOGS_HOST="http://localhost:3100"
|
||||
ARG PEER_HOST="http://localhost:8093/oc"
|
||||
ARG DATACENTER_HOST="http://localhost:8092/oc"
|
||||
ARG COLLABORATIVE_AREA_HOST="http://localhost:8091/oc"
|
||||
ARG WORKSPACE_HOST=${WORKSPACE_HOST:-"http://localhost:8000/workspace"}
|
||||
ARG WORKFLOW_HOST=${WORKFLOW_HOST:-"http://localhost:8000/workflow"}
|
||||
ARG ITEM_HOST=${ITEM_HOST:-"http://localhost:8000/catalog"}
|
||||
ARG SCHEDULER_HOST=${SCHEDULER_HOST:-"http://localhost:8000/scheduler"}
|
||||
ARG LOGS_HOST=${LOGS_HOST:-"http://localhost:8000/tools/loki"}
|
||||
ARG PEER_HOST=${PEER_HOST:-"http://localhost:8000/peer"}
|
||||
ARG DATACENTER_HOST=${DATACENTER_HOST:-"http://localhost:8000/datacenter"}
|
||||
ARG COLLABORATIVE_AREA_HOST=${COLLABORATIVE_AREA_HOST:-"http://localhost:8000/shared"}
|
||||
ARG AUTH_HOST=${AUTH_HOST:-"http://localhost:8000/auth"}
|
||||
ARG AUTH_MODE=true
|
||||
# define variables
|
||||
ARG FLUTTER_SDK=/usr/local/flutter
|
||||
|
@ -1,12 +1,12 @@
|
||||
{
|
||||
"WORKSPACE_HOST": "http://localhost:8089/oc",
|
||||
"WORKFLOW_HOST": "http://localhost:8088/oc",
|
||||
"ITEM_HOST": "http://localhost:8087/oc",
|
||||
"SCHEDULER_HOST": "http://localhost:8090/oc",
|
||||
"LOGS_HOST": "http://localhost:3100",
|
||||
"PEER_HOST": "http://localhost:8093/oc",
|
||||
"DATACENTER_HOST": "http://localhost:8092/oc",
|
||||
"COLLABORATIVE_AREA_HOST": "http://localhost:8091/oc",
|
||||
"HOST": "http://localhost:8089/oc",
|
||||
"AUTH_HOST": "http://localhost:8080/auth"
|
||||
"WORKSPACE_HOST": "http://localhost:8000/workspace",
|
||||
"WORKFLOW_HOST": "http://localhost:8000/workflow",
|
||||
"ITEM_HOST": "http://localhost:8000/catalog",
|
||||
"SCHEDULER_HOST": "http://localhost:8000/scheduler",
|
||||
"LOGS_HOST": "http://localhost:8000/tools/loki",
|
||||
"PEER_HOST": "http://localhost:8000/peer",
|
||||
"DATACENTER_HOST": "http://localhost:8000/datacenter",
|
||||
"COLLABORATIVE_AREA_HOST": "http://localhost:8000/shared",
|
||||
"HOST": "http://localhost:8000",
|
||||
"AUTH_HOST": "http://localhost:8000/auth"
|
||||
}
|
||||
|
@ -8,6 +8,14 @@ services:
|
||||
- 8080:80
|
||||
networks:
|
||||
- catalog
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.front.entrypoints=web"
|
||||
- "traefik.http.routers.front.rule=PathPrefix(`/`)"
|
||||
- "traefik.http.services.front.loadbalancer.server.port=80"
|
||||
- "traefik.http.middlewares.front-stripprefix.stripprefix.prefixes=/"
|
||||
- "traefik.http.routers.front.middlewares=front-stripprefix"
|
||||
- "traefik.http.middlewares.front.forwardauth.address=http://oc-auth:8080/oc/forward"
|
||||
networks:
|
||||
catalog:
|
||||
external: true
|
@ -12,7 +12,6 @@ class AppConfig {
|
||||
Future<void> loadConfig() async {
|
||||
final response = await rootBundle.loadString('assets/config/front.json');
|
||||
_config = Map<String, String>.from(json.decode(response));
|
||||
print('Config loaded: $_config');
|
||||
}
|
||||
|
||||
String get(String key, {String defaultValue = ''}) {
|
||||
|
@ -29,6 +29,7 @@ class WorkspaceLocal {
|
||||
static List<AbstractItem> items = [];
|
||||
|
||||
static Future<void> init(BuildContext? context, bool changeCurrent) async {
|
||||
WorkspaceLocal.createWorkspace("default workspace", null);
|
||||
var value = await _service.all(context);
|
||||
if (value.data != null && value.data!.values.isNotEmpty ) {
|
||||
var vals = value.data!.values;
|
||||
@ -47,8 +48,6 @@ class WorkspaceLocal {
|
||||
fill();
|
||||
HeaderConstants.headerKey.currentState?.setState(() {});
|
||||
}
|
||||
} else {
|
||||
await WorkspaceLocal.createWorkspace("default workspace", null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,7 +107,7 @@ class WorkspaceLocal {
|
||||
WorkflowFactory.key.currentState?.setState(() {});
|
||||
HeaderConstants.headerKey.currentState?.setState(() {});
|
||||
}
|
||||
});
|
||||
}).catchError( (e) {});
|
||||
}
|
||||
|
||||
static void changeWorkspaceByName(String name) {
|
||||
|
@ -18,7 +18,7 @@ class APIService<T extends SerializerDeserializer> {
|
||||
|
||||
Dio _dio = Dio(
|
||||
BaseOptions(
|
||||
baseUrl: const String.fromEnvironment('HOST', defaultValue: 'http://localhost:8080'), // you can keep this blank
|
||||
baseUrl: const String.fromEnvironment('HOST', defaultValue: 'http://localhost:8000'), // you can keep this blank
|
||||
headers: { 'Content-Type': 'application/json; charset=UTF-8', 'Access-Control-Allow-Origin': '*' },
|
||||
),
|
||||
)..interceptors.add(LogInterceptor(
|
||||
|
@ -5,10 +5,10 @@ import 'package:oc_front/main.dart';
|
||||
import 'package:oc_front/models/response.dart';
|
||||
|
||||
class AuthService {
|
||||
static var isAuth = const bool.fromEnvironment('AUTH_MODE', defaultValue: false);
|
||||
static var isAuth = const bool.fromEnvironment('AUTH_MODE', defaultValue: true);
|
||||
static const _clientID = String.fromEnvironment('CLIENT_ID', defaultValue: 'test-client');
|
||||
static APIService<SimpleData> service = APIService(
|
||||
baseURL: const String.fromEnvironment('AUTH_HOST', defaultValue: 'http://localhost:8080/auth'),
|
||||
baseURL: const String.fromEnvironment('AUTH_HOST', defaultValue: 'http://localhost:8000/auth'),
|
||||
);
|
||||
|
||||
static Future<void> init() async {
|
||||
|
@ -4,7 +4,7 @@ import 'package:oc_front/core/services/api_service.dart';
|
||||
class EnumService {
|
||||
static final APIService<EnumData> _service = APIService<EnumData>(
|
||||
baseURL: const String.fromEnvironment('ITEM_HOST',
|
||||
defaultValue: 'http://localhost:8080/catalog')
|
||||
defaultValue: 'http://localhost:8000/catalog')
|
||||
);
|
||||
static String subPath = "/enum/";
|
||||
static Map<String, Map<String,dynamic>> enums = {};
|
||||
|
@ -71,7 +71,6 @@ class PermsService {
|
||||
try {
|
||||
var what = json.decode(foo);
|
||||
what = what["session"]["access_token"] as Map<String, dynamic>;
|
||||
|
||||
for (var w in perms.keys) {
|
||||
if (what.keys.contains(perms[w])) {
|
||||
_perms[w] = true;
|
||||
|
@ -1,3 +1,5 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:oc_front/core/sections/header/header.dart';
|
||||
import 'package:oc_front/main.dart';
|
||||
import 'package:oc_front/pages/abstract_page.dart';
|
||||
@ -42,7 +44,8 @@ class RouterItem {
|
||||
|
||||
void go(BuildContext context, Map<String, String> params) {
|
||||
AppRouter.currentRoute = this;
|
||||
var newPath = "$path";
|
||||
var newPath = path;
|
||||
AppRouter.setRouteCookie(newPath, params, context);
|
||||
for (var arg in args) { newPath = newPath.replaceAll(":$arg", params[arg] ?? ""); }
|
||||
Future.delayed( const Duration(seconds: 1), () {
|
||||
HeaderConstants.setTitle(null);
|
||||
@ -87,6 +90,29 @@ class AppRouter {
|
||||
});
|
||||
}
|
||||
|
||||
static verifyRoute(context) async {
|
||||
var url = await getRouteCookie();
|
||||
if (url != null && url != "") {
|
||||
for (var zone in zones) {
|
||||
print("URL: $url ${zone.route}");
|
||||
if (zone.route == url.replaceAll("/", "")) {
|
||||
Map<String, String> params = {};
|
||||
var srcParams = await getRouteParamsCookie();
|
||||
for (var key in srcParams.keys) {
|
||||
params[key] = "${srcParams[key]}";
|
||||
}
|
||||
zone.go(context, params);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Future<Map<String,dynamic>> getRouteParamsCookie() async {
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getString("params") != null && prefs.getString("params") != "" ? json.decode(prefs.getString("params")!) : {};
|
||||
}
|
||||
|
||||
static Future<String?> getRouteCookie() async {
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getString("url") != "" ? prefs.getString("url") : null;
|
||||
@ -95,11 +121,13 @@ class AppRouter {
|
||||
static removeRouteCookie() async {
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
prefs.remove("url");
|
||||
prefs.remove("params");
|
||||
}
|
||||
|
||||
static setRouteCookie( String path , BuildContext context ) async {
|
||||
static setRouteCookie( String path, Map<String, String> params, BuildContext context ) async {
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
prefs.setString("url", path);
|
||||
prefs.setString("params", params.toString());
|
||||
if (realHistory.isNotEmpty && realHistory.last != path || realHistory.isEmpty) {
|
||||
try {
|
||||
var index = history.indexOf(realHistory.last);
|
||||
@ -122,7 +150,6 @@ class AppRouter {
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
prefs.setString("url", realHistory.last);
|
||||
prefs.setString("history", realHistory.join(","));
|
||||
var splitted = realHistory.last.split(":");
|
||||
routerKey.currentState?.setState(() { });
|
||||
scaffoldKey.currentState?.setState(() {});
|
||||
}
|
||||
@ -139,7 +166,6 @@ class AppRouter {
|
||||
realHistory.add(history[index + 1]);
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
prefs.setString("url", realHistory.last);
|
||||
var splitted = realHistory.last.split(":");
|
||||
prefs.setString("history", realHistory.join(","));
|
||||
routerKey.currentState?.setState(() { });
|
||||
scaffoldKey.currentState?.setState(() {});
|
||||
|
@ -6,7 +6,7 @@ import 'package:oc_front/models/workflow.dart';
|
||||
|
||||
class BookingExecutionService extends AbstractService<WorkflowExecution> {
|
||||
@override APIService<WorkflowExecution> service = APIService<WorkflowExecution>(
|
||||
baseURL: const String.fromEnvironment('DATACENTER_HOST', defaultValue: 'http://localhost:8080/datacenter')
|
||||
baseURL: const String.fromEnvironment('DATACENTER_HOST', defaultValue: 'http://localhost:8000/datacenter')
|
||||
);
|
||||
@override String subPath = "/booking/";
|
||||
|
||||
|
@ -6,7 +6,7 @@ import 'package:oc_front/models/response.dart';
|
||||
|
||||
class DatacenterService extends AbstractService<Resource> {
|
||||
@override APIService<Resource> service = APIService<Resource>(
|
||||
baseURL: const String.fromEnvironment('DATACENTER_HOST', defaultValue: 'http://localhost:8080/datacenter')
|
||||
baseURL: const String.fromEnvironment('DATACENTER_HOST', defaultValue: 'http://localhost:8000/datacenter')
|
||||
);
|
||||
@override String subPath = "/";
|
||||
|
||||
|
@ -11,10 +11,9 @@ class LogsService extends AbstractService<LogsResult> {
|
||||
@override
|
||||
String subPath = "/loki/api/v1/";
|
||||
|
||||
LogService() {
|
||||
LogsService() {
|
||||
service = APIService<LogsResult>(
|
||||
baseURL:
|
||||
super.conf.get('LOGS_HOST', defaultValue: 'http://localhost:3100'));
|
||||
baseURL: super.conf.get('LOGS_HOST', defaultValue: 'http://localhost:8000/tools/loki'));
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -12,6 +12,6 @@ class PeerService extends AbstractService<Peer> {
|
||||
service = APIService<Peer>(
|
||||
baseURL: super
|
||||
.conf
|
||||
.get('PEER_HOST', defaultValue: 'http://localhost:8080/peer'));
|
||||
.get('PEER_HOST', defaultValue: 'http://localhost:8000/peer'));
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ class ResourceService extends AbstractService<Resource> {
|
||||
service = APIService<Resource>(
|
||||
baseURL: super
|
||||
.conf
|
||||
.get('ITEM_HOST', defaultValue: 'http://localhost:8080/catalog'));
|
||||
.get('ITEM_HOST', defaultValue: 'http://localhost:8000/catalog'));
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -14,7 +14,7 @@ class SharedService extends AbstractService<CollaborativeArea> {
|
||||
SharedService() {
|
||||
service = APIService<CollaborativeArea>(
|
||||
baseURL: super.conf.get('COLLABORATIVE_AREA_HOST',
|
||||
defaultValue: 'http://localhost:8080/shared'));
|
||||
defaultValue: 'http://localhost:8000/shared'));
|
||||
}
|
||||
|
||||
Future<APIResponse<CollaborativeArea>> addWorkspace(
|
||||
|
@ -6,14 +6,14 @@ import 'package:oc_front/models/workflow.dart';
|
||||
|
||||
class WorkflowExecutionService extends AbstractService<WorkflowExecutions> {
|
||||
@override APIService<WorkflowExecutions> service = APIService<WorkflowExecutions>(
|
||||
baseURL: const String.fromEnvironment('SCHEDULER_HOST', defaultValue: 'http://localhost:8080/scheduler')
|
||||
baseURL: const String.fromEnvironment('SCHEDULER_HOST', defaultValue: 'http://localhost:8000/scheduler')
|
||||
);
|
||||
@override String subPath = "/execution/";
|
||||
|
||||
WorkflowExecutionService() {
|
||||
service = APIService<WorkflowExecutions>(
|
||||
baseURL: super.conf.get('SCHEDULER_HOST',
|
||||
defaultValue: 'http://localhost:8080/scheduler'));
|
||||
defaultValue: 'http://localhost:8000/scheduler'));
|
||||
}
|
||||
@override
|
||||
Future<APIResponse<WorkflowExecutions>> search(
|
||||
|
@ -6,12 +6,11 @@ import 'package:oc_front/models/workflow.dart';
|
||||
|
||||
class SchedulerService extends AbstractService<WorkflowExecutions> {
|
||||
@override APIService<WorkflowExecutions> service = APIService<WorkflowExecutions>(
|
||||
baseURL: const String.fromEnvironment('SCHEDULER_HOST', defaultValue: 'http://localhost:8080/scheduler')
|
||||
baseURL: const String.fromEnvironment('SCHEDULER_HOST', defaultValue: 'http://localhost:8000/scheduler')
|
||||
);
|
||||
@override String subPath = "/";
|
||||
|
||||
Future<APIResponse<WorkflowExecutions>> schedule(BuildContext? context, String id, Map<String, dynamic> body, Map<String, dynamic> params) {
|
||||
print(body);
|
||||
return service.post("$subPath$id", body, context);
|
||||
}
|
||||
|
||||
|
@ -14,10 +14,10 @@ class WorflowService extends AbstractService<Workflow> {
|
||||
WorflowService() {
|
||||
service = APIService<Workflow>(
|
||||
baseURL: super.conf.get('WORKFLOW_HOST',
|
||||
defaultValue: 'http://localhost:8080/workflow'));
|
||||
defaultValue: 'http://localhost:8000/workflow'));
|
||||
serviceCheck = APIService<Check>(
|
||||
baseURL: super.conf.get('WORKFLOW_HOST',
|
||||
defaultValue: 'http://localhost:8080/workflow'));
|
||||
defaultValue: 'http://localhost:8000/workflow'));
|
||||
}
|
||||
|
||||
Future<APIResponse<Check>> check(
|
||||
|
@ -12,6 +12,6 @@ class WorkspaceService extends AbstractService<Workspace> {
|
||||
WorkspaceService() {
|
||||
service = APIService<Workspace>(
|
||||
baseURL: super.conf.get('WORKSPACE_HOST',
|
||||
defaultValue: 'http://localhost:8080/workspace'));
|
||||
defaultValue: 'http://localhost:8000/workspace'));
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:localstorage/localstorage.dart';
|
||||
import 'package:oc_front/core/models/shared_workspace_local.dart';
|
||||
import 'package:oc_front/core/models/workspace_local.dart';
|
||||
import 'package:oc_front/core/sections/header/header.dart';
|
||||
import 'package:oc_front/core/sections/header/menu.dart';
|
||||
@ -14,7 +15,6 @@ import 'package:oc_front/core/services/router.dart';
|
||||
import 'package:oc_front/core/sections/end_drawer.dart';
|
||||
import 'package:oc_front/widgets/dialog/login.dart';
|
||||
import 'package:oc_front/core/conf/conf_reader.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
@ -35,6 +35,7 @@ class MyApp extends StatelessWidget {
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
AppRouter.verifyRoute(context);
|
||||
AuthService.init();
|
||||
EnumService.init();
|
||||
SearchConstants.clear();
|
||||
@ -88,7 +89,6 @@ double getMainWidth(BuildContext context) {
|
||||
}
|
||||
bool loginIsSet = false;
|
||||
class MainPageState extends State<MainPage> {
|
||||
bool isCtrl = false;
|
||||
final FocusNode node = FocusNode();
|
||||
@override
|
||||
void initState() {
|
||||
@ -106,13 +106,13 @@ class MainPageState extends State<MainPage> {
|
||||
// fast, so that you can just rebuild anything that needs updating rather
|
||||
// than having to individually change instances of widgets.i
|
||||
scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
isCtrl = false;
|
||||
if (!AuthService.isConnected() && !loginIsSet) {
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
loginIsSet = true;
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context ?? context, builder: (context) {
|
||||
// ignore: use_build_context_synchronously
|
||||
context: context, builder: (context) {
|
||||
return AlertDialog(
|
||||
insetPadding: EdgeInsets.zero,
|
||||
backgroundColor: Colors.white,
|
||||
@ -137,23 +137,20 @@ class MainPageState extends State<MainPage> {
|
||||
Container( padding: const EdgeInsets.symmetric(vertical: 30),
|
||||
decoration: BoxDecoration( color: darkColor),
|
||||
width: 50, height: getHeight(context) - 50,
|
||||
child: SingleChildScrollView( child: LeftMenuWidget() )),
|
||||
child: const SingleChildScrollView( child: LeftMenuWidget() )),
|
||||
SizedBox( width: getMainWidth(context), height: getHeight(context) - 50,
|
||||
child: KeyboardListener(
|
||||
focusNode: node,
|
||||
onKeyEvent: (event) async {
|
||||
if ( event.logicalKey == LogicalKeyboardKey.controlLeft ) {
|
||||
isCtrl = (event is KeyDownEvent);
|
||||
node.requestFocus();
|
||||
} else if( (event is KeyDownEvent) && event.logicalKey == LogicalKeyboardKey.enter) {
|
||||
AppRouter.currentRoute.factory.search(context, isCtrl);
|
||||
if( (event is KeyDownEvent) && event.logicalKey == LogicalKeyboardKey.enter) {
|
||||
AppRouter.currentRoute.factory.search(context, false);
|
||||
node.requestFocus();
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
HeaderWidget(),
|
||||
const HeaderWidget(),
|
||||
widget.page ?? Container() // CatalogPageWidget(),
|
||||
],
|
||||
),
|
||||
|
@ -72,6 +72,7 @@ class Log extends SerializerDeserializer<Log> {
|
||||
|
||||
String getMessage(String mess) {
|
||||
var jsonString = mess;
|
||||
print(mess);
|
||||
try {
|
||||
var j = JsonString(mess.replaceAll("\\", "")).decodedValue as Map<String, dynamic>;
|
||||
map = j;
|
||||
@ -87,9 +88,8 @@ class Log extends SerializerDeserializer<Log> {
|
||||
|
||||
@override deserialize(dynamic json) {
|
||||
try { json = json as List<dynamic>;
|
||||
} catch (e) { return Log(); }
|
||||
var l = Log(
|
||||
timestamp: json.isNotEmpty ? DateTime.fromMillisecondsSinceEpoch(int.parse(json[0]) ~/ 1000) : null,
|
||||
} catch (e) { return Log(); } var l = Log(
|
||||
timestamp: json.isNotEmpty ? DateTime.fromMillisecondsSinceEpoch(int.parse(json[0]) ~/ 1000, isUtc : true) : null,
|
||||
message: json.length > 1 ? getMessage(json[1].toString()) : null,
|
||||
rawMessage : json.length > 1 ? json[1].toString() : null,
|
||||
);
|
||||
|
@ -67,9 +67,9 @@ class MapPageWidgetState extends State<MapPageWidget> {
|
||||
height: 30,
|
||||
point: coordinates[topic]![coord]!,
|
||||
child: HoverMenu( width: 110, title: Container( alignment: Alignment.center,
|
||||
constraints: BoxConstraints( maxHeight: 100, maxWidth: 100 ),
|
||||
constraints: const BoxConstraints( maxHeight: 100, maxWidth: 100 ),
|
||||
child: Icon(FontAwesomeIcons.locationDot,
|
||||
shadows: <Shadow>[Shadow(color: Color.fromRGBO(0, 0, 0, 1), blurRadius: 10.0)],
|
||||
shadows: const <Shadow>[Shadow(color: Color.fromRGBO(0, 0, 0, 1), blurRadius: 10.0)],
|
||||
color: getColor(topic)) ),
|
||||
items: [ Container(color: Colors.white,
|
||||
child: ItemRowWidget(low: true, contextWidth: 290, item: coord)) ]
|
||||
|
@ -61,7 +61,6 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
|
||||
dash.error = "You need to link each processing element to a compute element";
|
||||
}
|
||||
}
|
||||
print("qdjqksdn ${dash.error}");
|
||||
if (dash.error != null) {
|
||||
showAlertBanner( context, () {}, AlertAlertBannerChild(text: dash.error.toString()),// <-- Put any widget here you want!
|
||||
alertBannerLocation: AlertBannerLocation.bottom,);
|
||||
@ -71,7 +70,6 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
|
||||
for (var k in formKeys) {
|
||||
if (k.currentState != null) {
|
||||
if (!k.currentState!.validate()) {
|
||||
print("bwak");
|
||||
return;
|
||||
} else { k.currentState!.save();}
|
||||
}
|
||||
@ -84,14 +82,11 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
|
||||
}
|
||||
}
|
||||
Duration durationBefore = widget.schedule.start!.difference(DateTime.now().toUtc()) + Duration(seconds: 5);
|
||||
print("qdjqksdn ${widget.item.id}");
|
||||
widget._schedulerService.schedule(context, widget.item.id ?? "", widget.schedule.serialize(), {}).catchError( (e) {
|
||||
print("THERE2");
|
||||
setState(() {
|
||||
widget.error = e.toString();
|
||||
});
|
||||
}).then((value) {
|
||||
print("THERE");
|
||||
setState(() { widget.valid = true; });
|
||||
Future.delayed(durationBefore, () {
|
||||
try {
|
||||
@ -222,12 +217,11 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
|
||||
);
|
||||
});
|
||||
} : null,
|
||||
);
|
||||
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;
|
||||
);
|
||||
shallow.change =(p0) => Future.delayed( const Duration(milliseconds: 100), () async {
|
||||
if (shallow.current == p0) {
|
||||
dash.name = p0 ?? dash.name;
|
||||
await WorflowService().put(context, widget.item.id ?? "", { "name" : dash.name }, {});
|
||||
}
|
||||
});
|
||||
return Column( children: [
|
||||
@ -243,7 +237,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
|
||||
bottom: const BorderSide(color: Colors.grey))),
|
||||
child: shallow ),
|
||||
const SizedBox(height: 20, width: 200 ),
|
||||
isService ? Text("Warning a processing is a service, if no end execution it will run forever.") : Container(),
|
||||
isService ? const Text("Warning a processing is a service, if no end execution it will run forever.") : Container(),
|
||||
Tooltip( message: "start executions",
|
||||
child: Container( height: 40, margin: const EdgeInsets.only(top: 5),
|
||||
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
|
||||
|
@ -27,8 +27,8 @@ class LogsWidgetState extends State<LogsWidget> {
|
||||
try { setState(() { });
|
||||
} catch (e) { /**/ }
|
||||
});
|
||||
return Container( height: getMainHeight(context) - 100,
|
||||
child: Center( child: CircularProgressIndicator()) );
|
||||
return SizedBox( height: getMainHeight(context) - 100,
|
||||
child: const Center( child: CircularProgressIndicator()) );
|
||||
}
|
||||
if (widget.exec == null) {
|
||||
return Container();
|
||||
@ -53,11 +53,7 @@ class LogsWidgetState extends State<LogsWidget> {
|
||||
end = (DateTime.parse(widget.exec!.startDate!).add( const Duration(days: 14)).microsecondsSinceEpoch).toString();
|
||||
}
|
||||
} catch(e) { /* */ }
|
||||
Future.delayed(const Duration(minutes: 1), () {
|
||||
try { setState(() {});
|
||||
} catch (e) { /**/ }
|
||||
});
|
||||
return FutureBuilder(future: LogsService().search(context, [], {
|
||||
return FutureBuilder(future: LogsService().search(null, [], {
|
||||
"workflow_execution_id": widget.exec!.id,
|
||||
"start": start,
|
||||
"end": end
|
||||
|
@ -44,6 +44,7 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
|
||||
"${widget.end.year}-${widget.end.month > 9 ? widget.end.month : "0${widget.end.month}"}-${widget.end.day > 9 ? widget.end.day : "0${widget.end.day}"}"], {}),
|
||||
builder: (ctx, as) {
|
||||
Map<String, List<WorkflowExecution>> data = {};
|
||||
DateTime? firstDate;
|
||||
if (as.hasData && as.data!.data != null) {
|
||||
for (var element in as.data!.data!.executions) {
|
||||
if (element.startDate == null) { continue; }
|
||||
@ -55,6 +56,17 @@ class ScheduleWidgetState extends State<ScheduleWidget> {
|
||||
data[str]!.sort((a, b) => DateTime.parse(a.startDate!).compareTo(DateTime.parse(b.startDate!)));
|
||||
}
|
||||
}
|
||||
List<WorkflowExecution> vals = [];
|
||||
for (var val in data.values) {
|
||||
vals.addAll(val);
|
||||
}
|
||||
if (vals.isNotEmpty) {
|
||||
try {
|
||||
Future.delayed(const Duration(minutes: 1), () {
|
||||
setState(() {});
|
||||
});
|
||||
} catch (e) { /* */ }
|
||||
}
|
||||
bool isInfo = getMainWidth(context) <= 600 && selected != null && widget.isBox;
|
||||
double w = selected != null && widget.isBox ? getMainWidth(context) - menuSize : getMainWidth(context);
|
||||
List<Widget> children = [];
|
||||
|
@ -34,7 +34,6 @@ class SchedulerItemWidgetState extends State<SchedulerItemWidget> {
|
||||
selected = selected != element || ev.startDate != selectedReal ? element : null;
|
||||
widget.parent!.widget.selectedID = selected;
|
||||
selectedReal = selected == null ? null : ev.startDate;
|
||||
print("there");
|
||||
if (selectedReal == null) {
|
||||
widget.parent!.widget.isDayPlanner = true;
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_flow_chart/flutter_flow_chart.dart';
|
||||
import 'package:flutter_flow_chart/src/flow_chart_menu.dart';
|
||||
import 'package:flutter_flow_chart/src/flow_chart_selected_menu.dart';
|
||||
import 'package:flutter_flow_chart/src/ui/draw_arrow.dart';
|
||||
import 'package:flutter_flow_chart/src/ui/segment_handler.dart';
|
||||
|
||||
/// Listener definition for a new connection
|
||||
@ -842,7 +841,6 @@ class Dashboard extends ChangeNotifier {
|
||||
}
|
||||
|
||||
if (found == 0) {
|
||||
debugPrint('Element with $destId id not found!');
|
||||
return;
|
||||
}
|
||||
if (notify) {
|
||||
|
@ -296,9 +296,9 @@ class HoverMenuState extends State<HoverMenu> {
|
||||
}
|
||||
}
|
||||
|
||||
bool isCtrl = false;
|
||||
class FlowChartState<T extends FlowData> extends State<FlowChart> {
|
||||
var node = FocusNode();
|
||||
bool isCtrl = false;
|
||||
@override
|
||||
void initState() {
|
||||
node.requestFocus();
|
||||
@ -313,7 +313,6 @@ class FlowChartState<T extends FlowData> extends State<FlowChart> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
if (!widget.dashboard.isOpened && widget.onDashboardAlertOpened != null ) {
|
||||
if (widget.dashboard.id != null) {
|
||||
widget.dashboard.isOpened = true;
|
||||
@ -365,15 +364,20 @@ class FlowChartState<T extends FlowData> extends State<FlowChart> {
|
||||
autofocus: true,
|
||||
onKeyEvent: (event) {
|
||||
bool change = false;
|
||||
if (event.logicalKey == LogicalKeyboardKey.controlLeft) {
|
||||
isCtrl = event is KeyDownEvent || event is KeyRepeatEvent;
|
||||
if (event.logicalKey == LogicalKeyboardKey.controlLeft && event is KeyDownEvent) {
|
||||
print("CTRL true");
|
||||
isCtrl = true;
|
||||
}
|
||||
/*if ((event is KeyDownEvent || event.logicalKey == LogicalKeyboardKey.keyZ) && isCtrl) {
|
||||
if (event.logicalKey == LogicalKeyboardKey.controlLeft && event is KeyUpEvent) {
|
||||
print("CTRL false");
|
||||
isCtrl = false;
|
||||
}
|
||||
if ((event is KeyDownEvent || event.logicalKey == LogicalKeyboardKey.keyZ) && isCtrl) {
|
||||
widget.dashboard.back();
|
||||
}
|
||||
if ((event is KeyDownEvent || event.logicalKey == LogicalKeyboardKey.keyY) && isCtrl) {
|
||||
widget.dashboard.forward();
|
||||
}*/
|
||||
}
|
||||
if (event is KeyDownEvent && event.logicalKey == LogicalKeyboardKey.add) {
|
||||
change = true;
|
||||
for (var el in widget.dashboard.elementSelected) {
|
||||
@ -418,7 +422,7 @@ class FlowChartState<T extends FlowData> extends State<FlowChart> {
|
||||
children: [
|
||||
Stack(children: [
|
||||
// Draw the grid
|
||||
Container( child: DragTarget<T>(
|
||||
DragTarget<T>(
|
||||
builder: (
|
||||
BuildContext context,
|
||||
List<dynamic> accepted,
|
||||
@ -475,7 +479,7 @@ class FlowChartState<T extends FlowData> extends State<FlowChart> {
|
||||
);
|
||||
widget.dashboard.addElement(el, context);
|
||||
},
|
||||
))]
|
||||
)]
|
||||
),
|
||||
widget.dashboard.isMenu ? Positioned(top: 50, child: FlowChartSelectedMenu(
|
||||
key: widget.dashboard.selectedMenuKey,
|
||||
@ -729,9 +733,10 @@ class ChartWidgetState<T extends FlowData> extends State<ChartWidget> {
|
||||
final gridKey = GlobalKey();
|
||||
var tapDownPos = Offset.zero;
|
||||
var secondaryTapDownPos = Offset.zero;
|
||||
for (int i = 0; i < widget.dashboard.elements.length; i++)
|
||||
for (int i = 0; i < widget.dashboard.elements.length; i++) {
|
||||
widget.dashboard.elements[i].next.removeWhere((element) =>
|
||||
widget.dashboard.findElementIndexById(element.destElementId) < 0);
|
||||
}
|
||||
return Stack( children: [
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
|
@ -240,12 +240,12 @@ class FlowChartMenuState extends State<FlowChartMenu> {
|
||||
|
||||
])),
|
||||
Expanded(
|
||||
child: Padding( child: Text("current workflow : ${widget.dashboard.name}", overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: Colors.white, fontSize: 14), textAlign: TextAlign.start),
|
||||
padding: EdgeInsets.symmetric(horizontal: 20))),
|
||||
child: Padding( padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Text("current workflow : ${widget.dashboard.name}", overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(color: Colors.white, fontSize: 14), textAlign: TextAlign.start))),
|
||||
])),
|
||||
widget.menuExtension != null && widget.chart.widget.flowChart.widget.width > 600 ? Container(
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(left: BorderSide(color: Colors.white, width: 1))
|
||||
),
|
||||
child: widget.menuExtension
|
||||
|
@ -3,8 +3,6 @@ import 'dart:convert';
|
||||
import 'dart:ui' as ui;
|
||||
import 'dart:math' as math;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_flow_chart/flutter_flow_chart.dart';
|
||||
import 'package:flutter_flow_chart/src/ui/segment_handler.dart';
|
||||
|
||||
@ -257,6 +255,7 @@ class DrawingArrow extends ChangeNotifier {
|
||||
|
||||
/// Draw arrow from [srcElement] to [destElement]
|
||||
/// using [arrowParams] parameters
|
||||
// ignore: must_be_immutable
|
||||
class DrawArrow extends StatefulWidget {
|
||||
ChartWidgetState flow;
|
||||
///
|
||||
@ -377,14 +376,15 @@ class DrawArrowState extends State<DrawArrow> {
|
||||
}
|
||||
}
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class GraphParamsWidget extends StatefulWidget {
|
||||
ChartWidgetState comp;
|
||||
bool isShowed = false;
|
||||
Offset? position;
|
||||
FlowElement element;
|
||||
int index;
|
||||
GraphParamsWidget({ Key? key, required this.element, required this.comp,
|
||||
required this.index }): super(key: key);
|
||||
GraphParamsWidget({ super.key, required this.element, required this.comp,
|
||||
required this.index });
|
||||
@override GraphParamsWidgetState createState() => GraphParamsWidgetState();
|
||||
}
|
||||
class GraphParamsWidgetState extends State<GraphParamsWidget> {
|
||||
@ -393,32 +393,32 @@ class GraphParamsWidgetState extends State<GraphParamsWidget> {
|
||||
top: (widget.position?.dy ?? 0) - 5, left: (widget.position?.dx ?? 0) - 5,
|
||||
child: MouseRegion( cursor: SystemMouseCursors.click,
|
||||
onHover: (event) => setState(() { widget.isShowed = true; }),
|
||||
child: Container(
|
||||
child: Row(children: [
|
||||
IconButton(onPressed: () {
|
||||
widget.comp.setState(() {
|
||||
widget.comp.widget.dashboard.removeArrows((el) => el.fromID == "${widget.element.id}${widget.index}", context);
|
||||
widget.element.next.removeAt(widget.index);
|
||||
});
|
||||
}, icon: Icon(Icons.delete))
|
||||
],))));
|
||||
}, icon: const Icon(Icons.delete))
|
||||
],)));
|
||||
}
|
||||
}
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class ArrowInfoWidget extends StatefulWidget {
|
||||
Dashboard dashboard;
|
||||
ArrowInfoWidget ({ Key? key, required this.dashboard }): super(key: key);
|
||||
ArrowInfoWidget ({ super.key, required this.dashboard });
|
||||
@override ArrowInfoWidgetState createState() => ArrowInfoWidgetState();
|
||||
}
|
||||
class ArrowInfoWidgetState extends State<ArrowInfoWidget> {
|
||||
@override Widget build(BuildContext context) {
|
||||
return SingleChildScrollView( child: Column(children: [
|
||||
Container(height: 50,
|
||||
decoration: BoxDecoration(color: widget.dashboard.midDashColor, border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
|
||||
child: Center( child: Text("<Arrow> Style", style: TextStyle(fontSize: 20)))),
|
||||
decoration: BoxDecoration(color: widget.dashboard.midDashColor, border: const Border(bottom: BorderSide(color: Colors.grey, width: 1))),
|
||||
child: const Center( child: Text("<Arrow> Style", style: TextStyle(fontSize: 20)))),
|
||||
Container(height: 50,
|
||||
decoration: BoxDecoration(color: widget.dashboard.midDashColor, border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
|
||||
child: Row(children: [],)
|
||||
decoration: BoxDecoration(color: widget.dashboard.midDashColor, border: const Border(bottom: BorderSide(color: Colors.grey, width: 1))),
|
||||
child: const Row(children: [],)
|
||||
),
|
||||
],) );
|
||||
}
|
||||
|
@ -136,32 +136,27 @@ class ElementWidgetState<T extends FlowData> extends State<ElementWidget> {
|
||||
if (widget.element.widget == null) { element = RectangleWidget(element: widget.element);
|
||||
} else { element = AnyWidget(element: widget.element); }
|
||||
}
|
||||
|
||||
var tapLocation = Offset.zero;
|
||||
var secondaryTapDownPos = Offset.zero;
|
||||
|
||||
|
||||
Widget w = GestureDetector(
|
||||
Widget w = InkWell(
|
||||
onTapDown: (details) => tapLocation = details.globalPosition,
|
||||
onSecondaryTapDown: (details) =>
|
||||
secondaryTapDownPos = details.globalPosition,
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (!(widget.dashboard.flutterChartKey.currentState?.isCtrl ?? true)) {
|
||||
if (!isCtrl) {
|
||||
for (var element in widget.dashboard.elements) {
|
||||
element.isSelected = false;
|
||||
element.dashboard.chartKey.currentState?. setState(() { });
|
||||
widget.dashboard.selectedMenuKey.currentState?. setState(() { });
|
||||
}
|
||||
}
|
||||
Future.delayed(Duration(milliseconds: 100), () {
|
||||
DrawingArrow.instance.notifyListeners();
|
||||
widget.element.isSelected = !widget.element.isSelected;
|
||||
for (var sel in widget.dashboard.arrows) { sel.isSelected = false; }
|
||||
widget.dashboard.selectedMenuKey.currentState?. setState(() { });
|
||||
});
|
||||
DrawingArrow.instance.notifyListeners();
|
||||
widget.isHovered = false;
|
||||
widget.element.isSelected = !widget.element.isSelected;
|
||||
for (var sel in widget.dashboard.arrows) { sel.isSelected = false; }
|
||||
widget.dashboard.selectedMenuKey.currentState?. setState(() { });
|
||||
});
|
||||
widget.onElementPressed?.call(context, tapLocation);
|
||||
},
|
||||
onSecondaryTap: () {
|
||||
widget.onElementSecondaryTapped?.call(context, secondaryTapDownPos);
|
||||
@ -169,9 +164,9 @@ class ElementWidgetState<T extends FlowData> extends State<ElementWidget> {
|
||||
onLongPress: () {
|
||||
widget.onElementLongPressed?.call(context, tapLocation);
|
||||
},
|
||||
onSecondaryLongPress: () {
|
||||
/*onSecondaryLongPress: () {
|
||||
widget.onElementSecondaryLongTapped?.call(context, secondaryTapDownPos);
|
||||
},
|
||||
},*/
|
||||
child: Listener(
|
||||
onPointerDown: (event) {
|
||||
delta = event.localPosition;
|
||||
@ -198,7 +193,7 @@ class ElementWidgetState<T extends FlowData> extends State<ElementWidget> {
|
||||
onHandlerLongPressed: widget.onHandlerLongPressed,
|
||||
onHandlerSecondaryLongTapped: widget.onHandlerSecondaryLongTapped,
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(10), // why some change
|
||||
margin: const EdgeInsets.all(10), // why some change
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: widget.element.isSelected ? Colors.red : widget.dashboard.midDashColor,
|
||||
width: widget.element.isSelected ? 2 : 1),
|
||||
|
@ -195,7 +195,6 @@ class _GridBackgroundPainter extends CustomPainter {
|
||||
|
||||
@override
|
||||
bool shouldRepaint(_GridBackgroundPainter oldDelegate) {
|
||||
debugPrint('shouldRepaint ${oldDelegate.dx} $dx ${oldDelegate.dy} $dy');
|
||||
return oldDelegate.dx != dx || oldDelegate.dy != dy;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user