opt.: use ssh term to decompress (#519)
This commit is contained in:
@@ -61,7 +61,7 @@ class BackupPage extends StatelessWidget {
|
||||
child: ExpandTile(
|
||||
leading: const Icon(Icons.file_open),
|
||||
title: Text(libL10n.file),
|
||||
initiallyExpanded: true,
|
||||
initiallyExpanded: false,
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text(libL10n.backup),
|
||||
@@ -112,7 +112,7 @@ class BackupPage extends StatelessWidget {
|
||||
child: ExpandTile(
|
||||
leading: const Icon(Icons.storage),
|
||||
title: const Text('WebDAV'),
|
||||
initiallyExpanded: true,
|
||||
initiallyExpanded: false,
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text(l10n.setting),
|
||||
@@ -261,11 +261,11 @@ class BackupPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) {
|
||||
onTap: () {
|
||||
for (final snippet in snippets) {
|
||||
Pros.snippet.add(snippet);
|
||||
}
|
||||
c.pop();
|
||||
context.pop();
|
||||
context.pop();
|
||||
},
|
||||
).toList,
|
||||
@@ -294,7 +294,7 @@ class BackupPage extends StatelessWidget {
|
||||
'${libL10n.restore} ${libL10n.backup}(${backup.date})',
|
||||
)),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) async {
|
||||
onTap: () async {
|
||||
await backup.restore(force: true);
|
||||
context.pop();
|
||||
},
|
||||
@@ -386,7 +386,7 @@ class BackupPage extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: Btn.ok(onTap: (c) => context.pop(true)).toList,
|
||||
actions: Btnx.oks,
|
||||
);
|
||||
if (result == true) {
|
||||
final result = await Webdav.test(url.text, user.text, pwd.text);
|
||||
@@ -423,7 +423,7 @@ class BackupPage extends StatelessWidget {
|
||||
'${libL10n.restore} ${libL10n.backup}(${backup.date})',
|
||||
)),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) async {
|
||||
onTap: () async {
|
||||
await backup.restore(force: true);
|
||||
context.pop();
|
||||
},
|
||||
@@ -454,7 +454,7 @@ class BackupPage extends StatelessWidget {
|
||||
final sure = await context.showRoundDialog<bool>(
|
||||
title: libL10n.import,
|
||||
child: Text(libL10n.askContinue('${spis.length} ${l10n.server}')),
|
||||
actions: Btn.ok(onTap: (c) => context.pop(true)).toList,
|
||||
actions: Btnx.oks,
|
||||
);
|
||||
if (sure == true) {
|
||||
final (suc, err) = await context.showLoadingDialog(
|
||||
|
||||
@@ -353,7 +353,7 @@ class _ContainerPageState extends State<ContainerPage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: Btn.ok(onTap: (c) async {
|
||||
actions: Btn.ok(onTap: () async {
|
||||
context.pop();
|
||||
await _showAddCmdPreview(
|
||||
_buildAddCmd(
|
||||
@@ -421,7 +421,7 @@ class _ContainerPageState extends State<ContainerPage> {
|
||||
hint: 'unix:///run/user/1000/docker.sock',
|
||||
suggestion: false,
|
||||
),
|
||||
actions: Btn.ok(onTap: (c) => _onSaveDockerHost(ctrl.text)).toList,
|
||||
actions: Btn.ok(onTap: () => _onSaveDockerHost(ctrl.text)).toList,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ class _ContainerPageState extends State<ContainerPage> {
|
||||
libL10n.askContinue('${libL10n.delete} Image(${e.repository})'),
|
||||
),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) async {
|
||||
onTap: () async {
|
||||
context.pop();
|
||||
final result = await _container.run('rmi ${e.id} -f');
|
||||
if (result != null) {
|
||||
@@ -483,7 +483,7 @@ class _ContainerPageState extends State<ContainerPage> {
|
||||
)
|
||||
],
|
||||
),
|
||||
actions: Btn.ok(onTap: (c) async {
|
||||
actions: Btn.ok(onTap: () async {
|
||||
context.pop();
|
||||
|
||||
final (result, err) = await context.showLoadingDialog(
|
||||
|
||||
@@ -62,7 +62,7 @@ class _PingPageState extends State<PingPage>
|
||||
minLines: 1,
|
||||
onSubmitted: (_) => _doPing(),
|
||||
),
|
||||
actions: Btn.ok(onTap: (c) => _doPing()).toList,
|
||||
actions: Btn.ok(onTap: _doPing).toList,
|
||||
);
|
||||
},
|
||||
child: const Icon(Icons.search),
|
||||
|
||||
@@ -88,7 +88,7 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage> {
|
||||
'${libL10n.delete} ${l10n.privateKey}(${widget.pki!.id})',
|
||||
)),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) {
|
||||
onTap: () {
|
||||
Pros.key.delete(widget.pki!);
|
||||
context.pop();
|
||||
context.pop();
|
||||
|
||||
@@ -80,7 +80,7 @@ class _PrivateKeyListState extends State<PrivateKeysListPage>
|
||||
context.showRoundDialog(
|
||||
title: libL10n.attention,
|
||||
child: Text(l10n.addSystemPrivateKeyTip),
|
||||
actions: Btn.ok(onTap: (c) {
|
||||
actions: Btn.ok(onTap: () {
|
||||
context.pop();
|
||||
AppRoutes.keyEdit(pki: sysPk).go(context);
|
||||
}).toList,
|
||||
|
||||
@@ -158,7 +158,7 @@ class _ProcessPageState extends State<ProcessPage> {
|
||||
child: Text(libL10n.askContinue(
|
||||
'${l10n.stop} ${l10n.process}(${proc.pid})',
|
||||
)),
|
||||
actions: Btn.ok(onTap: (c) async {
|
||||
actions: Btn.ok(onTap: () async {
|
||||
context.pop();
|
||||
await context.showLoadingDialog(fn: () async {
|
||||
await _client?.run('kill ${proc.pid}');
|
||||
|
||||
@@ -61,7 +61,7 @@ final class _PvePageState extends State<PvePage> {
|
||||
? UIs.placeholder
|
||||
: Btn.icon(
|
||||
icon: const Icon(Icons.refresh),
|
||||
onTap: (_) {
|
||||
onTap: () {
|
||||
_pve.err.value = null;
|
||||
_pve.list();
|
||||
_initRefreshTimer();
|
||||
@@ -397,22 +397,22 @@ final class _PvePageState extends State<PvePage> {
|
||||
if (!item.available) {
|
||||
return Btn.icon(
|
||||
icon: const Icon(Icons.play_arrow, color: Colors.grey),
|
||||
onTap: (_) => _onCtrl(_pve.start, l10n.start, item));
|
||||
onTap: () => _onCtrl(_pve.start, l10n.start, item));
|
||||
}
|
||||
return Row(
|
||||
children: [
|
||||
Btn.icon(
|
||||
icon: const Icon(Icons.stop, color: Colors.grey, size: 20),
|
||||
padding: pad,
|
||||
onTap: (_) => _onCtrl(_pve.stop, l10n.stop, item)),
|
||||
onTap: () => _onCtrl(_pve.stop, l10n.stop, item)),
|
||||
Btn.icon(
|
||||
icon: const Icon(Icons.refresh, color: Colors.grey, size: 20),
|
||||
padding: pad,
|
||||
onTap: (_) => _onCtrl(_pve.reboot, l10n.reboot, item)),
|
||||
onTap: () => _onCtrl(_pve.reboot, l10n.reboot, item)),
|
||||
Btn.icon(
|
||||
icon: const Icon(Icons.power_off, color: Colors.grey, size: 20),
|
||||
padding: pad,
|
||||
onTap: (_) => _onCtrl(_pve.shutdown, l10n.shutdown, item)),
|
||||
onTap: () => _onCtrl(_pve.shutdown, l10n.shutdown, item)),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -421,10 +421,7 @@ final class _PvePageState extends State<PvePage> {
|
||||
final sure = await context.showRoundDialog<bool>(
|
||||
title: libL10n.attention,
|
||||
child: Text(libL10n.askContinue('$action ${item.id}')),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) => context.pop(true),
|
||||
red: true,
|
||||
).toList,
|
||||
actions: Btnx.okReds,
|
||||
);
|
||||
if (sure != true) return;
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
));
|
||||
}),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) async {
|
||||
onTap: () async {
|
||||
context.pop();
|
||||
Pros.server.delServer(widget.spi!.id);
|
||||
context.pop(true);
|
||||
|
||||
@@ -345,7 +345,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
const textStyle = TextStyle(color: Colors.grey);
|
||||
final children = [
|
||||
Btn.column(
|
||||
onTap: (_) => _askFor(
|
||||
onTap: () => _askFor(
|
||||
func: () async {
|
||||
if (Stores.setting.showSuspendTip.fetch()) {
|
||||
await context.showRoundDialog(
|
||||
@@ -368,7 +368,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
textStyle: textStyle,
|
||||
),
|
||||
Btn.column(
|
||||
onTap: (_) => _askFor(
|
||||
onTap: () => _askFor(
|
||||
func: () => srv.client?.execWithPwd(
|
||||
ShellFunc.shutdown.exec(srv.spi.id),
|
||||
context: context,
|
||||
@@ -382,7 +382,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
textStyle: textStyle,
|
||||
),
|
||||
Btn.column(
|
||||
onTap: (_) => _askFor(
|
||||
onTap: () => _askFor(
|
||||
func: () => srv.client?.execWithPwd(
|
||||
ShellFunc.reboot.exec(srv.spi.id),
|
||||
context: context,
|
||||
@@ -396,7 +396,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
textStyle: textStyle,
|
||||
),
|
||||
Btn.column(
|
||||
onTap: (_) => AppRoutes.serverEdit(spi: srv.spi).go(context),
|
||||
onTap: () => AppRoutes.serverEdit(spi: srv.spi).go(context),
|
||||
icon: const Icon(Icons.edit, color: Colors.grey),
|
||||
text: libL10n.edit,
|
||||
textStyle: textStyle,
|
||||
@@ -693,7 +693,7 @@ ${ss.err?.message ?? 'null'}
|
||||
title: libL10n.attention,
|
||||
child: Text(libL10n.askContinue('$typ ${l10n.server}($name)')),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) {
|
||||
onTap: () {
|
||||
context.pop();
|
||||
func();
|
||||
},
|
||||
|
||||
@@ -43,7 +43,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
),
|
||||
),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) {
|
||||
onTap: () {
|
||||
context.pop();
|
||||
_setting.box.deleteAll(_setting.box.keys);
|
||||
context.showSnackBar(l10n.success);
|
||||
@@ -266,7 +266,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
children: children,
|
||||
);
|
||||
}),
|
||||
actions: Btn.ok(onTap: (c) => _onSaveColor(ctrl.text)).toList,
|
||||
actions: Btn.ok(onTap: () => _onSaveColor(ctrl.text)).toList,
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -765,7 +765,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
onSubmitted: _onSaveTextScaler,
|
||||
suggestion: false,
|
||||
),
|
||||
actions: Btn.ok(onTap: (c) => _onSaveTextScaler(ctrl.text)).toList,
|
||||
actions: Btn.ok(onTap: () => _onSaveTextScaler(ctrl.text)).toList,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -870,7 +870,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
suggestion: false,
|
||||
onSubmitted: (_) => onSave(),
|
||||
),
|
||||
actions: Btn.ok(onTap: (c) => onSave()).toList,
|
||||
actions: Btn.ok(onTap: onSave).toList,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1111,7 +1111,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
context.showRoundDialog(
|
||||
title: libL10n.fail,
|
||||
child: Text('${l10n.invalid} URL'),
|
||||
actions: Btn.ok(onTap: (c) => context.pop()).toList,
|
||||
actions: Btnx.oks,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -1147,7 +1147,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: Btn.ok(onTap: (c) => onSave(ctrl.text)).toList,
|
||||
actions: Btn.ok(onTap: () => onSave(ctrl.text)).toList,
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -1205,7 +1205,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
suggestion: false,
|
||||
onSubmitted: (_) => onSave(),
|
||||
),
|
||||
actions: [Btn.ok(onTap: (_) => onSave())],
|
||||
actions: Btn.ok(onTap: onSave).toList,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -54,7 +54,7 @@ class _SnippetEditPageState extends State<SnippetEditPage>
|
||||
'${libL10n.delete} ${l10n.snippet}(${widget.snippet!.name})',
|
||||
)),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) {
|
||||
onTap: () {
|
||||
Pros.snippet.del(widget.snippet!);
|
||||
context.pop();
|
||||
context.pop();
|
||||
|
||||
@@ -73,10 +73,7 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
return AlertDialog(
|
||||
title: Text(libL10n.attention),
|
||||
content: Text('${libL10n.close} SSH ${l10n.conn}($name) ?'),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) => context.pop(true),
|
||||
red: true,
|
||||
).toList,
|
||||
actions: Btnx.okReds,
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -274,7 +271,7 @@ final class _TabBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
color: color,
|
||||
size: 17,
|
||||
),
|
||||
onTap: (_) => onClose(name),
|
||||
onTap: () => onClose(name),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
|
||||
@@ -226,7 +226,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
title: libL10n.file,
|
||||
child: Text(fileName),
|
||||
actions: [
|
||||
Btn.ok(onTap: (c) {
|
||||
Btn.ok(onTap: () {
|
||||
context.pop();
|
||||
context.pop(file.path);
|
||||
}),
|
||||
@@ -350,7 +350,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
title: libL10n.delete,
|
||||
child: Text(libL10n.askContinue('${libL10n.delete} $fileName')),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) async {
|
||||
onTap: () async {
|
||||
context.pop();
|
||||
try {
|
||||
await file.delete(recursive: true);
|
||||
|
||||
@@ -396,7 +396,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
var newPerm = perm.copyWith();
|
||||
final ok = await context.showRoundDialog(
|
||||
child: UnixPermEditor(perm: perm, onChanged: (p) => newPerm = p),
|
||||
actions: [Btn.ok(onTap: (context) => context.pop(true))],
|
||||
actions: Btnx.okReds,
|
||||
);
|
||||
|
||||
final permStr = newPerm.perm;
|
||||
@@ -594,7 +594,8 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
final textController = TextEditingController();
|
||||
|
||||
void onSubmitted() async {
|
||||
if (textController.text.isEmpty) {
|
||||
final text = textController.text.trim();
|
||||
if (text.isEmpty) {
|
||||
context.showRoundDialog(
|
||||
child: Text(libL10n.empty),
|
||||
actions: Btnx.oks,
|
||||
@@ -605,7 +606,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
|
||||
final (suc, err) = await context.showLoadingDialog(
|
||||
fn: () async {
|
||||
final dir = '${_status.path!.path}/${textController.text}';
|
||||
final dir = '${_status.path!.path}/$text';
|
||||
await _status.client!.mkdir(dir);
|
||||
return true;
|
||||
},
|
||||
@@ -626,7 +627,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
onSubmitted: (_) => onSubmitted(),
|
||||
),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) => onSubmitted(),
|
||||
onTap: onSubmitted,
|
||||
red: true,
|
||||
).toList,
|
||||
);
|
||||
@@ -637,13 +638,12 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
final textController = TextEditingController();
|
||||
|
||||
void onSubmitted() async {
|
||||
if (textController.text.isEmpty) {
|
||||
final text = textController.text.trim();
|
||||
if (text.isEmpty) {
|
||||
context.showRoundDialog(
|
||||
title: libL10n.attention,
|
||||
child: Text(libL10n.empty),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) => context.pop(),
|
||||
).toList,
|
||||
actions: Btnx.oks,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -651,7 +651,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
|
||||
final (suc, err) = await context.showLoadingDialog(
|
||||
fn: () async {
|
||||
final path = '${_status.path!.path}/${textController.text}';
|
||||
final path = '${_status.path!.path}/$text';
|
||||
await _client!.run('touch "$path"');
|
||||
return true;
|
||||
},
|
||||
@@ -671,10 +671,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
suggestion: true,
|
||||
onSubmitted: (_) => onSubmitted(),
|
||||
),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) => onSubmitted(),
|
||||
red: true,
|
||||
).toList,
|
||||
actions: Btn.ok(onTap: onSubmitted, red: true).toList,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -683,13 +680,12 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
final textController = TextEditingController(text: file.filename);
|
||||
|
||||
void onSubmitted() async {
|
||||
if (textController.text.isEmpty) {
|
||||
final text = textController.text.trim();
|
||||
if (text.isEmpty) {
|
||||
context.showRoundDialog(
|
||||
title: libL10n.attention,
|
||||
child: Text(libL10n.empty),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) => context.pop(),
|
||||
).toList,
|
||||
actions: Btnx.oks,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -743,17 +739,11 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
final confirm = await context.showRoundDialog(
|
||||
title: libL10n.attention,
|
||||
child: SimpleMarkdown(data: '```sh\n$cmd\n```'),
|
||||
actions: [
|
||||
Btn.cancel(onTap: (c) => c.pop(false)),
|
||||
Btn.ok(onTap: (c) => c.pop(true), red: true),
|
||||
],
|
||||
actions: Btnx.cancelRedOk,
|
||||
);
|
||||
if (confirm != true) return;
|
||||
|
||||
final (suc, err) = await context.showLoadingDialog(
|
||||
fn: () => _client?.run(cmd) ?? Future.value(false),
|
||||
);
|
||||
if (suc == null || err != null) return;
|
||||
await AppRoutes.ssh(spi: widget.spi, initCmd: cmd).go(context);
|
||||
_listDir();
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ class _SftpMissionPageState extends State<SftpMissionPage> {
|
||||
'${libL10n.delete} ${l10n.mission}($name)',
|
||||
)),
|
||||
actions: Btn.ok(
|
||||
onTap: (c) {
|
||||
onTap: () {
|
||||
Pros.sftp.cancel(id);
|
||||
context.pop();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user