Skip to content

Commit b8765c8

Browse files
committed
feat(ui): add Created At column to TagList's table
1 parent 8638261 commit b8765c8

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

ui/src/components/Tags/TagList.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
>
2121
{{ item.name }}
2222
</td>
23+
<td
24+
class="text-center"
25+
data-test="tag-created-at"
26+
>
27+
{{ formatShortDateTime(item.created_at) }}
28+
</td>
2329
<td class="text-center">
2430
<v-menu
2531
location="bottom"
@@ -92,12 +98,17 @@ import TagEdit from "./TagEdit.vue";
9298
import handleError from "@/utils/handleError";
9399
import useTagsStore from "@/store/modules/tags";
94100
import useSnackbar from "@/helpers/snackbar";
101+
import { formatShortDateTime } from "@/utils/date";
95102
96103
const headers = ref([
97104
{
98105
text: "Name",
99106
value: "name",
100107
},
108+
{
109+
text: "Created At",
110+
value: "created_at",
111+
},
101112
{
102113
text: "Actions",
103114
value: "actions",

ui/tests/components/Tags/TagList.spec.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,20 @@ import { router } from "@/router";
88
import { tagsApi } from "@/api/http";
99
import { SnackbarPlugin } from "@/plugins/snackbar";
1010

11-
const tags = [{ name: "123x" }, { name: "newtag" }];
11+
const tags = [
12+
{
13+
tenant_id: "fake-tenant-data",
14+
name: "123x",
15+
created_at: "2025-01-01T10:00:00Z",
16+
updated_at: "2025-01-01T10:00:00Z",
17+
},
18+
{
19+
tenant_id: "fake-tenant-data",
20+
name: "newtag",
21+
created_at: "2025-01-02T12:00:00Z",
22+
updated_at: "2025-01-02T12:00:00Z",
23+
},
24+
];
1225

1326
describe("Tag List", () => {
1427
const vuetify = createVuetify();

ui/tests/components/Tags/__snapshots__/TagList.spec.ts.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ exports[`Tag List > Renders the component 1`] = `
99
<thead class="bg-v-theme-background">
1010
<tr>
1111
<th class="text-center" data-test="th-name"><span data-test="th-label">Name</span></th>
12+
<th class="text-center" data-test="th-created_at"><span data-test="th-label">Created At</span></th>
1213
<th class="text-center" data-test="th-actions"><span data-test="th-label">Actions</span></th>
1314
</tr>
1415
</thead>
1516
<tbody data-test="tbody-has-items">
1617
<tr>
1718
<td class="text-center" data-test="tag-name">123x</td>
19+
<td class="text-center" data-test="tag-created-at">January 1, 2025 10:00 AM</td>
1820
<td class="text-center"><button type="button" class="v-btn v-btn--icon v-theme--light v-btn--density-comfortable v-btn--size-default v-btn--variant-plain border rounded bg-v-theme-background" aria-haspopup="menu" aria-expanded="false" aria-controls="v-menu-v-7" aria-owns="v-menu-v-7" data-test="tag-list-actions"><span class="v-btn__overlay"></span><span class="v-btn__underlay"></span>
1921
<!----><span class="v-btn__content" data-no-activator=""><i class="mdi-format-list-bulleted mdi v-icon notranslate v-theme--light v-icon--size-default" aria-hidden="true"></i></span>
2022
<!---->
@@ -26,6 +28,7 @@ exports[`Tag List > Renders the component 1`] = `
2628
</tr>
2729
<tr>
2830
<td class="text-center" data-test="tag-name">newtag</td>
31+
<td class="text-center" data-test="tag-created-at">January 2, 2025 12:00 PM</td>
2932
<td class="text-center"><button type="button" class="v-btn v-btn--icon v-theme--light v-btn--density-comfortable v-btn--size-default v-btn--variant-plain border rounded bg-v-theme-background" aria-haspopup="menu" aria-expanded="false" aria-controls="v-menu-v-11" aria-owns="v-menu-v-11" data-test="tag-list-actions"><span class="v-btn__overlay"></span><span class="v-btn__underlay"></span>
3033
<!----><span class="v-btn__content" data-no-activator=""><i class="mdi-format-list-bulleted mdi v-icon notranslate v-theme--light v-icon--size-default" aria-hidden="true"></i></span>
3134
<!---->

0 commit comments

Comments
 (0)