Skip to content

Commit

Permalink
replace _org check by cloud account check, add missing percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
milan-deepfence committed Jul 9, 2024
1 parent 90e32a9 commit f9e5ea2
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useSuspenseQuery } from '@suspensive/react-query';
import { useIsFetching } from '@tanstack/react-query';
import { capitalize, startCase } from 'lodash-es';
import { capitalize, startCase, upperFirst } from 'lodash-es';
import { Suspense, useCallback, useEffect, useMemo, useState } from 'react';
import {
ActionFunctionArgs,
Expand Down Expand Up @@ -1323,8 +1323,10 @@ const AccountTable = ({
);
},
header: () =>
getDisplayNameOfNodeType(
nodeType as ModelCloudNodeAccountsListReqCloudProviderEnum,
upperFirst(
getDisplayNameOfNodeType(
nodeType as ModelCloudNodeAccountsListReqCloudProviderEnum,
).toLowerCase(),
),
...columnWidth.node_name,
}),
Expand All @@ -1335,7 +1337,7 @@ const AccountTable = ({
const percent = Number(cell.getValue());
const isScanned = !!cell.row.original.last_scan_status;

if (isScanned) {
if (isScanned || isCloudOrgNode(nodeType)) {
return (
<span
style={{
Expand All @@ -1354,7 +1356,7 @@ const AccountTable = ({
}),
columnHelper.accessor('last_scan_status', {
cell: (info) => {
if (nodeType?.endsWith?.('_org')) {
if (isCloudOrgNode(nodeType)) {
const data = info.row.original.scan_status_map ?? {};
const statuses = Object.keys(data).map((current) => {
return (
Expand Down Expand Up @@ -1409,7 +1411,7 @@ const AccountTable = ({
...columnWidth.refresh_status,
header: () => 'Refresh status',
cell: (info) => {
if (nodeType?.endsWith?.('_org')) {
if (isCloudOrgNode(nodeType)) {
const data = info.row.original.refresh_status_map ?? {};
const statuses = Object.keys(data).map((current) => {
return (
Expand Down Expand Up @@ -1855,7 +1857,7 @@ const AccountWithTab = () => {
};

const [currentTab, setTab] = useState(() => {
return nodeType.endsWith('_org') ? 'org-accounts' : 'accounts';
return isCloudOrgNode(nodeType) ? 'org-accounts' : 'accounts';
});
const { navigate } = usePageNavigation();

Expand Down

0 comments on commit f9e5ea2

Please sign in to comment.