mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
feat: add shared host note to private domain dialog with i18n
This commit is contained in:
@@ -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