diff --git a/web/projects/ui/src/app/routes/portal/routes/system/routes/domains/dns.component.ts b/web/projects/ui/src/app/routes/portal/routes/system/routes/domains/dns.component.ts
index 12bde76db..cd06be58f 100644
--- a/web/projects/ui/src/app/routes/portal/routes/system/routes/domains/dns.component.ts
+++ b/web/projects/ui/src/app/routes/portal/routes/system/routes/domains/dns.component.ts
@@ -1,22 +1,29 @@
+import { NgTemplateOutlet } from '@angular/common'
import {
ChangeDetectionStrategy,
Component,
computed,
inject,
+ signal,
} from '@angular/core'
+import { FormsModule } from '@angular/forms'
import {
DialogService,
ErrorService,
i18nKey,
i18nPipe,
- LoadingService,
} from '@start9labs/shared'
-import { TuiButton, TuiDialogContext } from '@taiga-ui/core'
-import { ApiService } from 'src/app/services/api/embassy-api.service'
-import { MappedDomain } from './domain.service'
+import { TuiButton, TuiDialogContext, TuiIcon } from '@taiga-ui/core'
+import {
+ TuiButtonLoading,
+ TuiSwitch,
+ tuiSwitchOptionsProvider,
+} from '@taiga-ui/kit'
import { injectContext, PolymorpheusComponent } from '@taiga-ui/polymorpheus'
import { TableComponent } from 'src/app/routes/portal/components/table.component'
+import { ApiService } from 'src/app/services/api/embassy-api.service'
import { parse } from 'tldts'
+import { MappedDomain } from './domain.service'
// @TODO translations
@@ -25,72 +32,152 @@ import { parse } from 'tldts'
template: `
@let wanIp = context.data.gateway.ipInfo?.wanIp || ('Error' | i18n);
-
-
- | A |
- {{ subdomain() || '@' }} |
- {{ wanIp }} |
- |
-
-
- | A |
- {{ subdomain() ? '*.' + subdomain() : '*' }} |
- {{ wanIp }} |
- |
-
+ @if (context.data.gateway.ipInfo?.deviceType !== 'wireguard') {
+
+ }
-
+
+ @if (mode) {
+
+ |
+ @if (root() !== undefined; as $implicit) {
+
+ }
+ ALIAS
+ |
+ {{ subdomain() || '@' }} |
+ [DDNS Address] |
+ |
+
+
+ |
+ @if (wildcard() !== undefined; as $implicit) {
+
+ }
+ ALIAS
+ |
+ {{ subdomain() ? '*.' + subdomain() : '*' }} |
+ [DDNS Address] |
+ |
+
+ } @else {
+
+ |
+ @if (root() !== undefined; as $implicit) {
+
+ }
+ A
+ |
+ {{ subdomain() || '@' }} |
+ {{ wanIp }} |
+ |
+
+
+ |
+ @if (wildcard() !== undefined; as $implicit) {
+
+ }
+ A
+ |
+ {{ subdomain() ? '*.' + subdomain() : '*' }} |
+ {{ wanIp }} |
+ |
+
+ }
+
+ @if (result) {
+
+ } @else {
+
+ }
+
+
`,
styles: `
- section {
- margin: 1.5rem 0;
+ label {
+ display: flex;
+ gap: 0.75rem;
+ align-items: center;
+ margin: 1rem 0;
+ }
+
+ tui-icon {
+ font-size: 1rem;
+ vertical-align: text-bottom;
}
`,
+ providers: [
+ tuiSwitchOptionsProvider({
+ appearance: () => 'primary',
+ icon: () => '',
+ }),
+ ],
changeDetection: ChangeDetectionStrategy.OnPush,
- imports: [TuiButton, i18nPipe, TableComponent],
+ imports: [
+ TuiButton,
+ i18nPipe,
+ TableComponent,
+ TuiSwitch,
+ FormsModule,
+ TuiButtonLoading,
+ NgTemplateOutlet,
+ TuiIcon,
+ ],
})
export class DnsComponent {
- private readonly loader = inject(LoadingService)
private readonly errorService = inject(ErrorService)
private readonly api = inject(ApiService)
private readonly dialog = inject(DialogService)
+ mode = false
+
readonly context = injectContext>()
readonly subdomain = computed(() => parse(this.context.data.fqdn).subdomain)
+ readonly loading = signal(false)
+ readonly root = signal(undefined)
+ readonly wildcard = signal(undefined)
async testDns() {
- const loader = this.loader.open().subscribe()
+ this.loading.set(true)
try {
- await this.api.testDomain({
- fqdn: this.context.data.fqdn,
- gateway: this.context.data.gateway.id,
- })
- return true
+ await this.api
+ .testDomain({
+ fqdn: this.context.data.fqdn,
+ gateway: this.context.data.gateway.id,
+ })
+ .then(({ root, wildcard }) => {
+ this.root.set(root)
+ this.wildcard.set(wildcard)
+ })
} catch (e: any) {
this.errorService.handleError(e)
- return false
} finally {
- loader.unsubscribe()
+ this.loading.set(false)
}
}
@@ -100,9 +187,7 @@ export class DnsComponent {
: `This DNS record routes subdomains of ${this.context.data.fqdn} to your server.`
this.dialog
- .openAlert(message as i18nKey, {
- label: 'Purpose' as i18nKey,
- })
+ .openAlert(message as i18nKey, { label: 'Purpose' as i18nKey })
.subscribe()
}
}