Skip to content

Commit

Permalink
fix: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ivelin committed Nov 20, 2019
1 parent 14c0e21 commit ed8810c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
9 changes: 6 additions & 3 deletions src/components/DetectionBoxes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export default {
}
},
props: {
detections: Array
detections: {
type: Array,
default: () => []
}
},
directives: {
resize
Expand All @@ -76,8 +79,8 @@ export default {
// console.log('container parent: ', container.parentElement)
// Resize the canvas to fit its parent's width.
let width = container.offsetWidth
let height = container.offsetHeight
const width = container.offsetWidth
const height = container.offsetHeight
// console.log('container w, h: ', width, height)
this.stageSize.width = width
Expand Down
8 changes: 4 additions & 4 deletions src/remote/edgeAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ async function getRootURL () {
Get one page of timeline events.
*/
export async function getTimelinePage (pageNum = 1) {
let apiRoot = await getRootURL()
let timelineURL = apiRoot + 'timeline.json'
const apiRoot = await getRootURL()
const timelineURL = apiRoot + 'timeline.json'
let timelinePage = []
try {
timelinePage = await axios.get(timelineURL, {
Expand All @@ -43,8 +43,8 @@ export async function getTimelinePage (pageNum = 1) {
Return full image URL given an image file name and a relative directory.
*/
export async function getImageURL (relDir, imageName) {
let apiRoot = await getRootURL()
let p = apiRoot + 'data/' + relDir + '/' + imageName
const apiRoot = await getRootURL()
const p = apiRoot + 'data/' + relDir + '/' + imageName
// console.debug('imagePath: ' + p)
return p
}
2 changes: 1 addition & 1 deletion src/views/About.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
justify="center"
>
<v-tooltip right>
<template v-slot:activator="{ on }">
<template>
<v-card
max-width="344"
class="mx-auto"
Expand Down
23 changes: 9 additions & 14 deletions src/views/Timeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</v-row>
</template>
<template
v-if='isImageLoaded[index]'
v-if="isImageLoaded[index]"
>
<detection-boxes
:detections="sample.args.inference_result"
Expand Down Expand Up @@ -86,25 +86,23 @@
>
<v-col cols="7">
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<template>
<v-btn
fab
color="success lighten-2"
class="mx-2"
v-on="on"
>
<v-icon>mdi-check</v-icon>
</v-btn>
</template>
<span>Looks fine</span>
</v-tooltip>
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<template>
<v-btn
color="error lighten-2"
fab
class="mx-2"
v-on="on"
>
<v-icon>mdi-bell</v-icon>
</v-btn>
Expand All @@ -114,32 +112,29 @@
</v-col>
<v-col cols="1">
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<template>
<v-btn
icon
v-on="on"
>
<v-icon>mdi-heart</v-icon>
</v-btn>
</template>
<span>Save to Favorites</span>
</v-tooltip>
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<template>
<v-btn
icon
v-on="on"
>
<v-icon>mdi-pen</v-icon>
</v-btn>
</template>
<span>Edit event details</span>
</v-tooltip>
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<template>
<v-btn
icon
v-on="on"
>
<v-icon>mdi-share-variant</v-icon>
</v-btn>
Expand Down Expand Up @@ -259,7 +254,7 @@ export default {
console.log('new timeline events: ', data.timeline.length)
// eslint-disable-next-line
// console.log('timeline slice: ' + JSON.stringify(data.timeline))
let startIndex = this.timeline.length
const startIndex = this.timeline.length
// update full image URLs
data.timeline.map(
(sample, index) =>
Expand Down Expand Up @@ -306,7 +301,7 @@ export default {
},
eventIcon (event) {
let topLabel = 'none'
let inf = event.args.inference_result
const inf = event.args.inference_result
if (inf.length > 0) {
topLabel = inf[0].label
}
Expand Down Expand Up @@ -339,7 +334,7 @@ export default {
return moment(datetime).calendar()
},
asPercentage (number) {
let p = Number(number).toLocaleString(undefined, { style: 'percent', minimumFractionDigits: 0 })
const p = Number(number).toLocaleString(undefined, { style: 'percent', minimumFractionDigits: 0 })
return p
}
}
Expand Down

0 comments on commit ed8810c

Please sign in to comment.