MCPcopy Create free account
hub / github.com/su-kaka/gcli2api / loadConfig

Function loadConfig

front/common.js:2703–2729  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2701// 配置管理
2702// =====================================================================
2703async function loadConfig() {
2704 const loading = document.getElementById('configLoading');
2705 const form = document.getElementById('configForm');
2706
2707 try {
2708 loading.style.display = 'block';
2709 form.classList.add('hidden');
2710
2711 const response = await fetch('./config/get', { headers: getAuthHeaders() });
2712 const data = await response.json();
2713
2714 if (response.ok) {
2715 AppState.currentConfig = data.config;
2716 AppState.envLockedFields = new Set(data.env_locked || []);
2717
2718 populateConfigForm();
2719 form.classList.remove('hidden');
2720 showStatus('配置加载成功', 'success');
2721 } else {
2722 showStatus(`加载配置失败: ${data.detail || data.error || '未知错误'}`, 'error');
2723 }
2724 } catch (error) {
2725 showStatus(`网络错误: ${error.message}`, 'error');
2726 } finally {
2727 loading.style.display = 'none';
2728 }
2729}
2730
2731function populateConfigForm() {
2732 const c = AppState.currentConfig;

Callers 2

triggerTabDataLoadFunction · 0.85
saveConfigFunction · 0.85

Calls 3

getAuthHeadersFunction · 0.85
populateConfigFormFunction · 0.85
showStatusFunction · 0.85

Tested by

no test coverage detected