fix(web): convert enum values to string names in API resource paths

Frontend was incorrectly using numeric enum values (e.g., 1, 2, 3) instead
of string names (e.g., "GENERAL", "STORAGE") when constructing API resource
paths. This caused the backend to fail with "unsupported instance setting
key: INSTANCE_SETTING_KEY_UNSPECIFIED" errors during initialization.

Changes:
- Add helper functions in store/common.ts to convert enum values to names
  - getInstanceSettingKeyName() and buildInstanceSettingName()
  - getUserSettingKeyName() and buildUserSettingName()
- Update instance store to use string enum names in API calls
- Update user store to use string enum names in API calls
- Update all components to use new helper functions for setting names

Fixes enum string conversion for:
- InstanceSetting_Key (6 locations)
- UserSetting_Key (2 locations)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Steven
2025-12-11 20:08:11 +08:00
parent edd3ced9bf
commit 8a7e00886d
7 changed files with 41 additions and 15 deletions
@@ -7,7 +7,7 @@ import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
import { instanceStore } from "@/store";
import { instanceSettingNamePrefix } from "@/store/common";
import { buildInstanceSettingName } from "@/store/common";
import {
InstanceSetting_GeneralSetting_CustomProfile,
InstanceSetting_GeneralSetting_CustomProfileSchema,
@@ -78,7 +78,7 @@ function UpdateCustomizedProfileDialog({ open, onOpenChange, onSuccess }: Props)
try {
await instanceStore.upsertInstanceSetting(
create(InstanceSettingSchema, {
name: `${instanceSettingNamePrefix}${InstanceSetting_Key.GENERAL}`,
name: buildInstanceSettingName(InstanceSetting_Key.GENERAL),
value: {
case: "generalSetting",
value: {