feat(service): replace show-in-service with hide-for-guest toggle

Mirror the server HideForGuest flag on services: rename the
enable_show_in_service field to hide_for_guest across the form, schema
and generated types, reuse the existing HideForGuest label, and drop the
now-orphaned ShowInService i18n keys. Services are now visible to guests
by default and hidden only when the box is checked, matching servers.
This commit is contained in:
Nezha Dev
2026-06-02 03:07:36 +00:00
parent 4c0de60843
commit 90135b0819
13 changed files with 6 additions and 16 deletions
+3 -3
View File
@@ -56,8 +56,8 @@ const serviceFormSchema = z.object({
cover: z.coerce.number().int().min(0),
display_index: z.coerce.number().int(),
duration: z.coerce.number().int().min(30),
enable_show_in_service: asOptionalField(z.boolean()),
enable_trigger_task: asOptionalField(z.boolean()),
hide_for_guest: asOptionalField(z.boolean()),
fail_trigger_tasks: z.array(z.number()),
fail_trigger_tasks_raw: z.string(),
latency_notify: asOptionalField(z.boolean()),
@@ -235,7 +235,7 @@ export const ServiceCard: React.FC<ServiceCardProps> = ({ data, mutate }) => {
/>
<FormField
control={form.control}
name="enable_show_in_service"
name="hide_for_guest"
render={({ field }) => (
<FormItem className="flex items-center space-x-2">
<FormControl>
@@ -245,7 +245,7 @@ export const ServiceCard: React.FC<ServiceCardProps> = ({ data, mutate }) => {
onCheckedChange={field.onChange}
/>
<Label className="text-sm">
{t("ShowInService")}
{t("HideForGuest")}
</Label>
</div>
</FormControl>
-1
View File
@@ -163,7 +163,6 @@
"Login": "Anmelden",
"NewPassword": "Neues Passwort",
"FileManager": "Pseudo File Manager",
"ShowInService": "Zeige in Service",
"CommunityThemeDescription": "Dieses Design wird von der Community bereitgestellt, Benutzung auf eigene Gefahr",
"Language": "Sprache",
"FullIPNotification": "Vollständige IP-Adresse in Benachrichtigung anzeigen",
-1
View File
@@ -83,7 +83,6 @@
"Confirm": "Confirm",
"ConfirmDeletion": "Confirm Deletion?",
"Services": "Services",
"ShowInService": "Show in Service",
"Coverages": {
"Excludes": "Excludes Specific Servers",
"Only": "Only Specific Servers",
-1
View File
@@ -51,7 +51,6 @@
"Coverage": "Cobertura",
"LocalService": "Servicio local",
"InstallCommands": "Comando de instalación",
"ShowInService": "Mostrar en servicio",
"Coverages": {
"Alarmed": "Ejecutado en el servidor que activó la alarma",
"Excludes": "Excluir servidores específicos",
-1
View File
@@ -64,7 +64,6 @@
"Confirm": "Confirmer",
"ConfirmDeletion": "Confirmer la suppression?",
"Services": "Services",
"ShowInService": "Montrer en service",
"MaximumLatency": "Délai maximum (ms)",
"MinimumLatency": "Délai minimum (millisecondes)",
"Command": "Commande",
-1
View File
@@ -83,7 +83,6 @@
"Confirm": "Konfirmasi",
"ConfirmDeletion": "Konfirmasi Penghapusan?",
"Services": "Layanan",
"ShowInService": "Tampilkan di Layanan",
"Coverages": {
"Excludes": "Kecualikan Server Tertentu",
"Only": "Hanya Server Tertentu",
-1
View File
@@ -73,7 +73,6 @@
"Confirm": "Confermo",
"ConfirmDeletion": "Confermi l'eliminazione?",
"Services": "Servizi",
"ShowInService": "Mostra in servizio",
"Coverages": {
"Only": "Solo server specifici",
"Excludes": "Escludi server specifici",
-1
View File
@@ -178,7 +178,6 @@
"Language": "Язык",
"ConfirmDeletion": "Подтвердить удаление?",
"OriginalPassword": "Старый пароль",
"ShowInService": "Показывать в Сервисе",
"EnableFailureNotification": "Включить уведомления об ошибках",
"CreateNAT": "Создать NAT-конфигурацию",
"Scheduled": "Запланированные задачи",
-1
View File
@@ -25,7 +25,6 @@
},
"ConfirmDeletion": "நீக்குதலை உறுதிப்படுத்தவா?",
"Services": "சேவைகள்",
"ShowInService": "சேவையில் காட்டு",
"Coverages": {
"Excludes": "குறிப்பிட்ட சேவையகங்களை விலக்குகிறது",
"Only": "குறிப்பிட்ட சேவையகங்கள் மட்டுமே",
-1
View File
@@ -83,7 +83,6 @@
"Confirm": "Підтвердити",
"ConfirmDeletion": "Підтвердити видалення?",
"Services": "Сервіси",
"ShowInService": "Показувати у Сервісі",
"Coverages": {
"Excludes": "Виключити певні сервери",
"Only": "Тільки певні сервери",
-1
View File
@@ -83,7 +83,6 @@
"Confirm": "确认",
"ConfirmDeletion": "确认删除?",
"Services": "服务",
"ShowInService": "服务中显示",
"Coverages": {
"Excludes": "排除特定服务器",
"Only": "仅特定服务器",
-1
View File
@@ -75,7 +75,6 @@
"Confirm": "確認",
"ConfirmDeletion": "確認刪除?",
"Services": "服務",
"ShowInService": "服務中顯示",
"Coverages": {
"Only": "僅特定伺服器",
"Excludes": "排除特定伺服器",
+3 -2
View File
@@ -631,10 +631,11 @@ export interface ModelService {
/** 展示排序,越大越靠前 */
display_index: number
duration: number
enable_show_in_service: boolean
enable_trigger_task: boolean
/** 失败时执行的触发任务id */
fail_trigger_tasks: number[]
/** 对游客隐藏 */
hide_for_guest: boolean
id: number
latency_notify: boolean
max_latency: number
@@ -656,9 +657,9 @@ export interface ModelServiceForm {
/** 展示排序,越大越靠前 */
display_index: number
duration: number
enable_show_in_service?: boolean
enable_trigger_task?: boolean
fail_trigger_tasks: number[]
hide_for_guest?: boolean
latency_notify?: boolean
/** @default 0 */
max_latency: number