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
Added jobs count to dashboard #2585
Conversation
src/api/posts/test/feeds.test.js
Outdated
| const resKeys = Object.keys(resBody.queueInfo); | ||
| for (let i = 0; i < resKeys.length; i += 1) { | ||
| if (allKeys.indexOf(resKeys[i]) < 0 || typeof resBody.queueInfo[resKeys[i]] !== 'number') { | ||
| bool = false; | ||
| break; | ||
| } | ||
| } |
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.
| const resKeys = Object.keys(resBody.queueInfo); | |
| for (let i = 0; i < resKeys.length; i += 1) { | |
| if (allKeys.indexOf(resKeys[i]) < 0 || typeof resBody.queueInfo[resKeys[i]] !== 'number') { | |
| bool = false; | |
| break; | |
| } | |
| } | |
| Object.keys(resBody.queueInfo).forEach((key) => | |
| if (!allKeys.includes(key) || typeof key !== 'number') | |
| return false; |
(didn't test it, but it's probably something very close to this)
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 used every instead of forEach because forEach doesn't support break or return
|
This needs a rebase to update for changes to posts and status. |
45ab3af
to
135aefd
Compare
135aefd
to
8832133
Compare
8832133
to
f11210e
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.
LGTM, nice feature
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.
The dashboard LGTM. Not quite sure how to review the backend.
The backend is ok except for some test refactoring, I’ve got the backend approved in another PR |
|
Where is this at? It says "Draft" |
|
This needs to be rebased to pick up the changes in affected files, and I'd like to see it get finished asap so we can land it this week. Can I get an update please @TueNguyen2911? |
|
Of course, I'll rebase this this afternoon after my last final! Sorry for the delay |
54b53f3
to
7ba97dd
Compare
|
@humphd, I've rebased it, can you take a look? |
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 👍.
src/api/status/src/js/queue-stats.js
Outdated
|
|
||
| module.exports = async function getJobCount() { | ||
| try { | ||
| const data = await fetch(`${process.env.POST_URL}/feeds/info`, { method: 'GET' }); |
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.
| const data = await fetch(`${process.env.POST_URL}/feeds/info`, { method: 'GET' }); | |
| const data = await fetch(`${process.env.POSTS_URL}/feeds/info`, { method: 'GET' }); |
7ba97dd
to
0705797
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.
LGMT, great job 👍
src/api/posts/test/feeds.test.js
Outdated
| return Object.keys(resBody.queueInfo).every((key) => { | ||
| if (!allKeys.includes(key) || typeof resBody.queueInfo[key] !== 'number') { | ||
| return false; |
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.
| return Object.keys(resBody.queueInfo).every((key) => { | |
| if (!allKeys.includes(key) || typeof resBody.queueInfo[key] !== 'number') { | |
| return false; | |
| return Object.keys(resBody.queueInfo).every((key) => allKeys.includes(key) && typeof resBody.queueInfo[key] === 'number') |
This can be shorted. Affirmative is usually easier to read too.
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.
Sorry, I missed this part in the previous review.
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.
No worries, thank you for the suggestion
0705797
to
1eaf75e
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.
R+ with CI passing.
|
Thanks! |
Issue This PR Addresses
This fixes issue #2414 which is also a follow up of PR #2541
Type of Change
Description
jobCountCard.hbsto display jobs in feeds queue in the backendsrc/api/status/src/jsa new filequeue-stats.jsto fetch queue's information using posts APIposts/feeds/infoTo test this feature:
*orhttp://localhost/v1/posts/feeds/infotoconnectSrcin server.jsqueue/index.jstohttp://localhost/v1/posts/feeds/infopnpm run services:start postsin root folder andnpm run devinapi/status, you'll getfeeds/infoinitial responsepnpm run services:startandpnpm startto start the backend feeds queue. Reload to see changes2021-12-09.13-31-08.mp4
Checklist