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-199 Add storage trends chart #40

Merged
merged 1 commit into from
Jan 4, 2024
Merged

HOSTSD-199 Add storage trends chart #40

merged 1 commit into from
Jan 4, 2024

Conversation

Fosol
Copy link
Contributor

@Fosol Fosol commented Jan 4, 2024

We now have storage trends and a way to access historical data.

I needed to update the DB schema to support maintaining a link between historical server items and the current server item. This was required to improve performance by offloading capacity calculations to the Data Server.

I've also added some horrible looking loading spinners to slightly improve the user experience when waiting for data.

Loading Spinners

image

Dashboard

image

@Fosol Fosol added the enhancement New feature or request label Jan 4, 2024
@Fosol Fosol self-assigned this Jan 4, 2024
padding-left: 42px;
}

.spinner {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ugly spinner

import React from 'react';
import { IStats } from './IStats';
import { defaultData } from './defaultData';
import { updateData } from './updateData';

export const useDonutChart = () => {
const serverItem = useFiltered((state) => state.serverItem);
const serverItems = useFiltered((state) => state.serverItems);
const serverItems = useDashboard((state) => state.serverItems);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simplified

const { organizations } = useOrganizations();
const { operatingSystemItems } = useOperatingSystemItems();
const { serverItems } = useServerItems();
const { isReady: tenantsReady, tenants } = useTenants();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Filter now displays loading spinners

@@ -111,4 +111,20 @@
.selected {
background-color: $bc-blue;
color: $white;
}

.spinner {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ugly spinner

* @returns A string representing the storage size.
*/
export const convertToStorageSize = (
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.

Needed a way to return just the converted value. I don't love the generics in this case.

@@ -291,10 +291,6 @@ private async Task ProcessConfigurationItemsAsync(Models.DataSyncModel option)
_serverItems[serverItem.ServiceNowKey] = serverItem;
}

// Add the server history item to HSB.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding historical records is the api job now

@@ -15,6 +15,7 @@ public override void Configure(EntityTypeBuilder<ServerItem> builder)
builder.Property(m => m.TenantId);
builder.Property(m => m.OrganizationId);
builder.Property(m => m.OperatingSystemItemId);
builder.Property(m => m.HistoryKey);
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 essentially a foreign key, but it's not enforced otherwise we'd have a chicken/egg issue.

@Fosol Fosol merged commit da54f9d into bcgov:main Jan 4, 2024
2 checks passed
@Fosol Fosol deleted the 199 branch January 4, 2024 21:01
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