fix(settings): code-managed keys in advanced panel only
Align can_edit lists with deploy SQL: runtime Montzar/price keys stay in tenant advanced settings (read-only), not super admin catalog. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -214,6 +214,7 @@ import {
|
|||||||
formatValueForSave,
|
formatValueForSave,
|
||||||
helpText,
|
helpText,
|
||||||
isSettingVisible,
|
isSettingVisible,
|
||||||
|
isCodeManagedSettingKey,
|
||||||
isSettingLocked,
|
isSettingLocked,
|
||||||
isSettingActive,
|
isSettingActive,
|
||||||
isSwitchOn,
|
isSwitchOn,
|
||||||
@@ -308,6 +309,7 @@ const filteredRows = computed(() =>
|
|||||||
(baseData.value || []).filter((row) => {
|
(baseData.value || []).filter((row) => {
|
||||||
if (row.id == null || !matchesFilter(row)) return false
|
if (row.id == null || !matchesFilter(row)) return false
|
||||||
if (!isSettingVisible(row.key)) return false
|
if (!isSettingVisible(row.key)) return false
|
||||||
|
if (isCodeManagedSettingKey(row.key) && !isSystemMode.value) return false
|
||||||
if (isSystemMode.value) return true
|
if (isSystemMode.value) return true
|
||||||
return isEditable(row)
|
return isEditable(row)
|
||||||
})
|
})
|
||||||
@@ -427,6 +429,7 @@ function rowColSpan(row: Const): number {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isReadonly(row: Const): boolean {
|
function isReadonly(row: Const): boolean {
|
||||||
|
if (isCodeManagedSettingKey(row.key)) return true
|
||||||
if (isSystemMode.value) return false
|
if (isSystemMode.value) return false
|
||||||
return isSettingLocked(row.can_edit)
|
return isSettingLocked(row.can_edit)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,6 +174,31 @@ export function supportMessengerIdPlaceholder(messenger?: string): string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* کلیدهایی که کد tenant مستقیم مینویسد — can_edit=1 در DB (خارج از سوپرادمین)،
|
||||||
|
* فقط در «تنظیمات پیشرفته» دیده میشوند و از UI قابل ویرایش نیستند.
|
||||||
|
* همتراز SuperAdminProgramSettingsOverlay::RUNTIME_KEYS (+ tracking_systems جدا).
|
||||||
|
*/
|
||||||
|
export const SETTING_CODE_MANAGED_KEYS = new Set([
|
||||||
|
'montzar_last_product_log',
|
||||||
|
'montzar_order_response',
|
||||||
|
'montzar_live_price',
|
||||||
|
'montzar_mazaneh',
|
||||||
|
'montzar_diff',
|
||||||
|
'montzar_truly_buy_mazaneh',
|
||||||
|
'montzar_truly_sell_mazaneh',
|
||||||
|
'montzar_token',
|
||||||
|
'montzar_closed',
|
||||||
|
'up_price',
|
||||||
|
'down_price',
|
||||||
|
'price_extreme_date',
|
||||||
|
'do_send_liman',
|
||||||
|
])
|
||||||
|
|
||||||
|
export function isCodeManagedSettingKey(key?: string | null): boolean {
|
||||||
|
return SETTING_CODE_MANAGED_KEYS.has(String(key ?? '').trim())
|
||||||
|
}
|
||||||
|
|
||||||
/** کلیدهای legacy — در پنل نمایش داده نمیشوند */
|
/** کلیدهای legacy — در پنل نمایش داده نمیشوند */
|
||||||
export const HIDDEN_LEGACY_SETTING_KEYS = new Set([
|
export const HIDDEN_LEGACY_SETTING_KEYS = new Set([
|
||||||
'main_product_price',
|
'main_product_price',
|
||||||
@@ -183,9 +208,6 @@ export const HIDDEN_LEGACY_SETTING_KEYS = new Set([
|
|||||||
'goldir_price',
|
'goldir_price',
|
||||||
'price_primary_source',
|
'price_primary_source',
|
||||||
'price_method',
|
'price_method',
|
||||||
'montzar_last_product_log',
|
|
||||||
'montzar_order_response',
|
|
||||||
'service_charge_percentage',
|
|
||||||
'support_messenger',
|
'support_messenger',
|
||||||
'support_messenger_id',
|
'support_messenger_id',
|
||||||
// JSON از صفحهٔ اختصاصی «سایتهای ریگیری» مدیریت میشود؛ سوییچ نمایش در تنظیمات میماند
|
// JSON از صفحهٔ اختصاصی «سایتهای ریگیری» مدیریت میشود؛ سوییچ نمایش در تنظیمات میماند
|
||||||
@@ -1099,17 +1121,14 @@ export const SETTING_LOCKED_KEYS = new Set([
|
|||||||
'logo_login', 'logo_register', 'title_pwa', 'title_fav',
|
'logo_login', 'logo_register', 'title_pwa', 'title_fav',
|
||||||
'main_product', 'main_wallet_products', 'metal_type', 'main_metal',
|
'main_product', 'main_wallet_products', 'metal_type', 'main_metal',
|
||||||
'montify_name',
|
'montify_name',
|
||||||
'montzar_base_url', 'montzar_closed',
|
'montzar_base_url',
|
||||||
'montzar_diff', 'montzar_last_product_log', 'montzar_live_price', 'montzar_mazaneh',
|
|
||||||
'montzar_order_response', 'montzar_token',
|
|
||||||
'montzar_truly_buy_mazaneh', 'montzar_truly_sell_mazaneh',
|
|
||||||
'node_client_id', 'node_shared_secret',
|
'node_client_id', 'node_shared_secret',
|
||||||
'payping_fin_customer_id', 'payping_fin_sync_enabled', 'payping_fin_token', 'payping_fin_url',
|
'payping_fin_customer_id', 'payping_fin_sync_enabled', 'payping_fin_token', 'payping_fin_url',
|
||||||
'payping_gateway_items', 'payping_gateway_name',
|
'payping_gateway_items', 'payping_gateway_name',
|
||||||
'payping_round_toman', 'payping_start_url', 'payping_strict_failed_withdraw', 'payping_verify_url',
|
'payping_round_toman', 'payping_start_url', 'payping_strict_failed_withdraw', 'payping_verify_url',
|
||||||
'permision__enabled',
|
'permision__enabled',
|
||||||
'price_extreme_date', 'price_provider', 'profit_gold_api_enabled',
|
'price_provider', 'profit_gold_api_enabled',
|
||||||
'send_to_tahesab', 'send_to_pargar', 'accounting_provider', 'service_charge_percentage',
|
'send_to_tahesab', 'send_to_pargar', 'accounting_provider',
|
||||||
'sse_path',
|
'sse_path',
|
||||||
'tahesab_bank_account', 'tahesab_db', 'tahesab_host', 'tahesab_port', 'tahesab_token',
|
'tahesab_bank_account', 'tahesab_db', 'tahesab_host', 'tahesab_port', 'tahesab_token',
|
||||||
'zarin_api', 'zarin_token', 'zarin_noe_kar', 'zarin_gorohe_kar', 'zarin_name_g', 'zarin_uid_prefix',
|
'zarin_api', 'zarin_token', 'zarin_noe_kar', 'zarin_gorohe_kar', 'zarin_name_g', 'zarin_uid_prefix',
|
||||||
@@ -1120,7 +1139,6 @@ export const SETTING_LOCKED_KEYS = new Set([
|
|||||||
'price_channel_access',
|
'price_channel_access',
|
||||||
'price_channel_bale_to', 'price_channel_telegram_to', 'price_channel_rubika_to',
|
'price_channel_bale_to', 'price_channel_telegram_to', 'price_channel_rubika_to',
|
||||||
'unit',
|
'unit',
|
||||||
'up_price', 'down_price',
|
|
||||||
'wss_enabled',
|
'wss_enabled',
|
||||||
'zaarbox_api_url',
|
'zaarbox_api_url',
|
||||||
'show_to_users_chat', 'chat_api', 'chat_api_key', 'chat_upload_url', 'chat_download_url'
|
'show_to_users_chat', 'chat_api', 'chat_api_key', 'chat_upload_url', 'chat_download_url'
|
||||||
@@ -1150,6 +1168,9 @@ export const SETTING_EDITABLE_KEYS = new Set([
|
|||||||
'min_first_buy', 'min_withdraw', 'min_deposit', 'minimum_sell',
|
'min_first_buy', 'min_withdraw', 'min_deposit', 'minimum_sell',
|
||||||
'montzar_mobile', 'montzar_open_buy', 'montzar_open_sell',
|
'montzar_mobile', 'montzar_open_buy', 'montzar_open_sell',
|
||||||
'montzar_password', 'montzar_product_id',
|
'montzar_password', 'montzar_product_id',
|
||||||
|
'montzar_closed', 'montzar_diff', 'montzar_last_product_log', 'montzar_live_price', 'montzar_mazaneh',
|
||||||
|
'montzar_order_response', 'montzar_token',
|
||||||
|
'montzar_truly_buy_mazaneh', 'montzar_truly_sell_mazaneh',
|
||||||
'open_register',
|
'open_register',
|
||||||
'referral_id', 'referral_limit', 'referral_gift_on_first_order', 'referral_gift_buy_from_montzar',
|
'referral_id', 'referral_limit', 'referral_gift_on_first_order', 'referral_gift_buy_from_montzar',
|
||||||
'register_jibit_verify', 'register_referral_bonus_message', 'register_referral_sms_to_referrer',
|
'register_jibit_verify', 'register_referral_bonus_message', 'register_referral_sms_to_referrer',
|
||||||
@@ -1158,6 +1179,7 @@ export const SETTING_EDITABLE_KEYS = new Set([
|
|||||||
'products_site_link_enabled', 'products_site_link_url', 'products_site_link_text',
|
'products_site_link_enabled', 'products_site_link_url', 'products_site_link_text',
|
||||||
'startDay',
|
'startDay',
|
||||||
'support_messengers', 'support_messenger_text',
|
'support_messengers', 'support_messenger_text',
|
||||||
|
'up_price', 'down_price', 'price_extreme_date', 'do_send_liman',
|
||||||
'has_chat',
|
'has_chat',
|
||||||
'deposit_support_message_text', 'deposit_account_holder', 'deposit_card_number', 'deposit_account_number', 'deposit_sheba',
|
'deposit_support_message_text', 'deposit_account_holder', 'deposit_card_number', 'deposit_account_number', 'deposit_sheba',
|
||||||
'deposit_method_card_to_card', 'deposit_method_gateway', 'deposit_method_identified', 'deposit_method_shetab',
|
'deposit_method_card_to_card', 'deposit_method_gateway', 'deposit_method_identified', 'deposit_method_shetab',
|
||||||
|
|||||||
Reference in New Issue
Block a user