mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 04:49:41 -05:00
They were the last files the Import page read itself and sent whole. A chosen Jira file is now uploaded like the other sources: the people of its map-members step are read from it by the server (the Jira mapper is shared, models/lib/jiraMembersMapper.js), and the estimate mapping goes with the import call. A CSV / TSV file's header, sample rows and guessed mapping come from the server (csvUploadPreview), its people from the columns chosen (csvUploadPeople), and the import parses it there. Both methods read only the sender's own upload, signed in and while import is enabled, and leave it for the import that follows. Thanks to xet7 !
21 lines
803 B
JavaScript
21 lines
803 B
JavaScript
// Extract the distinct assignees from a Jira export so the import "map members"
|
|
// step can map each Jira user to a WeKan user. Shared: the page reads it from a
|
|
// pasted document, the server (models/import.js) from an uploaded file.
|
|
export function jiraGetMembersToMap(data) {
|
|
const issues = Array.isArray(data) ? data : data.issues || [];
|
|
const byId = {};
|
|
issues.forEach(issue => {
|
|
const assignee = issue.fields && issue.fields.assignee;
|
|
if (!assignee) return;
|
|
const id = assignee.accountId || assignee.name || assignee.emailAddress;
|
|
if (!id || byId[id]) return;
|
|
byId[id] = {
|
|
id,
|
|
username: assignee.name || assignee.displayName || id,
|
|
fullName: assignee.displayName || assignee.name || id,
|
|
wekanId: null,
|
|
};
|
|
});
|
|
return Object.values(byId);
|
|
}
|