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

HOSTSD-276 Storage Trend Size Type #121

Merged
merged 8 commits into from
Mar 21, 2024
Merged

HOSTSD-276 Storage Trend Size Type #121

merged 8 commits into from
Mar 21, 2024

Conversation

Fosol
Copy link
Contributor

@Fosol Fosol commented Mar 21, 2024

The Storage Trend chart will now use the same storage size type as the Total Storage Allocation chart.

image

@Fosol Fosol added the enhancement New feature or request label Mar 21, 2024
@Fosol Fosol self-assigned this Mar 21, 2024
@@ -31,8 +32,13 @@ interface LineChartProps {
loading?: boolean;
/** Date range selected for the filter. */
dateRange?: string[];
/** An array of server items */
serverItems?: IServerItemListModel[];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to pass the selected server items down so that it can be determine which storage size they are using.

@@ -56,6 +63,8 @@ export const StorageTrendsChart: React.FC<LineChartProps> = ({
const { isReady: serverHistoryItemsIsReady, findServerHistoryItems } = useServerHistoryItems();
const { tenantId, organizationId, operatingSystemItemId, serverItemKey } = useDashboard();

const [forceFetch, setForceFetch] = React.useState(0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clicking the Update button doesn't do anything if the date doesn't change. This allows it to force an update.

const groups = generateStorageHistoryForDateRange(minColumns, dateRange);

// Determine the output size type to use based on the current total storage of the selected servers.
const storageSizeType = convertStorageSize(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the magic

* @param options Configuration options.
* @returns A string representing the storage size.
*/
export const convertToStorageSize = <T extends string | number>(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separated the function into two so that I have access to the logic without the string output.

@Fosol Fosol merged commit 0c7d24c into bcgov:main Mar 21, 2024
2 checks passed
@Fosol Fosol deleted the 276 branch March 21, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant