refactor: streamline edit form handling for community and DoH profile selections
CI / changes (push) Successful in 7s
CI / openapi (push) Has been skipped
CI / go (push) Has been skipped
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, , evobgp-web) (push) Successful in 1m8s
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, evobgp-all, evobgp-web-all) (push) Successful in 1m9s
CI / docker-bird (push) Has been skipped
CI / bird2 (push) Has been skipped
CI / docker-go-prime (push) Has been skipped
CI / docker-go (deploy/docker/evobgp-agent/Dockerfile, , evobgp-agent) (push) Has been skipped
CI / docker-go (evobgp-all, 1, deploy/docker/gobinary/Dockerfile, , evobgp-all) (push) Has been skipped
CI / docker-go (evobgp-api, 1, deploy/docker/gobinary/Dockerfile, , evobgp-api) (push) Has been skipped
CI / docker-go (evobgp-deploy, 0, deploy/docker/gobinary/Dockerfile, , evobgp-deploy) (push) Has been skipped
CI / docker-go (evobgp-ingest, 0, deploy/docker/gobinary/Dockerfile, , evobgp-ingest) (push) Has been skipped
CI / docker-go (evobgp-node, 0, deploy/docker/gobinary/Dockerfile, , evobgp-node) (push) Has been skipped
CI / docker-go (evobgp-render, 0, deploy/docker/gobinary/Dockerfile, , evobgp-render) (push) Has been skipped
CI / docker-go (evobgp-scheduler, 0, deploy/docker/gobinary/Dockerfile, , evobgp-scheduler) (push) Has been skipped

Removed unnecessary state variables for community and DoH profile selections in the edit form. Updated the handling of these selections to directly utilize values from the edit form, improving code clarity and reducing redundancy. This change enhances the overall user experience by simplifying the state management in the module edit process.
This commit is contained in:
Denozordec
2026-04-08 20:57:29 +07:00
parent b99fc179ab
commit 1765ab89e7
+4 -12
View File
@@ -146,8 +146,6 @@
// Module edit
let editDialog = $state(false);
let editForm = $state<ModulePatch>({});
let editDefaultCommunitySelect = $state('__none__');
let editDohProfileSelect = $state('__none__');
let editSaving = $state(false);
let deleteModDialog = $state(false);
let deletingMod = $state(false);
@@ -267,8 +265,6 @@
default_community_id: mod.default_community_id,
doh_profile_id: mod.doh_profile_id
};
editDefaultCommunitySelect = nullableSelectValue(mod.default_community_id);
editDohProfileSelect = nullableSelectValue(mod.doh_profile_id);
editDialog = true;
}
@@ -285,8 +281,8 @@
...editForm,
cron_expr: cron ? cron : null,
refresh_interval_sec: Number.isFinite(interval) ? interval : null,
default_community_id: fromNullableSelect(editDefaultCommunitySelect),
doh_profile_id: fromNullableSelect(editDohProfileSelect)
default_community_id: fromNullableSelect(nullableSelectValue(editForm.default_community_id)),
doh_profile_id: fromNullableSelect(nullableSelectValue(editForm.doh_profile_id))
};
await apiMutate<ModuleRow>(`/v1/modules/${moduleId}`, 'PATCH', payload);
await loadMod();
@@ -1314,9 +1310,8 @@
<Label for="e-comm">Community по умолчанию</Label>
<Select
type="single"
value={editDefaultCommunitySelect}
value={nullableSelectValue(editForm.default_community_id)}
onValueChange={(v) => {
editDefaultCommunitySelect = nullableSelectValue(v);
editForm.default_community_id = fromNullableSelect(v);
}}
>
@@ -1336,7 +1331,6 @@
size="sm"
class="h-7 px-2"
onclick={() => {
editDefaultCommunitySelect = NONE_OPTION;
editForm.default_community_id = null;
}}
>
@@ -1347,9 +1341,8 @@
<Label for="e-doh">DoH профиль</Label>
<Select
type="single"
value={editDohProfileSelect}
value={nullableSelectValue(editForm.doh_profile_id)}
onValueChange={(v) => {
editDohProfileSelect = nullableSelectValue(v);
editForm.doh_profile_id = fromNullableSelect(v);
}}
>
@@ -1369,7 +1362,6 @@
size="sm"
class="h-7 px-2"
onclick={() => {
editDohProfileSelect = NONE_OPTION;
editForm.doh_profile_id = null;
}}
>