Skip to content

Commit

Permalink
chore: fix defect report
Browse files Browse the repository at this point in the history
  • Loading branch information
GalvinGao committed Dec 24, 2022
1 parent 208f15b commit f1397ef
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "penguin-stats-frontend",
"version": "3.10.2",
"version": "3.10.3",
"private": true,
"author": "Penguin Statistics Contributors <contributors@penguin-stats.io> (https://github.com/orgs/penguin-statistics/people)",
"scripts": {
Expand Down Expand Up @@ -137,4 +137,4 @@
],
"homepage": "https://github.com/penguin-statistics/frontend-v2#readme",
"license": "MIT"
}
}
33 changes: 30 additions & 3 deletions src/components/recognition/RecognitionDefectReportBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
</v-btn>

<v-btn
v-else
v-else-if="!dense"
depressed
text
outlined
Expand All @@ -144,6 +144,29 @@
</v-icon>
{{ $t("report.recognition.defectReport.action") }}
</v-btn>

<v-tooltip
v-else
bottom
>
<template #activator="{ on, attrs }">
<v-btn
depressed
text
outlined
icon
color="deep-purple lighten-4"
v-bind="attrs"
@click="expanded = true"
v-on="on"
>
<v-icon>
mdi-bug
</v-icon>
</v-btn>
</template>
<span>{{ $t("report.recognition.defectReport.action") }}</span>
</v-tooltip>
</div>
</template>

Expand All @@ -170,6 +193,10 @@ export default {
envContext: {
type: Object,
required: true
},
dense: {
type: Boolean,
default: () => false
}
},
data() {
Expand All @@ -186,7 +213,7 @@ export default {
},
computed: {
recognitionResult () {
return JSON.stringify(this.result.result, null, 4)
return JSON.stringify(this.result.originalResult, null, 4)
},
envInfo () {
return JSON.stringify(this.envContext, null, 4)
Expand All @@ -209,7 +236,7 @@ export default {
const preflight = (await reportDefect.initDefectReport({
environment: this.envContext,
recognitionResult: this.result.result,
recognitionResult: this.result.originalResult,
})).data
this.state = "uploading";
Expand Down
15 changes: 13 additions & 2 deletions src/components/recognition/RecognitionResultCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
</div>
<v-divider />

<v-card-title class="align-start">
<v-card-title class="d-flex align-start grow">
<div
v-if="result.result.stage.stageId"
class="d-flex flex-row align-start flex-wrap"
class="d-flex flex-row align-start flex-wrap full-width"
>
<FactTableItem>
<template #title>
Expand Down Expand Up @@ -93,6 +93,17 @@
/>
</v-badge>
</div>

<v-spacer />

<RecognitionDefectReportBtn
v-if="hasException"
:result="result"
:index="index"
:env-context="envContext"
dense
class="align-self-center"
/>
</div>

<div
Expand Down
5 changes: 4 additions & 1 deletion src/utils/recognizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ class Recognizer {

Console.debug('Recognizer', 'Recognized. Took', duration + 'ms', 'with result', parsedResult)

const copiedOriginalResult = JSON.parse(JSON.stringify(parsedResult))

parsedResult.exceptions = parsedResult.exceptions.map(exception => {
exception.what = `${
strings.capitalize(
Expand Down Expand Up @@ -293,7 +295,8 @@ class Recognizer {
file,
blobUrl,
duration,
result: parsedResult
result: parsedResult,
originalResult: copiedOriginalResult
})
// console.log('callback executed')
// console.timeLog(file.name)
Expand Down
4 changes: 2 additions & 2 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ module.exports = {
devServer: {
proxy: {
"/PenguinStats": {
// target: "https://penguin-stats.io/",
target: "http://localhost:9010/",
target: "https://penguin-stats.io/",
// target: "http://localhost:9010/",
},
},
},
Expand Down

0 comments on commit f1397ef

Please sign in to comment.