-
Notifications
You must be signed in to change notification settings - Fork 270
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
Simplify handling of GitRepo status resources #13244
Conversation
0c7cec3
to
8de803e
Compare
8de803e
to
25273f0
Compare
const getResourcesDefaultState = (labelGetter, stateKey) => { | ||
return [ | ||
STATES_ENUM.READY, | ||
STATES_ENUM.NOT_READY, | ||
STATES_ENUM.WAIT_APPLIED, | ||
STATES_ENUM.MODIFIED, | ||
STATES_ENUM.MISSING, | ||
STATES_ENUM.ORPHANED, | ||
STATES_ENUM.UNKNOWN, | ||
].reduce((acc, state) => { | ||
acc[state] = { | ||
count: 0, | ||
color: STATES[STATES_ENUM.READY].color, | ||
label: labelGetter(`${ stateKey }.${ STATES_ENUM.READY }`, null, STATES[STATES_ENUM.READY].label ), | ||
status: STATES_ENUM.READY | ||
}, | ||
info: { | ||
count: 0, | ||
color: STATES[STATES_ENUM.INFO].color, | ||
label: labelGetter(`${ stateKey }.${ STATES_ENUM.INFO }`, null, STATES[STATES_ENUM.INFO].label ), | ||
status: STATES_ENUM.INFO | ||
}, | ||
warning: { | ||
count: 0, | ||
color: STATES[STATES_ENUM.WARNING].color, | ||
label: labelGetter(`${ stateKey }.${ STATES_ENUM.WARNING }`, null, STATES[STATES_ENUM.WARNING].label ), | ||
status: STATES_ENUM.WARNING | ||
}, | ||
notready: { | ||
count: 0, | ||
color: STATES[STATES_ENUM.NOT_READY].color, | ||
label: labelGetter(`${ stateKey }.${ STATES_ENUM.NOT_READY }`, null, STATES[STATES_ENUM.NOT_READY].label ), | ||
status: STATES_ENUM.NOT_READY | ||
}, | ||
error: { | ||
count: 0, | ||
color: STATES[STATES_ENUM.ERROR].color, | ||
label: labelGetter(`${ stateKey }.${ STATES_ENUM.ERROR }`, null, STATES[STATES_ENUM.ERROR].label ), | ||
status: STATES_ENUM.ERROR | ||
}, | ||
errapplied: { | ||
count: 0, | ||
color: STATES[STATES_ENUM.ERR_APPLIED].color, | ||
label: labelGetter(`${ stateKey }.${ STATES_ENUM.ERR_APPLIED }`, null, STATES[STATES_ENUM.ERR_APPLIED].label ), | ||
status: STATES_ENUM.ERR_APPLIED, | ||
}, | ||
waitapplied: { | ||
count: 0, | ||
color: STATES[STATES_ENUM.WAIT_APPLIED].color, | ||
label: labelGetter(`${ stateKey }.${ STATES_ENUM.WAIT_APPLIED }`, null, STATES[STATES_ENUM.WAIT_APPLIED].label ), | ||
status: STATES_ENUM.WAIT_APPLIED | ||
}, | ||
unknown: { | ||
color: STATES[state].color, | ||
label: labelGetter(`${ stateKey }.${ state }`, null, STATES[state].label ), | ||
status: state | ||
}; | ||
return acc; | ||
}, {}); | ||
}; | ||
const getBundlesDefaultState = (labelGetter, stateKey) => { | ||
return [ | ||
STATES_ENUM.READY, | ||
STATES_ENUM.INFO, | ||
STATES_ENUM.WARNING, | ||
STATES_ENUM.NOT_READY, | ||
STATES_ENUM.ERROR, | ||
STATES_ENUM.ERR_APPLIED, | ||
STATES_ENUM.WAIT_APPLIED, | ||
STATES_ENUM.UNKNOWN, | ||
].reduce((acc, state) => { |
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.
25273f0
to
762359e
Compare
56f94e2
to
23e53a9
Compare
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 found some regressions, let's check together offline.
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
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.
LGTM
Summary
Change how the GitRepo status info is obtained and processed, by consuming the new fields exposed by Fleet.
Occurred changes and/or fixed issues
Fixes #13243
Technical notes summary
This PR changes (again, see #12896) the way that bundles state is processed, by iterating over the list of bundles, for simplicity.
Also:
PerClusterResourceCounts
status fieldResources.perClusterState
in order to build the GitRepo's resource table, getting rid of BundleDeployments altogether.Areas or cases that should be tested
Areas which could experience regressions
There is a small regression in the Resources table for GitRepos, since the info backing the
Age
column is no longer available. However, this field was often blank as it's not always available.Screenshot/Video
Checklist