From bb166593f9982edaf91daa5ed38ca3fd7fdabd27 Mon Sep 17 00:00:00 2001 From: Sina Date: Tue, 18 Jun 2024 18:01:12 +0200 Subject: [PATCH] [hotfix] add nonce where applies (#256) --- src/assets/icons/aws-logo.svg | 15 +-- src/assets/icons/createIcon.tsx | 4 +- src/locales/de-DE/messages.po | 84 ++++++++-------- src/locales/en-US/messages.po | 84 ++++++++-------- .../inventory/InventoryAdvanceSearch.tsx | 3 + ...tingsAccountsSetupCloudGCPInstructions.tsx | 3 + ...orkspaceSettingsAccountsSetupCloudPage.tsx | 6 +- .../WorkspaceSettingsAccountRow.tsx | 4 +- .../WorkspaceSettingsUserRoles.tsx | 4 +- src/shared/charts/StackbarChart.tsx | 2 +- src/shared/cloud-avatar/CloudAvatar.tsx | 8 +- src/shared/react-window/ListboxComponent.tsx | 2 +- src/shared/splitter/Splitter.tsx | 97 +++++++++++-------- 13 files changed, 170 insertions(+), 146 deletions(-) diff --git a/src/assets/icons/aws-logo.svg b/src/assets/icons/aws-logo.svg index 385ce518..4d65360c 100644 --- a/src/assets/icons/aws-logo.svg +++ b/src/assets/icons/aws-logo.svg @@ -1,13 +1,6 @@ - - - + + \ No newline at end of file diff --git a/src/assets/icons/createIcon.tsx b/src/assets/icons/createIcon.tsx index 8d3fcec1..1f9a7e4d 100644 --- a/src/assets/icons/createIcon.tsx +++ b/src/assets/icons/createIcon.tsx @@ -1,13 +1,11 @@ import { Palette, useTheme } from '@mui/material' import { FC, FunctionComponent, SVGProps, forwardRef } from 'react' -import { useNonce } from 'src/shared/providers' type SvgIconProps = SVGProps & { title?: string; nonce?: string } export const createIcon = (Icon: FunctionComponent) => { const SvgIconComp: FC = forwardRef(({ color, fill, ...props }, ref) => { const { palette } = useTheme() - const nonce = useNonce() type KeyOfPalette = 'common' type PaletteAsObject = Palette[KeyOfPalette] type KeyOfPaletteAsObject = keyof PaletteAsObject @@ -22,7 +20,7 @@ export const createIcon = (Icon: FunctionComponent) => { ) { iconColor = palette[firstColorKey][secondColorKey as KeyOfPaletteAsObject] } - return + return }) SvgIconComp.displayName = Icon.displayName || Icon.name return SvgIconComp diff --git a/src/locales/de-DE/messages.po b/src/locales/de-DE/messages.po index b3f741ea..8f651b64 100644 --- a/src/locales/de-DE/messages.po +++ b/src/locales/de-DE/messages.po @@ -136,7 +136,7 @@ msgstr "<0>Datenschutzerklärung | <1>Allgemeine Geschäftsbedingungen" msgid "<0>Step 1: Scan the QR Code<1>First up, see this QR code on your screen? Grab your phone and open your favorite authenticator app (like Google Authenticator).<2>Step 2: Add a New Account<3>In the app, tap on \"Add\" or \"+\" to set up a new account. Select \"Scan a QR Code\" and point your phone's camera at the QR code displayed here. This will link your account to the app.<4><5/><6>Step 3: Enter the Code<7>Once linked, the app will display a 6-digit code. It changes every 30 seconds, so it's super fresh! Enter that code in the box below and hit \"Activate\". And voilà, you're all set!" msgstr "<0>Schritt 1: Scannen Sie den QR-Code<1>Zuerst, sehen Sie diesen QR-Code auf Ihrem Bildschirm? Nehmen Sie Ihr Handy und öffnen Sie Ihre bevorzugte Authenticator-App (wie Google Authenticator).<2>Schritt 2: Ein neues Konto hinzufügen<3>In der App, tippen Sie auf \"Hinzufügen\" oder \"+\", um ein neues Konto einzurichten. Wählen Sie \"QR-Code scannen\" und richten Sie die Kamera Ihres Handys auf den hier angezeigten QR-Code. Dies verknüpft Ihr Konto mit der App.<4><5/><6>Schritt 3: Geben Sie den Code ein<7>Sobald verknüpft, zeigt die App einen 6-stelligen Code an. Er ändert sich alle 30 Sekunden, also ist er super aktuell! Geben Sie diesen Code in das Feld unten ein und klicken Sie auf \"Aktivieren\". Und voilà, Sie sind fertig!" -#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:47 +#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:50 msgid "<0>This search is complex.The combo boxes below may not display all filter details but can help narrow your results. For full control, please use the Advanced tab." msgstr "" @@ -204,8 +204,8 @@ msgstr "" msgid "Accept" msgstr "Akzeptieren" -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:239 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:365 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:241 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:367 msgid "Access to your account is broken" msgstr "Der Zugriff auf Ihr Konto ist unterbrochen" @@ -278,13 +278,13 @@ msgstr "Manuell hinzufügen" msgid "Added accounts" msgstr "Konten hinzugefügt" -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:58 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:59 #: src/pages/panel/workspace-settings-users/workspaceSettingsUserRoleToString.ts:10 #: src/pages/panel/workspace-settings-users/workspaceSettingsUserRoleToString.ts:18 msgid "Admin" msgstr "Admin" -#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:72 +#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:75 msgid "Advanced" msgstr "" @@ -384,7 +384,7 @@ msgstr "Möchten Sie die Verbindung zu {name} wirklich trennen?" msgid "Are you sure you want to remove the {name} account {0}?" msgstr "Sind Sie sicher, dass Sie das {name}-Konto {0} entfernen möchten?" -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:383 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:385 #: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserInvitationRow.tsx:85 #: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRow.tsx:107 msgid "Are you sure?" @@ -408,7 +408,7 @@ msgstr "AWS Marketplace" msgid "AWS Marketplace has been successfully subscribed" msgstr "AWS Marketplace wurde erfolgreich abonniert" -#: src/pages/panel/workspace-settings-accounts-setup-cloud-gcp/WorkspaceSettingsAccountsSetupCloudGCPInstructions.tsx:90 +#: src/pages/panel/workspace-settings-accounts-setup-cloud-gcp/WorkspaceSettingsAccountsSetupCloudGCPInstructions.tsx:93 msgid "Back" msgstr "" @@ -446,7 +446,7 @@ msgstr "Benchmarks" msgid "Billing" msgstr "Abrechnung" -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:62 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:63 #: src/pages/panel/workspace-settings-users/workspaceSettingsUserRoleToString.ts:13 msgid "Billing Admin" msgstr "Abrechnungsadmin" @@ -466,14 +466,14 @@ msgstr "Business" #: src/pages/panel/user-settings/UserSettingsSocialNetworkDeleteButton.tsx:68 #: src/pages/panel/user-settings/UserSettingsTotpActivationModal.tsx:121 #: src/pages/panel/user-settings/UserSettingsTotpDeactivationModal.tsx:49 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:285 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:289 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:290 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:402 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:287 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:291 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:292 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:404 #: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserInvitationRow.tsx:92 -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:152 -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:156 -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:157 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:154 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:158 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:159 #: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRow.tsx:118 #: src/pages/panel/workspace-settings/workspace-settings-services/WorkspaceSettingsDisconnectServiceModal.tsx:57 #: src/pages/panel/workspace-settings/workspace-settings-services/WorkspaceSettingsEmailService.tsx:105 @@ -546,7 +546,7 @@ msgstr "Schließen" #: src/pages/panel/inventory/inventory-form/InventoryFormMore.tsx:96 #: src/pages/panel/resource-detail/ResourceDetailView.tsx:235 #: src/pages/panel/security/AccountCard.tsx:37 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:422 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:424 #: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountsTableItem.tsx:50 msgid "Cloud" msgstr "Cloud" @@ -625,7 +625,7 @@ msgstr "Verbundene Konten" msgid "Connected Services" msgstr "Vernetzte Dienste" -#: src/pages/panel/workspace-settings-accounts-setup-cloud-gcp/WorkspaceSettingsAccountsSetupCloudGCPInstructions.tsx:85 +#: src/pages/panel/workspace-settings-accounts-setup-cloud-gcp/WorkspaceSettingsAccountsSetupCloudGCPInstructions.tsx:88 msgid "Continue" msgstr "" @@ -723,10 +723,10 @@ msgid "Delayed Effect" msgstr "Verzögerte Wirkung" #: src/pages/panel/user-settings/UserSettingsSocialNetworkDeleteButton.tsx:79 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:352 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:356 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:357 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:413 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:354 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:358 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:359 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:415 #: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserInvitationRow.tsx:73 #: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserInvitationRow.tsx:77 #: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserInvitationRow.tsx:78 @@ -744,7 +744,7 @@ msgstr "Anbieter löschen" #: src/pages/panel/shared/setup-cloud-button/SetupCloudButton.tsx:13 #: src/pages/panel/shared/setup-cloud-button/SetupCloudButton.tsx:29 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:370 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:372 msgid "Deploy Stack" msgstr "Deploy Stack" @@ -786,7 +786,7 @@ msgstr "" msgid "Do not show me again" msgstr "Zeig es mir nicht noch einmal" -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:386 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:388 msgid "Do you want to delete this account?" msgstr "Möchten Sie dieses Konto löschen?" @@ -816,10 +816,10 @@ msgstr "CSV herunterladen" msgid "Drop Service Account Key File" msgstr "" -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:301 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:302 -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:173 -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:174 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:303 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:304 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:175 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:176 msgid "Edit" msgstr "Edit" @@ -974,8 +974,8 @@ msgstr "Passwort vergessen? Klicken Sie hier, um Ihr Passwort zurückzusetzen." msgid "Forgot Password" msgstr "Passwort vergessen" -#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:60 #: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:63 +#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:66 msgid "Form" msgstr "" @@ -1043,7 +1043,7 @@ msgstr "" #: src/pages/panel/resource-detail/ResourceDetailView.tsx:232 #: src/pages/panel/security/AccountCard.tsx:34 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:419 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:421 #: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountsTableItem.tsx:53 #: src/shared/charts/NetworkDiagram.tsx:407 msgid "ID" @@ -1237,7 +1237,7 @@ msgstr "maximal {0} Cloud-Konten" msgid "Medium" msgstr "Mittel" -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:64 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:65 #: src/pages/panel/workspace-settings-users/workspaceSettingsUserRoleToString.ts:16 msgid "Member" msgstr "Mitglied" @@ -1273,7 +1273,7 @@ msgstr "Die meisten nicht konformen Konten" #: src/pages/panel/benchmark-detail/BenchmarkDetailCheckDetail.tsx:173 #: src/pages/panel/resource-detail/ResourceDetailView.tsx:233 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:425 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:427 #: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountsTableItem.tsx:56 #: src/pages/panel/workspace-settings-external-directory/AddExternalDirectory.tsx:42 #: src/pages/panel/workspace-settings-external-directory/AddExternalDirectory.tsx:46 @@ -1370,7 +1370,7 @@ msgstr "" msgid "Non-Compliant Resources" msgstr "" -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:389 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:391 msgid "Note: You are about to delete a management or delegated admin account. Please be aware that once deleted, we will no longer have the capability to retrieve any account names, requiring you to edit them manually." msgstr "Sie löschen gerade ein Management- oder delegiertes Admin-Konto. Beachten Sie bitte, dass wir nach der Löschung nicht mehr in der Lage sein werden, Kontonamen abzurufen, wodurch Sie diese manuell bearbeiten müssen." @@ -1415,7 +1415,7 @@ msgstr "Einmal" msgid "Oops, the username or password doesn't seem to match our records. Please try again." msgstr "Hoppla, der Benutzername oder das Passwort scheinen nicht mit unseren Aufzeichnungen übereinzustimmen. Bitte versuche es erneut." -#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:94 +#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:97 #: src/pages/panel/inventory/InventoryAdvanceSearchTextField.tsx:114 msgid "Oops! It looks like your query didn't match our format. Please check and try again." msgstr "Ups! Ihre Eingabe entspricht nicht unserem Format. Bitte überprüfen Sie sie und versuchen Sie es erneut." @@ -1473,7 +1473,7 @@ msgstr "Andere Arbeitsbereichseinstellungen" msgid "OTP Code" msgstr "OTP-Code" -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:60 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:61 #: src/pages/panel/workspace-settings-users/workspaceSettingsUserRoleToString.ts:7 msgid "Owner" msgstr "Eigentümer" @@ -1557,11 +1557,11 @@ msgstr "" msgid "Print or copy the following recovery codes" msgstr "Drucken oder kopieren Sie die folgenden Wiederherstellungscodes" -#: src/shared/cloud-avatar/CloudAvatar.tsx:44 +#: src/shared/cloud-avatar/CloudAvatar.tsx:46 msgid "Privileged" msgstr "Privilegiert" -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:234 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:236 msgid "Privileged account" msgstr "Privilegiertes Konto" @@ -1821,11 +1821,11 @@ msgstr "Es ist ein Fehler aufgetreten. Bitte versuchen Sie es später noch einma msgid "Sources" msgstr "Quellen" -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:274 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:275 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:280 -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:145 -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:146 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:276 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:277 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:282 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:147 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:148 msgid "Submit" msgstr "Einreichen" @@ -1887,7 +1887,7 @@ msgstr "" msgid "There's no account configured for this workspace." msgstr "Für diesen Arbeitsbereich ist kein Konto konfiguriert." -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:375 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:377 msgid "This account is currently in a degraded state possibly due to a misconfiguration. Fix was unable to access the account. To resume security scans, please log into account {accountName} ({0}) and re-deploy the CloudFormation stack that establishes the IAM role trust." msgstr "Dieses Konto befindet sich derzeit in einem nicht-funktionalen Zustand, möglicherweise aufgrund einer Fehlkonfiguration. Fix konnte nicht auf das Konto zugreifen. Um die Sicherheitsscans fortzusetzen, loggen Sie sich bitte in das Konto {accountName} ({0}) ein und erzeugen Sie den CloudFormation-Stacks, der die IAM Vertrauensstellung herstellt, erneut." diff --git a/src/locales/en-US/messages.po b/src/locales/en-US/messages.po index ed3dd005..83b5015b 100644 --- a/src/locales/en-US/messages.po +++ b/src/locales/en-US/messages.po @@ -136,7 +136,7 @@ msgstr "<0>Privacy policy | <1>Terms and conditions" msgid "<0>Step 1: Scan the QR Code<1>First up, see this QR code on your screen? Grab your phone and open your favorite authenticator app (like Google Authenticator).<2>Step 2: Add a New Account<3>In the app, tap on \"Add\" or \"+\" to set up a new account. Select \"Scan a QR Code\" and point your phone's camera at the QR code displayed here. This will link your account to the app.<4><5/><6>Step 3: Enter the Code<7>Once linked, the app will display a 6-digit code. It changes every 30 seconds, so it's super fresh! Enter that code in the box below and hit \"Activate\". And voilà, you're all set!" msgstr "<0>Step 1: Scan the QR Code<1>First up, see this QR code on your screen? Grab your phone and open your favorite authenticator app (like Google Authenticator).<2>Step 2: Add a New Account<3>In the app, tap on \"Add\" or \"+\" to set up a new account. Select \"Scan a QR Code\" and point your phone's camera at the QR code displayed here. This will link your account to the app.<4><5/><6>Step 3: Enter the Code<7>Once linked, the app will display a 6-digit code. It changes every 30 seconds, so it's super fresh! Enter that code in the box below and hit \"Activate\". And voilà, you're all set!" -#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:47 +#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:50 msgid "<0>This search is complex.The combo boxes below may not display all filter details but can help narrow your results. For full control, please use the Advanced tab." msgstr "<0>This search is complex.The combo boxes below may not display all filter details but can help narrow your results. For full control, please use the Advanced tab." @@ -204,8 +204,8 @@ msgstr "above" msgid "Accept" msgstr "Accept" -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:239 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:365 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:241 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:367 msgid "Access to your account is broken" msgstr "Access to your account is broken" @@ -278,13 +278,13 @@ msgstr "Add Manually" msgid "Added accounts" msgstr "Added accounts" -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:58 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:59 #: src/pages/panel/workspace-settings-users/workspaceSettingsUserRoleToString.ts:10 #: src/pages/panel/workspace-settings-users/workspaceSettingsUserRoleToString.ts:18 msgid "Admin" msgstr "Admin" -#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:72 +#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:75 msgid "Advanced" msgstr "Advanced" @@ -384,7 +384,7 @@ msgstr "Are you sure you want to disconnect {name}?" msgid "Are you sure you want to remove the {name} account {0}?" msgstr "Are you sure you want to remove the {name} account {0}?" -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:383 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:385 #: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserInvitationRow.tsx:85 #: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRow.tsx:107 msgid "Are you sure?" @@ -408,7 +408,7 @@ msgstr "AWS Marketplace" msgid "AWS Marketplace has been successfully subscribed" msgstr "AWS Marketplace has been successfully subscribed" -#: src/pages/panel/workspace-settings-accounts-setup-cloud-gcp/WorkspaceSettingsAccountsSetupCloudGCPInstructions.tsx:90 +#: src/pages/panel/workspace-settings-accounts-setup-cloud-gcp/WorkspaceSettingsAccountsSetupCloudGCPInstructions.tsx:93 msgid "Back" msgstr "Back" @@ -446,7 +446,7 @@ msgstr "Benchmarks" msgid "Billing" msgstr "Billing" -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:62 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:63 #: src/pages/panel/workspace-settings-users/workspaceSettingsUserRoleToString.ts:13 msgid "Billing Admin" msgstr "Billing Admin" @@ -466,14 +466,14 @@ msgstr "Business" #: src/pages/panel/user-settings/UserSettingsSocialNetworkDeleteButton.tsx:68 #: src/pages/panel/user-settings/UserSettingsTotpActivationModal.tsx:121 #: src/pages/panel/user-settings/UserSettingsTotpDeactivationModal.tsx:49 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:285 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:289 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:290 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:402 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:287 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:291 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:292 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:404 #: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserInvitationRow.tsx:92 -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:152 -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:156 -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:157 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:154 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:158 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:159 #: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRow.tsx:118 #: src/pages/panel/workspace-settings/workspace-settings-services/WorkspaceSettingsDisconnectServiceModal.tsx:57 #: src/pages/panel/workspace-settings/workspace-settings-services/WorkspaceSettingsEmailService.tsx:105 @@ -546,7 +546,7 @@ msgstr "Close" #: src/pages/panel/inventory/inventory-form/InventoryFormMore.tsx:96 #: src/pages/panel/resource-detail/ResourceDetailView.tsx:235 #: src/pages/panel/security/AccountCard.tsx:37 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:422 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:424 #: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountsTableItem.tsx:50 msgid "Cloud" msgstr "Cloud" @@ -625,7 +625,7 @@ msgstr "Connected Accounts" msgid "Connected Services" msgstr "Connected Services" -#: src/pages/panel/workspace-settings-accounts-setup-cloud-gcp/WorkspaceSettingsAccountsSetupCloudGCPInstructions.tsx:85 +#: src/pages/panel/workspace-settings-accounts-setup-cloud-gcp/WorkspaceSettingsAccountsSetupCloudGCPInstructions.tsx:88 msgid "Continue" msgstr "Continue" @@ -723,10 +723,10 @@ msgid "Delayed Effect" msgstr "Delayed Effect" #: src/pages/panel/user-settings/UserSettingsSocialNetworkDeleteButton.tsx:79 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:352 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:356 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:357 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:413 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:354 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:358 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:359 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:415 #: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserInvitationRow.tsx:73 #: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserInvitationRow.tsx:77 #: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserInvitationRow.tsx:78 @@ -744,7 +744,7 @@ msgstr "Delete Provider" #: src/pages/panel/shared/setup-cloud-button/SetupCloudButton.tsx:13 #: src/pages/panel/shared/setup-cloud-button/SetupCloudButton.tsx:29 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:370 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:372 msgid "Deploy Stack" msgstr "Deploy Stack" @@ -786,7 +786,7 @@ msgstr "Disposable email domains are not allowed" msgid "Do not show me again" msgstr "Do not show me again" -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:386 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:388 msgid "Do you want to delete this account?" msgstr "Do you want to delete this account?" @@ -816,10 +816,10 @@ msgstr "Download CSV" msgid "Drop Service Account Key File" msgstr "Drop Service Account Key File" -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:301 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:302 -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:173 -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:174 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:303 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:304 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:175 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:176 msgid "Edit" msgstr "Edit" @@ -974,8 +974,8 @@ msgstr "Forget your password? Click here to reset your password." msgid "Forgot Password" msgstr "Forgot Password" -#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:60 #: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:63 +#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:66 msgid "Form" msgstr "Form" @@ -1043,7 +1043,7 @@ msgstr "Id" #: src/pages/panel/resource-detail/ResourceDetailView.tsx:232 #: src/pages/panel/security/AccountCard.tsx:34 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:419 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:421 #: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountsTableItem.tsx:53 #: src/shared/charts/NetworkDiagram.tsx:407 msgid "ID" @@ -1237,7 +1237,7 @@ msgstr "maximum of {0} cloud accounts" msgid "Medium" msgstr "Medium" -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:64 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:65 #: src/pages/panel/workspace-settings-users/workspaceSettingsUserRoleToString.ts:16 msgid "Member" msgstr "Member" @@ -1273,7 +1273,7 @@ msgstr "Most Non-Compliant Accounts" #: src/pages/panel/benchmark-detail/BenchmarkDetailCheckDetail.tsx:173 #: src/pages/panel/resource-detail/ResourceDetailView.tsx:233 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:425 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:427 #: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountsTableItem.tsx:56 #: src/pages/panel/workspace-settings-external-directory/AddExternalDirectory.tsx:42 #: src/pages/panel/workspace-settings-external-directory/AddExternalDirectory.tsx:46 @@ -1370,7 +1370,7 @@ msgstr "Node Vulnerable" msgid "Non-Compliant Resources" msgstr "Non-Compliant Resources" -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:389 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:391 msgid "Note: You are about to delete a management or delegated admin account. Please be aware that once deleted, we will no longer have the capability to retrieve any account names, requiring you to edit them manually." msgstr "Note: You are about to delete a management or delegated admin account. Please be aware that once deleted, we will no longer have the capability to retrieve any account names, requiring you to edit them manually." @@ -1415,7 +1415,7 @@ msgstr "One time" msgid "Oops, the username or password doesn't seem to match our records. Please try again." msgstr "Oops, the username or password doesn't seem to match our records. Please try again." -#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:94 +#: src/pages/panel/inventory/InventoryAdvanceSearch.tsx:97 #: src/pages/panel/inventory/InventoryAdvanceSearchTextField.tsx:114 msgid "Oops! It looks like your query didn't match our format. Please check and try again." msgstr "Oops! It looks like your query didn't match our format. Please check and try again." @@ -1473,7 +1473,7 @@ msgstr "Other Workspace Settings" msgid "OTP Code" msgstr "OTP Code" -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:60 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:61 #: src/pages/panel/workspace-settings-users/workspaceSettingsUserRoleToString.ts:7 msgid "Owner" msgstr "Owner" @@ -1557,11 +1557,11 @@ msgstr "Press: Create Service and fill out the form." msgid "Print or copy the following recovery codes" msgstr "Print or copy the following recovery codes" -#: src/shared/cloud-avatar/CloudAvatar.tsx:44 +#: src/shared/cloud-avatar/CloudAvatar.tsx:46 msgid "Privileged" msgstr "Privileged" -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:234 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:236 msgid "Privileged account" msgstr "Privileged account" @@ -1821,11 +1821,11 @@ msgstr "Something went wrong please try again later." msgid "Sources" msgstr "Sources" -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:274 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:275 -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:280 -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:145 -#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:146 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:276 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:277 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:282 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:147 +#: src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx:148 msgid "Submit" msgstr "Submit" @@ -1887,7 +1887,7 @@ msgstr "The workspace you requested cannot be accessed. Please request access fr msgid "There's no account configured for this workspace." msgstr "There's no account configured for this workspace." -#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:375 +#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx:377 msgid "This account is currently in a degraded state possibly due to a misconfiguration. Fix was unable to access the account. To resume security scans, please log into account {accountName} ({0}) and re-deploy the CloudFormation stack that establishes the IAM role trust." msgstr "This account is currently in a degraded state possibly due to a misconfiguration. Fix was unable to access the account. To resume security scans, please log into account {accountName} ({0}) and re-deploy the CloudFormation stack that establishes the IAM role trust." diff --git a/src/pages/panel/inventory/InventoryAdvanceSearch.tsx b/src/pages/panel/inventory/InventoryAdvanceSearch.tsx index d740b969..dd6acfad 100644 --- a/src/pages/panel/inventory/InventoryAdvanceSearch.tsx +++ b/src/pages/panel/inventory/InventoryAdvanceSearch.tsx @@ -7,6 +7,7 @@ import { Alert, AlertTitle, Badge, Box, Collapse, FormHelperText, Stack, Tab, To import { Suspense, useState } from 'react' import { ErrorBoundaryFallback, NetworkErrorBoundary } from 'src/shared/error-boundary-fallback' import { useFixQueryParser } from 'src/shared/fix-query-parser' +import { useNonce } from 'src/shared/providers' import { InventoryAdvanceSearchTextField } from './InventoryAdvanceSearchTextField' import { InventoryForm, InventoryFormsSkeleton } from './inventory-form' @@ -18,6 +19,7 @@ interface InventoryAdvanceSearchProps { type TabsType = 'form' | 'advance' export const InventoryAdvanceSearch = ({ hasError, hasChanges }: InventoryAdvanceSearchProps) => { + const nonce = useNonce() const [tab, setTab] = useState('form') const { error, uiSimpleQuery, q } = useFixQueryParser() const hasSomethingExtra = !!q && q !== 'all' && !uiSimpleQuery @@ -36,6 +38,7 @@ export const InventoryAdvanceSearch = ({ hasError, hasChanges }: InventoryAdvanc ({ export const WorkspaceSettingsAccountsSetupCloudGCPInstructions = ({ isMobile, }: WorkspaceSettingsAccountsSetupCloudGCPInstructionsProps) => { + const nonce = useNonce() const [activeStep, setActiveStep] = usePersistState('WorkspaceSettingsAccountsSetupCloudGCP.activeStep', 0) const timeout = useRef() const instructions = getInstructions(isMobile) @@ -69,6 +71,7 @@ export const WorkspaceSettingsAccountsSetupCloudGCPInstructions = ({ effect="opacity" placeholder={} wrapperProps={{ + nonce, style: { color: 'transparent', display: 'inline-block', diff --git a/src/pages/panel/workspace-settings-accounts-setup-cloud/WorkspaceSettingsAccountsSetupCloudPage.tsx b/src/pages/panel/workspace-settings-accounts-setup-cloud/WorkspaceSettingsAccountsSetupCloudPage.tsx index a29d1262..517fbe99 100644 --- a/src/pages/panel/workspace-settings-accounts-setup-cloud/WorkspaceSettingsAccountsSetupCloudPage.tsx +++ b/src/pages/panel/workspace-settings-accounts-setup-cloud/WorkspaceSettingsAccountsSetupCloudPage.tsx @@ -1,8 +1,10 @@ import { Button, Stack, Typography } from '@mui/material' import { Link } from 'react-router-dom' import { AwsLogo, GcpLogo } from 'src/assets/icons' +import { useNonce } from 'src/shared/providers' export default function WorkspaceSettingsAccountsSetupCloudPage() { + const nonce = useNonce() return ( @@ -21,7 +23,7 @@ export default function WorkspaceSettingsAccountsSetupCloudPage() { alignItems: 'center', }} > - + Amazon Web Services @@ -42,7 +44,7 @@ export default function WorkspaceSettingsAccountsSetupCloudPage() { alignItems: 'center', }} > - + Google Cloud Platform diff --git a/src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx b/src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx index 460b0ffe..4d7f61a3 100644 --- a/src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx +++ b/src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountRow.tsx @@ -24,6 +24,7 @@ import { Link } from 'react-router-dom' import { useUserProfile } from 'src/core/auth' import { CloudAvatar } from 'src/shared/cloud-avatar' import { Modal } from 'src/shared/modal' +import { useNonce } from 'src/shared/providers' import { GetWorkspaceInventoryReportSummaryResponse } from 'src/shared/types/server' import { Account } from 'src/shared/types/server-shared' import { getAccountName } from 'src/shared/utils/getAccountName' @@ -49,6 +50,7 @@ export const WorkspaceSettingsAccountRow = ({ account, isNotConfigured }: Worksp const { selectedWorkspace, checkPermission } = useUserProfile() const hasPermission = checkPermission('updateCloudAccounts') const queryClient = useQueryClient() + const nonce = useNonce() const { mutate: renameAccount, isPending: renameAccountIsPending } = useMutation({ mutationFn: patchAccountMutation, @@ -264,7 +266,7 @@ export const WorkspaceSettingsAccountRow = ({ account, isNotConfigured }: Worksp variant="standard" autoFocus margin="none" - inputProps={{ style: { padding: '0' } }} + inputProps={{ nonce, style: { padding: '0' } }} inputRef={inputRef} disabled={renameAccountIsPending} /> diff --git a/src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx b/src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx index c451cc8b..907d5155 100644 --- a/src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx +++ b/src/pages/panel/workspace-settings-users/WorkspaceSettingsUserRoles.tsx @@ -6,6 +6,7 @@ import { Autocomplete, CircularProgress, IconButton, Stack, TextField, Tooltip, import { useMutation, useQueryClient } from '@tanstack/react-query' import { FormEvent, useState } from 'react' import { useUserProfile } from 'src/core/auth' +import { useNonce } from 'src/shared/providers' import { GetWorkspaceUsersResponse } from 'src/shared/types/server' import { UserRole } from 'src/shared/types/server-shared' import { putWorkspaceRolesMutation } from './putWorkspaceRoles.mutation' @@ -71,6 +72,7 @@ interface WorkspaceSettingsUserRolesProps { } export const WorkspaceSettingsUserRoles = ({ role, userId }: WorkspaceSettingsUserRolesProps) => { + const nonce = useNonce() const { selectedWorkspace, checkPermission } = useUserProfile() const hasUpdateRolesPermission = checkPermission('updateRoles') const [rolesValues, setValues] = useState(userRolesToAutocompleteOptions(role)) @@ -134,7 +136,7 @@ export const WorkspaceSettingsUserRoles = ({ role, userId }: WorkspaceSettingsUs autoFocus variant="standard" margin="none" - inputProps={{ ...params.inputProps, style: { ...params.inputProps.style, padding: '0' } }} + inputProps={{ ...params.inputProps, nonce, style: { ...params.inputProps.style, padding: '0' } }} /> )} /> diff --git a/src/shared/charts/StackbarChart.tsx b/src/shared/charts/StackbarChart.tsx index 35ad8ea4..3d45d600 100644 --- a/src/shared/charts/StackbarChart.tsx +++ b/src/shared/charts/StackbarChart.tsx @@ -87,7 +87,7 @@ export function StackbarChart({ data, colors }: StackbarChartProps) { {payload?.map(({ value, color }, i) => ( -
+
{value} diff --git a/src/shared/cloud-avatar/CloudAvatar.tsx b/src/shared/cloud-avatar/CloudAvatar.tsx index a201892d..8a395794 100644 --- a/src/shared/cloud-avatar/CloudAvatar.tsx +++ b/src/shared/cloud-avatar/CloudAvatar.tsx @@ -3,6 +3,7 @@ import WarningAmberIcon from '@mui/icons-material/WarningAmber' import { Avatar, Box, ButtonBase, Paper, Tooltip, Typography } from '@mui/material' import { ReactNode } from 'react' import { AwsLogo, Crown, FixLogo, GcpLogo } from 'src/assets/icons' +import { useNonce } from 'src/shared/providers' export interface CloudAvatarProps { cloud: string @@ -14,14 +15,15 @@ export interface CloudAvatarProps { } const CloudIcon = ({ cloud, small, withCrown }: CloudAvatarProps) => { + const nonce = useNonce() const size = small ? 30 : 40 switch (cloud.toLowerCase()) { case 'fix': - return + return case 'aws': - return + return case 'gcp': - return + return default: return ( diff --git a/src/shared/react-window/ListboxComponent.tsx b/src/shared/react-window/ListboxComponent.tsx index 09a4118c..946de79f 100644 --- a/src/shared/react-window/ListboxComponent.tsx +++ b/src/shared/react-window/ListboxComponent.tsx @@ -25,7 +25,7 @@ function RenderRow({ return ( - + {option} diff --git a/src/shared/splitter/Splitter.tsx b/src/shared/splitter/Splitter.tsx index d82f5b6c..f772d327 100644 --- a/src/shared/splitter/Splitter.tsx +++ b/src/shared/splitter/Splitter.tsx @@ -51,6 +51,16 @@ export interface SplitterProps { nonce?: string } +const setNonce = (elements: HTMLElement[], nonce?: string) => { + if (nonce) { + for (const el of elements) { + if (el.nonce !== nonce) { + el.nonce = nonce + } + } + } +} + export const Splitter = ({ direction = SplitDirection.Horizontal, minWidths = [], @@ -94,6 +104,8 @@ export const Splitter = ({ const pair = state.pairs[gutterIdx] onResizeStarted?.(pair.idx) + setNonce([pair.a, pair.b, pair.gutter, pair.parent, window.document.body], nonce) + // Disable selection. pair.a.style.userSelect = 'none' pair.b.style.userSelect = 'none' @@ -109,50 +121,54 @@ export const Splitter = ({ [state.pairs], ) - const stopDragging = useCallback(() => { - dispatch({ - type: ActionType.StopDragging, - }) + const stopDragging = useCallback( + () => { + dispatch({ + type: ActionType.StopDragging, + }) - // The callback receives an index of the resized pair and new sizes of all child elements. - const allSizes: number[] = [] - for (let idx = 0; idx < state.pairs.length; idx++) { - const pair = state.pairs[idx] - const parentSize = getInnerSize(direction, pair.parent) - if (parentSize === undefined) throw new Error(`Cannot call the 'onResizeFinished' callback - parentSize is undefined`) - if (pair.gutterSize === undefined) throw new Error(`Cannot call 'onResizeFinished' callback - gutterSize is undefined`) + // The callback receives an index of the resized pair and new sizes of all child elements. + const allSizes: number[] = [] + for (let idx = 0; idx < state.pairs.length; idx++) { + const pair = state.pairs[idx] + const parentSize = getInnerSize(direction, pair.parent) + if (parentSize === undefined) throw new Error(`Cannot call the 'onResizeFinished' callback - parentSize is undefined`) + if (pair.gutterSize === undefined) throw new Error(`Cannot call 'onResizeFinished' callback - gutterSize is undefined`) - const isFirst = idx === 0 - const isLast = idx === state.pairs.length - 1 + const isFirst = idx === 0 + const isLast = idx === state.pairs.length - 1 - const aSize = pair.a.getBoundingClientRect()[direction === SplitDirection.Horizontal ? 'width' : 'height'] - const { aGutterSize, bGutterSize } = getGutterSizes(pair.gutterSize, isFirst, isLast) - const aSizePct = ((aSize + aGutterSize) / parentSize) * 100 - allSizes.push(aSizePct) + const aSize = pair.a.getBoundingClientRect()[direction === SplitDirection.Horizontal ? 'width' : 'height'] + const { aGutterSize, bGutterSize } = getGutterSizes(pair.gutterSize, isFirst, isLast) + const aSizePct = ((aSize + aGutterSize) / parentSize) * 100 + allSizes.push(aSizePct) - if (isLast) { - const bSize = pair.b.getBoundingClientRect()[direction === SplitDirection.Horizontal ? 'width' : 'height'] - const bSizePct = ((bSize + bGutterSize) / parentSize) * 100 - allSizes.push(bSizePct) + if (isLast) { + const bSize = pair.b.getBoundingClientRect()[direction === SplitDirection.Horizontal ? 'width' : 'height'] + const bSizePct = ((bSize + bGutterSize) / parentSize) * 100 + allSizes.push(bSizePct) + } } - } - if (state.draggingIdx === undefined) throw new Error(`Could not reset cursor and user-select because 'state.draggingIdx' is undefined`) - const pair = state.pairs[state.draggingIdx] - onResizeFinished?.(pair.idx, allSizes) + if (state.draggingIdx === undefined) + throw new Error(`Could not reset cursor and user-select because 'state.draggingIdx' is undefined`) + const pair = state.pairs[state.draggingIdx] + onResizeFinished?.(pair.idx, allSizes) - // Disable selection. - pair.a.style.userSelect = '' - pair.b.style.userSelect = '' + // Disable selection. + pair.a.style.userSelect = '' + pair.b.style.userSelect = '' - // Set the mouse cursor. - // Must be done at multiple levels, not just for a gutter. - // The mouse cursor might move outside of the gutter element. - pair.gutter.style.cursor = '' - pair.parent.style.cursor = '' - window.document.body.style.cursor = '' + // Set the mouse cursor. + // Must be done at multiple levels, not just for a gutter. + // The mouse cursor might move outside of the gutter element. + pair.gutter.style.cursor = '' + pair.parent.style.cursor = '' + window.document.body.style.cursor = '' + }, // eslint-disable-next-line react-hooks/exhaustive-deps - }, [state.draggingIdx, state.pairs, direction]) + [state.draggingIdx, state.pairs, direction], + ) const calculateSizes = useCallback((direction: SplitDirection, gutterIdx: number) => { dispatch({ @@ -172,7 +188,7 @@ export const Splitter = ({ // This method is called on the initial render. // It iterates through the all children sets their initial sizes. const setInitialSizes = useCallback( - (direction: SplitDirection, children: HTMLElement[], gutters: HTMLElement[], initialSizes?: number[]) => { + (direction: SplitDirection, children: HTMLElement[], gutters: HTMLElement[], initialSizes?: number[], nonce?: string) => { // All children must have common parent. const parent = children[0].parentNode if (!parent) throw new Error(`Cannot set initial sizes - parent is undefined`) @@ -198,6 +214,8 @@ export const Splitter = ({ calc = `calc(${100 / children.length}% - ${gutterSize}px)` } + setNonce([c], nonce) + if (direction === SplitDirection.Horizontal) { c.style.width = calc // Reset the child wrapper's height because the direction could have changed. @@ -245,6 +263,7 @@ export const Splitter = ({ const aCalc = `calc(${aSizePct}% - ${aGutterSize}px)` const bCalc = `calc(${bSizePct}% - ${bGutterSize}px)` + if (direction === SplitDirection.Horizontal) { pair.a.style.width = aCalc pair.b.style.width = bCalc @@ -364,14 +383,14 @@ export const Splitter = ({ // Don't create pairs if there's only one child. if (children.length <= 1) { - setInitialSizes(direction, childRefs.current, gutterRefs.current, initialSizes) + setInitialSizes(direction, childRefs.current, gutterRefs.current, initialSizes, nonce) } else { - setInitialSizes(direction, childRefs.current, gutterRefs.current, initialSizes) + setInitialSizes(direction, childRefs.current, gutterRefs.current, initialSizes, nonce) createPairs(direction, childRefs.current, gutterRefs.current) } }, // eslint-disable-next-line react-hooks/exhaustive-deps - [reactChildren, state.isReady, direction, setInitialSizes, createPairs, initialSizes], + [reactChildren, state.isReady, direction, setInitialSizes, createPairs, initialSizes, nonce], ) function addRef(refs: typeof childRefs, el: HTMLElement | null) {