#50 new: docker shell

This commit is contained in:
lollipopkit
2023-05-27 14:24:54 +08:00
parent 7a211b9a55
commit a8194319b6
13 changed files with 59 additions and 20 deletions

View File

@@ -1019,6 +1019,12 @@ abstract class S {
/// **'Are you sure to delete server [{server}]?'**
String sureToDeleteServer(Object server);
/// No description provided for @terminal.
///
/// In en, this message translates to:
/// **'Terminal'**
String get terminal;
/// No description provided for @theme.
///
/// In en, this message translates to:

View File

@@ -500,6 +500,9 @@ class SDe extends S {
return 'Bist du sicher, dass du [$server] löschen willst?';
}
@override
String get terminal => 'Terminal';
@override
String get theme => 'Themen';

View File

@@ -500,6 +500,9 @@ class SEn extends S {
return 'Are you sure to delete server [$server]?';
}
@override
String get terminal => 'Terminal';
@override
String get theme => 'Theme';

View File

@@ -500,6 +500,9 @@ class SZh extends S {
return '你确定要删除服务器 [$server] 吗?';
}
@override
String get terminal => '终端';
@override
String get theme => '主题';

View File

@@ -360,7 +360,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 320;
CURRENT_PROJECT_VERSION = 321;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -368,7 +368,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.320;
MARKETING_VERSION = 1.0.321;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -491,7 +491,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 320;
CURRENT_PROJECT_VERSION = 321;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -499,7 +499,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.320;
MARKETING_VERSION = 1.0.321;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -516,7 +516,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 320;
CURRENT_PROJECT_VERSION = 321;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -524,7 +524,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.320;
MARKETING_VERSION = 1.0.321;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@@ -46,7 +46,8 @@ enum DockerMenuType {
stop,
restart,
rm,
logs;
logs,
terminal;
static List<DockerMenuType> items(bool running) {
if (running) {
@@ -68,6 +69,8 @@ enum DockerMenuType {
return Icons.delete;
case DockerMenuType.logs:
return Icons.logo_dev;
case DockerMenuType.terminal:
return Icons.terminal;
}
}
@@ -83,6 +86,8 @@ enum DockerMenuType {
return s.delete;
case DockerMenuType.logs:
return s.log;
case DockerMenuType.terminal:
return s.terminal;
}
}

View File

@@ -2,8 +2,8 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 320;
static const int build = 321;
static const String engine = "3.10.2";
static const String buildAt = "2023-05-26 20:00:35.224841";
static const int modifications = 5;
static const String buildAt = "2023-05-26 20:09:33.821996";
static const int modifications = 2;
}

View File

@@ -153,6 +153,7 @@
"sureDirEmpty": "Stelle sicher, dass der Ordner leer ist.",
"sureNoPwd": "Bist du sicher, dass du kein Passwort verwenden willst?",
"sureToDeleteServer": "Bist du sicher, dass du [{server}] löschen willst?",
"terminal": "Terminal",
"theme": "Themen",
"themeMode": "Thememodus",
"times": "x",

View File

@@ -153,6 +153,7 @@
"sureDirEmpty": "Make sure dir is empty.",
"sureNoPwd": "Are you sure to use no password?",
"sureToDeleteServer": "Are you sure to delete server [{server}]?",
"terminal": "Terminal",
"theme": "Theme",
"themeMode": "Theme mode",
"times": "Times",

View File

@@ -153,6 +153,7 @@
"sureDirEmpty": "请确保文件夹为空",
"sureNoPwd": "确认使用无密码?",
"sureToDeleteServer": "你确定要删除服务器 [{server}] 吗?",
"terminal": "终端",
"theme": "主题",
"themeMode": "主题模式",
"times": "次",

View File

@@ -2,7 +2,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:provider/provider.dart';
import 'package:toolbox/core/extension/navigator.dart';
import 'package:toolbox/core/route.dart';
import 'package:toolbox/core/utils/misc.dart';
import 'package:toolbox/view/page/ssh.dart';
import 'package:toolbox/view/widget/input_field.dart';
import '../../core/utils/ui.dart';
@@ -499,6 +501,9 @@ class _DockerManagePageState extends State<DockerManagePage> {
case DockerMenuType.stop:
_docker.stop(dItem.containerId);
break;
case DockerMenuType.restart:
_docker.restart(dItem.containerId);
break;
case DockerMenuType.logs:
final logs = await _docker.logs(dItem.containerId);
showRoundDialog(
@@ -514,9 +519,14 @@ class _DockerManagePageState extends State<DockerManagePage> {
],
);
break;
case DockerMenuType.restart:
_docker.restart(dItem.containerId);
break;
case DockerMenuType.terminal:
AppRoute(
SSHPage(
spi: widget.spi,
initCmd: 'docker exec -it ${dItem.containerId} /bin/sh',
),
'Docker terminal',
).go(context);
}
},
);

View File

@@ -25,7 +25,8 @@ import '../../locator.dart';
class SSHPage extends StatefulWidget {
final ServerPrivateInfo spi;
const SSHPage({Key? key, required this.spi}) : super(key: key);
final String? initCmd;
const SSHPage({Key? key, required this.spi, this.initCmd}) : super(key: key);
@override
_SSHPageState createState() => _SSHPageState();
@@ -341,6 +342,11 @@ class _SSHPageState extends State<SSHPage> {
_listen(session.stdout);
_listen(session.stderr);
if (widget.initCmd != null) {
_terminal.write(widget.initCmd!);
_terminal.keyInput(TerminalKey.enter);
}
await session.done;
if (mounted) {
context.pop();

View File

@@ -475,9 +475,9 @@
baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 320;
CURRENT_PROJECT_VERSION = 321;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.320;
MARKETING_VERSION = 1.0.321;
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
@@ -490,9 +490,9 @@
baseConfigurationReference = 15AF97DF993E8968098D6EBE /* Pods-RunnerTests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 320;
CURRENT_PROJECT_VERSION = 321;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.320;
MARKETING_VERSION = 1.0.321;
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
@@ -505,9 +505,9 @@
baseConfigurationReference = 7CFA7DE7FABA75685DFB6948 /* Pods-RunnerTests.profile.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 320;
CURRENT_PROJECT_VERSION = 321;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.320;
MARKETING_VERSION = 1.0.321;
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;