mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
feat: add shared host note to private domain dialog with i18n
This commit is contained in:
@@ -704,4 +704,5 @@ export default {
|
||||
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',
|
||||
776: 'Aktion nicht gefunden',
|
||||
777: 'Diese Domain wird auch gelten für',
|
||||
} satisfies i18n
|
||||
|
||||
@@ -704,4 +704,5 @@ export const ENGLISH: Record<string, number> = {
|
||||
'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,
|
||||
'Action not found': 776,
|
||||
'This domain will also apply to': 777,
|
||||
}
|
||||
|
||||
@@ -704,4 +704,5 @@ export default {
|
||||
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',
|
||||
776: 'Acción no encontrada',
|
||||
777: 'Este dominio también se aplicará a',
|
||||
} satisfies i18n
|
||||
|
||||
@@ -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",
|
||||
775: "Cette adresse ne fonctionnera pas depuis votre réseau local en raison d'une limitation de hairpinning du routeur",
|
||||
776: 'Action introuvable',
|
||||
777: "Ce domaine s'appliquera également à",
|
||||
} satisfies i18n
|
||||
|
||||
@@ -704,4 +704,5 @@ export default {
|
||||
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',
|
||||
776: 'Nie znaleziono akcji',
|
||||
777: 'Ta domena będzie również dotyczyć',
|
||||
} satisfies i18n
|
||||
|
||||
@@ -132,6 +132,7 @@ export class InterfaceAddressesComponent {
|
||||
}),
|
||||
}),
|
||||
),
|
||||
note: await this.getSharedHostNote(),
|
||||
buttons: [
|
||||
{
|
||||
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, {
|
||||
label: 'Add public domain',
|
||||
size: 's',
|
||||
data: {
|
||||
spec: await configBuilderToSpec(addSpec),
|
||||
note,
|
||||
note: await this.getSharedHostNote(),
|
||||
buttons: [
|
||||
{
|
||||
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(
|
||||
fqdn: string,
|
||||
authority?: 'local' | string,
|
||||
|
||||
Reference in New Issue
Block a user