Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] resources number and content in world map #311

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/locales/de-DE/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ msgstr "{0} Millisekunden"
msgid "{0} per"
msgstr ""

#: src/pages/panel/dashboard/WorldMap.tsx:345
#: src/pages/panel/dashboard/WorldMap.tsx:421
msgid "{0} Regions"
msgstr ""

#: src/pages/panel/dashboard/DashboardPage.tsx:163
msgid "{0} resources in {1} regions, {2} countries"
#: src/pages/panel/dashboard/DashboardPage.tsx:161
msgid "{0} regions, {1} countries"
msgstr ""

#: src/pages/panel/security/OverallScore.tsx:60
Expand Down Expand Up @@ -164,7 +164,7 @@ msgstr ""
msgid "/ month / cloud account"
msgstr "/ Monat / Cloud-Konto"

#: src/pages/panel/dashboard/WorldMap.tsx:326
#: src/pages/panel/dashboard/WorldMap.tsx:400
msgid "# of Resources"
msgstr ""

Expand Down Expand Up @@ -520,15 +520,15 @@ msgstr "Sind Sie sicher, dass Sie das {name}-Konto {0} entfernen möchten?"
msgid "Are you sure?"
msgstr "Bist du sicher?"

#: src/pages/panel/dashboard/DashboardPage.tsx:129
#: src/pages/panel/dashboard/DashboardPage.tsx:127
msgid "Asset summary"
msgstr ""

#: src/pages/panel/dashboard/getSlides.tsx:47
msgid "Asset Summary"
msgstr ""

#: src/pages/panel/dashboard/DashboardPage.tsx:161
#: src/pages/panel/dashboard/DashboardPage.tsx:159
#: src/pages/panel/dashboard/getSlides.tsx:115
msgid "Assets by region"
msgstr ""
Expand Down Expand Up @@ -961,7 +961,7 @@ msgstr ""
msgid "Cores"
msgstr ""

#: src/pages/panel/dashboard/WorldMap.tsx:320
#: src/pages/panel/dashboard/WorldMap.tsx:394
msgid "Country"
msgstr ""

Expand Down Expand Up @@ -1589,7 +1589,7 @@ msgstr "Info"
msgid "Info: Changes to your product tier will become active immediately and be applied for the current billing cycle. {0}<0/>Your next billing cycle starts: {1} UTC"
msgstr ""

#: src/pages/panel/dashboard/DashboardPage.tsx:114
#: src/pages/panel/dashboard/DashboardPage.tsx:112
#: src/pages/panel/dashboard/getSlides.tsx:8
msgid "Infrastructure Overview"
msgstr ""
Expand Down Expand Up @@ -1677,7 +1677,7 @@ msgstr "Letzte Anmeldung"
msgid "Last scan"
msgstr ""

#: src/pages/panel/dashboard/DashboardPage.tsx:122
#: src/pages/panel/dashboard/DashboardPage.tsx:120
msgid "Last scanned: {0} ago"
msgstr ""

Expand Down Expand Up @@ -1884,7 +1884,7 @@ msgstr "Neue Sicherheitsprobleme entdeckt"
msgid "New to Fix? <0>Create an account</0>"
msgstr ""

#: src/pages/panel/inventory/DataGridPagination.tsx:60
#: src/pages/panel/inventory/DataGridPagination.tsx:61
#: src/shared/right-slider/HelpSlider.tsx:113
msgid "Next"
msgstr ""
Expand Down Expand Up @@ -2182,7 +2182,7 @@ msgstr ""
msgid "Press: Create Service and fill out the form."
msgstr ""

#: src/pages/panel/inventory/DataGridPagination.tsx:60
#: src/pages/panel/inventory/DataGridPagination.tsx:61
#: src/shared/right-slider/HelpSlider.tsx:97
msgid "Previous"
msgstr ""
Expand Down Expand Up @@ -2264,7 +2264,7 @@ msgid "Regenerate"
msgstr "Regenerieren"

#: src/pages/panel/benchmark-detail/BenchmarkDetailCheckDetail.tsx:183
#: src/pages/panel/dashboard/WorldMap.tsx:314
#: src/pages/panel/dashboard/WorldMap.tsx:388
#: src/pages/panel/inventory-search/inventory-form/InventoryFormMore.tsx:98
#: src/pages/panel/inventory-search/inventory-form/InventoryFormRegionValues.tsx:60
#: src/pages/panel/resource-detail/ResourceDetailView.tsx:258
Expand Down Expand Up @@ -2369,7 +2369,7 @@ msgid "Resource types"
msgstr ""

#: src/pages/panel/dashboard/DashboardCloudCards.tsx:47
#: src/pages/panel/dashboard/DashboardPage.tsx:155
#: src/pages/panel/dashboard/DashboardPage.tsx:153
#: src/pages/panel/inventory-detail/InventoryDetailView.tsx:231
#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountsTableItem.tsx:68
msgid "Resources"
Expand Down Expand Up @@ -2918,7 +2918,7 @@ msgstr "Wert"
msgid "Version"
msgstr ""

#: src/pages/panel/dashboard/WorldMap.tsx:334
#: src/pages/panel/dashboard/WorldMap.tsx:408
msgid "View Details"
msgstr ""

Expand Down
30 changes: 15 additions & 15 deletions src/locales/en-US/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ msgstr "{0} Milliseconds"
msgid "{0} per"
msgstr "{0} per"

#: src/pages/panel/dashboard/WorldMap.tsx:345
#: src/pages/panel/dashboard/WorldMap.tsx:421
msgid "{0} Regions"
msgstr "{0} Regions"

#: src/pages/panel/dashboard/DashboardPage.tsx:163
msgid "{0} resources in {1} regions, {2} countries"
msgstr "{0} resources in {1} regions, {2} countries"
#: src/pages/panel/dashboard/DashboardPage.tsx:161
msgid "{0} regions, {1} countries"
msgstr "{0} regions, {1} countries"

#: src/pages/panel/security/OverallScore.tsx:60
#: src/pages/panel/shared/utils/createPieDataFromNonCompliance.ts:26
Expand Down Expand Up @@ -164,7 +164,7 @@ msgstr "{usersLength, plural, one {# user} other {# users}}"
msgid "/ month / cloud account"
msgstr "/ month / cloud account"

#: src/pages/panel/dashboard/WorldMap.tsx:326
#: src/pages/panel/dashboard/WorldMap.tsx:400
msgid "# of Resources"
msgstr "# of Resources"

Expand Down Expand Up @@ -520,15 +520,15 @@ msgstr "Are you sure you want to remove the {name} account {0}?"
msgid "Are you sure?"
msgstr "Are you sure?"

#: src/pages/panel/dashboard/DashboardPage.tsx:129
#: src/pages/panel/dashboard/DashboardPage.tsx:127
msgid "Asset summary"
msgstr "Asset summary"

#: src/pages/panel/dashboard/getSlides.tsx:47
msgid "Asset Summary"
msgstr "Asset Summary"

#: src/pages/panel/dashboard/DashboardPage.tsx:161
#: src/pages/panel/dashboard/DashboardPage.tsx:159
#: src/pages/panel/dashboard/getSlides.tsx:115
msgid "Assets by region"
msgstr "Assets by region"
Expand Down Expand Up @@ -961,7 +961,7 @@ msgstr "Copy the Secret Value of the created secret and paste it in the Secret V
msgid "Cores"
msgstr "Cores"

#: src/pages/panel/dashboard/WorldMap.tsx:320
#: src/pages/panel/dashboard/WorldMap.tsx:394
msgid "Country"
msgstr "Country"

Expand Down Expand Up @@ -1589,7 +1589,7 @@ msgstr "Info"
msgid "Info: Changes to your product tier will become active immediately and be applied for the current billing cycle. {0}<0/>Your next billing cycle starts: {1} UTC"
msgstr "Info: Changes to your product tier will become active immediately and be applied for the current billing cycle. {0}<0/>Your next billing cycle starts: {1} UTC"

#: src/pages/panel/dashboard/DashboardPage.tsx:114
#: src/pages/panel/dashboard/DashboardPage.tsx:112
#: src/pages/panel/dashboard/getSlides.tsx:8
msgid "Infrastructure Overview"
msgstr "Infrastructure Overview"
Expand Down Expand Up @@ -1677,7 +1677,7 @@ msgstr "Last login"
msgid "Last scan"
msgstr "Last scan"

#: src/pages/panel/dashboard/DashboardPage.tsx:122
#: src/pages/panel/dashboard/DashboardPage.tsx:120
msgid "Last scanned: {0} ago"
msgstr "Last scanned: {0} ago"

Expand Down Expand Up @@ -1884,7 +1884,7 @@ msgstr "New security issues detected"
msgid "New to Fix? <0>Create an account</0>"
msgstr "New to Fix? <0>Create an account</0>"

#: src/pages/panel/inventory/DataGridPagination.tsx:60
#: src/pages/panel/inventory/DataGridPagination.tsx:61
#: src/shared/right-slider/HelpSlider.tsx:113
msgid "Next"
msgstr "Next"
Expand Down Expand Up @@ -2182,7 +2182,7 @@ msgstr "Press the submit button, and Done. 🎉🎊"
msgid "Press: Create Service and fill out the form."
msgstr "Press: Create Service and fill out the form."

#: src/pages/panel/inventory/DataGridPagination.tsx:60
#: src/pages/panel/inventory/DataGridPagination.tsx:61
#: src/shared/right-slider/HelpSlider.tsx:97
msgid "Previous"
msgstr "Previous"
Expand Down Expand Up @@ -2264,7 +2264,7 @@ msgid "Regenerate"
msgstr "Regenerate"

#: src/pages/panel/benchmark-detail/BenchmarkDetailCheckDetail.tsx:183
#: src/pages/panel/dashboard/WorldMap.tsx:314
#: src/pages/panel/dashboard/WorldMap.tsx:388
#: src/pages/panel/inventory-search/inventory-form/InventoryFormMore.tsx:98
#: src/pages/panel/inventory-search/inventory-form/InventoryFormRegionValues.tsx:60
#: src/pages/panel/resource-detail/ResourceDetailView.tsx:258
Expand Down Expand Up @@ -2369,7 +2369,7 @@ msgid "Resource types"
msgstr "Resource types"

#: src/pages/panel/dashboard/DashboardCloudCards.tsx:47
#: src/pages/panel/dashboard/DashboardPage.tsx:155
#: src/pages/panel/dashboard/DashboardPage.tsx:153
#: src/pages/panel/inventory-detail/InventoryDetailView.tsx:231
#: src/pages/panel/workspace-settings-accounts/WorkspaceSettingsAccountsTableItem.tsx:68
msgid "Resources"
Expand Down Expand Up @@ -2918,7 +2918,7 @@ msgstr "Value"
msgid "Version"
msgstr "Version"

#: src/pages/panel/dashboard/WorldMap.tsx:334
#: src/pages/panel/dashboard/WorldMap.tsx:408
msgid "View Details"
msgstr "View Details"

Expand Down
9 changes: 3 additions & 6 deletions src/pages/panel/dashboard/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function DashboardPage() {
const [
{ data: lastScan },
{
data: { countries, data: worldMapDataWithCountries, regions, resources: regionBasedResources },
data: { countries, data: worldMapDataWithCountries, regions },
},
{
data: {
Expand Down Expand Up @@ -68,13 +68,12 @@ export default function DashboardPage() {
queryFn: postWorkspaceInventoryAggregateForDashboardQuery,
select: (data: PostWorkspaceInventoryAggregateForDashboardResponse) =>
data.reduce(
({ data, countries, regions, resources }, item) => {
({ data, countries, regions }, item) => {
const country = findCountryBasedOnCoordinates(item) ?? ''
return {
data: [...data, { ...item, country }],
countries: countries.includes(country) ? countries : [...countries, country],
regions: { ...regions, [item.group.cloud]: (regions[item.group.cloud] ?? 0) + 1 },
resources: resources + item.resource_count,
}
},
{
Expand All @@ -83,7 +82,6 @@ export default function DashboardPage() {
})[],
countries: [] as string[],
regions: {} as Record<AccountCloud, number | undefined>,
resources: 0,
},
),
},
Expand Down Expand Up @@ -161,8 +159,7 @@ export default function DashboardPage() {
title={<Trans>Assets by region</Trans>}
subtitle={
<Trans>
{regionBasedResources.toLocaleString(locale)} resources in {worldMapDataWithCountries.length.toLocaleString(locale)} regions,{' '}
{countries.length.toLocaleString(locale)} countries
{worldMapDataWithCountries.length.toLocaleString(locale)} regions, {countries.length.toLocaleString(locale)} countries
</Trans>
}
SubtitleIcon={GlobeIcon}
Expand Down
Loading
Loading