Merge branch 'KIN-144-frontend_dev'
This commit is contained in:
commit
977176f004
3 changed files with 50 additions and 7 deletions
|
|
@ -2,7 +2,7 @@
|
|||
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { api, type EscalationNotification, type Task } from '../api'
|
||||
import { api, ApiError, type EscalationNotification, type Task } from '../api'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
const router = useRouter()
|
||||
|
|
@ -186,6 +186,28 @@ function cancelRevise() {
|
|||
reviseComment.value = ''
|
||||
}
|
||||
|
||||
const restartingTaskId = ref<string | null>(null)
|
||||
const restartError = ref<string | null>(null)
|
||||
|
||||
async function restartTask(taskId: string) {
|
||||
if (!confirm(t('escalation.restart_confirm', { task_id: taskId }))) return
|
||||
restartingTaskId.value = taskId
|
||||
restartError.value = null
|
||||
try {
|
||||
await api.runTask(taskId)
|
||||
dismiss(taskId)
|
||||
} catch (e: any) {
|
||||
if (e instanceof ApiError && e.code === 'task_already_running') {
|
||||
restartError.value = t('escalation.restart_already_running')
|
||||
} else {
|
||||
restartError.value = e.message
|
||||
}
|
||||
setTimeout(() => { restartError.value = null }, 4000)
|
||||
} finally {
|
||||
restartingTaskId.value = null
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await load()
|
||||
pollTimer = setInterval(load, 10000)
|
||||
|
|
@ -282,14 +304,29 @@ onUnmounted(() => {
|
|||
<p class="text-xs text-gray-300 leading-snug break-words">{{ n.reason }}</p>
|
||||
<p class="text-xs text-gray-600 mt-1">{{ formatTime(n.blocked_at) }}</p>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 shrink-0">
|
||||
<button
|
||||
@click="restartTask(n.task_id)"
|
||||
:disabled="restartingTaskId === n.task_id"
|
||||
class="px-2 py-1 text-xs bg-blue-900/40 text-blue-400 border border-blue-800 rounded hover:bg-blue-900 hover:text-blue-200 disabled:opacity-50 transition-colors"
|
||||
>
|
||||
<span v-if="restartingTaskId === n.task_id" class="inline-block w-2 h-2 border border-blue-400 border-t-transparent rounded-full animate-spin"></span>
|
||||
<span v-else>{{ t('escalation.restart') }}</span>
|
||||
</button>
|
||||
<button
|
||||
@click="dismiss(n.task_id)"
|
||||
class="shrink-0 px-2 py-1 text-xs bg-gray-800 text-gray-400 border border-gray-700 rounded hover:bg-gray-700 hover:text-gray-200"
|
||||
class="px-2 py-1 text-xs bg-gray-800 text-gray-400 border border-gray-700 rounded hover:bg-gray-700 hover:text-gray-200 transition-colors"
|
||||
>{{ t('escalation.dismiss') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Ошибка перезапуска -->
|
||||
<div v-if="restartError" class="px-4 py-2 text-xs text-red-400 border-t border-gray-800 bg-red-950/20">
|
||||
{{ restartError }}
|
||||
</div>
|
||||
|
||||
<!-- Разделитель между секциями -->
|
||||
<div v-if="visible.length > 0 && visibleCompleted.length > 0" class="border-t border-gray-700"></div>
|
||||
|
|
|
|||
|
|
@ -243,7 +243,10 @@
|
|||
"revise_comment_placeholder": "Revision comment...",
|
||||
"revise_send": "Send",
|
||||
"revise_cancel": "Cancel",
|
||||
"revise_default_comment": "Sent for revision"
|
||||
"revise_default_comment": "Sent for revision",
|
||||
"restart": "▶ Restart",
|
||||
"restart_confirm": "Restart pipeline for task {task_id}?",
|
||||
"restart_already_running": "Pipeline is already running"
|
||||
},
|
||||
"liveConsole": {
|
||||
"hide_log": "▲ Скрыть лог",
|
||||
|
|
|
|||
|
|
@ -243,7 +243,10 @@
|
|||
"revise_comment_placeholder": "Комментарий к доработке...",
|
||||
"revise_send": "Отправить",
|
||||
"revise_cancel": "Отмена",
|
||||
"revise_default_comment": "Отправлено на доработку"
|
||||
"revise_default_comment": "Отправлено на доработку",
|
||||
"restart": "▶ Перезапустить",
|
||||
"restart_confirm": "Перезапустить pipeline для задачи {task_id}?",
|
||||
"restart_already_running": "Pipeline уже запущен"
|
||||
},
|
||||
"liveConsole": {
|
||||
"hide_log": "▲ Скрыть лог",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue