-
Notifications
You must be signed in to change notification settings - Fork 82
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
DCOS-51596: Services Table: avoid rerenders #3792
Conversation
93a0d18
to
9f7ebc5
Compare
The status column conversion is in its own commit since it was more complex than the others and affected multiple files. Comparison of react updates:
|
d965536
to
e0b3983
Compare
Just finished a nasty rebase since the accurate service status stuff merged and touched a lot of the same files. Would be great if someone familiar with that work could give this a look over cc @TattdCodeMonkey @pierrebeitz @Poltergeist |
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.
Brilliant and obviously a lot of work. 🎉 I saw about 1/3 or 1/2 as many updates as master branch
c545c25
to
a9dca61
Compare
I rebased in order to fix a commit message lint error. |
|
a9dca61
to
21fcdbf
Compare
Conflicts again and I run into strange bugs when I try to fix them (spent like 1,5h with it). I would say, let's get #3796 merged first and ship the status column individually. |
I created a new issue to track the efforts for the status column: DCOS-51596 |
21fcdbf
to
91b464d
Compare
When running with fixtures enabled, the services table is loading forever. |
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.
i think there are some gains in comprehensibility and this maintainability here that we should aim for.
also the services table does not load for me (for FE-cluster, SOAK and fixtures).
id: string | number; | ||
displayDeclinedOffers: boolean; | ||
appsWithWarnings: number | null; | ||
unableToLaunch: boolean; |
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.
these props look like they could benefit from telling apart a couple of things.
i'd propose to start with services
and groups
(a.k.a serviceTree
here). there seems to be uncertainty (| null
) by not telling them apart. also it looks like isServiceTree
and isService
is the same information because it's either one or another. that seems to cry for a union type.
); | ||
} | ||
|
||
//Master |
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.
there are multiple comments still in here.
instancesCount: service.getInstancesCount(), | ||
runningInstances: service.getRunningInstancesCount() | ||
}; | ||
let serviceTreeProps = {}; |
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.
can we move that into a block where we already know that service is a ServiceTree
and make it a const
? this would get rid of having to ask service instanceof ServiceTree
multiple times here.
statusText, | ||
totalCount, | ||
priorityStatusCount, | ||
tooltipContent |
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.
i wonder if the code would tell a clearer story if we moved those props right into RenderServiceTree
(currently line 2).
timeQueued: number | null; | ||
appsWithWarnings: number | null; | ||
displayDeclinedOffers: boolean; | ||
unableToLaunch: boolean; |
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.
could we make it so that the statusIcon
did not need to know about some of these things?
conceptually it feels like it should not need to know about whether it's associated to a service
or a group
/serviceTree
for example.
since?: unknown; | ||
} | ||
|
||
interface ItemWithQueue { |
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.
that's neat!
since: string | null; | ||
} | ||
|
||
const isUnableToLaunch = (service: Service | Pod | ServiceTree) => { |
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.
couldn't we use ItemWithQueue here instead of Service | Pod | ServiceTree
?
} | ||
|
||
const isUnableToLaunch = (service: Service | Pod | ServiceTree) => { | ||
const queue = service.getQueue() as ServiceQueue | null; |
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.
we wouldn't need the typecast here then 😊
|
||
const isUnableToLaunch = (service: Service | Pod | ServiceTree) => { | ||
const queue = service.getQueue() as ServiceQueue | null; | ||
const UNABLE_TO_LAUNCH_TIMEOUT = 1000 * 60 * 30; |
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.
we're recreating this constant every time we call isUnableToLaunch
. let's pull this to the root-level of the file!
const unableToLaunch = isUnableToLaunch(service); | ||
const appsWithWarnings = isServiceTree | ||
? (service as ServiceTree) | ||
.filterItems((item: any) => { |
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.
our typings say that this is a Service
. why override it with any
?
possibly the types of ServiceTree.filterItems
are wrong? (i updated them and possibly forgot that a serviceTree
can also contain another ServiceTree
. if so, please let's fix the types instead of working around here.
Testing
Trade-offs
Dependencies
Screenshots