update roadmap view and classification by epic/theme
This commit is contained in:
1 parent
5ffd56b020
commit
6b7a4e452d
4 files changed
+144
-38
No files matched your search
@@ -73,6 +73,15 @@ Vous pouvez maintenant modifier les dates directement depuis l'interface et les
|
||||
```
|
||||
|
||||
### 4. Roadmap Draw.io ⭐ NOUVEAU
|
||||
|
||||
**Regroupement par Epic/Theme :**
|
||||
|
||||
1. Le champ Jira `customfield_10202` est extrait automatiquement, sans configuration supplémentaire.
|
||||
2. Dans Table, saisissez une seule étiquette de projet, sans espace ni virgule, dans la colonne « Epic/Theme », puis cliquez sur « Update ». Une valeur vide efface les étiquettes du champ.
|
||||
3. Dans Roadmap, choisissez « By epic theme » : les projets et leurs CR ayant la même étiquette sont regroupés, chacun conservant sa ligne. Les tickets sans étiquette sont regroupés sous « No epic theme ».
|
||||
|
||||
Les tickets comportant déjà plusieurs étiquettes apparaissent sous « Multiple epic themes ». Leur remplacement ou suppression demande une confirmation. Comme pour les autres vues de la roadmap, seuls les tickets ayant au moins une date y apparaissent. L'édition nécessite que le champ soit modifiable dans Jira.
|
||||
|
||||
Générez une roadmap visuelle au format Draw.io (.drawio) importable dans draw.io/diagrams.net !
|
||||
|
||||
**Contenu de la roadmap :**
|
||||
|
||||
+7
-1
@@ -61,7 +61,7 @@
|
||||
<div class="form-group">
|
||||
<label for="customFields">Custom Fields (optional)</label>
|
||||
<input type="text" id="customFields" placeholder="customfield_10001:Production Date">
|
||||
<span class="hint">Format : customfield_ID:DisplayName, comma separated</span>
|
||||
<span class="hint">Format: customfield_ID:DisplayName, comma separated. Epic/Theme is extracted automatically.</span>
|
||||
</div>
|
||||
<div class="form-group full">
|
||||
<label for="jqlQuery">JQL Query (optional)</label>
|
||||
@@ -114,6 +114,12 @@
|
||||
<div class="tab-panel" id="panel-roadmap">
|
||||
<div class="toolbar-roadmap">
|
||||
<div class="view-controls">
|
||||
<span class="mr-8">Group :</span>
|
||||
<div class="btn-group no-margin" aria-label="Roadmap grouping">
|
||||
<button class="btn btn-secondary btn-sm active" data-gantt-mode="team" onclick="setGanttMode('team')">By assignee</button>
|
||||
<button class="btn btn-secondary btn-sm" data-gantt-mode="epic" onclick="setGanttMode('epic')">By epic theme</button>
|
||||
<button class="btn btn-secondary btn-sm" data-gantt-mode="global" onclick="setGanttMode('global')">Global</button>
|
||||
</div>
|
||||
<span class="mr-8"><i class="fa-solid fa-magnifying-glass-plus"></i> View :</span>
|
||||
<div class="btn-group no-margin">
|
||||
<button class="btn btn-secondary btn-sm" onclick="setGanttView('month')">Months</button>
|
||||
|
||||
+114
-28
@@ -5,6 +5,7 @@ let customFieldsMap = [];
|
||||
let lastUsername = '';
|
||||
let lastApiToken = '';
|
||||
let currentGanttView = 'month';
|
||||
let currentGanttMode = 'team';
|
||||
let isGanttExpanded = false;
|
||||
let currentSortCol = null;
|
||||
let isAsc = true;
|
||||
@@ -311,7 +312,7 @@ async function startExtraction() {
|
||||
|
||||
allTickets = data.tickets;
|
||||
filteredTickets = [...allTickets];
|
||||
customFieldsMap = parseCustomFields(custom);
|
||||
customFieldsMap = data.customFieldsMap || parseCustomFields(custom);
|
||||
lastUsername = user;
|
||||
lastApiToken = token;
|
||||
|
||||
@@ -361,20 +362,23 @@ function sortTable(colKey) {
|
||||
}
|
||||
|
||||
// --- TICKET UPDATE ---
|
||||
async function updateTicket(ticketKey, dueDate, goLiveDate) {
|
||||
async function updateTicket(ticketKey, dueDate, goLiveDate, epicTheme, refreshTable = true) {
|
||||
if (!lastUsername || !lastApiToken) {
|
||||
showToast('Please extract tickets first.', 'error');
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
const btn = document.querySelector(`[data-ticket="${ticketKey}"]`);
|
||||
const orig = btn ? btn.innerHTML : null;
|
||||
const wasDisabled = btn ? btn.disabled : true;
|
||||
if (btn) { btn.innerHTML = '<span class="spinner"></span>'; btn.disabled = true; }
|
||||
|
||||
const goLiveField = customFieldsMap.find(cf => cf.label.toLowerCase().includes('go live'));
|
||||
const goLiveField = getGoLiveField();
|
||||
const epicThemeField = getEpicThemeField();
|
||||
const updates = {};
|
||||
if (dueDate !== undefined) updates.duedate = dueDate;
|
||||
if (goLiveDate !== undefined && goLiveField) updates[goLiveField.id] = goLiveDate;
|
||||
if (epicTheme !== undefined && epicThemeField) updates[epicThemeField.id] = epicTheme;
|
||||
|
||||
try {
|
||||
const resp = await fetch(`${API_BASE}/api/update`, {
|
||||
@@ -391,15 +395,19 @@ async function updateTicket(ticketKey, dueDate, goLiveDate) {
|
||||
if (ticket) {
|
||||
if (updates.duedate !== undefined) ticket.dueDate = updates.duedate;
|
||||
if (goLiveField && updates[goLiveField.id] !== undefined) ticket[goLiveField.label] = updates[goLiveField.id];
|
||||
if (epicThemeField && updates[epicThemeField.id] !== undefined) ticket[epicThemeField.label] = updates[epicThemeField.id];
|
||||
}
|
||||
|
||||
renderTable();
|
||||
if (refreshTable) renderTable();
|
||||
renderRoadmap();
|
||||
renderJSON();
|
||||
showToast(`Ticket ${ticketKey} updated!`, 'success');
|
||||
return true;
|
||||
} catch (err) {
|
||||
showToast(err.message, 'error');
|
||||
return false;
|
||||
} finally {
|
||||
if (btn) { btn.innerHTML = orig; btn.disabled = false; }
|
||||
if (btn) { btn.innerHTML = orig; btn.disabled = wasDisabled; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,7 +423,7 @@ function getCreateIssueContext() {
|
||||
const projectMatch = jql.match(/\bproject\s*=\s*["']?([A-Z][A-Z0-9_-]*)["']?/i);
|
||||
const epicMatch = jql.match(/(?:["']?Epic Link["']?|\bparent|cf\[\d+\])\s*=\s*["']?([A-Z][A-Z0-9_-]*-\d+)["']?/i);
|
||||
const configuredFields = parseCustomFields(document.getElementById('customFields').value.trim());
|
||||
const dateField = configuredFields.find(field => /date|go live|production/i.test(field.label)) || configuredFields[0] || null;
|
||||
const dateField = configuredFields.find(field => /date|go live|production/i.test(field.label)) || configuredFields.find(field => field.id !== 'customfield_10202') || null;
|
||||
|
||||
return {
|
||||
jql,
|
||||
@@ -508,7 +516,7 @@ function handleUpdateClick(ticketKey, goLiveColName) {
|
||||
const dueInput = document.getElementById(`due-${ticketKey}`);
|
||||
const dueDate = dueInput && dueInput.value ? dueInput.value : null;
|
||||
|
||||
let goLiveDate = null;
|
||||
let goLiveDate;
|
||||
if (goLiveColName) {
|
||||
const goLiveInput = document.getElementById(`gl-${ticketKey}`);
|
||||
goLiveDate = goLiveInput && goLiveInput.value ? goLiveInput.value : null;
|
||||
@@ -516,15 +524,50 @@ function handleUpdateClick(ticketKey, goLiveColName) {
|
||||
updateTicket(ticketKey, dueDate, goLiveDate);
|
||||
}
|
||||
|
||||
async function saveEpicTheme(ticketKey) {
|
||||
const epicThemeInput = document.getElementById(`epic-theme-${ticketKey}`);
|
||||
const epicThemeField = getEpicThemeField();
|
||||
const ticket = allTickets.find(t => t.key === ticketKey);
|
||||
if (!epicThemeInput || epicThemeInput.disabled || !epicThemeField || !ticket) return;
|
||||
const existingThemes = Array.isArray(ticket[epicThemeField.label]) ? ticket[epicThemeField.label] : [];
|
||||
const newEpicTheme = epicThemeInput.value.trim();
|
||||
if (newEpicTheme === existingThemes.join(', ')) return;
|
||||
if (/[\s,]/.test(newEpicTheme)) {
|
||||
showToast('Epic/Theme must be a single label without spaces or commas.', 'error');
|
||||
return;
|
||||
}
|
||||
if (existingThemes.length > 1 && !window.confirm(`Replace all existing Epic/Theme labels (${existingThemes.join(', ')}) for ${ticketKey}?`)) {
|
||||
epicThemeInput.value = existingThemes.join(', ');
|
||||
return;
|
||||
}
|
||||
epicThemeInput.disabled = true;
|
||||
try {
|
||||
const saved = await updateTicket(ticketKey, undefined, undefined, newEpicTheme ? [newEpicTheme] : [], false);
|
||||
if (saved) {
|
||||
epicThemeInput.value = newEpicTheme;
|
||||
epicThemeInput.title = 'One project label, without spaces';
|
||||
const warning = document.getElementById(`epic-theme-warning-${ticketKey}`);
|
||||
if (warning) warning.remove();
|
||||
}
|
||||
} finally {
|
||||
epicThemeInput.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// --- GANTT DATE EDIT MODAL ---
|
||||
let dateEditContext = { ticketKey: null, goLiveColName: null };
|
||||
|
||||
// Detects the real go-live custom field name, ignoring known built-in ticket properties
|
||||
function getGoLiveField() {
|
||||
return customFieldsMap.find(field => /go live/i.test(field.label)) || customFieldsMap.find(field => /date|production/i.test(field.label)) || null;
|
||||
}
|
||||
|
||||
function getGoLiveColumnName() {
|
||||
if (!allTickets.length) return null;
|
||||
return Object.keys(allTickets[0]).find(key =>
|
||||
!['key','url','summary','description','status','statusCategory','assignee','reporter','priority','issueType','created','updated','dueDate','resolution','resolutionDate','labels','components','fixVersions','projectName'].includes(key)
|
||||
) || null;
|
||||
return getGoLiveField()?.label || null;
|
||||
}
|
||||
|
||||
function getEpicThemeField() {
|
||||
return customFieldsMap.find(field => field.id === 'customfield_10202') || null;
|
||||
}
|
||||
|
||||
function openDateEditModal(ticketKey) {
|
||||
@@ -599,6 +642,7 @@ function fmtDate(d) { if(!d) return '<span class="empty-cell">-</span>'; try { r
|
||||
|
||||
function renderTable() {
|
||||
const goLiveColName = getGoLiveColumnName();
|
||||
const epicThemeField = getEpicThemeField();
|
||||
|
||||
const colMapping = {
|
||||
'Ticket': 'key',
|
||||
@@ -615,6 +659,8 @@ function renderTable() {
|
||||
cols.push(goLiveColName);
|
||||
colMapping[goLiveColName] = goLiveColName;
|
||||
}
|
||||
cols.push('Epic/Theme');
|
||||
if (epicThemeField) colMapping['Epic/Theme'] = epicThemeField.label;
|
||||
cols.push('Actions');
|
||||
|
||||
document.getElementById('tableHead').innerHTML = '<tr>' + cols.map(c => {
|
||||
@@ -649,13 +695,17 @@ function renderTable() {
|
||||
body += `<td><input type="date" class="date-input" id="gl-${t.key}" value="${glVal}" onchange="enableUpdateBtn('${t.key}')"></td>`;
|
||||
}
|
||||
|
||||
const epicThemes = epicThemeField && Array.isArray(t[epicThemeField.label]) ? t[epicThemeField.label] : [];
|
||||
const themeTitle = epicThemes.length > 1 ? 'Multiple labels: changing this value replaces them all' : 'One project label, without spaces';
|
||||
body += `<td><input type="text" class="date-input" id="epic-theme-${t.key}" value="${escHtml(epicThemes.join(', ')).replace(/"/g, '"')}" onblur="saveEpicTheme('${t.key}')" onkeydown="if (event.key === 'Enter') { event.preventDefault(); this.blur(); }" title="${themeTitle}" ${epicThemeField ? '' : 'disabled'}>${epicThemes.length > 1 ? ` <span id="epic-theme-warning-${t.key}" title="Multiple Epic/Theme labels">⚠</span>` : ''}</td>`;
|
||||
|
||||
body += `<td>
|
||||
<button class="btn-update" id="update-${t.key}" data-ticket="${t.key}" onclick="handleUpdateClick('${t.key}', '${goLiveColName || ''}')" disabled>
|
||||
<i class="fa-solid fa-rotate"></i> Update
|
||||
</button>
|
||||
</td></tr>`;
|
||||
});
|
||||
document.getElementById('tableBody').innerHTML = body || '<tr><td colspan="10">No results found</td></tr>';
|
||||
document.getElementById('tableBody').innerHTML = body || `<tr><td colspan="${cols.length}">No results found</td></tr>`;
|
||||
}
|
||||
|
||||
// --- ROADMAP (GANTT) ---
|
||||
@@ -664,6 +714,26 @@ function setGanttView(view) {
|
||||
renderRoadmap();
|
||||
}
|
||||
|
||||
function setGanttMode(mode) {
|
||||
currentGanttMode = mode;
|
||||
document.querySelectorAll('[data-gantt-mode]').forEach(button => {
|
||||
button.classList.toggle('active', button.dataset.ganttMode === mode);
|
||||
});
|
||||
renderRoadmap();
|
||||
}
|
||||
|
||||
function sortTicketsByDueDate(tickets) {
|
||||
return [...tickets].sort((a, b) => {
|
||||
const dateA = Date.parse(a.dueDate);
|
||||
const dateB = Date.parse(b.dueDate);
|
||||
const orderA = Number.isNaN(dateA) ? Infinity : dateA;
|
||||
const orderB = Number.isNaN(dateB) ? Infinity : dateB;
|
||||
|
||||
if (orderA !== orderB) return orderA - orderB;
|
||||
return String(a.key || '').localeCompare(String(b.key || ''));
|
||||
});
|
||||
}
|
||||
|
||||
function toggleGanttExpand() {
|
||||
isGanttExpanded = !isGanttExpanded;
|
||||
updateGanttExpandState();
|
||||
@@ -734,7 +804,7 @@ function renderRoadmap() {
|
||||
return;
|
||||
}
|
||||
|
||||
const goLiveColName = Object.keys(filteredTickets[0]).find(k => k.toLowerCase().includes('go live')) || "Go Live Date";
|
||||
const goLiveColName = getGoLiveColumnName() || 'Go Live Date';
|
||||
|
||||
const leftWidth = 280;
|
||||
let colWidth = 140;
|
||||
@@ -807,12 +877,22 @@ function renderRoadmap() {
|
||||
return leftWidth + (index * colWidth) + (ratio * colWidth);
|
||||
};
|
||||
|
||||
const epicThemeField = getEpicThemeField();
|
||||
const grouped = ticketsWithDates.reduce((acc, t) => {
|
||||
const name = t.assignee || "Unassigned";
|
||||
if (!acc[name]) acc[name] = [];
|
||||
acc[name].push(t);
|
||||
const themes = epicThemeField && Array.isArray(t[epicThemeField.label]) ? t[epicThemeField.label] : [];
|
||||
const name = currentGanttMode === 'epic'
|
||||
? themes.length > 1 ? 'Multiple epic themes' : (themes[0] || 'No epic theme')
|
||||
: t.assignee || 'Unassigned';
|
||||
if (!acc.has(name)) acc.set(name, []);
|
||||
acc.get(name).push(t);
|
||||
return acc;
|
||||
}, {});
|
||||
}, new Map());
|
||||
const roadmapGroups = currentGanttMode === 'global'
|
||||
? [{ name: null, tickets: sortTicketsByDueDate(ticketsWithDates) }]
|
||||
: [...grouped.keys()].sort().map(name => ({
|
||||
name,
|
||||
tickets: sortTicketsByDueDate(grouped.get(name))
|
||||
}));
|
||||
|
||||
let html = `<div class="gantt-container ${isGanttExpanded ? 'expanded' : ''}"><div class="gantt-canvas" style="width: ${leftWidth + (timeScale.length * colWidth)}px;">`;
|
||||
|
||||
@@ -822,20 +902,21 @@ function renderRoadmap() {
|
||||
html += `<div class="gantt-today-label" id="todayMarker" style="left: ${todayX}px;">Today</div>`;
|
||||
}
|
||||
|
||||
html += `<div class="gantt-header"><div class="gantt-sticky-col gantt-group-name" style="width:${leftWidth}px">Assignee / Ticket (Title)</div>`;
|
||||
const rowHeader = currentGanttMode === 'global' ? 'Ticket (Due Date)' : currentGanttMode === 'epic' ? 'Epic Theme / Ticket (Title)' : 'Assignee / Ticket (Title)';
|
||||
html += `<div class="gantt-header"><div class="gantt-sticky-col gantt-group-name" style="width:${leftWidth}px">${rowHeader}</div>`;
|
||||
timeScale.forEach(ts => { html += `<div class="gantt-month-header" style="width:${colWidth}px;">${ts.label}</div>`; });
|
||||
html += `</div>`;
|
||||
|
||||
Object.keys(grouped).sort().forEach(assignee => {
|
||||
roadmapGroups.forEach(({ name, tickets }) => {
|
||||
if (name !== null) {
|
||||
html += `<div class="gantt-group-header">
|
||||
<div class="gantt-sticky-col gantt-group-name" style="width:${leftWidth}px">
|
||||
<i class="fa-solid fa-user-circle mr-8"></i>${assignee}
|
||||
<i class="fa-solid ${currentGanttMode === 'epic' ? 'fa-layer-group' : 'fa-user-circle'} mr-8"></i>${escHtml(name)}
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
const sortedTickets = grouped[assignee].sort((a, b) => (new Date(a.dueDate || 0)) - (new Date(b.dueDate || 0)));
|
||||
|
||||
sortedTickets.forEach(t => {
|
||||
tickets.forEach(t => {
|
||||
const dDue = t.dueDate ? new Date(t.dueDate) : null;
|
||||
const dLive = t[goLiveColName] ? new Date(t[goLiveColName]) : null;
|
||||
|
||||
@@ -975,14 +1056,19 @@ function exportDrawIOXML(mode) {
|
||||
acc[a].push(t);
|
||||
return acc;
|
||||
}, {});
|
||||
const exportGroups = currentGanttMode === 'global'
|
||||
? [{ name: null, tickets: sortTicketsByDueDate(ticketsWithDates) }]
|
||||
: Object.keys(groups).sort().map(name => ({ name, tickets: groups[name] }));
|
||||
|
||||
Object.keys(groups).sort().forEach(assignee => {
|
||||
xmlNodes += `<mxCell id="as_${currentY}" value="${assignee.toUpperCase()}" style="text;fontColor=#00e68a;fontStyle=1;fontSize=14" vertex="1" parent="1">
|
||||
exportGroups.forEach(({ name, tickets }) => {
|
||||
if (name !== null) {
|
||||
xmlNodes += `<mxCell id="as_${currentY}" value="${name.toUpperCase()}" style="text;fontColor=#00e68a;fontStyle=1;fontSize=14" vertex="1" parent="1">
|
||||
<mxGeometry x="10" y="${currentY}" width="200" height="30" as="geometry"/>
|
||||
</mxCell>`;
|
||||
currentY += 40;
|
||||
}
|
||||
|
||||
groups[assignee].forEach(t => {
|
||||
tickets.forEach(t => {
|
||||
const { shortTitle, type } = parseTicketSummary(t.summary);
|
||||
const mappedStatus = mapJiraStatus(t.status);
|
||||
const statusDef = STATUS_DEFINITIONS[mappedStatus] || STATUS_DEFINITIONS['Opportunity'];
|
||||
@@ -1007,7 +1093,7 @@ function exportDrawIOXML(mode) {
|
||||
|
||||
currentY += rowHeight;
|
||||
});
|
||||
currentY += 20;
|
||||
if (name !== null) currentY += 20;
|
||||
});
|
||||
|
||||
const finalXml = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
@@ -146,11 +146,9 @@ app.post('/api/extract', async (req, res) => {
|
||||
if (id) customFieldsMap.push({ id, label: label || id });
|
||||
});
|
||||
}
|
||||
|
||||
const fieldsToRequest = [
|
||||
...standardFields,
|
||||
...customFieldsMap.map(cf => cf.id)
|
||||
].join(',');
|
||||
const epicThemeField = customFieldsMap.find(cf => cf.id === 'customfield_10202');
|
||||
if (epicThemeField) epicThemeField.label = 'Epic/Theme';
|
||||
else customFieldsMap.push({ id: 'customfield_10202', label: 'Epic/Theme' });
|
||||
|
||||
const queryJql = jql || `project = "${projectKey}" ORDER BY created DESC`;
|
||||
|
||||
@@ -161,6 +159,11 @@ app.post('/api/extract', async (req, res) => {
|
||||
try {
|
||||
console.log(`[EXTRACT] Début pour ${projectKey} (JQL: ${queryJql.substring(0, 50)}...)`);
|
||||
|
||||
const fieldsToRequest = [
|
||||
...standardFields,
|
||||
...customFieldsMap.map(cf => cf.id)
|
||||
].join(',');
|
||||
|
||||
// Pagination automatique
|
||||
while (true) {
|
||||
const response = await jiraClient.get('/rest/api/2/search', {
|
||||
@@ -212,7 +215,9 @@ app.post('/api/extract', async (req, res) => {
|
||||
// Ajout des champs personnalisés
|
||||
customFieldsMap.forEach(cf => {
|
||||
const val = f[cf.id];
|
||||
if (val !== null && val !== undefined) {
|
||||
if (cf.id === 'customfield_10202') {
|
||||
ticket[cf.label] = Array.isArray(val) ? val : [];
|
||||
} else if (val !== null && val !== undefined) {
|
||||
// Pour les dates Jira, formater proprement
|
||||
if (typeof val === 'string' && (val.match(/^\d{4}-\d{2}-\d{2}/) || val.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/))) {
|
||||
ticket[cf.label] = val;
|
||||
@@ -232,7 +237,7 @@ app.post('/api/extract', async (req, res) => {
|
||||
}
|
||||
|
||||
console.log(`[EXTRACT] Terminé. ${allTickets.length} tickets extraits.`);
|
||||
res.json({ success: true, total: allTickets.length, tickets: allTickets });
|
||||
res.json({ success: true, total: allTickets.length, tickets: allTickets, customFieldsMap });
|
||||
|
||||
} catch (error) {
|
||||
console.error('[EXTRACT ERROR]', error.response?.data || error.message);
|
||||
@@ -345,14 +350,14 @@ app.put('/api/update', async (req, res) => {
|
||||
} catch (error) {
|
||||
console.error('[UPDATE ERROR]', error.response?.data || error.message);
|
||||
res.status(error.response?.status || 500).json({
|
||||
error: error.response?.data?.errorMessages?.[0] || error.message,
|
||||
error: error.response?.data?.errorMessages?.[0] || Object.values(error.response?.data?.errors || {})[0] || error.message,
|
||||
details: error.response?.data || null
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Démarrage
|
||||
const PORT = config.server?.port || 3000;
|
||||
const PORT = process.env.PORT || config.server?.port || 3000;
|
||||
app.listen(PORT, '0.0.0.0', () => {
|
||||
console.log('');
|
||||
console.log('============================================');
|
||||
|
||||
Reference in new issue
Block a user