docs: complete console application scope acceptance and deployment guidance
This commit is contained in:
@@ -23,10 +23,15 @@
|
||||
}
|
||||
function setView(view, updateHash = true) {
|
||||
const next = pageNames[view] ? view : 'overview';
|
||||
const leavingApplications = state.scopeReady && $('application-scope').hidden && next !== 'applications';
|
||||
document.querySelectorAll('.page-view').forEach(page => page.classList.toggle('active', page.dataset.page === next));
|
||||
document.querySelectorAll('.nav-item').forEach(item => item.classList.toggle('active', item.dataset.view === next));
|
||||
text('page-title', pageNames[next]);
|
||||
$('application-scope').hidden = next === 'applications';
|
||||
if (leavingApplications && state.scope?.can_switch) {
|
||||
scopeUI.nextApplication = '';
|
||||
loadScopeApplications().catch(error => showToast(`应用目录读取失败:${error.message}`));
|
||||
}
|
||||
text('scope-hint', ['workflows', 'retention', 'archives'].includes(next) ? '当前应用环境 · 不受队列筛选影响' : '任务、计划和订阅按所选队列显示');
|
||||
if (updateHash && location.hash !== `#/${next}`) location.hash = `/${next}`;
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
@@ -131,6 +136,11 @@
|
||||
state.scopeReady = true; renderConnectionSummary();
|
||||
} catch (error) {
|
||||
state.queue = ''; state.scopeReady = false;
|
||||
text('scope-summary', '范围不可用');
|
||||
$('scope-application').replaceChildren(new Option('范围不可用', ''));
|
||||
$('scope-queue').replaceChildren(new Option('未加载', ''));
|
||||
$('scope-application').disabled = true; $('scope-queue').disabled = true;
|
||||
$('task-table').innerHTML = '<tr><td colspan="6" class="empty-row"><span class="empty-icon">◇</span><b>当前范围未加载</b><small>请检查应用范围,或点击“重置范围”</small></td></tr>';
|
||||
text('scope-error', `当前应用范围不可用:${error.message}。可点击“重置范围”返回默认应用。`);
|
||||
}
|
||||
}
|
||||
@@ -783,9 +793,9 @@
|
||||
renderSchedules(scheduleItems || []);
|
||||
if (!scheduleItems) $('schedule-list').textContent = '定时计划读取失败,请刷新重试或检查权限';
|
||||
renderWorkflows(workflowItems || []);
|
||||
if (!workflowItems) $('workflow-list').textContent = '流程实例读取失败,请刷新重试或检查权限';
|
||||
if (!workflowItems) { $('workflow-list').textContent = '流程实例读取失败,请刷新重试或检查权限'; text('metric-workflows', '—'); text('metric-workflows-sub', '读取失败'); }
|
||||
renderSubscriptions(subscriptionItems || []);
|
||||
if (!subscriptionItems) $('subscription-list').textContent = '结果订阅读取失败,请刷新重试或检查权限';
|
||||
if (!subscriptionItems) { $('subscription-list').textContent = '结果订阅读取失败,请刷新重试或检查权限'; text('metric-subscriptions', '—'); text('metric-subscriptions-sub', '读取失败'); }
|
||||
setConnection(true); renderRuntimeStats(taskItems, scheduleItems, workflowItems, subscriptionItems); text('last-updated', `刚刚更新 · ${formatTime(new Date())}`); text('metric-health-sub', '数据库与 Schema 正常');
|
||||
} catch (error) { setConnection(false); showToast(`连接失败:${error.message}`); text('last-updated', '刷新失败'); }
|
||||
finally { state.loading = false; $('refresh-button').classList.remove('spinning'); }
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package httpserver
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"git.yuntuo.hk/k2safe/orbit/internal/consoleauth"
|
||||
"git.yuntuo.hk/k2safe/orbit/internal/fault"
|
||||
core "git.yuntuo.hk/k2safe/orbit/model"
|
||||
"git.yuntuo.hk/k2safe/orbit/platform/auth"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type consoleScopeKey struct{}
|
||||
@@ -40,6 +41,9 @@ func consoleScopePath(r *http.Request) bool {
|
||||
}
|
||||
|
||||
func RegisterConsoleScopes(server *http.Server, store consoleauth.Scopes) {
|
||||
if server == nil {
|
||||
return
|
||||
}
|
||||
mux, ok := server.Handler.(*http.ServeMux)
|
||||
if !ok || store == nil {
|
||||
return
|
||||
|
||||
@@ -39,7 +39,8 @@ func TestConsoleScopeOnlyBridgesCookieManagementRequests(t *testing.T) {
|
||||
{"anonymous", "GET", "/v1/tasks", "", "", false, true, 401},
|
||||
{"missing-marker", "GET", "/v1/tasks", "", "", true, false, 403},
|
||||
{"cross-origin", "POST", "/v1/tasks/task:cancel", "https://other.invalid", "", true, true, 403},
|
||||
{"worker", "GET", "/v1/workers/connect", "", "", true, true, 403},
|
||||
{"worker", "GET", "/v1/worker/connect", "", "", true, true, 403},
|
||||
{"consumer", "GET", "/v1/events/connect", "", "", true, true, 403},
|
||||
{"create", "POST", "/v1/tasks", "", "", true, true, 403},
|
||||
{"onboarding", "POST", "/console/applications/prepare", "", "", true, true, 403},
|
||||
} {
|
||||
|
||||
Reference in New Issue
Block a user