Gestion issue epic dans milestone

This commit is contained in:
2026-05-28 06:11:33 +02:00
parent e20a009882
commit 05bb1b58d9
10 changed files with 1024 additions and 21 deletions
+36 -3
View File
@@ -166,7 +166,7 @@ export class IssueDetail {
protected async confirmCreateInEpic(): Promise<void> {
const name = this.newIssueName.trim();
if (!name) return;
await this.issuesStore.upsert({
const created = await this.issuesStore.upsert({
id: 0,
type: 'Story',
assignee: '',
@@ -181,6 +181,13 @@ export class IssueDetail {
status: 'draft',
progress: 0,
});
const epicMilestone = this.currentMilestone;
if (epicMilestone) {
await this.milestonesStore.upsert({
...epicMilestone,
issueIds: [...epicMilestone.issueIds, created.id],
});
}
this.showCreateInEpic = false;
this.newIssueName = '';
}
@@ -200,6 +207,22 @@ export class IssueDetail {
const target = this.issues().find((i) => i.id === this.selectedEpicCandidateId);
if (target) {
await this.issuesStore.upsert({ ...target, epic: this.issue.name });
const epicMilestone = this.currentMilestone;
if (epicMilestone) {
const prevMilestone = this.milestones().find((m) => m.issueIds.includes(target.id));
if (prevMilestone && prevMilestone.id !== epicMilestone.id) {
await this.milestonesStore.upsert({
...prevMilestone,
issueIds: prevMilestone.issueIds.filter((id) => id !== target.id),
});
}
if (!epicMilestone.issueIds.includes(target.id)) {
await this.milestonesStore.upsert({
...epicMilestone,
issueIds: [...epicMilestone.issueIds, target.id],
});
}
}
}
}
this.showAddToEpic = false;
@@ -210,6 +233,10 @@ export class IssueDetail {
return this.issueTypeValue === 'Epic';
}
protected get isChildOfEpic(): boolean {
return !!this.issue.epic;
}
protected onDescriptionPaste(event: ClipboardEvent): void {
const ta = event.target as HTMLTextAreaElement;
const start = ta.selectionStart;
@@ -294,17 +321,23 @@ export class IssueDetail {
protected async onMilestoneChange(newMilestoneId: number | null): Promise<void> {
if (this.isNewIssueRoute) return;
const childIds = this.isEpicIssue
? this.issues().filter((i) => i.epic === this.issue.name).map((i) => i.id)
: [];
const allIds = [this.issue.id, ...childIds];
const previous = this.currentMilestone;
if (previous) {
await this.milestonesStore.upsert({
...previous,
issueIds: previous.issueIds.filter((id) => id !== this.issue.id),
issueIds: previous.issueIds.filter((id) => !allIds.includes(id)),
});
}
if (newMilestoneId !== null) {
const target = this.milestones().find((m) => m.id === newMilestoneId);
if (target) {
await this.milestonesStore.upsert({ ...target, issueIds: [...target.issueIds, this.issue.id] });
const toAdd = allIds.filter((id) => !target.issueIds.includes(id));
await this.milestonesStore.upsert({ ...target, issueIds: [...target.issueIds, ...toAdd] });
}
}
}