diff --git a/packages/admin/__generated__/HarvestAttemptsListFragment.graphql.ts b/packages/admin/__generated__/HarvestAttemptsListFragment.graphql.ts index 5dc18db46..cf55e5999 100644 --- a/packages/admin/__generated__/HarvestAttemptsListFragment.graphql.ts +++ b/packages/admin/__generated__/HarvestAttemptsListFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<3d08046137414727d6d1a19f279c7acf>> + * @generated SignedSource<<86fa2fc388bdc1923cc822799698e969>> * @lightSyntaxTransform * @nogrep */ @@ -15,6 +15,7 @@ import { FragmentRefs } from "relay-runtime"; export type HarvestAttemptsListFragment$data = { readonly nodes: ReadonlyArray<{ readonly beganAt: string | null | undefined; + readonly createdAt: string; readonly currentState: HarvestAttemptState; readonly endedAt: string | null | undefined; readonly harvestRecords: { @@ -30,6 +31,7 @@ export type HarvestAttemptsListFragment$data = { }; readonly id: string; readonly mode: HarvestScheduleMode; + readonly scheduledAt: string | null | undefined; readonly slug: string; }>; readonly " $fragmentSpreads": FragmentRefs<"ModelListPageFragment">; @@ -82,6 +84,20 @@ const node: ReaderFragment = { "name": "endedAt", "storageKey": null }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "scheduledAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, { "alias": null, "args": null, @@ -174,6 +190,6 @@ const node: ReaderFragment = { "abstractKey": null }; -(node as any).hash = "a3aa257368d6303a2e69bf67ec5ef7eb"; +(node as any).hash = "323d60a35e278e054d7f0265fdce98fa"; export default node; diff --git a/packages/admin/__generated__/attemptsHarvestMappingQuery.graphql.ts b/packages/admin/__generated__/attemptsHarvestMappingQuery.graphql.ts index d14ee3b98..2b460908d 100644 --- a/packages/admin/__generated__/attemptsHarvestMappingQuery.graphql.ts +++ b/packages/admin/__generated__/attemptsHarvestMappingQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<147e1d13a7889d6026881868cb6d9645>> + * @generated SignedSource<<7e9f40df572d70ecba3c877e7fb2cbc2>> * @lightSyntaxTransform * @nogrep */ @@ -180,6 +180,20 @@ return { "name": "endedAt", "storageKey": null }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "scheduledAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, { "alias": null, "args": null, @@ -322,12 +336,12 @@ return { ] }, "params": { - "cacheID": "aaaf0f1615c1f0439b734bb91ee5c209", + "cacheID": "6d308509efc1532d990799e71a23770a", "id": null, "metadata": {}, "name": "attemptsHarvestMappingQuery", "operationKind": "query", - "text": "query attemptsHarvestMappingQuery(\n $slug: Slug!\n $order: HarvestAttemptOrder\n $page: Int!\n) {\n harvestMapping(slug: $slug) {\n harvestAttempts(order: $order, page: $page, perPage: 20) {\n ...HarvestAttemptsListFragment\n }\n id\n }\n}\n\nfragment HarvestAttemptsListFragment on HarvestAttemptConnection {\n nodes {\n id\n slug\n beganAt\n endedAt\n mode\n currentState\n harvestSource {\n name\n id\n }\n harvestSet {\n identifier\n id\n }\n harvestRecords {\n pageInfo {\n totalCount\n }\n }\n }\n ...ModelListPageFragment\n}\n\nfragment ModelListPageFragment on Paginated {\n __isPaginated: __typename\n ...ModelPageCountActionsFragment\n ...ModelPaginationFragment\n}\n\nfragment ModelPageCountActionsFragment on Paginated {\n __isPaginated: __typename\n pageInfo {\n page\n pageCount\n perPage\n hasNextPage\n hasPreviousPage\n totalCount\n }\n}\n\nfragment ModelPaginationFragment on Paginated {\n __isPaginated: __typename\n pageInfo {\n page\n pageCount\n }\n}\n" + "text": "query attemptsHarvestMappingQuery(\n $slug: Slug!\n $order: HarvestAttemptOrder\n $page: Int!\n) {\n harvestMapping(slug: $slug) {\n harvestAttempts(order: $order, page: $page, perPage: 20) {\n ...HarvestAttemptsListFragment\n }\n id\n }\n}\n\nfragment HarvestAttemptsListFragment on HarvestAttemptConnection {\n nodes {\n id\n slug\n beganAt\n endedAt\n scheduledAt\n createdAt\n mode\n currentState\n harvestSource {\n name\n id\n }\n harvestSet {\n identifier\n id\n }\n harvestRecords {\n pageInfo {\n totalCount\n }\n }\n }\n ...ModelListPageFragment\n}\n\nfragment ModelListPageFragment on Paginated {\n __isPaginated: __typename\n ...ModelPageCountActionsFragment\n ...ModelPaginationFragment\n}\n\nfragment ModelPageCountActionsFragment on Paginated {\n __isPaginated: __typename\n pageInfo {\n page\n pageCount\n perPage\n hasNextPage\n hasPreviousPage\n totalCount\n }\n}\n\nfragment ModelPaginationFragment on Paginated {\n __isPaginated: __typename\n pageInfo {\n page\n pageCount\n }\n}\n" } }; })(); diff --git a/packages/admin/__generated__/attemptsHarvestSourceQuery.graphql.ts b/packages/admin/__generated__/attemptsHarvestSourceQuery.graphql.ts index 8549578e2..cf3659b25 100644 --- a/packages/admin/__generated__/attemptsHarvestSourceQuery.graphql.ts +++ b/packages/admin/__generated__/attemptsHarvestSourceQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -180,6 +180,20 @@ return { "name": "endedAt", "storageKey": null }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "scheduledAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, { "alias": null, "args": null, @@ -322,12 +336,12 @@ return { ] }, "params": { - "cacheID": "e5c2b97b1d1ab5ae543979f23664c9ef", + "cacheID": "b6142e7dd4072207a6367aaaf4908adc", "id": null, "metadata": {}, "name": "attemptsHarvestSourceQuery", "operationKind": "query", - "text": "query attemptsHarvestSourceQuery(\n $slug: Slug!\n $order: HarvestAttemptOrder\n $page: Int!\n) {\n harvestSource(slug: $slug) {\n harvestAttempts(order: $order, page: $page, perPage: 20) {\n ...HarvestAttemptsListFragment\n }\n id\n }\n}\n\nfragment HarvestAttemptsListFragment on HarvestAttemptConnection {\n nodes {\n id\n slug\n beganAt\n endedAt\n mode\n currentState\n harvestSource {\n name\n id\n }\n harvestSet {\n identifier\n id\n }\n harvestRecords {\n pageInfo {\n totalCount\n }\n }\n }\n ...ModelListPageFragment\n}\n\nfragment ModelListPageFragment on Paginated {\n __isPaginated: __typename\n ...ModelPageCountActionsFragment\n ...ModelPaginationFragment\n}\n\nfragment ModelPageCountActionsFragment on Paginated {\n __isPaginated: __typename\n pageInfo {\n page\n pageCount\n perPage\n hasNextPage\n hasPreviousPage\n totalCount\n }\n}\n\nfragment ModelPaginationFragment on Paginated {\n __isPaginated: __typename\n pageInfo {\n page\n pageCount\n }\n}\n" + "text": "query attemptsHarvestSourceQuery(\n $slug: Slug!\n $order: HarvestAttemptOrder\n $page: Int!\n) {\n harvestSource(slug: $slug) {\n harvestAttempts(order: $order, page: $page, perPage: 20) {\n ...HarvestAttemptsListFragment\n }\n id\n }\n}\n\nfragment HarvestAttemptsListFragment on HarvestAttemptConnection {\n nodes {\n id\n slug\n beganAt\n endedAt\n scheduledAt\n createdAt\n mode\n currentState\n harvestSource {\n name\n id\n }\n harvestSet {\n identifier\n id\n }\n harvestRecords {\n pageInfo {\n totalCount\n }\n }\n }\n ...ModelListPageFragment\n}\n\nfragment ModelListPageFragment on Paginated {\n __isPaginated: __typename\n ...ModelPageCountActionsFragment\n ...ModelPaginationFragment\n}\n\nfragment ModelPageCountActionsFragment on Paginated {\n __isPaginated: __typename\n pageInfo {\n page\n pageCount\n perPage\n hasNextPage\n hasPreviousPage\n totalCount\n }\n}\n\nfragment ModelPaginationFragment on Paginated {\n __isPaginated: __typename\n pageInfo {\n page\n pageCount\n }\n}\n" } }; })(); diff --git a/packages/admin/components/composed/harvesting/HarvestAttemptsList/HarvestAttemptsList.tsx b/packages/admin/components/composed/harvesting/HarvestAttemptsList/HarvestAttemptsList.tsx index 4ce42f97e..eed698d86 100644 --- a/packages/admin/components/composed/harvesting/HarvestAttemptsList/HarvestAttemptsList.tsx +++ b/packages/admin/components/composed/harvesting/HarvestAttemptsList/HarvestAttemptsList.tsx @@ -1,6 +1,5 @@ import { graphql, useFragment } from "react-relay"; import { useTranslation } from "react-i18next"; -import { formatDate } from "@wdp/lib/helpers"; import ModelListPage from "components/composed/model/ModelListPage"; import ModelColumns from "components/composed/model/ModelColumns"; import PageHeader from "components/layout/PageHeader"; @@ -8,6 +7,7 @@ import type { HarvestAttemptsListFragment$data, HarvestAttemptsListFragment$key, } from "@/relay/HarvestAttemptsListFragment.graphql"; +import { getDateDisplay } from "./helpers"; type HeaderProps = React.ComponentProps; @@ -16,7 +16,8 @@ type Props = Pick & { backTo?: string; }; -type HarvestAttemptNode = HarvestAttemptsListFragment$data["nodes"][number]; +export type HarvestAttemptNode = + HarvestAttemptsListFragment$data["nodes"][number]; function HarvestAttemptsList({ data, headerStyle, hideHeader, backTo }: Props) { const harvestAttempts = useFragment( @@ -28,7 +29,7 @@ function HarvestAttemptsList({ data, headerStyle, hideHeader, backTo }: Props) { const columns = [ ModelColumns.NameColumn({ - accessorFn: (row) => formatDate(row.beganAt ?? ""), + accessorFn: (row) => getDateDisplay(row), header: () => t("lists.began_at_column"), enableSorting: false, route: "harvestAttempt", @@ -70,6 +71,8 @@ export const fragment = graphql` slug beganAt endedAt + scheduledAt + createdAt mode currentState harvestSource { diff --git a/packages/admin/components/composed/harvesting/HarvestAttemptsList/helpers.ts b/packages/admin/components/composed/harvesting/HarvestAttemptsList/helpers.ts new file mode 100644 index 000000000..bab5dc679 --- /dev/null +++ b/packages/admin/components/composed/harvesting/HarvestAttemptsList/helpers.ts @@ -0,0 +1,15 @@ +import { formatDate } from "@wdp/lib/helpers"; +import type { HarvestAttemptNode } from "./HarvestAttemptsList"; + +export const getDateDisplay = (row: HarvestAttemptNode) => { + switch (row.currentState) { + case "SCHEDULED": + return `Scheduled ${formatDate(row.scheduledAt ?? "")}`; + case "EXTRACTED": + return `Extracted ${formatDate(row.endedAt ?? "")}`; + default: + return row.beganAt + ? `Started ${formatDate(row.beganAt)}` + : `Created ${formatDate(row.createdAt)}`; + } +}; diff --git a/packages/admin/locales/en.json b/packages/admin/locales/en.json index 994ce434a..9aaf28c28 100644 --- a/packages/admin/locales/en.json +++ b/packages/admin/locales/en.json @@ -141,7 +141,7 @@ "count_column": "Count", "description_column": "Description", "record_count_column": "Record count", - "began_at_column": "Started At", + "began_at_column": "Latest Event", "ended_at_column": "Ended At", "status_column": "Status", "identifier_column": "Identifier",