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