-
Notifications
You must be signed in to change notification settings - Fork 257
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
Fix all events link #7059
Fix all events link #7059
Conversation
shell/components/CommunityLinks.vue
Outdated
if (this.uiCustomLinks?.value) { | ||
try { | ||
const customLinks = JSON.parse(this.uiCustomLinks.value); | ||
|
||
if (Array.isArray(customLinks)) { | ||
return JSON.parse(this.uiCustomLinks.value).reduce((prev, curr) => { | ||
prev[curr.key] = curr.value; | ||
|
||
return prev; | ||
}, {}); | ||
} | ||
} catch (e) { | ||
console.error('Could not parse custom links setting', e); // eslint-disable-line no-console | ||
} |
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.
if (this.uiCustomLinks?.value) { | |
try { | |
const customLinks = JSON.parse(this.uiCustomLinks.value); | |
if (Array.isArray(customLinks)) { | |
return JSON.parse(this.uiCustomLinks.value).reduce((prev, curr) => { | |
prev[curr.key] = curr.value; | |
return prev; | |
}, {}); | |
} | |
} catch (e) { | |
console.error('Could not parse custom links setting', e); // eslint-disable-line no-console | |
} | |
if (!!this.uiCustomLinks?.value) { | |
const val = JSON.parse(this.uiCustomLinks.value); | |
// User could have no links. | |
const customLinks = Array.isArray(val) ? val : Object.keys({}); | |
return customLinks.reduce((prev, curr) => { | |
prev[curr.key] = curr.value; | |
return prev; | |
}, {}); | |
} |
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.
Unless I'm missing something here I think .reduce
is fine on an empty array if there's an initial value set? Other than my uncertainty around this the PR looks good.
shell/components/CommunityLinks.vue
Outdated
if (this.uiCustomLinks?.value) { | ||
try { | ||
const customLinks = JSON.parse(this.uiCustomLinks.value); | ||
|
||
if (Array.isArray(customLinks)) { | ||
return JSON.parse(this.uiCustomLinks.value).reduce((prev, curr) => { | ||
prev[curr.key] = curr.value; | ||
|
||
return prev; | ||
}, {}); | ||
} | ||
} catch (e) { | ||
console.error('Could not parse custom links setting', e); // eslint-disable-line no-console | ||
} |
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.
Unless I'm missing something here I think .reduce
is fine on an empty array if there's an initial value set? Other than my uncertainty around this the PR looks good.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #7059 +/- ##
=========================================
Coverage ? 36.30%
=========================================
Files ? 967
Lines ? 17222
Branches ? 4462
=========================================
Hits ? 6253
Misses ? 10969
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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
* Fix all events link * Minor update
Fixes #5816
Addresses 2 problems when clicking on the 'Show all events' link on the cluster dashboard page.
{}
- which can happen