feat: add shared host note to private domain dialog with i18n

This commit is contained in:
Aiden McClelland
2026-03-04 17:40:55 -07:00
parent 4005365239
commit d982ffa722
6 changed files with 29 additions and 21 deletions

View File

@@ -704,4 +704,5 @@ export default {
774: 'Der Portstatus kann nicht ermittelt werden, solange der Dienst nicht läuft', 774: 'Der Portstatus kann nicht ermittelt werden, solange der Dienst nicht läuft',
775: 'Diese Adresse funktioniert nicht aus Ihrem lokalen Netzwerk aufgrund einer Router-Hairpinning-Einschränkung', 775: 'Diese Adresse funktioniert nicht aus Ihrem lokalen Netzwerk aufgrund einer Router-Hairpinning-Einschränkung',
776: 'Aktion nicht gefunden', 776: 'Aktion nicht gefunden',
777: 'Diese Domain wird auch gelten für',
} satisfies i18n } satisfies i18n

View File

@@ -704,4 +704,5 @@ export const ENGLISH: Record<string, number> = {
'Port status cannot be determined while service is not running': 774, 'Port status cannot be determined while service is not running': 774,
'This address will not work from your local network due to a router hairpinning limitation': 775, 'This address will not work from your local network due to a router hairpinning limitation': 775,
'Action not found': 776, 'Action not found': 776,
'This domain will also apply to': 777,
} }

View File

@@ -704,4 +704,5 @@ export default {
774: 'El estado del puerto no se puede determinar mientras el servicio no está en ejecución', 774: 'El estado del puerto no se puede determinar mientras el servicio no está en ejecución',
775: 'Esta dirección no funcionará desde tu red local debido a una limitación de hairpinning del router', 775: 'Esta dirección no funcionará desde tu red local debido a una limitación de hairpinning del router',
776: 'Acción no encontrada', 776: 'Acción no encontrada',
777: 'Este dominio también se aplicará a',
} satisfies i18n } satisfies i18n

View File

@@ -704,4 +704,5 @@ export default {
774: "L'état du port ne peut pas être déterminé tant que le service n'est pas en cours d'exécution", 774: "L'état du port ne peut pas être déterminé tant que le service n'est pas en cours d'exécution",
775: "Cette adresse ne fonctionnera pas depuis votre réseau local en raison d'une limitation de hairpinning du routeur", 775: "Cette adresse ne fonctionnera pas depuis votre réseau local en raison d'une limitation de hairpinning du routeur",
776: 'Action introuvable', 776: 'Action introuvable',
777: "Ce domaine s'appliquera également à",
} satisfies i18n } satisfies i18n

View File

@@ -704,4 +704,5 @@ export default {
774: 'Status portu nie może być określony, gdy usługa nie jest uruchomiona', 774: 'Status portu nie może być określony, gdy usługa nie jest uruchomiona',
775: 'Ten adres nie będzie działać z Twojej sieci lokalnej z powodu ograniczenia hairpinning routera', 775: 'Ten adres nie będzie działać z Twojej sieci lokalnej z powodu ograniczenia hairpinning routera',
776: 'Nie znaleziono akcji', 776: 'Nie znaleziono akcji',
777: 'Ta domena będzie również dotyczyć',
} satisfies i18n } satisfies i18n

View File

@@ -132,6 +132,7 @@ export class InterfaceAddressesComponent {
}), }),
}), }),
), ),
note: await this.getSharedHostNote(),
buttons: [ buttons: [
{ {
text: this.i18n.transform('Save')!, text: this.i18n.transform('Save')!,
@@ -185,32 +186,12 @@ export class InterfaceAddressesComponent {
: {}), : {}),
}) })
let note = ''
const pkgId = this.packageId()
if (pkgId) {
const pkg = await firstValueFrom(
this.patch.watch$('packageData', pkgId),
)
if (pkg) {
const hostId = iface.addressInfo.hostId
const otherNames = Object.values(pkg.serviceInterfaces)
.filter(
si =>
si.addressInfo.hostId === hostId && si.id !== iface.id,
)
.map(si => si.name)
if (otherNames.length) {
note = `This domain also applies to ${otherNames.join(', ')}`
}
}
}
this.formDialog.open(FormComponent, { this.formDialog.open(FormComponent, {
label: 'Add public domain', label: 'Add public domain',
size: 's', size: 's',
data: { data: {
spec: await configBuilderToSpec(addSpec), spec: await configBuilderToSpec(addSpec),
note, note: await this.getSharedHostNote(),
buttons: [ buttons: [
{ {
text: this.i18n.transform('Save')!, text: this.i18n.transform('Save')!,
@@ -254,6 +235,28 @@ export class InterfaceAddressesComponent {
} }
} }
private async getSharedHostNote(): Promise<string> {
const iface = this.value()
const pkgId = this.packageId()
if (!iface || !pkgId) return ''
const pkg = await firstValueFrom(
this.patch.watch$('packageData', pkgId),
)
if (!pkg) return ''
const hostId = iface.addressInfo.hostId
const otherNames = Object.values(pkg.serviceInterfaces)
.filter(
si => si.addressInfo.hostId === hostId && si.id !== iface.id,
)
.map(si => si.name)
if (!otherNames.length) return ''
return `${this.i18n.transform('This domain will also apply to')} ${otherNames.join(', ')}`
}
private async savePublicDomain( private async savePublicDomain(
fqdn: string, fqdn: string,
authority?: 'local' | string, authority?: 'local' | string,