Skip to content

Commit

Permalink
fix for storage trends chart aspect ratio bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wkaspryk committed Mar 27, 2024
1 parent 242d6af commit 4816463
Showing 1 changed file with 33 additions and 24 deletions.
57 changes: 33 additions & 24 deletions src/dashboard/src/components/dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,26 @@ export const Dashboard = () => {
[download],
);

const renderStorageTrendsChart = (isLarge: boolean) => {
return (
<StorageTrendsChart
large={isLarge}
serverItems={dashboardServerItem ? [dashboardServerItem] : dashboardServerItems}
showExport
onExport={(startDate, endDate) => {
handleExport({
tenantId: dashboardTenant?.id,
organizationId: dashboardOrganization?.id,
operatingSystemItemId: dashboardOperatingSystemItem?.id,
serviceNowKey: dashboardServerItem?.serviceNowKey,
startDate: startDate,
endDate: endDate,
});
}}
/>
);
};

return (
<>
<Breadcrumbs multipleOrganizations={organizations.length > 1} />
Expand Down Expand Up @@ -254,31 +274,20 @@ export const Dashboard = () => {
)}
{/* Multiple Organizations */}
{showAllOrganizations && (
<AllOrganizations
organizations={dashboardOrganizations}
serverItems={dashboardServerItems}
loading={!isReadyOrganizations || !isReadyServerItems}
showExport
onExport={() => {
handleExport({ tenantId: dashboardTenant?.id });
}}
/>
<>
<AllOrganizations
organizations={dashboardOrganizations}
serverItems={dashboardServerItems}
loading={!isReadyOrganizations || !isReadyServerItems}
showExport
onExport={() => {
handleExport({ tenantId: dashboardTenant?.id });
}}
/>
{renderStorageTrendsChart(false)}
</>
)}
<StorageTrendsChart
large={!!dashboardOrganization || !!dashboardOperatingSystemItem || !!dashboardServerItem}
serverItems={dashboardServerItem ? [dashboardServerItem] : dashboardServerItems}
showExport
onExport={(startDate, endDate) => {
handleExport({
tenantId: dashboardTenant?.id,
organizationId: dashboardOrganization?.id,
operatingSystemItemId: dashboardOperatingSystemItem?.id,
serviceNowKey: dashboardServerItem?.serviceNowKey,
startDate: startDate,
endDate: endDate,
});
}}
/>
{!showAllOrganizations && renderStorageTrendsChart(true)}
{showAllocationByStorageVolume && (
<AllocationByStorageVolume
organizations={dashboardOrganizations}
Expand Down

0 comments on commit 4816463

Please sign in to comment.