-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
Copy pathDebugContainer.vue
100 lines (90 loc) · 2.34 KB
/
DebugContainer.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<template>
<div>
<div
v-if="loginConnectStore.user.isLoggedIn && loginConnectStore.project.isProjectConnected && run"
>
<DebugPageHeader
:gql="run"
:commits-ahead="0"
/>
<DebugSpecList
:specs="debugSpecsArray"
/>
</div>
<div
v-else
data-cy="debug-empty"
>
<div
v-if="!loginConnectStore.user.isLoggedIn"
>
{{ t('debugPage.notLoggedIn') }}
</div>
<div
v-else-if="!loginConnectStore.project.isProjectConnected"
>
{{ t('debugPage.notConnected' ) }}
</div>
<div
v-else-if="!run"
>
{{ t('debugPage.noRuns') }}
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { gql } from '@urql/vue'
import { computed } from '@vue/reactivity'
import type { DebugSpecsFragment } from '../generated/graphql'
import { useLoginConnectStore } from '@packages/frontend-shared/src/store/login-connect-store'
import DebugPageHeader from './DebugPageHeader.vue'
import DebugSpecList from './DebugSpecList.vue'
import { useI18n } from 'vue-i18n'
import { specsList } from './utils/DebugMapping'
const { t } = useI18n()
gql`
fragment DebugSpecs on Query {
currentProject {
id
cloudProject {
__typename
... on CloudProject {
id
runByNumber(runNumber: 2) {
...DebugPage
id
runNumber
status
overLimitActionType
overLimitActionUrl
testsForReview {
id
...DebugSpecListTests
}
specs {
id
...DebugSpecListSpec
}
}
}
}
}
}
`
const props = defineProps<{
gql: DebugSpecsFragment
}>()
const loginConnectStore = useLoginConnectStore()
const run = computed(() => {
return props.gql.currentProject?.cloudProject?.__typename === 'CloudProject' && props.gql.currentProject.cloudProject.runByNumber
})
const debugSpecsArray = computed(() => {
if (props.gql.currentProject?.cloudProject?.__typename === 'CloudProject') {
const specs = props.gql.currentProject.cloudProject.runByNumber?.specs || []
const tests = props.gql.currentProject.cloudProject.runByNumber?.testsForReview || []
return specsList(specs, tests)
}
return []
})
</script>