A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix(Interface): Set the correct default values for Interface forms(time_zone)
haitaoo3b9070cf4ffc
diff --git a/ui/src/common/constants.ts b/ui/src/common/constants.tsindex 9867afbe..c02fb479 100644--- a/ui/src/common/constants.ts+++ b/ui/src/common/constants.ts@@ -87,8 +87,6 @@ export const ADMIN_NAV_MENUS = [},];-export const ADMIN_LEGAL_MENUS = [{ name: 'tos' }, { name: 'privacy' }];-export const TIMEZONES = [{label: 'Africa',@@ -575,7 +573,7 @@ export const TIMEZONES = [{label: 'UTC',- options: [{ value: 'UTC', label: 'UTC' }],+ options: [{ value: 'UTC+0', label: 'UTC' }],},];export const DEFAULT_TIMEZONE = 'UTC+0';diff --git a/ui/src/pages/Admin/Interface/index.tsx b/ui/src/pages/Admin/Interface/index.tsxindex aad84117..36f173ca 100644--- a/ui/src/pages/Admin/Interface/index.tsx+++ b/ui/src/pages/Admin/Interface/index.tsx@@ -112,7 +112,12 @@ const Interface: FC = () => {if (setting) {const formMeta = {};Object.keys(setting).forEach((k) => {- formMeta[k] = { ...formData[k], value: setting[k] };+ // In this form, all form items are `Select` and must have a default value+ let fieldVal = setting[k];+ if (!fieldVal && formData[k] && formData[k].value) {+ fieldVal = formData[k].value;+ }+ formMeta[k] = { ...formData[k], value: fieldVal };});setFormData({ ...formData, ...formMeta });}