13
13
<BuildList :list =" passingKeyboards" :filter =" filter" @show-error-pane =" showErrors" >
14
14
Builds Passing
15
15
</BuildList >
16
- <ErrorPane :visible =" showErrorPane" :error-log =" errorLog" @backdrop-clicked =" hideErrors" />
16
+ <ErrorPane :visible =" showErrorPane" :error-log =" errorLog" :loading = " errorLogLoading " @backdrop-clicked =" hideErrors" />
17
17
</div >
18
18
</template >
19
19
@@ -35,34 +35,67 @@ const filter = ref('')
35
35
const passingKeyboards = ref ([])
36
36
const failingKeyboards = ref ([])
37
37
const errorLog = ref (' ' )
38
+ const errorLogLoading = ref (false )
38
39
const showErrorPane = ref (false )
39
40
40
41
onMounted (() => {
41
- downloadBuildLog ()
42
+ loadBuildSummary ()
42
43
})
43
44
44
- function downloadBuildLog () {
45
+ async function loadBuildSummary () {
45
46
const start = performance .now ()
46
- axios
47
- .get (` ${ import .meta.env.VITE_QMK_API_BASEURL}/v1/keyboards/build_log` , {
48
- onDownloadProgress: (e) => {
49
- loadProgress.value = Math.floor((e.loaded / e.total) * 100)
50
- }
51
- })
52
- .then((res) => {
53
- if (res.status === 200) {
54
- buildLog = res.data
55
- binKeyboards()
47
+
48
+ try {
49
+ const { status , data } = await axios .get (
50
+ ` ${ import .meta.env.VITE_QMK_API_BASEURL}/v1/keyboards/build_summary` ,
51
+ {
52
+ onDownloadProgress: (e) => {
53
+ loadProgress.value = Math.floor((e.loaded / e.total) * 100)
54
+ }
56
55
}
57
- })
58
- .then(() => {
59
- loading.value = false
60
- loadTime.value = ((performance.now() - start) / 1000).toFixed(2)
61
- })
56
+ )
57
+
58
+ if (status === 200) {
59
+ buildLog = data
60
+ binKeyboards()
61
+ }
62
+ } catch (e) {
63
+ console.log(e.message)
64
+ }
65
+
66
+ loading.value = false
67
+ loadTime.value = ((performance.now() - start) / 1000).toFixed(2)
68
+ }
69
+
70
+ async function loadBuildLog(keyboard) {
71
+ errorLogLoading.value = true
72
+
73
+ try {
74
+ const { status, statusText, data } = await axios.get(
75
+ ` ${import .meta .env .VITE_QMK_API_BASEURL }/v1/keyboards/${keyboard }/build_log`
76
+ )
77
+
78
+ if (status === 200) {
79
+ buildLog[keyboard].message = data.message
80
+ errorLog.value = data.message
81
+ } else {
82
+ buildLog[keyboard].message = ` ERROR ${status }: ${statusText }`
83
+ }
84
+ } catch (e) {
85
+ buildLog[keyboard].message = ` ERROR: ${e .message }`
86
+ }
87
+
88
+ errorLogLoading.value = false;
89
+ errorLog.value = buildLog[keyboard].message
62
90
}
63
91
64
92
function showErrors(key) {
65
- errorLog.value = buildLog[key].message
93
+ if (!('message' in buildLog[key])) {
94
+ loadBuildLog(key)
95
+ } else {
96
+ errorLog.value = buildLog[key].message
97
+ }
98
+
66
99
showErrorPane.value = true
67
100
}
68
101
0 commit comments