Skip to content

Commit

Permalink
opt.: spi with same id (#585)
Browse files Browse the repository at this point in the history
  • Loading branch information
lollipopkit committed Sep 21, 2024
1 parent 50af289 commit d7669c9
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/l10n/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"route": "Routen",
"run": "Ausführen",
"running": "läuft",
"sameIdServerExist": "Ein Server mit derselben ID existiert bereits",
"save": "Speichern",
"saved": "Gerettet",
"second": "s",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"route": "Routing",
"run": "Run",
"running": "Running",
"sameIdServerExist": "A server with the same ID already exists",
"save": "Save",
"saved": "Saved",
"second": "s",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"route": "Enrutamiento",
"run": "Ejecutar",
"running": "En ejecución",
"sameIdServerExist": "Ya existe un servidor con el mismo ID",
"save": "Guardar",
"saved": "Guardado",
"second": "Segundo",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"route": "Routage",
"run": "Exécuter",
"running": "En cours d'exécution",
"sameIdServerExist": "Un serveur avec le même ID existe déjà",
"save": "Enregistrer",
"saved": "Enregistré",
"second": "s",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_id.arb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"route": "Routing",
"run": "Berlari",
"running": "berlari",
"sameIdServerExist": "Server dengan ID yang sama sudah ada",
"save": "Menyimpan",
"saved": "Diselamatkan",
"second": "S",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_ja.arb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"route": "ルーティング",
"run": "実行",
"running": "実行中",
"sameIdServerExist": "同じIDのサーバーが既に存在します",
"save": "保存",
"saved": "保存されました",
"second": "秒",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_nl.arb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"route": "Route",
"run": "Uitvoeren",
"running": "Uitgevoerd",
"sameIdServerExist": "Er bestaat al een server met dezelfde ID",
"save": "Opslaan",
"saved": "Opgeslagen",
"second": "s",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_pt.arb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"route": "Roteamento",
"run": "Executar",
"running": "Executando",
"sameIdServerExist": "Já existe um servidor com o mesmo ID",
"save": "Salvar",
"saved": "Salvo",
"second": "Segundo",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"route": "Маршрутизация",
"run": "запустить",
"running": "работает",
"sameIdServerExist": "Сервер с таким ID уже существует",
"save": "сохранить",
"saved": "сохранено",
"second": "секунда",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_tr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"route": "Yönlendirme",
"run": "Çalıştır",
"running": "Çalışıyor",
"sameIdServerExist": "Aynı kimliğe sahip bir sunucu zaten var",
"save": "Kaydet",
"saved": "Kaydedildi",
"second": "s",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_uk.arb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"route": "Маршрут",
"run": "Запустити",
"running": "Виконання",
"sameIdServerExist": "Сервер з таким ID вже існує",
"save": "Зберегти",
"saved": "Збережено",
"second": "сек.",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"route": "路由",
"run": "运行",
"running": "运行中",
"sameIdServerExist": "已存在相同 id 的服务器",
"save": "保存",
"saved": "已保存",
"second": "秒",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_zh_tw.arb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"route": "路由",
"run": "運行",
"running": "運作中",
"sameIdServerExist": "已存在相同 ID 的伺服器",
"save": "保存",
"saved": "已保存",
"second": "秒",
Expand Down
7 changes: 7 additions & 0 deletions lib/view/page/server/edit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:server_box/data/provider/server.dart';
import 'package:server_box/core/route.dart';
import 'package:server_box/data/model/server/server_private_info.dart';
import 'package:server_box/data/provider/private_key.dart';
import 'package:server_box/data/store/server.dart';

class ServerEditPage extends StatefulWidget {
final Spi? args;
Expand Down Expand Up @@ -609,6 +610,12 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
envs: _env.value.isEmpty ? null : _env.value,
);

final existsIds = ServerStore.instance.box.keys;
if (existsIds.contains(spi.id)) {
context.showSnackBar('${l10n.sameIdServerExist}: ${spi.id}');
return;
}

if (this.spi == null) {
ServerProvider.addServer(spi);
} else {
Expand Down

0 comments on commit d7669c9

Please sign in to comment.