|
5 | 5 | >
|
6 | 6 | <div
|
7 | 7 | data-cy="debug-header"
|
8 |
| - class="flex w-full grid py-24px px-24px gap-y-2 overflow-hidden items-center" |
| 8 | + class="flex w-full grid py-24px px-24px gap-y-2 items-center overflow-hidden" |
9 | 9 | >
|
10 | 10 | <ul
|
11 | 11 | data-cy="header-top"
|
12 |
| - class="flex flex-row gap-x-2 self-stretch items-center whitespace-nowrap" |
| 12 | + class="flex flex-row gap-x-2 items-center self-stretch whitespace-nowrap" |
13 | 13 | >
|
14 | 14 | <li
|
15 | 15 | v-if="debug?.commitInfo?.summary"
|
|
18 | 18 | >
|
19 | 19 | {{ debug.commitInfo.summary }}
|
20 | 20 | </li>
|
21 |
| - <div |
| 21 | + <li |
| 22 | + v-if="props.commitsAhead" |
22 | 23 | class="border rounded flex border-gray-100 h-6 text-sm items-center"
|
23 |
| - data-cy="debug-runCommit-info" |
24 | 24 | >
|
25 |
| - <span |
26 |
| - class="font-medium mx-px px-2 text-gray-700 items-center" |
27 |
| - data-cy="debug-runNumber" |
28 |
| - > |
29 |
| - Run #{{ debug.runNumber }} |
30 |
| - </span> |
31 |
| - <div class="bg-gray-100 h-3 my-6px w-px" /> |
32 | 25 | <span
|
33 | 26 | v-if="props.commitsAhead"
|
34 | 27 | class="font-normal mx-px px-2 text-orange-500 items-center"
|
35 | 28 | data-cy="debug-commitsAhead"
|
36 | 29 | >
|
37 | 30 | {{ t('debugPage.header.commitsAhead', props.commitsAhead) }}
|
38 | 31 | </span>
|
39 |
| - </div> |
| 32 | + </li> |
40 | 33 | <li class="-mt-8px text-lg text-gray-400">
|
41 | 34 | .
|
42 | 35 | </li>
|
|
55 | 48 | class="flex flex-wrap font-normal text-sm text-gray-700 gap-x-2 items-center whitespace-nowrap children:flex children:items-center"
|
56 | 49 | >
|
57 | 50 | <li
|
58 |
| - :data-cy="'debug-results'" |
| 51 | + class="flex flex-row text-sm gap-x-2 items-center justify-center" |
59 | 52 | >
|
| 53 | + <div |
| 54 | + v-if="(debug.runNumber && debug.status)" |
| 55 | + class="border rounded flex flex-row font-semibold bg-gray-50 border-gray-200 h-6 px-2 gap-x-1 items-center justify-center" |
| 56 | + :data-cy="`debug-runNumber-${debug.status}`" |
| 57 | + > |
| 58 | + <SolidStatusIcon |
| 59 | + size="16" |
| 60 | + :status="ICON_MAP[debug.status].type" |
| 61 | + /> |
| 62 | + <span :class="runNumberColor"> |
| 63 | + {{ `#${debug.runNumber}` }} |
| 64 | + </span> |
| 65 | + </div> |
60 | 66 | <DebugResults
|
61 | 67 | :gql="props.gql"
|
| 68 | + data-cy="debug-results" |
62 | 69 | />
|
63 | 70 | </li>
|
64 | 71 | <li
|
|
107 | 114 | import { computed } from 'vue'
|
108 | 115 | import DebugResults from './DebugResults.vue'
|
109 | 116 | import ExternalLink from '@cy/gql-components/ExternalLink.vue'
|
110 |
| -import type { DebugPageFragment } from '../generated/graphql' |
111 |
| -import CommitIcon from '~icons/cy/commit_x14' |
| 117 | +import type { DebugPageFragment, CloudRunStatus } from '../generated/graphql' |
112 | 118 | import { IconTimeStopwatch } from '@cypress-design/vue-icon'
|
| 119 | +import { SolidStatusIcon, StatusType } from '@cypress-design/vue-statusicon' |
| 120 | +import CommitIcon from '~icons/cy/commit_x14' |
113 | 121 | import { gql } from '@urql/core'
|
114 | 122 | import { dayjs } from '../runs/utils/day.js'
|
115 | 123 | import { useI18n } from 'vue-i18n'
|
@@ -144,6 +152,25 @@ const props = defineProps<{
|
144 | 152 |
|
145 | 153 | const debug = computed(() => props.gql)
|
146 | 154 |
|
| 155 | +const ICON_MAP: Record<CloudRunStatus, { textColor: string, type: StatusType }> = { |
| 156 | + PASSED: { textColor: 'text-jade-400', type: 'passed' }, |
| 157 | + FAILED: { textColor: 'text-red-400', type: 'failed' }, |
| 158 | + CANCELLED: { textColor: 'text-gray-500', type: 'cancelled' }, |
| 159 | + ERRORED: { textColor: 'text-orange-400', type: 'errored' }, |
| 160 | + RUNNING: { textColor: 'text-indigo-500', type: 'running' }, |
| 161 | + NOTESTS: { textColor: 'text-indigo-500', type: 'noTests' }, |
| 162 | + OVERLIMIT: { textColor: 'text-indigo-500', type: 'overLimit' }, |
| 163 | + TIMEDOUT: { textColor: 'text-indigo-500', type: 'timedOut' }, |
| 164 | +} as const |
| 165 | +
|
| 166 | +const runNumberColor = computed(() => { |
| 167 | + if (props.gql.status) { |
| 168 | + return ICON_MAP[props.gql.status].textColor |
| 169 | + } |
| 170 | +
|
| 171 | + return '' |
| 172 | +}) |
| 173 | +
|
147 | 174 | const relativeCreatedAt = computed(() => dayjs(new Date(debug.value.createdAt!)).fromNow())
|
148 | 175 |
|
149 | 176 | const totalDuration = useDurationFormat(debug.value.totalDuration ?? 0)
|
|
0 commit comments