mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.
This commit is contained in:
@@ -470,7 +470,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 417;
|
CURRENT_PROJECT_VERSION = 422;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||||
@@ -478,7 +478,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.417;
|
MARKETING_VERSION = 1.0.422;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@@ -602,7 +602,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 417;
|
CURRENT_PROJECT_VERSION = 422;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||||
@@ -610,7 +610,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.417;
|
MARKETING_VERSION = 1.0.422;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@@ -628,7 +628,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 417;
|
CURRENT_PROJECT_VERSION = 422;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||||
@@ -636,7 +636,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.417;
|
MARKETING_VERSION = 1.0.422;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@@ -657,7 +657,7 @@
|
|||||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 417;
|
CURRENT_PROJECT_VERSION = 422;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
@@ -670,7 +670,7 @@
|
|||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
"@executable_path/../../Frameworks",
|
"@executable_path/../../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.417;
|
MARKETING_VERSION = 1.0.422;
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
||||||
@@ -696,7 +696,7 @@
|
|||||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 417;
|
CURRENT_PROJECT_VERSION = 422;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
@@ -709,7 +709,7 @@
|
|||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
"@executable_path/../../Frameworks",
|
"@executable_path/../../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.417;
|
MARKETING_VERSION = 1.0.422;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
@@ -732,7 +732,7 @@
|
|||||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 417;
|
CURRENT_PROJECT_VERSION = 422;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
@@ -745,7 +745,7 @@
|
|||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
"@executable_path/../../Frameworks",
|
"@executable_path/../../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.417;
|
MARKETING_VERSION = 1.0.422;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ enum AppShellFuncType {
|
|||||||
case AppShellFuncType.status:
|
case AppShellFuncType.status:
|
||||||
return 'status';
|
return 'status';
|
||||||
case AppShellFuncType.docker:
|
case AppShellFuncType.docker:
|
||||||
/// `dockeR` -> avoid conflict with `docker` command
|
// `dockeR` -> avoid conflict with `docker` command
|
||||||
/// 以防止循环递归
|
// 以防止循环递归
|
||||||
return 'dockeR';
|
return 'dockeR';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,13 +16,14 @@ import 'package:toolbox/locator.dart';
|
|||||||
|
|
||||||
final _dockerNotFound = RegExp(r'command not found|Unknown command');
|
final _dockerNotFound = RegExp(r'command not found|Unknown command');
|
||||||
final _versionReg = RegExp(r'(Version:)\s+([0-9]+\.[0-9]+\.[0-9]+)');
|
final _versionReg = RegExp(r'(Version:)\s+([0-9]+\.[0-9]+\.[0-9]+)');
|
||||||
final _editionReg = RegExp(r'(Client:)\s+(.+-.+)');
|
// eg: `Docker Engine - Community`
|
||||||
|
final _editionReg = RegExp(r'Docker Engine - [a-zA-Z]+');
|
||||||
final _dockerPrefixReg = RegExp(r'(sudo )?docker ');
|
final _dockerPrefixReg = RegExp(r'(sudo )?docker ');
|
||||||
|
|
||||||
final _logger = Logger('DOCKER');
|
final _logger = Logger('DOCKER');
|
||||||
|
|
||||||
class DockerProvider extends BusyProvider {
|
class DockerProvider extends BusyProvider {
|
||||||
final dockerStore = locator<DockerStore>();
|
final _dockerStore = locator<DockerStore>();
|
||||||
|
|
||||||
SSHClient? client;
|
SSHClient? client;
|
||||||
String? userName;
|
String? userName;
|
||||||
@@ -36,8 +37,12 @@ class DockerProvider extends BusyProvider {
|
|||||||
String? runLog;
|
String? runLog;
|
||||||
bool isRequestingPwd = false;
|
bool isRequestingPwd = false;
|
||||||
|
|
||||||
void init(SSHClient client, String userName, PwdRequestFunc onPwdReq,
|
void init(
|
||||||
String hostId) {
|
SSHClient client,
|
||||||
|
String userName,
|
||||||
|
PwdRequestFunc onPwdReq,
|
||||||
|
String hostId,
|
||||||
|
) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
this.onPwdReq = onPwdReq;
|
this.onPwdReq = onPwdReq;
|
||||||
@@ -77,29 +82,22 @@ class DockerProvider extends BusyProvider {
|
|||||||
|
|
||||||
// Parse docker version
|
// Parse docker version
|
||||||
final verRaw = DockerCmdType.version.find(segments);
|
final verRaw = DockerCmdType.version.find(segments);
|
||||||
try {
|
version = _versionReg.firstMatch(verRaw)?.group(2);
|
||||||
version = _versionReg.firstMatch(verRaw)?.group(2);
|
edition = _editionReg.firstMatch(verRaw)?.group(0);
|
||||||
edition = _editionReg.firstMatch(verRaw)?.group(2);
|
|
||||||
} catch (e) {
|
|
||||||
error = DockerErr(
|
|
||||||
type: DockerErrType.invalidVersion,
|
|
||||||
message: '$verRaw\n\n$e',
|
|
||||||
);
|
|
||||||
rethrow;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse docker ps
|
// Parse docker ps
|
||||||
final psRaw = DockerCmdType.ps.find(segments);
|
final psRaw = DockerCmdType.ps.find(segments);
|
||||||
try {
|
try {
|
||||||
final lines = psRaw.split('\n');
|
final lines = psRaw.split('\n');
|
||||||
lines.removeWhere((element) => element.isEmpty);
|
lines.removeWhere((element) => element.isEmpty);
|
||||||
lines.removeAt(0);
|
if (lines.isNotEmpty) lines.removeAt(0);
|
||||||
items = lines.map((e) => DockerPsItem.fromRawString(e)).toList();
|
items = lines.map((e) => DockerPsItem.fromRawString(e)).toList();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = DockerErr(
|
error = DockerErr(
|
||||||
type: DockerErrType.parsePsItem,
|
type: DockerErrType.parsePsItem,
|
||||||
message: '$psRaw\n\n$e',
|
message: '$psRaw\n-\n$e',
|
||||||
);
|
);
|
||||||
|
_logger.warning('parse docker ps: $psRaw', e);
|
||||||
rethrow;
|
rethrow;
|
||||||
} finally {
|
} finally {
|
||||||
setBusyState(false);
|
setBusyState(false);
|
||||||
@@ -110,13 +108,14 @@ class DockerProvider extends BusyProvider {
|
|||||||
try {
|
try {
|
||||||
final imageLines = imageRaw.split('\n');
|
final imageLines = imageRaw.split('\n');
|
||||||
imageLines.removeWhere((element) => element.isEmpty);
|
imageLines.removeWhere((element) => element.isEmpty);
|
||||||
imageLines.removeAt(0);
|
if (imageLines.isNotEmpty) imageLines.removeAt(0);
|
||||||
images = imageLines.map((e) => DockerImage.fromRawStr(e)).toList();
|
images = imageLines.map((e) => DockerImage.fromRawStr(e)).toList();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = DockerErr(
|
error = DockerErr(
|
||||||
type: DockerErrType.parseImages,
|
type: DockerErrType.parseImages,
|
||||||
message: '$imageRaw\n\n$e',
|
message: '$imageRaw\n-\n$e',
|
||||||
);
|
);
|
||||||
|
_logger.warning('parse docker images: $imageRaw', e);
|
||||||
rethrow;
|
rethrow;
|
||||||
} finally {
|
} finally {
|
||||||
setBusyState(false);
|
setBusyState(false);
|
||||||
@@ -139,8 +138,10 @@ class DockerProvider extends BusyProvider {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = DockerErr(
|
error = DockerErr(
|
||||||
type: DockerErrType.parseStats,
|
type: DockerErrType.parseStats,
|
||||||
message: '$statsRaw\n\n$e',
|
message: '$statsRaw\n-\n$e',
|
||||||
);
|
);
|
||||||
|
_logger.warning('parse docker stats: $statsRaw', e);
|
||||||
|
rethrow;
|
||||||
} finally {
|
} finally {
|
||||||
setBusyState(false);
|
setBusyState(false);
|
||||||
}
|
}
|
||||||
@@ -205,7 +206,7 @@ class DockerProvider extends BusyProvider {
|
|||||||
|
|
||||||
// judge whether to use DOCKER_HOST
|
// judge whether to use DOCKER_HOST
|
||||||
String _wrap(String cmd) {
|
String _wrap(String cmd) {
|
||||||
final dockerHost = dockerStore.getDockerHost(hostId!);
|
final dockerHost = _dockerStore.getDockerHost(hostId!);
|
||||||
if (dockerHost == null || dockerHost.isEmpty) {
|
if (dockerHost == null || dockerHost.isEmpty) {
|
||||||
return cmd.withLangExport;
|
return cmd.withLangExport;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ServerBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 417;
|
static const int build = 422;
|
||||||
static const String engine = "3.10.6";
|
static const String engine = "3.10.6";
|
||||||
static const String buildAt = "2023-08-05 13:35:14.889342";
|
static const String buildAt = "2023-08-05 17:05:26.027438";
|
||||||
static const int modifications = 3;
|
static const int modifications = 10;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import '../model/app/shell_func.dart';
|
import '../model/app/shell_func.dart';
|
||||||
import 'build_data.dart';
|
import 'build_data.dart';
|
||||||
|
|
||||||
const seperator = 'SrvBox';
|
const seperator = 'SrvBoxSep';
|
||||||
const serverBoxDir = r'$HOME/.config/server_box';
|
const serverBoxDir = r'$HOME/.config/server_box';
|
||||||
const shellPath = '$serverBoxDir/mobile_app.sh';
|
const shellPath = '$serverBoxDir/mobile_app.sh';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:toolbox/core/extension/navigator.dart';
|
||||||
import 'package:toolbox/data/provider/debug.dart';
|
import 'package:toolbox/data/provider/debug.dart';
|
||||||
|
|
||||||
class DebugPage extends StatefulWidget {
|
class DebugPage extends StatefulWidget {
|
||||||
@@ -14,7 +15,11 @@ class _DebugPageState extends State<DebugPage> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Logs'),
|
leading: IconButton(
|
||||||
|
onPressed: () => context.pop(),
|
||||||
|
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||||
|
),
|
||||||
|
title: const Text('Logs', style: TextStyle(color: Colors.white)),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
),
|
),
|
||||||
body: _buildTerminal(context),
|
body: _buildTerminal(context),
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
size: 37,
|
size: 37,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 27),
|
const SizedBox(height: 27),
|
||||||
_buildErr(_docker.error!),
|
Text(_docker.error?.message ?? _s.unknownError),
|
||||||
const SizedBox(height: 27),
|
const SizedBox(height: 27),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(17),
|
padding: const EdgeInsets.all(17),
|
||||||
@@ -250,7 +250,7 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (_docker.items == null || _docker.images == null) {
|
if (_docker.items == null || _docker.images == null) {
|
||||||
Future.delayed(const Duration(milliseconds: 177), () {
|
Future.delayed(const Duration(milliseconds: 37), () {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
_docker.refresh();
|
_docker.refresh();
|
||||||
}
|
}
|
||||||
@@ -258,40 +258,37 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
return centerLoading;
|
return centerLoading;
|
||||||
}
|
}
|
||||||
|
|
||||||
final items = <Widget>[];
|
final items = <Widget>[
|
||||||
items.addAll([
|
|
||||||
_buildLoading(),
|
_buildLoading(),
|
||||||
_buildVersion(
|
_buildVersion(),
|
||||||
_docker.edition ?? _s.unknown,
|
_buildPsHeader(),
|
||||||
_docker.version ?? _s.unknown,
|
|
||||||
),
|
|
||||||
_buildPsItems(),
|
_buildPsItems(),
|
||||||
_buildImages(),
|
_buildImageHeader(),
|
||||||
|
_buildImageItems(),
|
||||||
_buildEditHost(),
|
_buildEditHost(),
|
||||||
].map((e) => RoundRectCard(e)));
|
const SizedBox(height: 37),
|
||||||
items.add(const SizedBox(height: 37));
|
].map((e) => RoundRectCard(e));
|
||||||
return ListView(
|
return ListView(
|
||||||
padding: const EdgeInsets.all(7),
|
padding: const EdgeInsets.all(7),
|
||||||
children: items,
|
children: items.toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildImages() {
|
Widget _buildImageHeader() {
|
||||||
|
return ListTile(
|
||||||
|
title: Text(_s.imagesList),
|
||||||
|
subtitle: Text(
|
||||||
|
_s.dockerImagesFmt(_docker.images!.length),
|
||||||
|
style: grey,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildImageItems() {
|
||||||
if (_docker.images == null) {
|
if (_docker.images == null) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
final items = _docker.images!.map(_buildImageItem).toList();
|
return Column(children: _docker.images!.map(_buildImageItem).toList());
|
||||||
items.insert(
|
|
||||||
0,
|
|
||||||
ListTile(
|
|
||||||
title: Text(_s.imagesList),
|
|
||||||
subtitle: Text(
|
|
||||||
_s.dockerImagesFmt(_docker.images!.length),
|
|
||||||
style: grey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return Column(children: items);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildImageItem(DockerImage e) {
|
Widget _buildImageItem(DockerImage e) {
|
||||||
@@ -355,69 +352,6 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildEditHost() {
|
|
||||||
final children = <Widget>[];
|
|
||||||
if (_docker.items!.isEmpty && _docker.images!.isEmpty) {
|
|
||||||
children.add(Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(17, 17, 17, 0),
|
|
||||||
child: Text(
|
|
||||||
_s.dockerEmptyRunningItems,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
children.add(
|
|
||||||
TextButton(
|
|
||||||
onPressed: _showEditHostDialog,
|
|
||||||
child: Text(_s.dockerEditHost),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return Column(
|
|
||||||
children: children,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _showEditHostDialog() async {
|
|
||||||
await showRoundDialog(
|
|
||||||
context: context,
|
|
||||||
title: Text(_s.dockerEditHost),
|
|
||||||
child: Input(
|
|
||||||
maxLines: 1,
|
|
||||||
controller:
|
|
||||||
TextEditingController(text: 'unix:///run/user/1000/docker.sock'),
|
|
||||||
onSubmitted: (value) {
|
|
||||||
locator<DockerStore>().setDockerHost(widget.spi.id, value.trim());
|
|
||||||
_docker.refresh();
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => context.pop(),
|
|
||||||
child: Text(_s.cancel),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildErr(DockerErr err) {
|
|
||||||
var errStr = '';
|
|
||||||
switch (err.type) {
|
|
||||||
case DockerErrType.noClient:
|
|
||||||
errStr = _s.noClient;
|
|
||||||
break;
|
|
||||||
case DockerErrType.notInstalled:
|
|
||||||
errStr = _s.dockerNotInstalled;
|
|
||||||
break;
|
|
||||||
case DockerErrType.invalidVersion:
|
|
||||||
errStr = _s.invalidVersion;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
errStr = err.message ?? _s.unknown;
|
|
||||||
}
|
|
||||||
return Text(errStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildSolution(DockerErr err) {
|
Widget _buildSolution(DockerErr err) {
|
||||||
switch (err.type) {
|
switch (err.type) {
|
||||||
case DockerErrType.notInstalled:
|
case DockerErrType.notInstalled:
|
||||||
@@ -432,43 +366,58 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
text: _s.invalidVersionHelp(appHelpUrl),
|
text: _s.invalidVersionHelp(appHelpUrl),
|
||||||
replace: 'Github',
|
replace: 'Github',
|
||||||
);
|
);
|
||||||
default:
|
|
||||||
return Text(_s.unknownError);
|
/// TODO: Add solution for these cases.
|
||||||
|
case DockerErrType.parseImages:
|
||||||
|
return const Text('Parse images error');
|
||||||
|
case DockerErrType.parsePsItem:
|
||||||
|
return const Text('Parse ps item error');
|
||||||
|
case DockerErrType.parseStats:
|
||||||
|
return const Text('Parse stats error');
|
||||||
|
case DockerErrType.unknown:
|
||||||
|
return const Text('Unknown error');
|
||||||
|
case DockerErrType.cmdNoPrefix:
|
||||||
|
return const Text('Cmd no prefix');
|
||||||
|
case DockerErrType.segmentsNotMatch:
|
||||||
|
return const Text('Segments not match');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildVersion(String edition, String version) {
|
Widget _buildVersion() {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(17),
|
padding: const EdgeInsets.all(17),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [Text(edition), Text(version)],
|
children: [
|
||||||
|
Text(_docker.edition ?? _s.unknown),
|
||||||
|
Text(_docker.version ?? _s.unknown),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildPsItems() {
|
Widget _buildPsHeader() {
|
||||||
final items = _docker.items!.map(_buildPsItem).toList();
|
return ListTile(
|
||||||
items.insert(
|
title: Text(_s.containerStatus),
|
||||||
0,
|
subtitle: Text(_buildPsCardSubtitle(_docker.items!), style: grey),
|
||||||
ListTile(
|
|
||||||
title: Text(_s.containerStatus),
|
|
||||||
subtitle: Text(_buildSubtitle(_docker.items!), style: grey),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
// Bottom padding
|
}
|
||||||
items.add(height13);
|
|
||||||
|
Widget _buildPsItems() {
|
||||||
|
if (_docker.items == null) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: items,
|
children: _docker.items!.map(_buildPsItem).toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildPsItem(DockerPsItem item) {
|
Widget _buildPsItem(DockerPsItem item) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(item.name),
|
title: Text(item.image),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
'${item.image}\n${item.status}',
|
'${item.name} - ${item.status}',
|
||||||
style: textSize13Grey,
|
style: textSize13Grey,
|
||||||
),
|
),
|
||||||
trailing: _buildMoreBtn(item, _docker.isBusy),
|
trailing: _buildMoreBtn(item, _docker.isBusy),
|
||||||
@@ -554,7 +503,7 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String _buildSubtitle(List<DockerPsItem> running) {
|
String _buildPsCardSubtitle(List<DockerPsItem> running) {
|
||||||
final runningCount = running.where((element) => element.running).length;
|
final runningCount = running.where((element) => element.running).length;
|
||||||
final stoped = running.length - runningCount;
|
final stoped = running.length - runningCount;
|
||||||
if (stoped == 0) {
|
if (stoped == 0) {
|
||||||
@@ -562,4 +511,49 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
}
|
}
|
||||||
return _s.dockerStatusRunningAndStoppedFmt(runningCount, stoped);
|
return _s.dockerStatusRunningAndStoppedFmt(runningCount, stoped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildEditHost() {
|
||||||
|
final children = <Widget>[];
|
||||||
|
if (_docker.items!.isEmpty && _docker.images!.isEmpty) {
|
||||||
|
children.add(Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(17, 17, 17, 0),
|
||||||
|
child: Text(
|
||||||
|
_s.dockerEmptyRunningItems,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
children.add(
|
||||||
|
TextButton(
|
||||||
|
onPressed: _showEditHostDialog,
|
||||||
|
child: Text(_s.dockerEditHost),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return Column(
|
||||||
|
children: children,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _showEditHostDialog() async {
|
||||||
|
await showRoundDialog(
|
||||||
|
context: context,
|
||||||
|
title: Text(_s.dockerEditHost),
|
||||||
|
child: Input(
|
||||||
|
maxLines: 1,
|
||||||
|
controller:
|
||||||
|
TextEditingController(text: 'unix:///run/user/1000/docker.sock'),
|
||||||
|
onSubmitted: (value) {
|
||||||
|
locator<DockerStore>().setDockerHost(widget.spi.id, value.trim());
|
||||||
|
_docker.refresh();
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => context.pop(),
|
||||||
|
child: Text(_s.cancel),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
_buildTopRightText(ss, cs),
|
_buildTopRightText(ss, cs),
|
||||||
width7,
|
width13,
|
||||||
_buildSSHBtn(spi),
|
_buildSSHBtn(spi),
|
||||||
_buildMoreBtn(spi),
|
_buildMoreBtn(spi),
|
||||||
],
|
],
|
||||||
@@ -240,32 +240,33 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
ss.uptime,
|
ss.uptime,
|
||||||
ss.failedInfo,
|
ss.failedInfo,
|
||||||
);
|
);
|
||||||
final hasError = cs == ServerState.failed && ss.failedInfo != null;
|
if (cs == ServerState.failed && ss.failedInfo != null) {
|
||||||
return hasError
|
return GestureDetector(
|
||||||
? GestureDetector(
|
onTap: () => showRoundDialog(
|
||||||
onTap: () => showRoundDialog(
|
context: context,
|
||||||
context: context,
|
title: Text(_s.error),
|
||||||
title: Text(_s.error),
|
child: SingleChildScrollView(
|
||||||
child: Text(ss.failedInfo ?? _s.unknownError),
|
child: Text(ss.failedInfo!),
|
||||||
actions: [
|
),
|
||||||
TextButton(
|
actions: [
|
||||||
onPressed: () =>
|
TextButton(
|
||||||
copy2Clipboard(ss.failedInfo ?? _s.unknownError),
|
onPressed: () => copy2Clipboard(ss.failedInfo!),
|
||||||
child: Text(_s.copy),
|
child: Text(_s.copy),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
_s.viewErr,
|
_s.viewErr,
|
||||||
style: textSize12Grey,
|
style: textSize12Grey,
|
||||||
textScaleFactor: 1.0,
|
textScaleFactor: 1.0,
|
||||||
),
|
),
|
||||||
)
|
);
|
||||||
: Text(
|
}
|
||||||
topRightStr,
|
return Text(
|
||||||
style: textSize12Grey,
|
topRightStr,
|
||||||
textScaleFactor: 1.0,
|
style: textSize12Grey,
|
||||||
);
|
textScaleFactor: 1.0,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSSHBtn(ServerPrivateInfo spi) {
|
Widget _buildSSHBtn(ServerPrivateInfo spi) {
|
||||||
@@ -281,6 +282,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
Widget _buildMoreBtn(ServerPrivateInfo spi) {
|
Widget _buildMoreBtn(ServerPrivateInfo spi) {
|
||||||
return PopupMenu(
|
return PopupMenu(
|
||||||
items: ServerTabMenuType.values.map((e) => e.build(_s)).toList(),
|
items: ServerTabMenuType.values.map((e) => e.build(_s)).toList(),
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
onSelected: (ServerTabMenuType value) async {
|
onSelected: (ServerTabMenuType value) async {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case ServerTabMenuType.pkg:
|
case ServerTabMenuType.pkg:
|
||||||
|
|||||||
@@ -154,11 +154,11 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
|||||||
),
|
),
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
if (!isDir) return;
|
if (!isDir) return;
|
||||||
showDirActionDialog(file);
|
_showDirActionDialog(file);
|
||||||
},
|
},
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
if (!isDir) {
|
if (!isDir) {
|
||||||
await showFileActionDialog(file);
|
await _showFileActionDialog(file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_path!.update(fileName);
|
_path!.update(fileName);
|
||||||
@@ -169,7 +169,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> showDirActionDialog(FileSystemEntity file) async {
|
Future<void> _showDirActionDialog(FileSystemEntity file) async {
|
||||||
showRoundDialog(
|
showRoundDialog(
|
||||||
context: context,
|
context: context,
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -178,7 +178,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
|||||||
ListTile(
|
ListTile(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
context.pop();
|
context.pop();
|
||||||
showRenameDialog(file);
|
_showRenameDialog(file);
|
||||||
},
|
},
|
||||||
title: Text(_s.rename),
|
title: Text(_s.rename),
|
||||||
leading: const Icon(Icons.abc),
|
leading: const Icon(Icons.abc),
|
||||||
@@ -186,7 +186,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
|||||||
ListTile(
|
ListTile(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
context.pop();
|
context.pop();
|
||||||
showDeleteDialog(file);
|
_showDeleteDialog(file);
|
||||||
},
|
},
|
||||||
title: Text(_s.delete),
|
title: Text(_s.delete),
|
||||||
leading: const Icon(Icons.delete),
|
leading: const Icon(Icons.delete),
|
||||||
@@ -196,7 +196,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> showFileActionDialog(FileSystemEntity file) async {
|
Future<void> _showFileActionDialog(FileSystemEntity file) async {
|
||||||
final fileName = file.path.split('/').last;
|
final fileName = file.path.split('/').last;
|
||||||
if (widget.isPickFile) {
|
if (widget.isPickFile) {
|
||||||
await showRoundDialog(
|
await showRoundDialog(
|
||||||
@@ -252,7 +252,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
|||||||
title: Text(_s.rename),
|
title: Text(_s.rename),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
context.pop();
|
context.pop();
|
||||||
showRenameDialog(file);
|
_showRenameDialog(file);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
@@ -260,7 +260,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
|||||||
title: Text(_s.delete),
|
title: Text(_s.delete),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
context.pop();
|
context.pop();
|
||||||
showDeleteDialog(file);
|
_showDeleteDialog(file);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
@@ -319,7 +319,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showRenameDialog(FileSystemEntity file) {
|
void _showRenameDialog(FileSystemEntity file) {
|
||||||
final fileName = file.path.split('/').last;
|
final fileName = file.path.split('/').last;
|
||||||
showRoundDialog(
|
showRoundDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -342,7 +342,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showDeleteDialog(FileSystemEntity file) {
|
void _showDeleteDialog(FileSystemEntity file) {
|
||||||
final fileName = file.path.split('/').last;
|
final fileName = file.path.split('/').last;
|
||||||
showRoundDialog(
|
showRoundDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@@ -475,9 +475,9 @@
|
|||||||
baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */;
|
baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
CURRENT_PROJECT_VERSION = 417;
|
CURRENT_PROJECT_VERSION = 422;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0.417;
|
MARKETING_VERSION = 1.0.422;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@@ -490,9 +490,9 @@
|
|||||||
baseConfigurationReference = 15AF97DF993E8968098D6EBE /* Pods-RunnerTests.release.xcconfig */;
|
baseConfigurationReference = 15AF97DF993E8968098D6EBE /* Pods-RunnerTests.release.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
CURRENT_PROJECT_VERSION = 417;
|
CURRENT_PROJECT_VERSION = 422;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0.417;
|
MARKETING_VERSION = 1.0.422;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@@ -505,9 +505,9 @@
|
|||||||
baseConfigurationReference = 7CFA7DE7FABA75685DFB6948 /* Pods-RunnerTests.profile.xcconfig */;
|
baseConfigurationReference = 7CFA7DE7FABA75685DFB6948 /* Pods-RunnerTests.profile.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
CURRENT_PROJECT_VERSION = 417;
|
CURRENT_PROJECT_VERSION = 422;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0.417;
|
MARKETING_VERSION = 1.0.422;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
|||||||
Reference in New Issue
Block a user