diff --git a/apps/console/src/__generated__/core/NewDomainDialogMutation.graphql.ts b/apps/console/src/__generated__/core/NewDomainDialogMutation.graphql.ts index 560c63bdb..6f12b98d8 100644 --- a/apps/console/src/__generated__/core/NewDomainDialogMutation.graphql.ts +++ b/apps/console/src/__generated__/core/NewDomainDialogMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<098714fcfe212fae40bdad19b10f8a00>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -20,6 +20,7 @@ export type NewDomainDialogMutation$variables = { export type NewDomainDialogMutation$data = { readonly createCustomDomain: { readonly customDomain: { + readonly canDelete: boolean; readonly createdAt: string; readonly dnsRecords: ReadonlyArray<{ readonly name: string; @@ -159,6 +160,19 @@ v1 = [ "kind": "ScalarField", "name": "sslExpiresAt", "storageKey": null + }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:custom-domain:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:custom-domain:delete\")" } ], "storageKey": null @@ -185,16 +199,16 @@ return { "selections": (v1/*: any*/) }, "params": { - "cacheID": "b8aa27fe9ab3442dea9b96a70966524b", + "cacheID": "39d421d36a6418d0ee687d43b9d7a7ee", "id": null, "metadata": {}, "name": "NewDomainDialogMutation", "operationKind": "mutation", - "text": "mutation NewDomainDialogMutation(\n $input: CreateCustomDomainInput!\n) {\n createCustomDomain(input: $input) {\n customDomain {\n id\n domain\n sslStatus\n dnsRecords {\n type\n name\n value\n ttl\n purpose\n }\n createdAt\n updatedAt\n sslExpiresAt\n }\n }\n}\n" + "text": "mutation NewDomainDialogMutation(\n $input: CreateCustomDomainInput!\n) {\n createCustomDomain(input: $input) {\n customDomain {\n id\n domain\n sslStatus\n dnsRecords {\n type\n name\n value\n ttl\n purpose\n }\n createdAt\n updatedAt\n sslExpiresAt\n canDelete: permission(action: \"core:custom-domain:delete\")\n }\n }\n}\n" } }; })(); -(node as any).hash = "f49cd22c5d6656e662fad5afab6fc344"; +(node as any).hash = "37ef764ab4f78a6898f06d00374347ee"; export default node; diff --git a/apps/console/src/components/PageError.tsx b/apps/console/src/components/PageError.tsx index 4b64f1682..1c9ff2ac4 100644 --- a/apps/console/src/components/PageError.tsx +++ b/apps/console/src/components/PageError.tsx @@ -26,8 +26,8 @@ export function PageError({ resetErrorBoundary, error: propsError }: Props) { // Reset error boundary on page change useEffect(() => { if ( - location.pathname !== baseLocation.current.pathname && - resetErrorBoundary + location.pathname !== baseLocation.current.pathname + && resetErrorBoundary ) { resetErrorBoundary(); } @@ -54,7 +54,7 @@ export function PageError({ resetErrorBoundary, error: propsError }: Props) { ); } - if (!error || (error && error.toString().includes("PAGE_NOT_FOUND"))) { + if (!error || (error instanceof Error && error.message.includes("PAGE_NOT_FOUND"))) { return (

@@ -68,7 +68,7 @@ export function PageError({ resetErrorBoundary, error: propsError }: Props) { ); } - if (error && error.toString().includes("FORBIDDEN")) { + if (error instanceof Error && error.message.includes("FORBIDDEN")) { return (

@@ -82,7 +82,7 @@ export function PageError({ resetErrorBoundary, error: propsError }: Props) { ); } - if (error && error.toString().includes("UNAUTHORIZED")) { + if (error instanceof Error && error.message.includes("UNAUTHORIZED")) { return (

@@ -103,7 +103,8 @@ export function PageError({ resetErrorBoundary, error: propsError }: Props) { {__("Something went wrong")} -

{error.toString()}

+ {error instanceof Error + &&

{error.message}

}

); diff --git a/apps/console/src/components/SnapshotBanner.tsx b/apps/console/src/components/SnapshotBanner.tsx index b8cbe6698..6f8b2bbc3 100644 --- a/apps/console/src/components/SnapshotBanner.tsx +++ b/apps/console/src/components/SnapshotBanner.tsx @@ -46,8 +46,8 @@ export function SnapshotBanner({ snapshotId }: Props) { } if ( - snapshot.type && - !isSnapshotTypeValidForUrl(snapshot.type, location.pathname) + snapshot.type + && !isSnapshotTypeValidForUrl(snapshot.type, location.pathname) ) { throw new Error("PAGE_NOT_FOUND"); } @@ -58,7 +58,9 @@ export function SnapshotBanner({ snapshotId }: Props) {
- {__("Snapshot")} {snapshot.name} + {__("Snapshot")} + {" "} + {snapshot.name}

diff --git a/apps/console/src/components/assets/AssetsTable.tsx b/apps/console/src/components/assets/AssetsTable.tsx index 27b57db28..20b24b332 100644 --- a/apps/console/src/components/assets/AssetsTable.tsx +++ b/apps/console/src/components/assets/AssetsTable.tsx @@ -141,7 +141,7 @@ export function AssetsTable(props: Props) { edge.node) ?? []} + defaultValue={item?.vendors?.edges?.map(edge => edge.node) ?? []} /> )} @@ -163,7 +163,7 @@ const useDeleteAsset = (connectionId: string) => { promisifyMutation(mutate)({ variables: { input: { - assetId: asset.id!, + assetId: asset.id, }, connections: [connectionId], }, @@ -171,7 +171,7 @@ const useDeleteAsset = (connectionId: string) => { { message: sprintf( __( - 'This will permanently delete "%s". This action cannot be undone.', + "This will permanently delete \"%s\". This action cannot be undone.", ), asset.name, ), diff --git a/apps/console/src/components/assets/ReadOnlyAssetsTable.tsx b/apps/console/src/components/assets/ReadOnlyAssetsTable.tsx index ebae035d9..968aa1a4e 100644 --- a/apps/console/src/components/assets/ReadOnlyAssetsTable.tsx +++ b/apps/console/src/components/assets/ReadOnlyAssetsTable.tsx @@ -39,7 +39,7 @@ export function ReadOnlyAssetsTable(props: Props) { - {assets.map((entry) => ( + {assets.map(entry => ( ))} @@ -51,7 +51,7 @@ function AssetRow({ entry }: { entry: AssetEntry }) { const organizationId = useOrganizationId(); const { __ } = useTranslate(); const { snapshotId } = useParams<{ snapshotId?: string }>(); - const vendors = entry.vendors?.edges.map((edge) => edge.node) ?? []; + const vendors = entry.vendors?.edges.map(edge => edge.node) ?? []; return ( {entry.amount} {entry.owner?.fullName ?? __("Unassigned")} - {vendors.length > 0 ? ( -

- {vendors.slice(0, 3).map((vendor) => ( - - - {vendor.name} - - ))} - {vendors.length > 3 && ( - - +{vendors.length - 3} - + {vendors.length > 0 + ? ( +
+ {vendors.slice(0, 3).map(vendor => ( + + + {vendor.name} + + ))} + {vendors.length > 3 && ( + + + + {vendors.length - 3} + + )} +
+ ) + : ( + {__("None")} )} -
- ) : ( - {__("None")} - )} ); diff --git a/apps/console/src/components/audits/LinkedAuditsCard.tsx b/apps/console/src/components/audits/LinkedAuditsCard.tsx index 5621ac074..399f1bdb5 100644 --- a/apps/console/src/components/audits/LinkedAuditsCard.tsx +++ b/apps/console/src/components/audits/LinkedAuditsCard.tsx @@ -131,7 +131,7 @@ export function LinkedAuditsCard(props: Props) { )} - {audits.map((audit) => ( + {audits.map(audit => ( ) { const { __ } = useTranslate(); const [search, setSearch] = useState(""); const audits = useMemo( - () => data.audits?.edges?.map((edge) => edge.node) ?? [], + () => data.audits?.edges?.map(edge => edge.node) ?? [], [data.audits], ); const linkedIds = useMemo(() => { - return new Set(props.linkedAudits?.map((a) => a.id) ?? []); + return new Set(props.linkedAudits?.map(a => a.id) ?? []); }, [props.linkedAudits]); const filteredAudits = useMemo(() => { - return audits.filter((audit) => + return audits.filter(audit => (audit.name || "").toLowerCase().includes(search.toLowerCase()), ); }, [audits, search]); @@ -127,7 +127,7 @@ function LinkedAuditsDialogContent(props: Omit) { />
- {filteredAudits.map((audit) => ( + {filteredAudits.map(audit => ( - {isLinked ? __("Unlink") : __("Link")} + + {" "} + {isLinked ? __("Unlink") : __("Link")} diff --git a/apps/console/src/components/controls/LinkedControlsCard.tsx b/apps/console/src/components/controls/LinkedControlsCard.tsx index 9abe40266..167b82ef5 100644 --- a/apps/console/src/components/controls/LinkedControlsCard.tsx +++ b/apps/console/src/components/controls/LinkedControlsCard.tsx @@ -111,7 +111,7 @@ export function LinkedControlsCard(props: Props) { )} - {controls.map((control) => ( + {controls.map(control => ( - {control.framework.name}{" "} + {control.framework.name} + {" "} {control.sectionTitle} diff --git a/apps/console/src/components/controls/LinkedControlsDialog.tsx b/apps/console/src/components/controls/LinkedControlsDialog.tsx index 4eebf15e1..a240366a8 100644 --- a/apps/console/src/components/controls/LinkedControlsDialog.tsx +++ b/apps/console/src/components/controls/LinkedControlsDialog.tsx @@ -12,6 +12,7 @@ import { } from "@probo/ui"; import { Suspense, + useEffect, useMemo, useRef, useState, @@ -104,11 +105,11 @@ export function LinkedControlsDialog(props: Props) {
- } + )} > @@ -123,32 +124,37 @@ function LinkedControlsDialogContent(props: Props & { ref: SearchRef }) { const mainData = useLazyLoadQuery(query, { organizationId, }); - const { data, loadNext, hasNext, isLoadingNext, refetch } = - usePaginationFragment( - controlsFragment, - mainData.organization as LinkedControlsDialogFragment$key, - ); + const { data, loadNext, hasNext, isLoadingNext, refetch } = usePaginationFragment( + controlsFragment, + mainData.organization as LinkedControlsDialogFragment$key, + ); - const controls = data.controls?.edges?.map((edge) => edge.node) ?? []; + const controls = data.controls?.edges?.map(edge => edge.node) ?? []; const controlIds = useMemo(() => { - return new Set(props.linkedControls?.map((c) => c.id) ?? []); + return new Set(props.linkedControls?.map(c => c.id) ?? []); }, [props.linkedControls]); - props.ref.current = { - search: useDebounceCallback((v: string) => { - refetch({ - first: 20, - filter: { - query: v, - }, - }); - }, 500), - }; + const handleSearch = useDebounceCallback((v: string) => { + refetch({ + first: 20, + filter: { + query: v, + }, + }); + }, 500); + + useEffect(() => { + if (!props.ref.current) { + props.ref.current = { + search: handleSearch, + }; + } + }); return ( <>
- {controls.map((control) => ( + {controls.map(control => ( onClick(props.control.id)} > - {props.control.sectionTitle} : {props.control.name} + {props.control.sectionTitle} + {" "} + : + {props.control.name} {props.control.framework.name} diff --git a/apps/console/src/components/documents/BulkExportDialog.tsx b/apps/console/src/components/documents/BulkExportDialog.tsx index 061a92bec..ee1895e89 100644 --- a/apps/console/src/components/documents/BulkExportDialog.tsx +++ b/apps/console/src/components/documents/BulkExportDialog.tsx @@ -35,7 +35,7 @@ type BulkExportFormData = z.infer; type Props = { children: ReactNode; - onExport: (options: BulkExportFormData) => void; + onExport: (options: BulkExportFormData) => Promise; isLoading?: boolean; defaultEmail: string; selectedCount: number; @@ -59,7 +59,7 @@ export const BulkExportDialog = forwardRef( watermarkEmail: defaultEmail, withSignatures: true, }, - } + }, ); const watchWatermark = watch("withWatermark"); @@ -70,14 +70,14 @@ export const BulkExportDialog = forwardRef( close: () => dialogRef.current?.close(), })); - const onSubmit = handleSubmit((data) => { + const onSubmit = async (data: BulkExportFormData) => { const options = { ...data, watermarkEmail: data.withWatermark ? data.watermarkEmail : undefined, }; - onExport(options); + await onExport(options); dialogRef.current?.close(); - }); + }; return ( <> @@ -87,13 +87,13 @@ export const BulkExportDialog = forwardRef( ref={dialogRef} title={sprintf(__("Export %s Documents"), selectedCount)} > -
+ void handleSubmit(onSubmit)(e)}>
setValue("withSignatures", checked)} + onChange={checked => setValue("withSignatures", checked)} />