Skip to content

Commit 3f9afe5

Browse files
committed
Use new build log endpoints for some speed improvements
1 parent 76e0d02 commit 3f9afe5

File tree

2 files changed

+61
-20
lines changed

2 files changed

+61
-20
lines changed

src/App.vue

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<BuildList :list="passingKeyboards" :filter="filter" @show-error-pane="showErrors">
1414
Builds Passing
1515
</BuildList>
16-
<ErrorPane :visible="showErrorPane" :error-log="errorLog" @backdrop-clicked="hideErrors" />
16+
<ErrorPane :visible="showErrorPane" :error-log="errorLog" :loading="errorLogLoading" @backdrop-clicked="hideErrors" />
1717
</div>
1818
</template>
1919

@@ -35,34 +35,67 @@ const filter = ref('')
3535
const passingKeyboards = ref([])
3636
const failingKeyboards = ref([])
3737
const errorLog = ref('')
38+
const errorLogLoading = ref(false)
3839
const showErrorPane = ref(false)
3940
4041
onMounted(() => {
41-
downloadBuildLog()
42+
loadBuildSummary()
4243
})
4344
44-
function downloadBuildLog() {
45+
async function loadBuildSummary() {
4546
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+
}
5655
}
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
6290
}
6391
6492
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+
6699
showErrorPane.value = true
67100
}
68101

src/components/ErrorPane.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
<h4>Detailed Error Log</h4>
99
</div>
1010
<div id="error-text">
11-
<pre v-html="colorizedErrorLog"></pre>
11+
<p v-if="loading" id="error-loading">Loading…</p>
12+
<pre v-else v-html="colorizedErrorLog"></pre>
1213
</div>
1314
</div>
1415
</Transition>
@@ -26,6 +27,10 @@ const props = defineProps({
2627
type: String,
2728
required: true
2829
},
30+
loading: {
31+
type: Boolean,
32+
required: true
33+
},
2934
visible: {
3035
type: Boolean,
3136
required: true
@@ -65,6 +70,9 @@ const colorizedErrorLog = computed(() => ansiConverter.toHtml(props.errorLog))
6570
overflow: auto;
6671
margin: 6px;
6772
}
73+
#error-loading {
74+
text-align: center;
75+
}
6876
6977
#backdrop {
7078
position: fixed;

0 commit comments

Comments
 (0)