peer card batch operation

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-08-03 16:48:14 +08:00
parent bdc5cded22
commit 5a0865559c
8 changed files with 462 additions and 174 deletions

View File

@@ -131,6 +131,12 @@ class AbModel {
peers.add(peer);
}
void addPeers(List<Peer> ps) {
for (var p in ps) {
addPeer(p);
}
}
void addTag(String tag) async {
if (tagContainBy(tag)) {
return;
@@ -146,6 +152,14 @@ class AbModel {
it.first.tags = tags;
}
void changeTagForPeers(List<String> ids, List<dynamic> tags) {
peers.map((e) {
if (ids.contains(e.id)) {
e.tags = tags;
}
}).toList();
}
Future<void> pushAb() async {
debugPrint("pushAb");
final api = "${await bind.mainGetApiServer()}/api/ab";
@@ -192,6 +206,10 @@ class AbModel {
peers.removeWhere((element) => element.id == id);
}
void deletePeers(List<String> ids) {
peers.removeWhere((e) => ids.contains(e.id));
}
void deleteTag(String tag) {
gFFI.abModel.selectedTags.remove(tag);
tags.removeWhere((element) => element == tag);