From bb8ec75f40d09631f08629204eee519d6765aa89 Mon Sep 17 00:00:00 2001 From: milan-deepfence Date: Tue, 2 Jul 2024 18:21:01 +0530 Subject: [PATCH 1/2] Update applied filters text, update to Yes or No --- .../src/features/postures/pages/Accounts.tsx | 34 +++++++++--------- .../data-components/tables/HostsTable.tsx | 30 +++++++++++----- .../tables/KubernetesTable.tsx | 15 +++++--- .../pages/MostExploitableVulnerabilities.tsx | 25 +++++++++++-- .../pages/UniqueVulnerabilities.tsx | 25 +++++++++++-- .../pages/VulnerabilityScanResults.tsx | 36 +++++++++++++++++-- .../pages/VulnerabilityScans.tsx | 22 ++++++++++-- .../apps/dashboard/src/utils/enum.ts | 14 ++++++++ 8 files changed, 163 insertions(+), 38 deletions(-) diff --git a/deepfence_frontend/apps/dashboard/src/features/postures/pages/Accounts.tsx b/deepfence_frontend/apps/dashboard/src/features/postures/pages/Accounts.tsx index dfb8315fe0..18423b4ef4 100644 --- a/deepfence_frontend/apps/dashboard/src/features/postures/pages/Accounts.tsx +++ b/deepfence_frontend/apps/dashboard/src/features/postures/pages/Accounts.tsx @@ -10,6 +10,7 @@ import { useSearchParams, } from 'react-router-dom'; import { toast } from 'sonner'; +import { cn } from 'tailwind-preset'; import { Badge, Breadcrumb, @@ -915,6 +916,7 @@ const ActionDropdown = ({ if (!scanId || !nodeType) return; onTableAction(row, ActionEnumType.DELETE_SCAN); }} + color="error" > Delete latest scan @@ -1338,23 +1340,17 @@ const AccountTable = ({ cell: (info) => { if (nodeType?.endsWith?.('_org')) { const data = info.row.original.scan_status_map ?? {}; - const keys = Object.keys(data); - const statuses = Object.keys(data).map((current, index) => { + const statuses = Object.keys(data).map((current) => { return ( - <> -
- - {data[current]} - - - {index < keys.length - 1 ? ( -
- ) : null} -
- +
+ + {data[current]} + + +
); }); - return
{statuses}
; + return
{statuses}
; } else { const value = info.getValue(); return ; @@ -1367,7 +1363,11 @@ const AccountTable = ({ ...columnWidth.active, header: () => 'Active', cell: (info) => { - return info.getValue() ? 'Yes' : 'No'; + return ( + + {info.getValue() ? 'Yes' : 'No'} + + ); }, }), ]; @@ -1380,7 +1380,9 @@ const AccountTable = ({ ...columnWidth.account_name, header: () => 'Name', cell: (info) => { - return ; + return ( + + ); }, }), ); diff --git a/deepfence_frontend/apps/dashboard/src/features/topology/data-components/tables/HostsTable.tsx b/deepfence_frontend/apps/dashboard/src/features/topology/data-components/tables/HostsTable.tsx index f25d090274..08e394d202 100644 --- a/deepfence_frontend/apps/dashboard/src/features/topology/data-components/tables/HostsTable.tsx +++ b/deepfence_frontend/apps/dashboard/src/features/topology/data-components/tables/HostsTable.tsx @@ -1,6 +1,8 @@ import { useSuspenseQuery } from '@suspensive/react-query'; +import { startCase } from 'lodash-es'; import { Suspense, useEffect, useMemo, useState } from 'react'; import { useSearchParams } from 'react-router-dom'; +import { cn } from 'tailwind-preset'; import { Badge, Button, @@ -546,7 +548,7 @@ function Filters() { }} getDisplayValue={() => FILTER_SEARCHPARAMS['agentRunning']} > - {['On', 'Off'] + {['Yes', 'No'] .filter((item) => { if (!agentRunningSearchText.length) return true; return item.toLowerCase().includes(agentRunningSearchText.toLowerCase()); @@ -639,7 +641,7 @@ function useSearchHostsWithPagination() { order: getOrderFromSearchParams(searchParams), agentRunning: searchParams .getAll('agentRunning') - .map((value) => (value === 'On' ? true : false)), + .map((value) => (value === 'Yes' ? true : false)), cloudAccounts: searchParams.getAll('cloudAccounts'), clusterIds: searchParams.getAll('clusters'), hosts: searchParams.getAll('hosts'), @@ -723,8 +725,8 @@ const DataTable = ({ }, header: () => 'Name', minSize: 300, - size: 400, - maxSize: 600, + size: 320, + maxSize: 360, }), columnHelper.accessor('vulnerability_scan_status', { cell: (info) => { @@ -767,20 +769,27 @@ const DataTable = ({ if (!info.getValue()) { return
; } - return ; + return ; }, - header: () => OS, + header: () => 'OS', minSize: 50, size: 60, maxSize: 120, }), columnHelper.accessor('agent_running', { cell: (info) => { - return ; + return ( + + ); }, header: () => , - minSize: 50, - size: 60, + minSize: 80, + size: 100, maxSize: 120, }), columnHelper.accessor('version', { @@ -827,6 +836,9 @@ const DataTable = ({ ); } } + if (!info.getValue()) { + return
; + } return ; }, header: () => , diff --git a/deepfence_frontend/apps/dashboard/src/features/topology/data-components/tables/KubernetesTable.tsx b/deepfence_frontend/apps/dashboard/src/features/topology/data-components/tables/KubernetesTable.tsx index d78cabb589..a207676d3c 100644 --- a/deepfence_frontend/apps/dashboard/src/features/topology/data-components/tables/KubernetesTable.tsx +++ b/deepfence_frontend/apps/dashboard/src/features/topology/data-components/tables/KubernetesTable.tsx @@ -1,7 +1,7 @@ import { useSuspenseQuery } from '@suspensive/react-query'; -import { upperFirst } from 'lodash-es'; import { Suspense, useEffect, useMemo, useState } from 'react'; import { useSearchParams } from 'react-router-dom'; +import { cn } from 'tailwind-preset'; import { Badge, Button, @@ -109,7 +109,7 @@ function Filters() { }} getDisplayValue={() => FILTER_SEARCHPARAMS['agentRunning']} > - {['On', 'Off'] + {['Yes', 'No'] .filter((item) => { if (!agentRunningSearchText.length) return true; return item.toLowerCase().includes(agentRunningSearchText.toLowerCase()); @@ -347,7 +347,7 @@ function useSearchClustersWithPagination() { clusterIds: searchParams.getAll('clusters'), agentRunning: searchParams .getAll('agentRunning') - .map((value) => (value === 'On' ? true : false)), + .map((value) => (value === 'Yes' ? true : false)), }), keepPreviousData: true, }); @@ -458,7 +458,14 @@ const DataTable = ({ }), columnHelper.accessor('agent_running', { cell: (info) => { - return ; + return ( + + ); }, header: () => Agent running, minSize: 60, diff --git a/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/MostExploitableVulnerabilities.tsx b/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/MostExploitableVulnerabilities.tsx index 8700651481..91a5723dff 100644 --- a/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/MostExploitableVulnerabilities.tsx +++ b/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/MostExploitableVulnerabilities.tsx @@ -50,7 +50,7 @@ import { ScanTypeEnum, VulnerabilitySeverityType } from '@/types/common'; import { get403Message } from '@/utils/403'; import { apiWrapper, retryUntilResponseHasValue } from '@/utils/api'; import { download } from '@/utils/download'; -import { SeverityEnumList } from '@/utils/enum'; +import { getSeverityPrettyName, SeverityEnumList, SeverityValueType } from '@/utils/enum'; const DEFAULT_PAGE_SIZE = 10; @@ -79,6 +79,24 @@ const FILTER_SEARCHPARAMS: Record = { clusters: 'Clusters', }; +const getPrettyNameForAppliedFilters = ({ + key, + value, +}: { + key: string; + value: string; +}) => { + switch (key) { + case 'severity': + return getSeverityPrettyName(value as SeverityValueType); + case 'liveConnection': + return upperFirst(value); + + default: + return value; + } +}; + enum ActionEnumType { DOWNLOAD = 'download', } @@ -399,7 +417,10 @@ const Filters = () => { ); diff --git a/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/UniqueVulnerabilities.tsx b/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/UniqueVulnerabilities.tsx index 93e16b81f9..e4be88d31a 100644 --- a/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/UniqueVulnerabilities.tsx +++ b/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/UniqueVulnerabilities.tsx @@ -35,7 +35,7 @@ import { FilterWrapper } from '@/features/common/FilterWrapper'; import { queries } from '@/queries'; import { useTheme } from '@/theme/ThemeContext'; import { ScanTypeEnum, VulnerabilitySeverityType } from '@/types/common'; -import { SeverityEnumList } from '@/utils/enum'; +import { getSeverityPrettyName, SeverityEnumList, SeverityValueType } from '@/utils/enum'; import { getOrderFromSearchParams, useSortingState } from '@/utils/table'; const DEFAULT_PAGE_SIZE = 10; @@ -65,6 +65,24 @@ const FILTER_SEARCHPARAMS: Record = { clusters: 'Clusters', }; +const getPrettyNameForAppliedFilters = ({ + key, + value, +}: { + key: string; + value: string; +}) => { + switch (key) { + case 'severity': + return getSeverityPrettyName(value as SeverityValueType); + case 'liveConnection': + return upperFirst(value); + + default: + return value; + } +}; + const getAppliedFiltersCount = (searchParams: URLSearchParams) => { return Object.keys(FILTER_SEARCHPARAMS).reduce((prev, curr) => { return prev + searchParams.getAll(curr).length; @@ -287,7 +305,10 @@ const Filters = () => { ); diff --git a/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/VulnerabilityScanResults.tsx b/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/VulnerabilityScanResults.tsx index 1234bfb5ea..e2ecd02e2a 100644 --- a/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/VulnerabilityScanResults.tsx +++ b/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/VulnerabilityScanResults.tsx @@ -98,7 +98,13 @@ import { import { get403Message, getResponseErrors } from '@/utils/403'; import { apiWrapper } from '@/utils/api'; import { formatMilliseconds } from '@/utils/date'; -import { SeverityEnum, SeverityEnumList } from '@/utils/enum'; +import { + getMaskedUnmaskedPrettyName, + getSeverityPrettyName, + SeverityEnum, + SeverityEnumList, + SeverityValueType, +} from '@/utils/enum'; import { abbreviateNumber } from '@/utils/number'; import { isScanComplete, @@ -1216,6 +1222,30 @@ const FILTER_SEARCHPARAMS: Record = { language: 'CVE Type', exploitable: 'Exploitable', }; + +const getPrettyNameForAppliedFilters = ({ + key, + value, +}: { + key: string; + value: string; +}) => { + switch (key) { + case 'severity': + return getSeverityPrettyName(value as SeverityValueType); + case 'visibility': + return getMaskedUnmaskedPrettyName(value); + case 'exploitable': + return 'Most Exploitable'; + case 'attackVector': + return capitalize(value); + case 'language': + return capitalize(value); + default: + return value; + } +}; + const getAppliedFiltersCount = (searchParams: URLSearchParams) => { return Object.keys(FILTER_SEARCHPARAMS).reduce((prev, curr) => { return prev + searchParams.getAll(curr).length; @@ -1306,7 +1336,7 @@ const Filters = () => { }).map((item) => { return ( - {capitalize(item)} + {getSeverityPrettyName(item)} ); })} @@ -1383,7 +1413,7 @@ const Filters = () => { return prev; }); }} - text={`${FILTER_SEARCHPARAMS[key]}: ${value}`} + text={`${FILTER_SEARCHPARAMS[key]}: ${getPrettyNameForAppliedFilters({ key, value })}`} /> ); })} diff --git a/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/VulnerabilityScans.tsx b/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/VulnerabilityScans.tsx index 958bbed8eb..b9fc62be2d 100644 --- a/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/VulnerabilityScans.tsx +++ b/deepfence_frontend/apps/dashboard/src/features/vulnerabilities/pages/VulnerabilityScans.tsx @@ -1,6 +1,6 @@ import { useSuspenseQuery } from '@suspensive/react-query'; import { useIsFetching } from '@tanstack/react-query'; -import { capitalize } from 'lodash-es'; +import { capitalize, startCase } from 'lodash-es'; import React, { Suspense, useCallback, useEffect, useMemo, useState } from 'react'; import { ActionFunctionArgs, @@ -788,6 +788,21 @@ const FILTER_SEARCHPARAMS: Record = { registryAccounts: 'Registry', }; +const getPrettyNameForAppliedFilters = ({ + key, + value, +}: { + key: string; + value: string; +}) => { + switch (key) { + case 'nodeType': + return startCase(value); + default: + return value; + } +}; + const getAppliedFiltersCount = (searchParams: URLSearchParams) => { return Object.keys(FILTER_SEARCHPARAMS).reduce((prev, curr) => { return prev + searchParams.getAll(curr).length; @@ -1036,7 +1051,10 @@ const Filters = () => { ); diff --git a/deepfence_frontend/apps/dashboard/src/utils/enum.ts b/deepfence_frontend/apps/dashboard/src/utils/enum.ts index b61d6e1a5a..c0830dedc0 100644 --- a/deepfence_frontend/apps/dashboard/src/utils/enum.ts +++ b/deepfence_frontend/apps/dashboard/src/utils/enum.ts @@ -97,3 +97,17 @@ export function getSeverityPrettyName(severity: SeverityValueType) { throw new Error(`Unhandled case: ${_exhaustiveCheck}`); } } + +export function getMaskedUnmaskedPrettyName(maskedUnmasked: string) { + switch (maskedUnmasked) { + case 'masked': + return 'Masked'; + case 'unmasked': + return 'Unmasked'; + + default: + throw new Error( + `Unhandled case: No matching key found for getMaskedUnmaskedPrettyName`, + ); + } +} From dbc2a8b953bb4a5a7b3e9fec1585825da462ac35 Mon Sep 17 00:00:00 2001 From: milan-deepfence Date: Thu, 4 Jul 2024 20:52:15 +0530 Subject: [PATCH 2/2] update refresh status to use refresh status map --- .../apps/dashboard/api-spec.json | 14 ++++++--- .../models/ModelCloudNodeAccountInfo.ts | 21 ++++++------- .../models/ModelIntegrationAddReq.ts | 8 +++++ .../models/ModelIntegrationUpdateReq.ts | 8 +++++ .../src/components/ScanStatusBadge.tsx | 25 ++++++++++++--- .../components/RefreshAccountStatusError.tsx | 22 ------------- .../src/features/postures/pages/Accounts.tsx | 31 +++++++++++++------ .../src/features/postures/utils/index.ts | 4 +-- 8 files changed, 78 insertions(+), 55 deletions(-) delete mode 100644 deepfence_frontend/apps/dashboard/src/features/postures/components/RefreshAccountStatusError.tsx diff --git a/deepfence_frontend/apps/dashboard/api-spec.json b/deepfence_frontend/apps/dashboard/api-spec.json index 503677fd85..b1bd59b3d3 100644 --- a/deepfence_frontend/apps/dashboard/api-spec.json +++ b/deepfence_frontend/apps/dashboard/api-spec.json @@ -13616,9 +13616,11 @@ "node_id": { "type": "string" }, "node_name": { "type": "string" }, "refresh_message": { "type": "string" }, - "refresh_status": { - "enum": ["STARTING", "IN_PROGRESS", "ERROR", "COMPLETE"], - "type": "string" + "refresh_status": { "type": "string" }, + "refresh_status_map": { + "type": "object", + "additionalProperties": { "type": "integer" }, + "nullable": true }, "scan_status_map": { "type": "object", @@ -14587,7 +14589,8 @@ "config": { "type": "object", "additionalProperties": {}, "nullable": true }, "filters": { "$ref": "#/components/schemas/ModelIntegrationFilters" }, "integration_type": { "type": "string" }, - "notification_type": { "type": "string" } + "notification_type": { "type": "string" }, + "send_summary": { "type": "boolean" } } }, "ModelIntegrationFilters": { @@ -14625,7 +14628,8 @@ "filters": { "$ref": "#/components/schemas/ModelIntegrationFilters" }, "id": { "type": "integer" }, "integration_type": { "type": "string" }, - "notification_type": { "type": "string" } + "notification_type": { "type": "string" }, + "send_summary": { "type": "boolean" } } }, "ModelInviteUserRequest": { diff --git a/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelCloudNodeAccountInfo.ts b/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelCloudNodeAccountInfo.ts index 29775ee60e..e493165119 100644 --- a/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelCloudNodeAccountInfo.ts +++ b/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelCloudNodeAccountInfo.ts @@ -84,7 +84,13 @@ export interface ModelCloudNodeAccountInfo { * @type {string} * @memberof ModelCloudNodeAccountInfo */ - refresh_status?: ModelCloudNodeAccountInfoRefreshStatusEnum; + refresh_status?: string; + /** + * + * @type {{ [key: string]: number; }} + * @memberof ModelCloudNodeAccountInfo + */ + refresh_status_map?: { [key: string]: number; } | null; /** * * @type {{ [key: string]: number; }} @@ -113,17 +119,6 @@ export const ModelCloudNodeAccountInfoCloudProviderEnum = { } as const; export type ModelCloudNodeAccountInfoCloudProviderEnum = typeof ModelCloudNodeAccountInfoCloudProviderEnum[keyof typeof ModelCloudNodeAccountInfoCloudProviderEnum]; -/** - * @export - */ -export const ModelCloudNodeAccountInfoRefreshStatusEnum = { - Starting: 'STARTING', - InProgress: 'IN_PROGRESS', - Error: 'ERROR', - Complete: 'COMPLETE' -} as const; -export type ModelCloudNodeAccountInfoRefreshStatusEnum = typeof ModelCloudNodeAccountInfoRefreshStatusEnum[keyof typeof ModelCloudNodeAccountInfoRefreshStatusEnum]; - /** * Check if a given object implements the ModelCloudNodeAccountInfo interface. @@ -155,6 +150,7 @@ export function ModelCloudNodeAccountInfoFromJSONTyped(json: any, ignoreDiscrimi 'node_name': !exists(json, 'node_name') ? undefined : json['node_name'], 'refresh_message': !exists(json, 'refresh_message') ? undefined : json['refresh_message'], 'refresh_status': !exists(json, 'refresh_status') ? undefined : json['refresh_status'], + 'refresh_status_map': !exists(json, 'refresh_status_map') ? undefined : json['refresh_status_map'], 'scan_status_map': !exists(json, 'scan_status_map') ? undefined : json['scan_status_map'], 'version': !exists(json, 'version') ? undefined : json['version'], }; @@ -180,6 +176,7 @@ export function ModelCloudNodeAccountInfoToJSON(value?: ModelCloudNodeAccountInf 'node_name': value.node_name, 'refresh_message': value.refresh_message, 'refresh_status': value.refresh_status, + 'refresh_status_map': value.refresh_status_map, 'scan_status_map': value.scan_status_map, 'version': value.version, }; diff --git a/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelIntegrationAddReq.ts b/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelIntegrationAddReq.ts index f5211dd456..7a68b9abfa 100644 --- a/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelIntegrationAddReq.ts +++ b/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelIntegrationAddReq.ts @@ -50,6 +50,12 @@ export interface ModelIntegrationAddReq { * @memberof ModelIntegrationAddReq */ notification_type: string; + /** + * + * @type {boolean} + * @memberof ModelIntegrationAddReq + */ + send_summary?: boolean; } /** @@ -77,6 +83,7 @@ export function ModelIntegrationAddReqFromJSONTyped(json: any, ignoreDiscriminat 'filters': !exists(json, 'filters') ? undefined : ModelIntegrationFiltersFromJSON(json['filters']), 'integration_type': json['integration_type'], 'notification_type': json['notification_type'], + 'send_summary': !exists(json, 'send_summary') ? undefined : json['send_summary'], }; } @@ -93,6 +100,7 @@ export function ModelIntegrationAddReqToJSON(value?: ModelIntegrationAddReq | nu 'filters': ModelIntegrationFiltersToJSON(value.filters), 'integration_type': value.integration_type, 'notification_type': value.notification_type, + 'send_summary': value.send_summary, }; } diff --git a/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelIntegrationUpdateReq.ts b/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelIntegrationUpdateReq.ts index d6406f84a5..c000619da9 100644 --- a/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelIntegrationUpdateReq.ts +++ b/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelIntegrationUpdateReq.ts @@ -56,6 +56,12 @@ export interface ModelIntegrationUpdateReq { * @memberof ModelIntegrationUpdateReq */ notification_type?: string; + /** + * + * @type {boolean} + * @memberof ModelIntegrationUpdateReq + */ + send_summary?: boolean; } /** @@ -82,6 +88,7 @@ export function ModelIntegrationUpdateReqFromJSONTyped(json: any, ignoreDiscrimi 'id': !exists(json, 'id') ? undefined : json['id'], 'integration_type': !exists(json, 'integration_type') ? undefined : json['integration_type'], 'notification_type': !exists(json, 'notification_type') ? undefined : json['notification_type'], + 'send_summary': !exists(json, 'send_summary') ? undefined : json['send_summary'], }; } @@ -99,6 +106,7 @@ export function ModelIntegrationUpdateReqToJSON(value?: ModelIntegrationUpdateRe 'id': value.id, 'integration_type': value.integration_type, 'notification_type': value.notification_type, + 'send_summary': value.send_summary, }; } diff --git a/deepfence_frontend/apps/dashboard/src/components/ScanStatusBadge.tsx b/deepfence_frontend/apps/dashboard/src/components/ScanStatusBadge.tsx index 690ab2128e..b9ec63aef9 100644 --- a/deepfence_frontend/apps/dashboard/src/components/ScanStatusBadge.tsx +++ b/deepfence_frontend/apps/dashboard/src/components/ScanStatusBadge.tsx @@ -1,6 +1,6 @@ import { capitalize } from 'lodash-es'; import { cn } from 'tailwind-preset'; -import { CircleSpinner } from 'ui-components'; +import { CircleSpinner, Tooltip } from 'ui-components'; import { ErrorIcon, @@ -22,10 +22,12 @@ export const ScanStatusBadge = ({ status, className, justIcon = false, + errorMessage, }: { status: string; className?: string; justIcon?: boolean; + errorMessage?: string; }) => { const wrapperClassName = cn( 'flex items-center gap-1.5 text-text-text-and-icon text-p4a', @@ -49,10 +51,23 @@ export const ScanStatusBadge = ({ } else if (isScanFailed(status)) { return (
- - - - {!justIcon ? : null} + {errorMessage ? ( + +
+ + + + {!justIcon ? : null} +
+
+ ) : ( + <> + + + + {!justIcon ? : null} + + )}
); } else if (isNeverScanned(status)) { diff --git a/deepfence_frontend/apps/dashboard/src/features/postures/components/RefreshAccountStatusError.tsx b/deepfence_frontend/apps/dashboard/src/features/postures/components/RefreshAccountStatusError.tsx deleted file mode 100644 index ca1752aaab..0000000000 --- a/deepfence_frontend/apps/dashboard/src/features/postures/components/RefreshAccountStatusError.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { Tooltip } from 'ui-components'; - -import { ErrorStandardSolidIcon } from '@/components/icons/common/ErrorStandardSolid'; - -export const RefreshAccountStatusError = ({ errorMessage }: { errorMessage: string }) => { - return ( -
-
Error
- {errorMessage ? ( - -
- -
-
- ) : ( -
- -
- )} -
- ); -}; diff --git a/deepfence_frontend/apps/dashboard/src/features/postures/pages/Accounts.tsx b/deepfence_frontend/apps/dashboard/src/features/postures/pages/Accounts.tsx index 18423b4ef4..16f7fb22e5 100644 --- a/deepfence_frontend/apps/dashboard/src/features/postures/pages/Accounts.tsx +++ b/deepfence_frontend/apps/dashboard/src/features/postures/pages/Accounts.tsx @@ -1,6 +1,6 @@ import { useSuspenseQuery } from '@suspensive/react-query'; import { useIsFetching } from '@tanstack/react-query'; -import { capitalize, startCase } from 'lodash-es'; +import { capitalize } from 'lodash-es'; import { Suspense, useCallback, useEffect, useMemo, useState } from 'react'; import { ActionFunctionArgs, @@ -66,7 +66,6 @@ import { getColorForCompliancePercent } from '@/constants/charts'; import { BreadcrumbWrapper } from '@/features/common/BreadcrumbWrapper'; import { useDownloadScan } from '@/features/common/data-component/downloadScanAction'; import { FilterWrapper } from '@/features/common/FilterWrapper'; -import { RefreshAccountStatusError } from '@/features/postures/components/RefreshAccountStatusError'; import { providersToNameMapping } from '@/features/postures/pages/Posture'; import { getDeleteConfirmationDisplayName, @@ -1393,14 +1392,28 @@ const AccountTable = ({ ...columnWidth.refresh_status, header: () => 'Refresh status', cell: (info) => { - if (isRefreshAccountFailed(info.getValue())) { - return ( - - ); + if (nodeType?.endsWith?.('_org')) { + const data = info.row.original.refresh_status_map ?? {}; + const statuses = Object.keys(data).map((current) => { + return ( +
+ + {data[current]} + + +
+ ); + }); + return
{statuses}
; + } else { + ; } - return ; }, }), ); diff --git a/deepfence_frontend/apps/dashboard/src/features/postures/utils/index.ts b/deepfence_frontend/apps/dashboard/src/features/postures/utils/index.ts index 0e9f05f071..fe67bab5bc 100644 --- a/deepfence_frontend/apps/dashboard/src/features/postures/utils/index.ts +++ b/deepfence_frontend/apps/dashboard/src/features/postures/utils/index.ts @@ -1,8 +1,8 @@ import { ModelCloudComplianceStatusEnum, - ModelCloudNodeAccountInfoRefreshStatusEnum, ModelCloudNodeAccountsListReqCloudProviderEnum, ModelComplianceStatusEnum, + ModelScanInfoStatusEnum, } from '@/api/generated'; export const isCloudNonOrgNode = (nodeType?: string) => { @@ -122,7 +122,7 @@ export function getDeleteConfirmationDisplayName( } export const isRefreshAccountFailed = (status: string): boolean => { - if (status?.length && ModelCloudNodeAccountInfoRefreshStatusEnum.Error === status) { + if (status?.length && ModelScanInfoStatusEnum.Error === status) { return true; } return false;