-
Notifications
You must be signed in to change notification settings - Fork 189
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
Adding posts count to dashboard #2476
Conversation
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'm getting Total Posts: N/A when running this. Is there something I need to change before running it?
Hi Mengi, you should change the URL in the |
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.
File name should be changed to: posts-count.js
This needs a rebase |
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 you include a screenshot of your work in the PR?
You need to revert the changes I mentioned, so that it can pull in the proper ones when you rebase onto 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.
The rebase is correct now, I tested on local but the "http://localhost/v1/posts" return an empty array (probably not your fault). Other than that, everything is great.
src/api/status/public/index.html
Outdated
@@ -1307,5 +1328,6 @@ <h6 class="mt-3">Thank you for sharing!</h6> | |||
<!-- Telescope JS Files --> | |||
<script src="js/github-stats.js"></script> | |||
<script src="js/feed/index.js"></script> | |||
<script type="module" src="js/index.js"></script> |
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.
@nguyenhung15913 this should be changed to js/pages/dashboard.js.
EDIT: can you also export the functions in github-stats.js and feed/index.js, add them to the load even of js/pages/dashboard.js just like your function?
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.
Good to go, just revert the unnecessary change and squash all the commits.
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 rebase went wrong again...
config/env.development
Outdated
@@ -18,7 +18,7 @@ TELESCOPE_HOST=http://localhost:3000 | |||
|
|||
# The host where all the microservices run (e.g., http://localhost) | |||
# NOTE: if you change this, change all other occurrences below too. | |||
API_HOST=localhost | |||
API_HOST=http://localhost |
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.
Revert.
package.json
Outdated
@@ -82,8 +82,8 @@ | |||
"opml-generator": "1.1.1", | |||
"passport": "0.4.1", | |||
"passport-saml": "3.1.2", | |||
"pino": "7.3.0", | |||
"pino-elasticsearch": "6.2.0", | |||
"pino": "6.11.2", |
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.
Revert.
rebased Make functions more precise Fixed PR commit before rebasing added files back after aborting rebase commit after rebase final fix update package.json of posts commit b4 rebase commit 2 fixed before rebase
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.
Great work!
I tested locally and this should be ready to merge @humphd.
import { getFeedCount } from '../feed/index.js'; | ||
import { getGitHubData } from '../github-stats.js'; | ||
|
||
window.addEventListener('load', (event) => { |
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.
Minor nit: event
isn't used, you should remove it.
Issue This PR Addresses
Fixes #2419
Type of Change
Description
cors
to Satellite options atsrc/api/posts/src/index.js
to exposex-total-count
header.src/api/status/public/index.html
postCounts.js
atsrc/api/status/public
to fetch and get the total of postsconnectSrc
of Satellite options, andcors
atsrc/api/status/src/server.js
Note: I worked with
postsCount.js
locally using fetch to get thex-total-count
header fromhttps://localhost/v1/posts
and it worked. However, withhttps://dev.api.telescope.cdot.systems/v1/posts
,response.headers.get(x-total-count)
will return null.To test locally:
src/api/status/env.local
, includeAPI_HOST=http://localhost/v1/posts
<base href="/v1/status/" />
insrc/api/status/public/index.html
(This line however is required in production)process.env.API_HOST
toconnectSrc
insrc/api/status/src/server.js
url
to 'http://localhost/v1/posts' instead insrc/api/status/public/js/post/index.js
npm run services:start posts
npm run dev
insrc/api/status
Here is the screenshot of working posts count:
Checklist