From 348137e484d2f7a9c970bfcc83ebacd60a881f7e Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 17 Jun 2025 17:30:15 +0200 Subject: [PATCH] Add pagination on assets Signed-off-by: Bryan Frimin --- apps/console/src/hooks/graph/AssetGraph.ts | 49 +- .../AssetGraphListQuery.graphql.ts | 442 +++++++----------- .../pages/organizations/assets/AssetsPage.tsx | 88 +++- .../__generated__/AssetsListQuery.graphql.ts | 412 ++++++++++++++++ .../AssetsPageFragment.graphql.ts | 350 ++++++++++++++ 5 files changed, 1025 insertions(+), 316 deletions(-) create mode 100644 apps/console/src/pages/organizations/assets/__generated__/AssetsListQuery.graphql.ts create mode 100644 apps/console/src/pages/organizations/assets/__generated__/AssetsPageFragment.graphql.ts diff --git a/apps/console/src/hooks/graph/AssetGraph.ts b/apps/console/src/hooks/graph/AssetGraph.ts index 47db9896d..8c46fb110 100644 --- a/apps/console/src/hooks/graph/AssetGraph.ts +++ b/apps/console/src/hooks/graph/AssetGraph.ts @@ -1,5 +1,9 @@ import { graphql } from "relay-runtime"; -import { useMutation, usePreloadedQuery, type PreloadedQuery } from "react-relay"; +import { + useMutation, + usePreloadedQuery, + type PreloadedQuery, +} from "react-relay"; import { useConfirm } from "@probo/ui"; import { useTranslate } from "@probo/i18n"; import { promisifyMutation, sprintf } from "@probo/helpers"; @@ -10,32 +14,7 @@ export const assetsQuery = graphql` query AssetGraphListQuery($organizationId: ID!) { node(id: $organizationId) { ... on Organization { - assets(first: 100) @connection(key: "AssetsPage_assets") { - __id - edges { - node { - id - name - amount - criticity - assetType - dataTypesStored - owner { - fullName - } - vendors(first: 50) { - edges { - node { - id - name - websiteUrl - } - } - } - createdAt - } - } - } + ...AssetsPageFragment } } } @@ -250,19 +229,3 @@ export const useUpdateAsset = () => { }); }; }; - -export const useAssets = (queryRef: PreloadedQuery) => { - const data = usePreloadedQuery(assetsQuery, queryRef); - - return useMemo(() => { - const organization = data.node; - if (!organization || !organization.assets) { - return { assets: [], connectionId: "" }; - } - - return { - assets: organization.assets.edges.map((edge) => edge.node), - connectionId: organization.assets.__id, - }; - }, [data]); -}; diff --git a/apps/console/src/hooks/graph/__generated__/AssetGraphListQuery.graphql.ts b/apps/console/src/hooks/graph/__generated__/AssetGraphListQuery.graphql.ts index 6a61fc42d..85e6ac34f 100644 --- a/apps/console/src/hooks/graph/__generated__/AssetGraphListQuery.graphql.ts +++ b/apps/console/src/hooks/graph/__generated__/AssetGraphListQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<00b3c915ccd04831f9161442e27b635e>> + * @generated SignedSource<<8758668524dc47bc04757126d7f423b3>> * @lightSyntaxTransform * @nogrep */ @@ -9,39 +9,13 @@ // @ts-nocheck import { ConcreteRequest } from 'relay-runtime'; -export type AssetType = "PHYSICAL" | "VIRTUAL"; -export type CriticityLevel = "HIGH" | "LOW" | "MEDIUM"; +import { FragmentRefs } from "relay-runtime"; export type AssetGraphListQuery$variables = { organizationId: string; }; export type AssetGraphListQuery$data = { readonly node: { - readonly assets?: { - readonly __id: string; - readonly edges: ReadonlyArray<{ - readonly node: { - readonly amount: number; - readonly assetType: AssetType; - readonly createdAt: any; - readonly criticity: CriticityLevel; - readonly dataTypesStored: string; - readonly id: string; - readonly name: string; - readonly owner: { - readonly fullName: string; - }; - readonly vendors: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly id: string; - readonly name: string; - readonly websiteUrl: string | null | undefined; - }; - }>; - }; - }; - }>; - }; + readonly " $fragmentSpreads": FragmentRefs<"AssetsPageFragment">; }; }; export type AssetGraphListQuery = { @@ -68,164 +42,30 @@ v2 = { "alias": null, "args": null, "kind": "ScalarField", - "name": "id", + "name": "__typename", "storageKey": null }, v3 = { "alias": null, "args": null, "kind": "ScalarField", - "name": "name", - "storageKey": null -}, -v4 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "amount", + "name": "id", "storageKey": null }, +v4 = [ + { + "kind": "Literal", + "name": "first", + "value": 10 + } +], v5 = { "alias": null, "args": null, "kind": "ScalarField", - "name": "criticity", + "name": "name", "storageKey": null -}, -v6 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "assetType", - "storageKey": null -}, -v7 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "dataTypesStored", - "storageKey": null -}, -v8 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "fullName", - "storageKey": null -}, -v9 = { - "alias": null, - "args": [ - { - "kind": "Literal", - "name": "first", - "value": 50 - } - ], - "concreteType": "VendorConnection", - "kind": "LinkedField", - "name": "vendors", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "VendorEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "Vendor", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "websiteUrl", - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": "vendors(first:50)" -}, -v10 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "createdAt", - "storageKey": null -}, -v11 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null -}, -v12 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "cursor", - "storageKey": null -}, -v13 = { - "alias": null, - "args": null, - "concreteType": "PageInfo", - "kind": "LinkedField", - "name": "pageInfo", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "endCursor", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasNextPage", - "storageKey": null - } - ], - "storageKey": null -}, -v14 = { - "kind": "ClientExtension", - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__id", - "storageKey": null - } - ] -}, -v15 = [ - { - "kind": "Literal", - "name": "first", - "value": 100 - } -]; +}; return { "fragment": { "argumentDefinitions": (v0/*: any*/), @@ -245,61 +85,9 @@ return { "kind": "InlineFragment", "selections": [ { - "alias": "assets", "args": null, - "concreteType": "AssetConnection", - "kind": "LinkedField", - "name": "__AssetsPage_assets_connection", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "AssetEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "Asset", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v4/*: any*/), - (v5/*: any*/), - (v6/*: any*/), - (v7/*: any*/), - { - "alias": null, - "args": null, - "concreteType": "People", - "kind": "LinkedField", - "name": "owner", - "plural": false, - "selections": [ - (v8/*: any*/) - ], - "storageKey": null - }, - (v9/*: any*/), - (v10/*: any*/), - (v11/*: any*/) - ], - "storageKey": null - }, - (v12/*: any*/) - ], - "storageKey": null - }, - (v13/*: any*/), - (v14/*: any*/) - ], - "storageKey": null + "kind": "FragmentSpread", + "name": "AssetsPageFragment" } ], "type": "Organization", @@ -326,13 +114,14 @@ return { "name": "node", "plural": false, "selections": [ - (v11/*: any*/), + (v2/*: any*/), + (v3/*: any*/), { "kind": "InlineFragment", "selections": [ { "alias": null, - "args": (v15/*: any*/), + "args": (v4/*: any*/), "concreteType": "AssetConnection", "kind": "LinkedField", "name": "assets", @@ -354,12 +143,36 @@ return { "name": "node", "plural": false, "selections": [ - (v2/*: any*/), (v3/*: any*/), - (v4/*: any*/), (v5/*: any*/), - (v6/*: any*/), - (v7/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "amount", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "criticity", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "assetType", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "dataTypesStored", + "storageKey": null + }, { "alias": null, "args": null, @@ -368,30 +181,146 @@ return { "name": "owner", "plural": false, "selections": [ - (v8/*: any*/), - (v2/*: any*/) + (v3/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fullName", + "storageKey": null + } ], "storageKey": null }, - (v9/*: any*/), - (v10/*: any*/), - (v11/*: any*/) + { + "alias": null, + "args": [ + { + "kind": "Literal", + "name": "first", + "value": 50 + } + ], + "concreteType": "VendorConnection", + "kind": "LinkedField", + "name": "vendors", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "VendorEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Vendor", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v3/*: any*/), + (v5/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "websiteUrl", + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": "vendors(first:50)" + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, + (v2/*: any*/) ], "storageKey": null }, - (v12/*: any*/) + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + } ], "storageKey": null }, - (v13/*: any*/), - (v14/*: any*/) + { + "alias": null, + "args": null, + "concreteType": "PageInfo", + "kind": "LinkedField", + "name": "pageInfo", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "endCursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasNextPage", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasPreviousPage", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "startCursor", + "storageKey": null + } + ], + "storageKey": null + }, + { + "kind": "ClientExtension", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__id", + "storageKey": null + } + ] + } ], - "storageKey": "assets(first:100)" + "storageKey": "assets(first:10)" }, { "alias": null, - "args": (v15/*: any*/), - "filters": null, + "args": (v4/*: any*/), + "filters": [ + "orderBy" + ], "handle": "connection", "key": "AssetsPage_assets", "kind": "LinkedHandle", @@ -400,36 +329,23 @@ return { ], "type": "Organization", "abstractKey": null - }, - (v2/*: any*/) + } ], "storageKey": null } ] }, "params": { - "cacheID": "b070f08982995825d2695f833f773f5e", + "cacheID": "7e293e732d5ff8246a1ed772e1c33984", "id": null, - "metadata": { - "connection": [ - { - "count": null, - "cursor": null, - "direction": "forward", - "path": [ - "node", - "assets" - ] - } - ] - }, + "metadata": {}, "name": "AssetGraphListQuery", "operationKind": "query", - "text": "query AssetGraphListQuery(\n $organizationId: ID!\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n assets(first: 100) {\n edges {\n node {\n id\n name\n amount\n criticity\n assetType\n dataTypesStored\n owner {\n fullName\n id\n }\n vendors(first: 50) {\n edges {\n node {\n id\n name\n websiteUrl\n }\n }\n }\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n" + "text": "query AssetGraphListQuery(\n $organizationId: ID!\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n ...AssetsPageFragment\n }\n id\n }\n}\n\nfragment AssetsPageFragment on Organization {\n assets(first: 10) {\n edges {\n node {\n id\n name\n amount\n criticity\n assetType\n dataTypesStored\n owner {\n id\n fullName\n }\n vendors(first: 50) {\n edges {\n node {\n id\n name\n websiteUrl\n }\n }\n }\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n" } }; })(); -(node as any).hash = "79e2cf57067fabd4b124e6c0b47220dd"; +(node as any).hash = "88644d5fcb5f2e017df4b5d6373ce27f"; export default node; diff --git a/apps/console/src/pages/organizations/assets/AssetsPage.tsx b/apps/console/src/pages/organizations/assets/AssetsPage.tsx index 56a6008ba..040c91342 100644 --- a/apps/console/src/pages/organizations/assets/AssetsPage.tsx +++ b/apps/console/src/pages/organizations/assets/AssetsPage.tsx @@ -2,7 +2,6 @@ import { Button, IconPlusLarge, PageHeader, - Table, Thead, Tbody, Tr, @@ -16,16 +15,72 @@ import { } from "@probo/ui"; import { useTranslate } from "@probo/i18n"; import { usePageTitle } from "@probo/hooks"; -import { type PreloadedQuery } from "react-relay"; +import { + graphql, + usePaginationFragment, + usePreloadedQuery, + type PreloadedQuery, +} from "react-relay"; import { useOrganizationId } from "/hooks/useOrganizationId"; import { CreateAssetDialog } from "./dialogs/CreateAssetDialog"; -import { useDeleteAsset, useAssets } from "../../../hooks/graph/AssetGraph"; +import { useDeleteAsset, assetsQuery } from "../../../hooks/graph/AssetGraph"; import type { AssetGraphListQuery } from "/hooks/graph/__generated__/AssetGraphListQuery.graphql"; import { faviconUrl } from "@probo/helpers"; import type { NodeOf } from "/types"; import { getAssetTypeVariant, getCriticityVariant } from "@probo/helpers"; +import type { + AssetsPageFragment$data, + AssetsPageFragment$key, +} from "./__generated__/AssetsPageFragment.graphql"; +import { SortableTable } from "/components/SortableTable"; -type AssetEntry = NodeOf["assets"]>>; +const paginatedAssetsFragment = graphql` + fragment AssetsPageFragment on Organization + @refetchable(queryName: "AssetsListQuery") + @argumentDefinitions( + first: { type: "Int", defaultValue: 10 } + orderBy: { type: "AssetOrder", defaultValue: null } + after: { type: "CursorKey", defaultValue: null } + before: { type: "CursorKey", defaultValue: null } + last: { type: "Int", defaultValue: null } + ) { + assets( + first: $first + after: $after + last: $last + before: $before + orderBy: $orderBy + ) @connection(key: "AssetsPage_assets") { + __id + edges { + node { + id + name + amount + criticity + assetType + dataTypesStored + owner { + id + fullName + } + vendors(first: 50) { + edges { + node { + id + name + websiteUrl + } + } + } + createdAt + } + } + } + } +`; + +type AssetEntry = NodeOf; type Props = { queryRef: PreloadedQuery; @@ -35,7 +90,13 @@ export default function AssetsPage(props: Props) { const { __ } = useTranslate(); const organizationId = useOrganizationId(); - const { assets, connectionId } = useAssets(props.queryRef); + const data = usePreloadedQuery(assetsQuery, props.queryRef); + const pagination = usePaginationFragment( + paginatedAssetsFragment, + data.node as AssetsPageFragment$key + ); + const assets = pagination.data.assets?.edges.map((edge) => edge.node); + const connectionId = pagination.data.assets.__id; usePageTitle(__("Assets")); @@ -47,11 +108,14 @@ export default function AssetsPage(props: Props) { "Manage your organization's assets and their classifications." )} > - + - + @@ -72,7 +136,7 @@ export default function AssetsPage(props: Props) { /> ))} -
{__("Name")}
+ ); } @@ -87,7 +151,7 @@ function AssetRow({ const organizationId = useOrganizationId(); const { __ } = useTranslate(); const deleteAsset = useDeleteAsset(entry, connectionId); - const vendors = entry.vendors?.edges.map(edge => edge.node) ?? []; + const vendors = entry.vendors?.edges.map((edge) => edge.node) ?? []; return ( @@ -108,7 +172,11 @@ function AssetRow({ {vendors.length > 0 ? (
{vendors.slice(0, 3).map((vendor) => ( - + > + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type AssetOrderField = "AMOUNT" | "CREATED_AT" | "CRITICITY"; +export type OrderDirection = "ASC" | "DESC"; +export type AssetOrder = { + direction: OrderDirection; + field: AssetOrderField; +}; +export type AssetsListQuery$variables = { + after?: any | null | undefined; + before?: any | null | undefined; + first?: number | null | undefined; + id: string; + last?: number | null | undefined; + orderBy?: AssetOrder | null | undefined; +}; +export type AssetsListQuery$data = { + readonly node: { + readonly " $fragmentSpreads": FragmentRefs<"AssetsPageFragment">; + }; +}; +export type AssetsListQuery = { + response: AssetsListQuery$data; + variables: AssetsListQuery$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "after" +}, +v1 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "before" +}, +v2 = { + "defaultValue": 10, + "kind": "LocalArgument", + "name": "first" +}, +v3 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "id" +}, +v4 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "last" +}, +v5 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "orderBy" +}, +v6 = [ + { + "kind": "Variable", + "name": "id", + "variableName": "id" + } +], +v7 = [ + { + "kind": "Variable", + "name": "after", + "variableName": "after" + }, + { + "kind": "Variable", + "name": "before", + "variableName": "before" + }, + { + "kind": "Variable", + "name": "first", + "variableName": "first" + }, + { + "kind": "Variable", + "name": "last", + "variableName": "last" + }, + { + "kind": "Variable", + "name": "orderBy", + "variableName": "orderBy" + } +], +v8 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null +}, +v9 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v10 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null +}; +return { + "fragment": { + "argumentDefinitions": [ + (v0/*: any*/), + (v1/*: any*/), + (v2/*: any*/), + (v3/*: any*/), + (v4/*: any*/), + (v5/*: any*/) + ], + "kind": "Fragment", + "metadata": null, + "name": "AssetsListQuery", + "selections": [ + { + "alias": null, + "args": (v6/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "args": (v7/*: any*/), + "kind": "FragmentSpread", + "name": "AssetsPageFragment" + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": [ + (v0/*: any*/), + (v1/*: any*/), + (v2/*: any*/), + (v4/*: any*/), + (v5/*: any*/), + (v3/*: any*/) + ], + "kind": "Operation", + "name": "AssetsListQuery", + "selections": [ + { + "alias": null, + "args": (v6/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v8/*: any*/), + (v9/*: any*/), + { + "kind": "InlineFragment", + "selections": [ + { + "alias": null, + "args": (v7/*: any*/), + "concreteType": "AssetConnection", + "kind": "LinkedField", + "name": "assets", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "AssetEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Asset", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v9/*: any*/), + (v10/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "amount", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "criticity", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "assetType", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "dataTypesStored", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "People", + "kind": "LinkedField", + "name": "owner", + "plural": false, + "selections": [ + (v9/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fullName", + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": [ + { + "kind": "Literal", + "name": "first", + "value": 50 + } + ], + "concreteType": "VendorConnection", + "kind": "LinkedField", + "name": "vendors", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "VendorEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Vendor", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v9/*: any*/), + (v10/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "websiteUrl", + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": "vendors(first:50)" + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, + (v8/*: any*/) + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "PageInfo", + "kind": "LinkedField", + "name": "pageInfo", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "endCursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasNextPage", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasPreviousPage", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "startCursor", + "storageKey": null + } + ], + "storageKey": null + }, + { + "kind": "ClientExtension", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__id", + "storageKey": null + } + ] + } + ], + "storageKey": null + }, + { + "alias": null, + "args": (v7/*: any*/), + "filters": [ + "orderBy" + ], + "handle": "connection", + "key": "AssetsPage_assets", + "kind": "LinkedHandle", + "name": "assets" + } + ], + "type": "Organization", + "abstractKey": null + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "d712227ae7c1c1a4151005092f7eeaf9", + "id": null, + "metadata": {}, + "name": "AssetsListQuery", + "operationKind": "query", + "text": "query AssetsListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $first: Int = 10\n $last: Int = null\n $orderBy: AssetOrder = null\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...AssetsPageFragment_sdb03\n id\n }\n}\n\nfragment AssetsPageFragment_sdb03 on Organization {\n assets(first: $first, after: $after, last: $last, before: $before, orderBy: $orderBy) {\n edges {\n node {\n id\n name\n amount\n criticity\n assetType\n dataTypesStored\n owner {\n id\n fullName\n }\n vendors(first: 50) {\n edges {\n node {\n id\n name\n websiteUrl\n }\n }\n }\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n" + } +}; +})(); + +(node as any).hash = "e25e58aa9cf789614d280313c6059d5e"; + +export default node; diff --git a/apps/console/src/pages/organizations/assets/__generated__/AssetsPageFragment.graphql.ts b/apps/console/src/pages/organizations/assets/__generated__/AssetsPageFragment.graphql.ts new file mode 100644 index 000000000..80ed68700 --- /dev/null +++ b/apps/console/src/pages/organizations/assets/__generated__/AssetsPageFragment.graphql.ts @@ -0,0 +1,350 @@ +/** + * @generated SignedSource<<8bacf647a39e3c33616be7e9159928df>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ReaderFragment } from 'relay-runtime'; +export type AssetType = "PHYSICAL" | "VIRTUAL"; +export type CriticityLevel = "HIGH" | "LOW" | "MEDIUM"; +import { FragmentRefs } from "relay-runtime"; +export type AssetsPageFragment$data = { + readonly assets: { + readonly __id: string; + readonly edges: ReadonlyArray<{ + readonly node: { + readonly amount: number; + readonly assetType: AssetType; + readonly createdAt: any; + readonly criticity: CriticityLevel; + readonly dataTypesStored: string; + readonly id: string; + readonly name: string; + readonly owner: { + readonly fullName: string; + readonly id: string; + }; + readonly vendors: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly id: string; + readonly name: string; + readonly websiteUrl: string | null | undefined; + }; + }>; + }; + }; + }>; + }; + readonly id: string; + readonly " $fragmentType": "AssetsPageFragment"; +}; +export type AssetsPageFragment$key = { + readonly " $data"?: AssetsPageFragment$data; + readonly " $fragmentSpreads": FragmentRefs<"AssetsPageFragment">; +}; + +import AssetsListQuery_graphql from './AssetsListQuery.graphql'; + +const node: ReaderFragment = (function(){ +var v0 = [ + "assets" +], +v1 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v2 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null +}; +return { + "argumentDefinitions": [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "after" + }, + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "before" + }, + { + "defaultValue": 10, + "kind": "LocalArgument", + "name": "first" + }, + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "last" + }, + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "orderBy" + } + ], + "kind": "Fragment", + "metadata": { + "connection": [ + { + "count": null, + "cursor": null, + "direction": "bidirectional", + "path": (v0/*: any*/) + } + ], + "refetch": { + "connection": { + "forward": { + "count": "first", + "cursor": "after" + }, + "backward": { + "count": "last", + "cursor": "before" + }, + "path": (v0/*: any*/) + }, + "fragmentPathInResult": [ + "node" + ], + "operation": AssetsListQuery_graphql, + "identifierInfo": { + "identifierField": "id", + "identifierQueryVariableName": "id" + } + } + }, + "name": "AssetsPageFragment", + "selections": [ + { + "alias": "assets", + "args": [ + { + "kind": "Variable", + "name": "orderBy", + "variableName": "orderBy" + } + ], + "concreteType": "AssetConnection", + "kind": "LinkedField", + "name": "__AssetsPage_assets_connection", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "AssetEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Asset", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v1/*: any*/), + (v2/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "amount", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "criticity", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "assetType", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "dataTypesStored", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "People", + "kind": "LinkedField", + "name": "owner", + "plural": false, + "selections": [ + (v1/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fullName", + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": [ + { + "kind": "Literal", + "name": "first", + "value": 50 + } + ], + "concreteType": "VendorConnection", + "kind": "LinkedField", + "name": "vendors", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "VendorEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Vendor", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v1/*: any*/), + (v2/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "websiteUrl", + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": "vendors(first:50)" + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "PageInfo", + "kind": "LinkedField", + "name": "pageInfo", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "endCursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasNextPage", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasPreviousPage", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "startCursor", + "storageKey": null + } + ], + "storageKey": null + }, + { + "kind": "ClientExtension", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__id", + "storageKey": null + } + ] + } + ], + "storageKey": null + }, + (v1/*: any*/) + ], + "type": "Organization", + "abstractKey": null +}; +})(); + +(node as any).hash = "e25e58aa9cf789614d280313c6059d5e"; + +export default node;