Skip to content

Fix subdomain name duplicates #4266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions packages/playground/src/components/manage_gateway_dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
>
<weblet-layout ref="layout" @back="onBack">
<template #title> Manage Domains ({{ vm ? vm.name : k8s?.masters[0].name }}) </template>
<v-tabs v-model="gatewayTab" align-tabs="center" color="secondary" class="mb-6" :disabled="deleting">
<v-tabs
v-model="gatewayTab"
align-tabs="center"
color="secondary"
class="mb-6"
:disabled="deleting"
@update:model-value="onTabChange"
>
<v-tab>Domains List</v-tab>
<v-tab>Add new domain</v-tab>
</v-tabs>
Expand Down Expand Up @@ -294,6 +301,13 @@ export default {
return networks.value.find(net => net.value === selectedIPAddress.value)?.title === NetworkInterfaces.WireGuard;
});
watch(selectedK8SNodeName, getSupportedNetworks, { deep: true });

function onTabChange(newTab: unknown) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the type unknown?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it's what onUpdate:modelValue is assignable to; if you assign it to any type except any or unknown, it will raise an error
image

if (newTab === 1) {
suggestName();
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we please do the same but without using a watcher for efficiency?

const tableHeaders = ref([
{ title: "Name", key: "name" },
{ title: "Contract ID", key: "contractId" },
Expand Down Expand Up @@ -501,7 +515,8 @@ export default {
grid.config.twinId;
prefix.value = oldPrefix.value + props.vm.name;
}
subdomain.value = generateName({ prefix: prefix.value }, 4).toLowerCase();
const randomSuffix = generateName({}, 2);
subdomain.value = `${prefix.value}${randomSuffix}`.toLowerCase();
}

const subdomainRules = [
Expand Down Expand Up @@ -545,6 +560,7 @@ export default {
getSupportedNetworks,
formatDomainName,
onBack,
onTabChange,
getDomainNode,
tableHeaders,
subdomainRules,
Expand Down
Loading