Skip to content

Commit

Permalink
fix(pci-billing): pair test return of billing history
Browse files Browse the repository at this point in the history
ref: DTCORE-2895
Signed-off-by: LIDRISSI Hamid <[email protected]>
  • Loading branch information
seven-amid committed Nov 26, 2024
1 parent b6fe5ac commit 3e92cec
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ export default function ArchiveStorageList({
totalItems={paginatedStorages.totalRows}
pagination={pagination}
onPaginationChange={setPagination}
className="overflow-x-visible"
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export default function ColdArchiveList({
totalItems={paginatedColdArchives.totalRows}
pagination={pagination}
onPaginationChange={setPagination}
className="overflow-x-visible"
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ export default function InstanceList({
totalItems={instanceConsumptionDetails.totalRows}
pagination={pagination}
onPaginationChange={setPagination}
className="overflow-x-visible"
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export default function ObjectStorageList({
totalItems={paginatedStorages.totalRows}
pagination={pagination}
onPaginationChange={setPagination}
className="overflow-x-visible"
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ export default function OutgoingTrafficList({
totalItems={paginatedInstanceBandWidths.totalRows}
pagination={pagination}
onPaginationChange={setPagination}
className="overflow-x-visible"
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export default function ResourceUsageList({
totalItems={paginatedResourcesUsage.totalRows}
pagination={pagination}
onPaginationChange={setPagination}
className="overflow-x-visible"
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ export default function SnapshotList({
},
)}`;

const paginatedSnapshots = useMemo(() => {
const sortedSnapshots = snapshots?.sort((a, b) =>
a.region.localeCompare(b.region),
);
return paginateResults(sortedSnapshots || [], pagination);
}, [snapshots, pagination, setPagination]);
const paginatedSnapshots = useMemo(
() => paginateResults(snapshots || [], pagination),
[snapshots, pagination, setPagination],
);

const columns = [
{
Expand Down Expand Up @@ -85,7 +83,6 @@ export default function SnapshotList({
totalItems={paginatedSnapshots.totalRows}
pagination={pagination}
onPaginationChange={setPagination}
className="overflow-x-visible"
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ export default function VolumeList({ volumes }: Readonly<VolumeListProps>) {
totalItems={paginatedVolumes.totalRows}
pagination={pagination}
onPaginationChange={setPagination}
className="overflow-x-visible"
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function Consumption() {

const { data: consumption, isPending } = useGeTCurrentUsage(projectId);

const isTrustedZone = availability && availability[TRUSTED_ZONE];
const isTrustedZone = availability?.[TRUSTED_ZONE];

const monthlyTotal = `${consumption?.totals?.monthly?.total?.toFixed(2)} ${
currency.symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,80 +47,78 @@ export default function History() {
TRUSTED_ZONE,
]);

const isTrustedZone = availability && availability[TRUSTED_ZONE];
const isPostPaidUsageBilling =
availability && availability[PCI_FEATURES_BILLING_POST_PAID];
const isTrustedZone = availability?.[TRUSTED_ZONE];
const isPostPaidUsageBilling = availability?.[PCI_FEATURES_BILLING_POST_PAID];

return (
<div>
<HistoryHeader />
<>
{isPending ? (
<OsdsSpinner
className="block text-center"
inline
size={ODS_SPINNER_SIZE.md}

{isPending ? (
<OsdsSpinner
className="block text-center"
inline
size={ODS_SPINNER_SIZE.md}
/>
) : (
<>
<HistoryResume
totalPrice={consumption?.totals.total}
isPostPaidUsageBilling={isPostPaidUsageBilling}
/>
) : (
<>
<HistoryResume
totalPrice={consumption?.totals.total}
isPostPaidUsageBilling={isPostPaidUsageBilling}
/>

<div className="flex items-start flex-col xl:flex-row gap-7">
<OsdsTile
className="shadow-custom-tile"
rounded
variant={ODS_TILE_VARIANT.flat}
>
<div className="flex flex-col w-full">
<OsdsText
size={ODS_TEXT_SIZE._400}
level={ODS_TEXT_LEVEL.heading}
color={ODS_THEME_COLOR_INTENT.text}
className="mb-5"
>
{t(
isPostPaidUsageBilling
? 'cpbhd_monthly_post_paid_header'
: 'cpbhd_monthly_header',
{
...translationValues,
},
)}
</OsdsText>
<div className="flex items-start flex-col xl:flex-row gap-7">
<OsdsTile
className="shadow-custom-tile"
rounded
variant={ODS_TILE_VARIANT.flat}
>
<div className="flex flex-col w-full">
<OsdsText
size={ODS_TEXT_SIZE._400}
level={ODS_TEXT_LEVEL.heading}
color={ODS_THEME_COLOR_INTENT.text}
className="mb-5"
>
{t(
isPostPaidUsageBilling
? 'cpbhd_monthly_post_paid_header'
: 'cpbhd_monthly_header',
{
...translationValues,
},
)}
</OsdsText>

<MonthlyConsumption consumption={consumption} />
</div>
</OsdsTile>
<MonthlyConsumption consumption={consumption} />
</div>
</OsdsTile>

<OsdsTile
className="shadow-custom-tile"
rounded
variant={ODS_TILE_VARIANT.flat}
>
<div className="flex flex-col w-full">
<OsdsText
size={ODS_TEXT_SIZE._400}
level={ODS_TEXT_LEVEL.heading}
color={ODS_THEME_COLOR_INTENT.text}
className="mb-5"
>
{t('cpbhd_hourly_header', { ...translationValues })}
</OsdsText>
<OsdsTile
className="shadow-custom-tile"
rounded
variant={ODS_TILE_VARIANT.flat}
>
<div className="flex flex-col w-full">
<OsdsText
size={ODS_TEXT_SIZE._400}
level={ODS_TEXT_LEVEL.heading}
color={ODS_THEME_COLOR_INTENT.text}
className="mb-5"
>
{t('cpbhd_hourly_header', { ...translationValues })}
</OsdsText>

<HourlyConsumption
consumption={consumption}
isTrustedZone={isTrustedZone}
/>
</div>
</OsdsTile>
</div>
<Outlet />
</>
)}
</>
<HourlyConsumption
consumption={consumption}
isTrustedZone={isTrustedZone}
/>
</div>
</OsdsTile>
</div>
<Outlet />
</>
)}
</div>
);
}

0 comments on commit 3e92cec

Please sign in to comment.