feat: Action status display on logs list
This commit is contained in:
parent
7425db53f6
commit
abecf6f8c6
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<span>
|
<div :class = "statusClass + ' annotation'">
|
||||||
<span :class="['action-status', statusClass]">{{ statusText }}</span><span>{{ exitCodeText }}</span>
|
<span>{{ statusText }}</span><span>{{ exitCodeText }}</span>
|
||||||
</span>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -35,11 +35,14 @@ const statusText = computed(() => {
|
||||||
const exitCodeText = computed(() => {
|
const exitCodeText = computed(() => {
|
||||||
const logEntry = props.logEntry
|
const logEntry = props.logEntry
|
||||||
if (!logEntry) return ''
|
if (!logEntry) return ''
|
||||||
|
if (logEntry.exitCode === 0) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
if (logEntry.executionFinished) {
|
if (logEntry.executionFinished) {
|
||||||
if (logEntry.blocked || logEntry.timedOut) {
|
if (logEntry.blocked || logEntry.timedOut) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
return ' Exit code: ' + logEntry.exitCode
|
return ' (Exit code: ' + logEntry.exitCode + ')'
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
})
|
})
|
||||||
|
|
@ -49,15 +52,35 @@ const statusClass = computed(() => {
|
||||||
if (!logEntry) return ''
|
if (!logEntry) return ''
|
||||||
if (logEntry.executionFinished) {
|
if (logEntry.executionFinished) {
|
||||||
if (logEntry.blocked) {
|
if (logEntry.blocked) {
|
||||||
return 'action-blocked'
|
return 'status-blocked'
|
||||||
} else if (logEntry.timedOut) {
|
} else if (logEntry.timedOut) {
|
||||||
return 'action-timeout'
|
return 'status-timeout'
|
||||||
} else if (logEntry.exitCode === 0) {
|
} else if (logEntry.exitCode === 0) {
|
||||||
return 'action-success'
|
return 'status-success'
|
||||||
} else {
|
} else {
|
||||||
return 'action-nonzero-exit'
|
return 'status-nonzero-exit'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.status-success {
|
||||||
|
color: var(--karma-good-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-nonzero-exit {
|
||||||
|
color: var(--karma-bad-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-timeout {
|
||||||
|
color: var(--karma-warning-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-blocked {
|
||||||
|
color: #ca79ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -46,9 +46,7 @@
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="exit-code">
|
<td class="exit-code">
|
||||||
<span :class="getStatusClass(log) + ' annotation'">
|
<ActionStatusDisplay :logEntry="log" />
|
||||||
{{ getStatusText(log) }}
|
|
||||||
</span>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
@ -70,6 +68,7 @@ import { ref, computed, onMounted } from 'vue'
|
||||||
import Pagination from 'picocrank/vue/components/Pagination.vue'
|
import Pagination from 'picocrank/vue/components/Pagination.vue'
|
||||||
import Section from 'picocrank/vue/components/Section.vue'
|
import Section from 'picocrank/vue/components/Section.vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import ActionStatusDisplay from '../components/ActionStatusDisplay.vue'
|
||||||
|
|
||||||
const logs = ref([])
|
const logs = ref([])
|
||||||
const searchText = ref('')
|
const searchText = ref('')
|
||||||
|
|
@ -134,20 +133,6 @@ function formatTimestamp(timestamp) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStatusClass(log) {
|
|
||||||
if (log.timedOut) return 'status-timeout'
|
|
||||||
if (log.blocked) return 'status-blocked'
|
|
||||||
if (log.exitCode !== 0) return 'status-error'
|
|
||||||
return 'status-success'
|
|
||||||
}
|
|
||||||
|
|
||||||
function getStatusText(log) {
|
|
||||||
if (log.timedOut) return t('logs.timed-out')
|
|
||||||
if (log.blocked) return t('logs.blocked')
|
|
||||||
if (log.exitCode !== 0) return `${t('logs.exit-code')} ${log.exitCode}`
|
|
||||||
return t('logs.completed')
|
|
||||||
}
|
|
||||||
|
|
||||||
function handlePageChange(page) {
|
function handlePageChange(page) {
|
||||||
currentPage.value = page
|
currentPage.value = page
|
||||||
fetchLogs()
|
fetchLogs()
|
||||||
|
|
@ -227,22 +212,6 @@ onMounted(() => {
|
||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-success {
|
|
||||||
color: var(--karma-good-fg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-error {
|
|
||||||
color: var(--karma-bad-fg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-timeout {
|
|
||||||
color: var(--karma-warning-fg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-blocked {
|
|
||||||
color: var(--karma-neutral-fg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-state {
|
.empty-state {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue