Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ export class ECCClientGa4ghDrsObjects extends LitElement {
this.pageSize,
this.currentPage - 1
);
this.objects = result.objects;
this.objects = ECCClientGa4ghDrsObjects.sortObjectsByLastUpdated(
result.objects
);

// Update total objects and pages from API response
if (result.pagination?.total !== undefined) {
Expand Down Expand Up @@ -166,6 +168,17 @@ export class ECCClientGa4ghDrsObjects extends LitElement {
this.loadData();
}

private static sortObjectsByLastUpdated(objects: DrsObject[]): DrsObject[] {
return [...objects].sort((a, b) => {
// Use updated_time if available, otherwise fall back to created_time
const aTime = a.updated_time || a.created_time;
const bTime = b.updated_time || b.created_time;

// Sort in reverse chronological order (most recent first)
return new Date(bTime).getTime() - new Date(aTime).getTime();
});
}

private renderPagination() {
return html`
<ecc-utils-design-pagination>
Expand Down Expand Up @@ -299,7 +312,7 @@ export class ECCClientGa4ghDrsObjects extends LitElement {
.map(
() => html`
<ecc-utils-design-table-row>
<ecc-utils-design-table-cell class="w-6/12">
<ecc-utils-design-table-cell class="w-5/12">
<div class="flex flex-col w-full gap-2">
<ecc-utils-design-skeleton
class="part:h-5 part:w-40"
Expand All @@ -317,14 +330,14 @@ export class ECCClientGa4ghDrsObjects extends LitElement {
class="part:h-4 part:w-20"
></ecc-utils-design-skeleton>
</ecc-utils-design-table-cell>
<ecc-utils-design-table-cell class="w-2/12">
<ecc-utils-design-table-cell class="w-2.5/12">
<ecc-utils-design-skeleton
class="part:h-4 part:w-24"
></ecc-utils-design-skeleton>
</ecc-utils-design-table-cell>
<ecc-utils-design-table-cell class="w-2/12">
<ecc-utils-design-table-cell class="w-2.5/12">
<ecc-utils-design-skeleton
class="part:h-8 part:w-8 part:rounded"
class="part:h-4 part:w-24"
></ecc-utils-design-skeleton>
</ecc-utils-design-table-cell>
</ecc-utils-design-table-row>
Expand All @@ -341,9 +354,17 @@ export class ECCClientGa4ghDrsObjects extends LitElement {
return `${parseFloat((bytes / k ** i).toFixed(2))} ${sizes[i]}`;
}

private static formatDate(dateString: string): string {
private static formatDateTime(dateString: string): string {
try {
return new Date(dateString).toLocaleDateString();
return new Date(dateString).toLocaleString("en-US", {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
hour12: false,
});
} catch {
return dateString;
}
Expand Down Expand Up @@ -403,18 +424,18 @@ export class ECCClientGa4ghDrsObjects extends LitElement {
<ecc-utils-design-table>
<ecc-utils-design-table-header>
<ecc-utils-design-table-row>
<ecc-utils-design-table-head class="w-6/12"
<ecc-utils-design-table-head class="w-5/12"
>Object Info</ecc-utils-design-table-head
>
<ecc-utils-design-table-head class="w-2/12"
>Size</ecc-utils-design-table-head
>
<ecc-utils-design-table-head class="w-2/12"
<ecc-utils-design-table-head class="w-2.5/12"
>Created</ecc-utils-design-table-head
>
<ecc-utils-design-table-head
class="w-2/12"
></ecc-utils-design-table-head>
<ecc-utils-design-table-head class="w-2.5/12"
>Last Updated</ecc-utils-design-table-head
>
</ecc-utils-design-table-row>
</ecc-utils-design-table-header>
<ecc-utils-design-table-body>
Expand All @@ -426,7 +447,7 @@ export class ECCClientGa4ghDrsObjects extends LitElement {
return html`
<ecc-utils-design-table-row>
<ecc-utils-design-table-cell
colspan="5"
colspan="4"
class="part:text-center part:py-8 part:text-muted-foreground"
>
No objects found
Expand All @@ -437,7 +458,7 @@ export class ECCClientGa4ghDrsObjects extends LitElement {
return this.objects.map(
(object) => html`
<ecc-utils-design-table-row>
<ecc-utils-design-table-cell class="w-6/12">
<ecc-utils-design-table-cell class="w-5/12">
<div class="flex flex-col w-full">
<ecc-utils-design-button
class="part:font-medium part:text-primary part:w-fit part:cursor-pointer part:p-0"
Expand Down Expand Up @@ -467,22 +488,19 @@ export class ECCClientGa4ghDrsObjects extends LitElement {
)}</span
>
</ecc-utils-design-table-cell>
<ecc-utils-design-table-cell class="w-2/12">
<ecc-utils-design-table-cell class="w-2.5/12">
<span class="text-sm"
>${ECCClientGa4ghDrsObjects.formatDate(
>${ECCClientGa4ghDrsObjects.formatDateTime(
object.created_time
)}</span
>
</ecc-utils-design-table-cell>
<ecc-utils-design-table-cell class="w-2/12">
<slot name=${`actions-${object.id}`}>
<ecc-utils-design-button
size="sm"
@click=${() => this.handleObjectSelect(object.id)}
>
View Details
</ecc-utils-design-button>
</slot>
<ecc-utils-design-table-cell class="w-2.5/12">
<span class="text-sm"
>${ECCClientGa4ghDrsObjects.formatDateTime(
object.updated_time || object.created_time
)}</span
>
</ecc-utils-design-table-cell>
</ecc-utils-design-table-row>
`
Expand Down
13 changes: 10 additions & 3 deletions packages/ecc-client-ga4gh-wes/src/components/run/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,16 @@ export class ECCClientGa4ghWesRun extends LitElement {
</div>

<div class="flex flex-wrap gap-2 items-center">
<ecc-utils-design-badge variant=${stateInfo.variant}>
${stateInfo.label}
</ecc-utils-design-badge>
${(() => {
const stateInfo = ECCClientGa4ghWesRun.getStateInfo(
this.run.state
);
return html`
<ecc-utils-design-badge variant=${stateInfo.variant}>
${stateInfo.label}
</ecc-utils-design-badge>
`;
})()}
<ecc-utils-design-badge variant="outline">
${this.run.request.workflow_type}
</ecc-utils-design-badge>
Expand Down