Merge pull request #5985 from 21pages/tag_filter_method

add option filter ab by intersection
This commit is contained in:
RustDesk 2023-10-11 17:45:53 +08:00 committed by GitHub
commit c0442edb8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 72 additions and 4 deletions

View File

@ -229,6 +229,22 @@ class _AddressBookState extends State<AddressBook> {
);
}
@protected
MenuEntryBase<String> filterMenuItem() {
return MenuEntrySwitch<String>(
switchType: SwitchType.scheckbox,
text: translate('Filter by intersection'),
getter: () async {
return filterAbTagByIntersection();
},
setter: (bool v) async {
bind.mainSetLocalOption(key: filterAbTagOption, value: v ? 'Y' : '');
gFFI.abModel.filterByIntersection.value = v;
},
dismissOnClicked: true,
);
}
void _showMenu(RelativeRect pos) {
final items = [
getEntry(translate("Add ID"), abAddId),
@ -236,6 +252,7 @@ class _AddressBookState extends State<AddressBook> {
getEntry(translate("Unselect all tags"), gFFI.abModel.unsetSelectedTags),
sortMenuItem(),
syncMenuItem(),
filterMenuItem(),
];
mod_menu.showMenu(

View File

@ -450,6 +450,14 @@ class AddressBookPeersView extends BasePeersView {
if (selectedTags.isEmpty) {
return true;
}
if (gFFI.abModel.filterByIntersection.value) {
for (final tag in selectedTags) {
if (!idents.contains(tag)) {
return false;
}
}
return true;
} else {
for (final tag in selectedTags) {
if (idents.contains(tag)) {
return true;
@ -457,6 +465,7 @@ class AddressBookPeersView extends BasePeersView {
}
return false;
}
}
}
class MyGroupPeerView extends BasePeersView {

View File

@ -23,6 +23,11 @@ bool shouldSortTags() {
return bind.mainGetLocalOption(key: sortAbTagsOption).isNotEmpty;
}
final filterAbTagOption = 'filter-ab-by-intersection';
bool filterAbTagByIntersection() {
return bind.mainGetLocalOption(key: filterAbTagOption).isNotEmpty;
}
class AbModel {
final abLoading = false.obs;
final pullError = "".obs;
@ -31,6 +36,7 @@ class AbModel {
final RxMap<String, int> tagColors = Map<String, int>.fromEntries([]).obs;
final peers = List<Peer>.empty(growable: true).obs;
final sortTags = shouldSortTags().obs;
final filterByIntersection = filterAbTagByIntersection().obs;
final retrying = false.obs;
bool get emtpy => peers.isEmpty && tags.isEmpty;

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "启动时检查软件更新"),
("upgrade_rustdesk_server_pro_to_{}_tip", "请升级专业版服务器到{}或更高版本!"),
("pull_group_failed_tip", "获取组信息失败"),
("Filter by intersection", "按交集过滤")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Kontrola aktualizace softwaru při spuštění"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Aktualizujte prosím RustDesk Server Pro na verzi {} nebo novější!"),
("pull_group_failed_tip", "Nepodařilo se obnovit skupinu"),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Beim Start auf Softwareaktualisierung prüfen"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Bitte aktualisieren Sie RustDesk Server Pro auf die Version {} oder neuer!"),
("pull_group_failed_tip", "Aktualisierung der Gruppe fehlgeschlagen"),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Comprobar actualización al iniciar"),
("upgrade_rustdesk_server_pro_to_{}_tip", "¡Por favor, actualiza RustDesk Server Pro a la versión {} o superior"),
("pull_group_failed_tip", "No se ha podido refrescar el grupo"),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Vérifier la disponibilité des mises à jour au démarrage"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Veuillez mettre à jour RustDesk Server Pro avec la version {} ou une version plus récente !"),
("pull_group_failed_tip", "Échec de l'actualisation du groupe"),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Periksa pembaruan aplikasi saat sistem dinyalakan."),
("upgrade_rustdesk_server_pro_to_{}_tip", "Silahkan perbarui RustDesk Server Pro ke versi {} atau yang lebih baru!"),
("pull_group_failed_tip", "Gagal memperbarui grup"),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "All'avvio verifica presenza aggiornamenti programma"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Aggiorna RustDesk Server Pro alla versione {} o successiva!"),
("pull_group_failed_tip", "Impossibile aggiornare il gruppo"),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Startējot pārbaudīt, vai nav programmatūras atjauninājumu"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Lūdzu, jauniniet RustDesk Server Pro uz versiju {} vai jaunāku!"),
("pull_group_failed_tip", "Neizdevās atsvaidzināt grupu"),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Checken voor updates bij opstarten"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Upgrade RustDesk Server Pro naar versie {} of nieuwer!"),
("pull_group_failed_tip", "Vernieuwen van groep mislukt"),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Sprawdź aktualizacje przy starcie programu"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Proszę zaktualizować RustDesk Server Pro do wersji {} lub nowszej!"),
("pull_group_failed_tip", "Błąd odświeżania grup"),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Проверять обновления программы при запуске"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Обновите RustDesk Server Pro до версии {} или новее!"),
("pull_group_failed_tip", "Невозможно обновить группу"),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "ตรวจสอบการอัปเดตโปรแกรมเมื่อเริ่มต้นใช้งาน"),
("upgrade_rustdesk_server_pro_to_{}_tip", "กรุณาอัปเดต Rustdesk Server Pro ไปยังเวอร์ชัน {} หรือใหม่กว่า!"),
("pull_group_failed_tip", "การเรียกใช้งานกลุ่มล้มเหลว"),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}

View File

@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
].iter().cloned().collect();
}