Skip to content

Commit

Permalink
add certificate sorting (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
immqu authored Oct 16, 2023
1 parent 5c65cb5 commit 4ac1629
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/lib/CertificateCard.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
<script lang="ts">
import { Card, CardBody, CardHeader, CardText, Table, Button, Modal, ModalBody, ModalHeader } from 'sveltestrap';
import type { Certificate } from '$lib/orchestrator';
import type { Certificate, State } from '$lib/orchestrator';
export let certificate: Certificate;
let states = certificate.states
var sortedStates: State[] = states.sort(
(s1,s2) => {
if (new Date(s1.timestamp) < new Date(s2.timestamp)){
return 1
} else {
return 0
}
});
let open = false;
let openScrollable = false;
Expand Down Expand Up @@ -55,7 +65,7 @@ const toggleScrollable = () => (openScrollable = !openScrollable);
</tr>
</thead>
<tbody>
{#each certificate.states.reverse() as state}
{#each sortedStates as state}
<tr>
<td>{state.state}</td>
<td>
Expand Down

0 comments on commit 4ac1629

Please sign in to comment.