-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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 ourterms of serviceand privacy statement.We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V5/homepage #20924
V5/homepage #20924
Conversation
The latest updates on your projects.Learn more aboutVercel for Git ↗︎
|
Looks like experimental failed to build because the yarn.lock is out of date, can you update it@Mcastres |
What yarn.lock? |
Take a look at the failure log from the experimental build:https://github /strapi/strapi/actions/runs/10230554919/job/28305494036 yarn.lock looks like it needs to be updated as when the GH actions is installing modules it's updating the yarn.lock and our automations don't allow that. |
building a new experimental:https://github /strapi/strapi/actions/runs/10271879316 |
exp version: |
})} | ||
</Typography> | ||
<Grid.Root gap={6} marginTop={4} marginBottom={8}> | ||
{upcomingReleasesCount && ( |
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.
|
||
export async function getContentTypeStatistics(contentType: UID.CollectionType, userId: number): Promise<ContentTypeStatistics> { | ||
// Fetch entries with associated user data that would always be there and just enough for the dashboard | ||
const [entries, initialCount] = await strapi.db.query(contentType).findWithCount({ |
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.
While the documentService doesn't have a findWidthCount we can still use findMany and count here since we aren't saving any resources on using findWithCount. That function makes two DB calls on it's own:
strapi/packages/core/database/src/entity-manager/entity-repository.ts
Lines 47 to 52 in a7ba501
findWithCount(params={}){ | |
returnPromise.all([ | |
db.entityManager.findMany(uid,params), | |
db.entityManager.count(uid,params), | |
]); | |
}, |
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.
Or we sweet talk the engineers into adding a findWithCount function the document service
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.
on top of this I would add that we might want to exclude drafts or published versions here, or a pair of them might count as 2 entries, using the doc service would handle that automatically
Technically looks amazing, but aesthetically ugly, pretty ugly. |
|
||
export async function getContentTypeStatistics(contentType: UID.CollectionType, userId: number): Promise<ContentTypeStatistics> { | ||
// Fetch entries with associated user data that would always be there and just enough for the dashboard | ||
const [entries, initialCount] = await strapi.db.query(contentType).findWithCount({ |
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.
rbac rules should be checked here to ensure we are not leaking any protected field information (Names could be protected with RBAC rules and this would not respect that) + permissions should be check to see if I am allowed to know that the content-type exists
In its current state an user with 0 permissions and just a jwt token can see firstnames of everyone plus can check any content type likeadmin::users
to see how many users exist and when they where created.
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.
+1, normally we do add those set of permissions in the controller handler, we should check if user has permissions to read the content type by its uid.
an example of how you would build such permission check on a controller:
const{userAbility}=ctx.state;
if(userAbility.cannot('plugin::content-manager.explorer.read',uid){
returnctx.forbidden()
}
Finally!!! A useful homepage ❤️ I have been testing your branch and I wanted to share some comments and feedback!, probably all of this could be iterated: I believe we could show a brief warning of what is supposed to be there, or show empty graphs.
Loading the home page for the first time, if there is a delay loading the data ( I just added a delay with I would expect the "Project statistics" to be loaded quickly, and the "Collection Types Overview" to be slower, that way we could have a quicker first load:) And when you select a different collection type, there is no loader:
Probably a bit tricky for some of them, but this might be the most performant way for heavy dbs. And another option would be to cache the statistics server side. |
@alexandrebodinWhy did you close this? |
@SalahAdDinIt got closed automatically because we removed the base branch. Right now this work is on hold and will be taken over by a team in the upcoming month. They will resubmit the PR when ready 👍 |
Hello there 👋
I submitted a commit on this PR. Please find below what it contains:
CE Users
Project statistics
Collection Type overview
EE Users
Collection Type overview
Assigned Entries
Advanced features
What's missing
While I'm proposing a dashboard foundation idea with this commit, some aspects are missing and will need discussions to move forward:
Thanks for your time!
This is how it looks like for an Enterprise User (Stacked Area Charts entries are all from the same day, so no area lol)