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

NAS-128386 / 24.10 / Port WidgetNetworkComponent to new dashboard #10014

Merged
merged 12 commits into from May 10, 2024

Conversation

denysbutenko
Copy link
Member

Check network widget at new dashboard

@denysbutenko denysbutenko requested a review from a team as a code owner May 1, 2024 18:22
@denysbutenko denysbutenko requested review from RehanY147 and removed request for a team May 1, 2024 18:22
@bugclerk bugclerk changed the title Port WidgetNetworkComponent to new dashboard NAS-128386 / 24.10 / Port WidgetNetworkComponent to new dashboard May 1, 2024
@bugclerk
Copy link
Contributor

bugclerk commented May 1, 2024

Copy link

codecov bot commented May 1, 2024

Codecov Report

Attention: Patch coverage is 65.97222% with 49 lines in your changes are missing coverage. Please review.

Project coverage is 73.67%. Comparing base (6a42c77) to head (ab9ba50).
Report is 1 commits behind head on master.

Files Patch % Lines
...network/widget-network/widget-network.component.ts 77.10% 19 Missing ⚠️
...ets/network/widget-network/widget-network.utils.ts 44.11% 19 Missing ⚠️
...ges/dashboard/services/widget-resources.service.ts 33.33% 10 Missing ⚠️
...rc/app/pages/dashboard/services/dashboard.store.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10014      +/-   ##
==========================================
+ Coverage   73.65%   73.67%   +0.02%     
==========================================
  Files        1505     1509       +4     
  Lines       52924    53032     +108     
  Branches     6329     6342      +13     
==========================================
+ Hits        38980    39071      +91     
- Misses      13944    13961      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

# Conflicts:
#	src/app/pages/dashboard/types/widget.interface.ts
#	src/app/pages/dashboard/widgets/all-widgets.constant.ts

networkInterfaceUpdate(interfaceName: string): Observable<ReportingData[]> {
return this.serverTime$.pipe(
skipWhile(() => !interfaceName),
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't think this will work when interfaceName is null/empty string. string is passed by value so that variable will never update and this observable will keep skipping emits because of the skipWhile.
Also, I think computing time values on the spot are a better approach. We don't need this information all the time. Just when making the calls. Why keep timers on when they are not needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that's right. It looks like leftover since we are switching to networkInterfaceUpdate once the interface is loaded

};
});

protected chartOptions: ChartOptions<'line'> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should break this large object down into smaller chunks stored in variables with declarative names so it's more readable what we're doing.

Copy link
Member Author

Choose a reason for hiding this comment

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

It sounded like a good idea at first. When I did, it became less readable, and understanding what and where became more complex. So, I prefer to keep it as is.

Here is what it might look like after splitting:
image
image

@denysbutenko denysbutenko merged commit a4d8675 into master May 10, 2024
9 checks passed
@denysbutenko denysbutenko deleted the NAS-128386 branch May 10, 2024 12:46
@bugclerk
Copy link
Contributor

This PR has been merged and conversations have been locked.
If you would like to discuss more about this issue please use our forums or raise a Jira ticket.

@truenas truenas locked as resolved and limited conversation to collaborators May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants