Ajout commentaire des issues
This commit is contained in:
@@ -180,3 +180,4 @@
|
||||
.markdown-body > *:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -247,6 +247,11 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Commentaires -->
|
||||
@if (!isNewIssueRoute) {
|
||||
<app-issue-comments [issueId]="issue.id" />
|
||||
}
|
||||
|
||||
@if (isNewIssueRoute) {
|
||||
<div class="d-flex justify-content-end gap-2 mt-4">
|
||||
<button type="button" class="btn btn-outline-secondary" (click)="cancelCreation()">Annuler</button>
|
||||
|
||||
@@ -5,10 +5,11 @@ import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { marked } from 'marked';
|
||||
import { IssueEntity, IssuesStore } from '../issues.store';
|
||||
import { IssueComments } from '../issue-comments/issue-comments';
|
||||
|
||||
@Component({
|
||||
selector: 'app-issue-detail',
|
||||
imports: [FormsModule],
|
||||
imports: [FormsModule, IssueComments],
|
||||
templateUrl: './issue-detail.html',
|
||||
styleUrl: './issue-detail.css',
|
||||
})
|
||||
@@ -16,7 +17,7 @@ export class IssueDetail {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly router = inject(Router);
|
||||
private readonly issuesStore = inject(IssuesStore);
|
||||
private readonly sanitizer = inject(DomSanitizer);
|
||||
protected readonly sanitizer = inject(DomSanitizer);
|
||||
protected readonly isNewIssueRoute = this.route.snapshot.routeConfig?.path === 'issues/new';
|
||||
|
||||
protected issue: IssueEntity = this.buildIssue();
|
||||
@@ -158,6 +159,7 @@ export class IssueDetail {
|
||||
description: '',
|
||||
estimatedTime: null,
|
||||
dependsOnIds: [],
|
||||
comments: [],
|
||||
priority: 'Moyenne',
|
||||
status: 'draft',
|
||||
progress: 0,
|
||||
@@ -196,6 +198,7 @@ export class IssueDetail {
|
||||
return this.sanitizer.bypassSecurityTrustHtml(html);
|
||||
}
|
||||
|
||||
|
||||
protected get typeBadgeClass(): string {
|
||||
return this.getBadgeClass(this.issueTypeValue);
|
||||
}
|
||||
@@ -266,8 +269,7 @@ export class IssueDetail {
|
||||
const resolvedId = Number(idParam ?? draftId ?? 0);
|
||||
const safeId = Number.isNaN(resolvedId) ? 0 : resolvedId;
|
||||
|
||||
if (isNewIssueRoute) {
|
||||
return {
|
||||
const blank: IssueEntity = {
|
||||
id: safeId,
|
||||
type: 'Story',
|
||||
assignee: '',
|
||||
@@ -277,29 +279,14 @@ export class IssueDetail {
|
||||
description: '',
|
||||
estimatedTime: null,
|
||||
dependsOnIds: [],
|
||||
comments: [],
|
||||
priority: 'Moyenne',
|
||||
status: 'draft',
|
||||
progress: 0,
|
||||
};
|
||||
}
|
||||
|
||||
const existingIssue = this.issuesStore.getById(safeId);
|
||||
if (isNewIssueRoute) return blank;
|
||||
|
||||
return (
|
||||
existingIssue ?? {
|
||||
id: safeId,
|
||||
type: 'Story',
|
||||
assignee: '',
|
||||
epic: '',
|
||||
name: '',
|
||||
dueDate: '',
|
||||
description: '',
|
||||
estimatedTime: null,
|
||||
dependsOnIds: [],
|
||||
priority: 'Moyenne',
|
||||
status: 'draft',
|
||||
progress: 0,
|
||||
}
|
||||
);
|
||||
return this.issuesStore.getById(safeId) ?? blank;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,13 @@ export type IssueStatus = 'draft' | 'todo' | 'done' | 'in-progress';
|
||||
export type IssuePriority = 'Basse' | 'Moyenne' | 'Haute';
|
||||
export type IssueType = 'Epic' | 'Bug' | 'Study' | 'Story' | 'Task' | 'Technical Story';
|
||||
|
||||
export type IssueComment = {
|
||||
id: number;
|
||||
text: string;
|
||||
createdAt: string;
|
||||
updatedAt: string | null;
|
||||
};
|
||||
|
||||
export type IssueEntity = {
|
||||
id: number;
|
||||
type: IssueType;
|
||||
@@ -16,6 +23,7 @@ export type IssueEntity = {
|
||||
description: string;
|
||||
estimatedTime: number | null;
|
||||
dependsOnIds: number[];
|
||||
comments: IssueComment[];
|
||||
priority: IssuePriority;
|
||||
status: IssueStatus;
|
||||
progress: number;
|
||||
@@ -32,6 +40,7 @@ const DEFAULT_ISSUES: IssueEntity[] = [
|
||||
description: 'Corriger le comportement du menu sur petits ecrans.',
|
||||
estimatedTime: 8,
|
||||
dependsOnIds: [],
|
||||
comments: [],
|
||||
priority: 'Haute',
|
||||
status: 'in-progress',
|
||||
progress: 35,
|
||||
@@ -46,6 +55,7 @@ const DEFAULT_ISSUES: IssueEntity[] = [
|
||||
description: 'Fiabiliser les regles de validation du formulaire projet.',
|
||||
estimatedTime: 16,
|
||||
dependsOnIds: [],
|
||||
comments: [],
|
||||
priority: 'Moyenne',
|
||||
status: 'todo',
|
||||
progress: 20,
|
||||
@@ -60,6 +70,7 @@ const DEFAULT_ISSUES: IssueEntity[] = [
|
||||
description: 'Mettre a jour le wording d accueil selon la charte produit.',
|
||||
estimatedTime: 4,
|
||||
dependsOnIds: [],
|
||||
comments: [],
|
||||
priority: 'Basse',
|
||||
status: 'done',
|
||||
progress: 100,
|
||||
@@ -135,6 +146,7 @@ export class IssuesStore {
|
||||
type: issue.type ?? 'Story',
|
||||
estimatedTime: issue.estimatedTime ?? null,
|
||||
dependsOnIds: normalizedDependencies,
|
||||
comments: Array.isArray(issue.comments) ? issue.comments : [],
|
||||
} as IssueEntity;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user