Add platform config website_url, admin tab, fix writer DB config fallback, add trigger endpoints
This commit is contained in:
@@ -102,8 +102,13 @@
|
||||
</div>
|
||||
<div class="module-content">
|
||||
<div><span>最后运行</span><span>{{ mod.last_run }}</span></div>
|
||||
<div><span>下次运行</span><span>{{ mod.next_run }}</span></div>
|
||||
<div><span>今日任务</span><span>{{ mod.task_count }} 个</span></div>
|
||||
<div v-if="mod.success_rate !== null"><span>成功率</span><span>{{ mod.success_rate }}%</span></div>
|
||||
<div><span>成功率</span><span>{{ mod.success_rate > 0 ? mod.success_rate + '%' : '暂无' }}</span></div>
|
||||
<div style="margin-top:10px; border-bottom:none;">
|
||||
<el-button v-if="mod.id === 'scheduled_optimize_sources'" size="small" type="primary" @click="triggerModule(mod.id)" :loading="runningModule === mod.id">立即运行</el-button>
|
||||
<el-button v-if="mod.id === 'scheduled_metrics_sync'" size="small" type="primary" @click="triggerModule(mod.id)" :loading="runningModule === mod.id">立即运行</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -158,7 +163,8 @@
|
||||
schedulerStatus: '',
|
||||
schedulerRunning: false,
|
||||
upcomingEntries: [],
|
||||
loadingPlan: false
|
||||
loadingPlan: false,
|
||||
runningModule: null
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@@ -276,6 +282,24 @@
|
||||
const url = filter ? '/topics.html?filter=' + encodeURIComponent(filter) : '/topics.html';
|
||||
window.location.href = url;
|
||||
},
|
||||
async triggerModule(modId) {
|
||||
this.runningModule = modId;
|
||||
try {
|
||||
const token = localStorage.getItem('authToken');
|
||||
const endpoint = modId === 'scheduled_optimize_sources' ? '/api/system/optimize-sources/run' : '/api/system/metrics-sync/run';
|
||||
const resp = await fetch(endpoint, { method: 'POST', headers: { 'Authorization': 'Bearer ' + token } });
|
||||
if (resp.ok) {
|
||||
const data = await resp.json();
|
||||
this.$message.success(data.message || '执行成功');
|
||||
this.fetchModules();
|
||||
} else {
|
||||
const err = await resp.json().catch(() => ({}));
|
||||
this.$message.error(err.detail || '执行失败');
|
||||
}
|
||||
} catch (e) {
|
||||
this.$message.error('执行失败: ' + e.message);
|
||||
} finally { this.runningModule = null; }
|
||||
},
|
||||
redirectToPage(page) {
|
||||
window.location.href = page.startsWith('/') ? page : '/' + page;
|
||||
}
|
||||
@@ -312,5 +336,6 @@
|
||||
if (window.installUniNav) { window.installUniNav(app); }
|
||||
app.mount('#app');
|
||||
</script>
|
||||
<script src="ai-assistant.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user