- server edit page display bugs, include userPubKey and pubKeyIdx
This commit is contained in:
Junyuan Feng
2022-05-25 13:10:30 +08:00
parent 4148aac31b
commit 1bd673a164
9 changed files with 25 additions and 69 deletions

View File

@@ -1,20 +1,9 @@
import 'package:toolbox/core/provider_base.dart';
import 'package:toolbox/data/service/app.dart';
class AppProvider extends BusyProvider {
Map? _notify;
Map? get notify => _notify;
int? _newestBuild;
int? get newestBuild => _newestBuild;
Future<void> loadData() async {
setBusyState(true);
final service = AppService();
_notify = await service.getNotify();
setBusyState(false);
notifyListeners();
}
void setNewestBuild(int build) {
_newestBuild = build;
notifyListeners();

View File

@@ -66,42 +66,22 @@ class DockerProvider extends BusyProvider {
}
}
Future<bool> stop(String id) async {
Future<bool> _do(String id, String cmd) async {
setBusyState();
if (client == null) {
error = 'no client';
setBusyState(false);
return false;
}
final result = await client!.run('docker stop $id').string;
final result = await client!.run(cmd).string;
await refresh();
setBusyState(false);
return result.contains(id);
}
Future<bool> start(String id) async {
setBusyState();
if (client == null) {
error = 'no client';
setBusyState(false);
return false;
}
final result = await client!.run('docker start $id').string;
await refresh();
setBusyState(false);
return result.contains(id);
}
Future<bool> stop(String id) async => await _do(id, 'docker stop $id');
Future<bool> delete(String id) async {
setBusyState();
if (client == null) {
error = 'no client';
setBusyState(false);
return false;
}
final result = await client!.run('docker rm $id').string;
await refresh();
setBusyState(false);
return result.contains(id);
}
Future<bool> start(String id) async => await _do(id, 'docker start $id');
Future<bool> delete(String id) async => await _do(id, 'docker rm $id');
}

View File

@@ -2,9 +2,9 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 145;
static const int build = 146;
static const String engine =
"Flutter 3.0.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision fb57da5f94 (4 days ago) • 2022-05-19 15:50:29 -0700\nEngine • revision caaafc5604\nTools • Dart 2.17.1 • DevTools 2.12.2\n";
static const String buildAt = "2022-05-24 13:29:00.556031";
static const int modifications = 4;
static const String buildAt = "2022-05-24 13:44:07.002192";
static const int modifications = 0;
}

View File

@@ -3,11 +3,6 @@ import 'package:toolbox/data/model/app/update.dart';
import 'package:toolbox/data/res/url.dart';
class AppService {
Future<Map> getNotify() async {
final resp = await Dio().get('$baseUrl/notify.json');
return resp.data;
}
Future<AppUpdate> getUpdate() async {
final resp = await Dio().get('$baseUrl/update.json');
return AppUpdate.fromJson(resp.data);