-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
@@ -31,8 +32,13 @@ interface LineChartProps { | |||
loading?: boolean; | |||
/** Date range selected for the filter. */ | |||
dateRange?: string[]; | |||
/** An array of server items */ | |||
serverItems?: IServerItemListModel[]; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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>( |
There was a problem hiding this comment.
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.
The Storage Trend chart will now use the same storage size type as the Total Storage Allocation chart.