web: Replace null defaults with undefined for optional props
Aligns optional prop types and defaults with TypeScript/Svelte 5 idioms by dropping explicit null in favor of undefined throughout components.
This commit is contained in:
parent
bd8cff84c3
commit
a6df277366
9 changed files with 24 additions and 24 deletions
|
|
@ -78,8 +78,8 @@
|
|||
body: {
|
||||
domain: domainName,
|
||||
group: group || undefined,
|
||||
id_owner: id_owner || undefined,
|
||||
id_provider: id_provider || undefined,
|
||||
id_owner: id_owner,
|
||||
id_provider: id_provider,
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@
|
|||
body: {
|
||||
domain: domain,
|
||||
group: group || undefined,
|
||||
id_owner: id_owner || undefined,
|
||||
id_provider: id_provider || undefined,
|
||||
id_owner: id_owner,
|
||||
id_provider: id_provider,
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@
|
|||
addingNewDomain?: boolean;
|
||||
autofocus?: boolean;
|
||||
noButton?: boolean;
|
||||
preAddFunc?: null | ((arg0: string) => Promise<boolean>);
|
||||
provider?: Provider | null;
|
||||
preAddFunc?: (arg0: string) => Promise<boolean>;
|
||||
provider?: Provider;
|
||||
value?: string;
|
||||
[key: string]: any
|
||||
}
|
||||
|
|
@ -57,8 +57,8 @@
|
|||
addingNewDomain = $bindable(false),
|
||||
autofocus = false,
|
||||
noButton = false,
|
||||
preAddFunc = null,
|
||||
provider = null,
|
||||
preAddFunc,
|
||||
provider,
|
||||
value = $bindable(""),
|
||||
...rest
|
||||
}: Props = $props();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
interface Props {
|
||||
toggle: () => void;
|
||||
step: number;
|
||||
service?: ServiceCombined | null;
|
||||
service?: ServiceCombined;
|
||||
form?: string;
|
||||
origin?: Domain | undefined;
|
||||
update?: boolean;
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
let {
|
||||
toggle,
|
||||
step,
|
||||
service = $bindable(null),
|
||||
service = $bindable(),
|
||||
form = "addSvcForm",
|
||||
origin = undefined,
|
||||
update = false,
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@
|
|||
edit?: boolean;
|
||||
ptype: string;
|
||||
state: number;
|
||||
providerId?: string | null;
|
||||
value?: ProviderSettingsState | null;
|
||||
providerId?: string;
|
||||
value?: ProviderSettingsState;
|
||||
}
|
||||
|
||||
let {
|
||||
|
|
@ -52,12 +52,12 @@
|
|||
edit = false,
|
||||
ptype,
|
||||
state: formstate,
|
||||
providerId = null,
|
||||
value = $bindable(null)
|
||||
providerId,
|
||||
value = $bindable()
|
||||
}: Props = $props();
|
||||
|
||||
//
|
||||
function createProviderForm(ptype: string, providerId: string | null, value: ProviderSettingsState | null, edit: boolean): ProviderForm {
|
||||
function createProviderForm(ptype: string, providerId: string | undefined, value: ProviderSettingsState | undefined, edit: boolean): ProviderForm {
|
||||
const pf = new ProviderForm(
|
||||
ptype,
|
||||
() => refreshProviders().then(() => navigate("/?newProvider")),
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
interface Props {
|
||||
canDoNext?: boolean;
|
||||
edit?: boolean;
|
||||
form?: CustomForm | null;
|
||||
form?: CustomForm;
|
||||
nextInProgress?: boolean;
|
||||
previousInProgress?: boolean;
|
||||
submitForm?: string;
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
let {
|
||||
canDoNext = true,
|
||||
edit = false,
|
||||
form = null,
|
||||
form,
|
||||
nextInProgress = false,
|
||||
previousInProgress = false,
|
||||
submitForm,
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
interface Props {
|
||||
class?: ClassValue;
|
||||
service: HappydnsService | null;
|
||||
service?: HappydnsService;
|
||||
}
|
||||
|
||||
let { service, class: className = "" }: Props = $props();
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
import { controls as ctrlServiceDetails } from "../ServiceDetailsOffcanvas.svelte";
|
||||
import { controls as ctrlServicePath } from "$lib/components/services/NewServicePath.svelte";
|
||||
import type { Domain } from "$lib/model/domain";
|
||||
import type { ServiceCombined } from "$lib/model/service.svelte";
|
||||
import type { HappydnsService } from "$lib/api-base/types.gen";
|
||||
import { servicesSpecs, servicesSpecsLoaded } from "$lib/stores/services";
|
||||
import { t } from "$lib/translations";
|
||||
import PropagationCountdown from "$lib/components/services/PropagationCountdown.svelte";
|
||||
|
|
@ -45,11 +45,11 @@
|
|||
interface Props {
|
||||
dn: string;
|
||||
origin: Domain;
|
||||
service?: ServiceCombined | null;
|
||||
service?: HappydnsService;
|
||||
zoneId: string;
|
||||
}
|
||||
|
||||
let { dn, origin, service = $bindable(null), zoneId }: Props = $props();
|
||||
let { dn, origin, service, zoneId }: Props = $props();
|
||||
|
||||
// Will be changed by PropagationCountdown
|
||||
let isPropagating = $state(true);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
let svcType: string = $derived(page.url.searchParams.get("type") ?? "");
|
||||
|
||||
let service: HappydnsService | null = $state(null);
|
||||
let service: HappydnsService | undefined = $state();
|
||||
let serviceLoading = $state(false);
|
||||
|
||||
let serviceTitle = $derived.by(() => {
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
$effect(() => {
|
||||
if (data.serviceid !== "new") {
|
||||
const svcs = $thisZone?.services[data.subdomain];
|
||||
service = svcs?.find((s) => s._id === data.serviceid) ?? null;
|
||||
service = svcs?.find((s) => s._id === data.serviceid);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -128,7 +128,7 @@
|
|||
);
|
||||
}
|
||||
|
||||
function helpLink(svc: HappydnsService | null): string {
|
||||
function helpLink(svc: HappydnsService | undefined): string {
|
||||
if (!svc?._svctype) return "";
|
||||
const svcPart = svc._svctype.toLowerCase().split(".");
|
||||
let path = svcPart[svcPart.length - 1] + "/";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue