feature/projects-all-the-way-down #3323
|
@ -11,8 +11,8 @@
|
|||
@search="findProjects"
|
||||
>
|
||||
<template #searchResult="{option}">
|
||||
<span class="has-text-grey" v-if="projectStore.getParentProjects(option).length > 1">
|
||||
{{ projectStore.getParentProjects(option).filter(p => p.id !== option.id).map(p => getProjectTitle(p)).join(' > ') }} >
|
||||
<span class="has-text-grey" v-if="projectStore.getAncestors(option).length > 1">
|
||||
{{ projectStore.getAncestors(option).filter(p => p.id !== option.id).map(p => getProjectTitle(p)).join(' > ') }} >
|
||||
</span>
|
||||
{{ getProjectTitle(option) }}
|
||||
</template>
|
||||
|
|
|
@ -158,14 +158,14 @@ export const useProjectStore = defineStore('project', () => {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
function getParentProjects(project: IProject): IProject[] {
|
||||
function getAncestors(project: IProject): IProject[] {
|
||||
if (!project?.parentProjectId) {
|
||||
return [project]
|
||||
}
|
||||
dpschen
commented
When I read this first I thought that this implies that one project could have several parents. If I got it correct that's wrong. So how about When I read this first I thought that this implies that one project could have several parents. If I got it correct that's wrong. So how about `getAncestors` instead?
konrad
commented
I like that. Changed it. I like that. Changed it.
|
||||
|
||||
const parentProject = projects.value[project.parentProjectId]
|
||||
return [
|
||||
...getParentProjects(parentProject),
|
||||
...getAncestors(parentProject),
|
||||
project,
|
||||
]
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ export const useProjectStore = defineStore('project', () => {
|
|||
createProject,
|
||||
updateProject,
|
||||
deleteProject,
|
||||
getParentProjects,
|
||||
getAncestors,
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
ref="heading"
|
||||
/>
|
||||
<h6 class="subtitle" v-if="project?.id">
|
||||
<template v-for="p in projectStore.getParentProjects(project)">
|
||||
dpschen
commented
Shouldn't we still show the parent here? Shouldn't we still show the parent here?
konrad
commented
I've changed it now so that is shows this: (each project is clickable individually) For a hierarchy like this: I've changed it now so that is shows this:
![Screenshot_20230328_174428.png](/attachments/35babb55-b48a-49bf-a595-3fcc28da12dc)
(each project is clickable individually)
For a hierarchy like this:
![Screenshot_20230328_174646.png](/attachments/070d677e-d199-45ee-af6b-c0a6b3196681)
dpschen
commented
Can't see these images either Can't see these images either
konrad
commented
This starts to feel like a gitea bug... This starts to feel like a gitea bug...
|
||||
<template v-for="p in projectStore.getAncestors(project)">
|
||||
dpschen
commented
This won't update dynamically. Should we change the This won't update dynamically. Should we change the `getParentProjects` to a computed `parentProjects` that automatically updates instead?
konrad
commented
I tried to change it but it fails with I tried to change it but it fails with `getAncestors is not a function`. Any idea?
konrad
commented
Actually this does update dynamically when the project changes. I've had a task open, moved the project to another parent project and it updated instantly. Actually this does update dynamically when the project changes. I've had a task open, moved the project to another parent project and it updated instantly.
|
||||
<router-link :to="{ name: 'project.index', params: { projectId: p.id } }">
|
||||
{{ getProjectTitle(p) }}
|
||||
</router-link>
|
||||
|
|
Unsure: we might want to return the return value of setProjects here instead. Because maybe the projects will be modfied while being set. So it will be better to return from that method OR filter and return the projects with the id from the store object.
But
setProjects
does not return anything? Neither doessetProject
.These methods don't modify anything. I think it's fine to leave it like it is.