fix: show env status warning in survey tab + add alert on survey failure
- Add isEnvAlive check on mount via /api/simulation/env-status - Show warning banner when simulation env is not running - Add alert() on survey failure for visibility - Add envNotRunning translation key for th/en/zh
This commit is contained in:
@@ -315,6 +315,10 @@
|
|||||||
<div v-if="activeTab === 'survey'" class="survey-container">
|
<div v-if="activeTab === 'survey'" class="survey-container">
|
||||||
<!-- Survey Setup -->
|
<!-- Survey Setup -->
|
||||||
<div class="survey-setup">
|
<div class="survey-setup">
|
||||||
|
<!-- Env status warning -->
|
||||||
|
<div v-if="!isEnvAlive" class="survey-env-warning">
|
||||||
|
⚠️ {{ $t('step5.envNotRunning') || 'Simulation environment is not running. Survey requires an active simulation environment.' }}
|
||||||
|
</div>
|
||||||
<div class="setup-section">
|
<div class="setup-section">
|
||||||
<div class="section-header">
|
<div class="section-header">
|
||||||
<span class="section-title">{{ $t('step5.selectSurveyTarget') }}</span>
|
<span class="section-title">{{ $t('step5.selectSurveyTarget') }}</span>
|
||||||
@@ -414,7 +418,7 @@
|
|||||||
import { ref, computed, watch, onMounted, onUnmounted, nextTick } from 'vue'
|
import { ref, computed, watch, onMounted, onUnmounted, nextTick } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { chatWithReport, getReport, getAgentLog } from '../api/report'
|
import { chatWithReport, getReport, getAgentLog } from '../api/report'
|
||||||
import { interviewAgents, getSimulationProfilesRealtime } from '../api/simulation'
|
import { interviewAgents, getSimulationProfilesRealtime, getEnvStatus } from '../api/simulation'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
@@ -445,9 +449,9 @@ const chatInputRef = ref(null)
|
|||||||
// Survey State
|
// Survey State
|
||||||
const selectedAgents = ref(new Set())
|
const selectedAgents = ref(new Set())
|
||||||
const surveyQuestion = ref('')
|
const surveyQuestion = ref('')
|
||||||
|
const isEnvAlive = ref(false)
|
||||||
const surveyResults = ref([])
|
const surveyResults = ref([])
|
||||||
const isSurveying = ref(false)
|
const isSurveying = ref(false)
|
||||||
|
|
||||||
// Report Data
|
// Report Data
|
||||||
const reportOutline = ref(null)
|
const reportOutline = ref(null)
|
||||||
const generatedSections = ref({})
|
const generatedSections = ref({})
|
||||||
@@ -782,6 +786,16 @@ const scrollToBottom = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Survey Methods
|
// Survey Methods
|
||||||
|
const checkEnvStatus = async () => {
|
||||||
|
if (!props.simulationId) return
|
||||||
|
try {
|
||||||
|
const res = await getEnvStatus({ simulation_id: props.simulationId })
|
||||||
|
isEnvAlive.value = res.success && res.data?.running === true
|
||||||
|
} catch {
|
||||||
|
isEnvAlive.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const toggleAgentSelection = (idx) => {
|
const toggleAgentSelection = (idx) => {
|
||||||
const newSet = new Set(selectedAgents.value)
|
const newSet = new Set(selectedAgents.value)
|
||||||
if (newSet.has(idx)) {
|
if (newSet.has(idx)) {
|
||||||
@@ -945,6 +959,7 @@ onMounted(() => {
|
|||||||
addLog(t('log.step5Init'))
|
addLog(t('log.step5Init'))
|
||||||
loadReportData()
|
loadReportData()
|
||||||
loadProfiles()
|
loadProfiles()
|
||||||
|
checkEnvStatus()
|
||||||
document.addEventListener('click', handleClickOutside)
|
document.addEventListener('click', handleClickOutside)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -2155,6 +2170,18 @@ watch(() => props.simulationId, (newId) => {
|
|||||||
|
|
||||||
/* Survey Container */
|
/* Survey Container */
|
||||||
.survey-container {
|
.survey-container {
|
||||||
|
/* env warning */
|
||||||
|
}
|
||||||
|
|
||||||
|
.survey-env-warning {
|
||||||
|
background: #FFF3CD;
|
||||||
|
color: #856404;
|
||||||
|
border: 1px solid #FFEAA7;
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -75,7 +75,13 @@
|
|||||||
"layoutGraph": "Graph",
|
"layoutGraph": "Graph",
|
||||||
"layoutSplit": "Split",
|
"layoutSplit": "Split",
|
||||||
"layoutWorkbench": "Workbench",
|
"layoutWorkbench": "Workbench",
|
||||||
"stepNames": ["Graph Build", "Env Setup", "Run Simulation", "Report Generation", "Deep Interaction"]
|
"stepNames": [
|
||||||
|
"Graph Build",
|
||||||
|
"Env Setup",
|
||||||
|
"Run Simulation",
|
||||||
|
"Report Generation",
|
||||||
|
"Deep Interaction"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"step1": {
|
"step1": {
|
||||||
"ontologyGeneration": "Ontology Generation",
|
"ontologyGeneration": "Ontology Generation",
|
||||||
@@ -282,7 +288,8 @@
|
|||||||
"errorOccurred": "Sorry, an error occurred: {error}",
|
"errorOccurred": "Sorry, an error occurred: {error}",
|
||||||
"noResponse": "No response",
|
"noResponse": "No response",
|
||||||
"requestFailed": "Request failed",
|
"requestFailed": "Request failed",
|
||||||
"selectAgentFirst": "Please select a simulated individual first"
|
"selectAgentFirst": "Please select a simulated individual first",
|
||||||
|
"envNotRunning": "Simulation environment is not running. Survey requires an active simulation environment."
|
||||||
},
|
},
|
||||||
"graph": {
|
"graph": {
|
||||||
"panelTitle": "Graph Relationship Visualization",
|
"panelTitle": "Graph Relationship Visualization",
|
||||||
|
|||||||
@@ -75,7 +75,13 @@
|
|||||||
"layoutGraph": "กราฟ",
|
"layoutGraph": "กราฟ",
|
||||||
"layoutSplit": "แบ่งหน้าจอ",
|
"layoutSplit": "แบ่งหน้าจอ",
|
||||||
"layoutWorkbench": "พื้นที่ทำงาน",
|
"layoutWorkbench": "พื้นที่ทำงาน",
|
||||||
"stepNames": ["สร้างกราฟ", "ตั้งค่าสภาพแวดล้อม", "จำลอง", "สร้างรายงาน", "โต้ตอบเชิงลึก"]
|
"stepNames": [
|
||||||
|
"สร้างกราฟ",
|
||||||
|
"ตั้งค่าสภาพแวดล้อม",
|
||||||
|
"จำลอง",
|
||||||
|
"สร้างรายงาน",
|
||||||
|
"โต้ตอบเชิงลึก"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"step1": {
|
"step1": {
|
||||||
"ontologyGeneration": "การสร้างออนโทโลยี",
|
"ontologyGeneration": "การสร้างออนโทโลยี",
|
||||||
@@ -282,7 +288,8 @@
|
|||||||
"errorOccurred": "ขออภัย เกิดข้อผิดพลาด: {error}",
|
"errorOccurred": "ขออภัย เกิดข้อผิดพลาด: {error}",
|
||||||
"noResponse": "ไม่มีคำตอบ",
|
"noResponse": "ไม่มีคำตอบ",
|
||||||
"requestFailed": "คำขอล้มเหลว",
|
"requestFailed": "คำขอล้มเหลว",
|
||||||
"selectAgentFirst": "กรุณาเลือกบุคคลที่จำลองก่อน"
|
"selectAgentFirst": "กรุณาเลือกบุคคลที่จำลองก่อน",
|
||||||
|
"envNotRunning": "สภาพแวดล้อมจำลองไม่ได้ทำงานอยู่ แบบสำรวจต้องการสภาพแวดล้อมจำลองที่ยังทำงานอยู่"
|
||||||
},
|
},
|
||||||
"graph": {
|
"graph": {
|
||||||
"panelTitle": "การแสดงผลความสัมพันธ์กราฟ",
|
"panelTitle": "การแสดงผลความสัมพันธ์กราฟ",
|
||||||
|
|||||||
@@ -75,7 +75,13 @@
|
|||||||
"layoutGraph": "图谱",
|
"layoutGraph": "图谱",
|
||||||
"layoutSplit": "双栏",
|
"layoutSplit": "双栏",
|
||||||
"layoutWorkbench": "工作台",
|
"layoutWorkbench": "工作台",
|
||||||
"stepNames": ["图谱构建", "环境搭建", "开始模拟", "报告生成", "深度互动"]
|
"stepNames": [
|
||||||
|
"图谱构建",
|
||||||
|
"环境搭建",
|
||||||
|
"开始模拟",
|
||||||
|
"报告生成",
|
||||||
|
"深度互动"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"step1": {
|
"step1": {
|
||||||
"ontologyGeneration": "本体生成",
|
"ontologyGeneration": "本体生成",
|
||||||
@@ -282,7 +288,8 @@
|
|||||||
"errorOccurred": "抱歉,发生了错误: {error}",
|
"errorOccurred": "抱歉,发生了错误: {error}",
|
||||||
"noResponse": "无响应",
|
"noResponse": "无响应",
|
||||||
"requestFailed": "请求失败",
|
"requestFailed": "请求失败",
|
||||||
"selectAgentFirst": "请先选择一个模拟个体"
|
"selectAgentFirst": "请先选择一个模拟个体",
|
||||||
|
"envNotRunning": "模拟环境未运行。问卷调查需要模拟环境处于运行状态。"
|
||||||
},
|
},
|
||||||
"graph": {
|
"graph": {
|
||||||
"panelTitle": "Graph Relationship Visualization",
|
"panelTitle": "Graph Relationship Visualization",
|
||||||
|
|||||||
Reference in New Issue
Block a user