-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: add projects select to analytics page gf-348 #470
feat: add projects select to analytics page gf-348 #470
Conversation
Can I make a separate request to get all the projects, because it is a bit problematic to make it an optional query? Because I need to extract all the projects for the selector |
@@ -227,17 +227,11 @@ class ProjectController extends BaseController { | |||
*/ | |||
private async findAll( | |||
options: APIHandlerOptions<{ | |||
query: ProjectGetAllRequestDto; | |||
query: object | ProjectGetAllRequestDto; |
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.
query: object | ProjectGetAllRequestDto; | |
query: ProjectGetAllRequestDto; |
specify type
@@ -120,7 +120,7 @@ class ProjectService implements Service { | |||
} | |||
|
|||
public async findAll( | |||
parameters: ProjectGetAllRequestDto, | |||
parameters: object | ProjectGetAllRequestDto, |
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.
same
Pay attention to the changes in this PR #468, so that they are not conflicting |
…4-gitfit into 348-feat-add-projects-select-to-analytics-page
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.
Place helpers in their separate folders
const { page } = action.meta.arg; | ||
|
||
state.projects = | ||
const page = action.meta.arg?.page; |
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 page = action.meta.arg?.page; | |
const { page } = action.meta.arg; |
const { projects } = useAppSelector(({ projects }) => projects); | ||
|
||
useEffect(() => { | ||
void dispatch(projectActions.loadAll()); |
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.
We need to load these projects separately, specifically for analytics module, so it should be in analytics slice. Also on the backend side we need to split service method for pagination and without and the same for repository. Take a look at how it's done here #491
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.
Did I understand correctly that I can make a separate request on the backend in order to get all the projects (without pagination)? And use it in the analytics slice? I thought it would be better that way, I asked, but I didn't get an answer then
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.
Yes, let's make it as a separate request and keep it separately
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.
probably missed your question in the chat
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.
Everything is fine, I hope it is correct now
…4-gitfit into 348-feat-add-projects-select-to-analytics-page
…4-gitfit into 348-feat-add-projects-select-to-analytics-page
@@ -1,5 +1,6 @@ | |||
const ProjectsApiPath = { | |||
$ID: "/:id", | |||
All: "/all", |
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.
let's use the same route, but call different method on the backend depending on the query parameters, If we pass page, then call method with pagination, otherwise another method
All: "/all", |
const projects = await this.projectService.findAllWithoutPagination(); | ||
|
||
return { | ||
payload: projects, | ||
status: HTTPCode.OK, |
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 projects = await this.projectService.findAllWithoutPagination(); | |
return { | |
payload: projects, | |
status: HTTPCode.OK, | |
return { | |
payload: await this.projectService.findAllWithoutPagination(), | |
status: HTTPCode.OK, |
return projects.map((project) => { | ||
const { id, lastActivityDate, name } = project.toObject(); | ||
|
||
return { id, lastActivityDate, name }; | ||
}); |
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't we do it like
return projects.map((project) => { | |
const { id, lastActivityDate, name } = project.toObject(); | |
return { id, lastActivityDate, name }; | |
}); | |
return projects.map((project) => project.toObject()); |
@@ -4,4 +4,5 @@ export { | |||
type ActivityLogGetAllItemResponseDto, | |||
type ActivityLogGetAllResponseDto, | |||
type ActivityLogQueryParameters, | |||
type ProjectGetAllItemResponseDto, |
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 not sure, but maybe it'll be better to import this type from ~/modules/projects/projects.ts
in places where you need it, and not reexport this here?
Add project selector to the analytics page
When the project is selected only contributors from this project be shown.