Skip to content

Commit 1154c09

Browse files
committed
Show associated images, if available
1 parent 6dfd38b commit 1154c09

7 files changed

Lines changed: 1413 additions & 1175 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: ci
33
on:
44
pull_request:
55
push:
6+
tags: "*"
67
branches:
78
- main
89
jobs:

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"vue-eslint-parser": "^9.4.3",
4242
"vue-tsc": "^2.2.0"
4343
},
44-
"packageManager": "yarn@4.5.1+sha256.dc2e45a77f87a9c2a76708d098ab54ca0cfdd5ec2cf7d9e3c1f24bf786a2383c",
44+
"packageManager": "yarn@4.10.3+sha512.c38cafb5c7bb273f3926d04e55e1d8c9dfa7d9c3ea1f36a4868fa028b9e5f72298f0b7f401ad5eb921749eb012eb1c3bb74bf7503df3ee43fd600d14a018266f",
4545
"dependenciesMeta": {
4646
"remixicon@3.7.0": {
4747
"unplugged": true
Lines changed: 2 additions & 0 deletions
Loading

client/src/components/ImageDataTable.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ defineProps({
2222
<tr class="text-base bg-gray-600">
2323
<th class="bg-neutral text-white py-5 px-6">Image File Name</th>
2424
<th class="bg-gray-600 text-white py-5 px-10">Image</th>
25+
<th class="bg-gray-600 text-white py-5 px-10">Label</th>
26+
<th class="bg-gray-600 text-white py-5 px-10">Macro</th>
2527
<th class="bg-gray-600 text-white">Redaction Status</th>
2628
<th
2729
v-if="Object.keys(imageRedactionPlan.data).includes('missing_tags')"
@@ -44,6 +46,12 @@ defineProps({
4446
<td>
4547
<img :src="image.thumbnail" />
4648
</td>
49+
<td>
50+
<img :src="image.label" />
51+
</td>
52+
<td>
53+
<img :src="image.macro" />
54+
</td>
4755
<td>
4856
<div
4957
v-if="image.missing_tags"
@@ -118,4 +126,7 @@ tbody th:first-child {
118126
z-index: 1;
119127
background-color: #ffffff;
120128
}
129+
td img {
130+
min-width: 160px;
131+
}
121132
</style>

client/src/store/imageStore.ts

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,31 @@ export const useRedactionPlan = reactive({
1414
},
1515
async getThumbnail(imagedict: Record<string, Record<string, string>>) {
1616
Object.keys(imagedict).forEach(async (image) => {
17-
const response = await getImages(
18-
this.currentDirectory + "/" + image,
19-
"thumbnail",
20-
);
21-
if (response.status >= 400) {
22-
this.imageRedactionPlan.data[image].thumbnail =
23-
"/thumbnailPlaceholder.svg";
24-
return;
25-
}
26-
if (response.body) {
27-
const reader = response.body.getReader();
28-
const chunks = [];
17+
const keys = ["thumbnail", "label", "macro"];
18+
for (let kidx=0; kidx < keys.length; kidx += 1) {
19+
const key = keys[kidx];
20+
const response = await getImages(
21+
this.currentDirectory + "/" + image,
22+
key,
23+
);
24+
if (response.status >= 400) {
25+
this.imageRedactionPlan.data[image][key] = key === "thumbnail" ? "/thumbnailPlaceholder.svg" : "/associatedPlaceholder.svg";
26+
return;
27+
}
28+
if (response.body) {
29+
const reader = response.body.getReader();
30+
const chunks = [];
2931

30-
while (true) {
31-
const { done, value } = await reader.read();
32-
if (done) break;
33-
chunks.push(value);
32+
while (true) {
33+
const { done, value } = await reader.read();
34+
if (done) break;
35+
chunks.push(value);
36+
}
37+
const blob = new Blob(chunks);
38+
const url = URL.createObjectURL(blob);
39+
this.imageRedactionPlan.data[image][key]= url;
3440
}
35-
const blob = new Blob(chunks);
36-
const url = URL.createObjectURL(blob);
37-
this.imageRedactionPlan.data[image].thumbnail = url;
38-
}
41+
};
3942
});
4043
},
4144

0 commit comments

Comments
 (0)