Skip to content

Commit

Permalink
Add additional columns to data dialog, properly format update time
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Apr 16, 2024
1 parent d5458b0 commit c3403d6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
17 changes: 17 additions & 0 deletions client/src/components/DataDialog/DataDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ const services = new Services();
const model = new Model({ multiple: props.multiple, format: props.format });
let urlTracker = new UrlTracker(getHistoryUrl());
/** Specifies data columns to be shown in the dialog's table */
const fields = [
{
key: "label",
},
{
key: "extension",
},
{
key: "tags",
},
{
key: "update_time",
},
];
/** Add highlighting for record variations, i.e. datasets vs. libraries/collections **/
function formatRows() {
for (const item of items.value) {
Expand Down Expand Up @@ -168,6 +184,7 @@ watch(
<SelectionDialog
:error-message="errorMessage"
:disable-ok="!hasValue"
:fields="fields"
:items="items"
:modal-show="modalShow"
:multiple="multiple"
Expand Down
19 changes: 19 additions & 0 deletions client/src/components/SelectionDialog/SelectionDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,22 @@ function filtered(items: Array<SelectionItem>) {
currentPage.value = 1;
}
/** Format time stamp */
function formatTime(value: string) {
if (value) {
const date = new Date(value);
return date.toLocaleString("default", {
day: "numeric",
month: "short",
year: "numeric",
minute: "numeric",
hour: "numeric",
});
} else {
return "-";
}
}
watch(
() => props.items,
() => {
Expand Down Expand Up @@ -170,6 +186,9 @@ watch(
<template v-slot:cell(time)="data">
{{ data.value ? data.value : "-" }}
</template>
<template v-slot:cell(update_time)="data">
{{ formatTime(data.value) }}
</template>
</BTable>
<div v-if="isBusy" class="text-center">
<BSpinner small type="grow" />
Expand Down

0 comments on commit c3403d6

Please sign in to comment.