/
Attachment.vue
66 lines (61 loc) · 1.7 KB
/
Attachment.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
<template>
<div>
<nav class="navbar">
<div class="navbar-brand">
<h3 class="is-size-5 has-text-weight-bold">
{{ header }}
</h3>
</div>
<div class="navbar-menu">
<div class="navbar-end">
<Submitters v-bind:type="sha256Type" v-bind:value="attachment" />
</div>
</div>
</nav>
<div class="table-container">
<table class="table is-fullwidth">
<tbody>
<tr>
<th>Filename</th>
<td>{{ attachment.filename }}</td>
</tr>
<tr>
<th>Size</th>
<td>{{ filesize }}</td>
</tr>
<tr>
<th>MIME type</th>
<td>{{ attachment.mimeType || "N/A" }}</td>
</tr>
<tr>
<th>Hash</th>
<td>
<Indicators v-bind:type="sha256Type" v-bind:values="values" />
</td>
</tr>
</tbody>
</table>
</div>
</div>
</template>
<script lang="ts">
import fileSize from "filesize.js";
import { Component, Prop, Vue } from "vue-property-decorator";
import Indicators from "@/components/indicators/Indicators.vue";
import Submitters from "@/components/submitters/Submitters.vue";
import H3 from "@/components/ui/h3.vue";
import { Attachment } from "@/types";
@Component({
components: { Indicators, H3, Submitters },
})
export default class AttachmentComponent extends Vue {
@Prop() private attachment!: Attachment;
@Prop() private index!: number;
private header = `#${this.index + 1}`;
private values = [this.attachment.hash.sha256];
private sha256Type = "sha256";
get filesize(): string {
return fileSize(this.attachment.size);
}
}
</script>