mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -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 !
19 lines
698 B
JavaScript
19 lines
698 B
JavaScript
import { ReactiveCache } from '/imports/reactiveCache';
|
|
import { csvPeopleNames } from '/models/lib/csvPeople';
|
|
|
|
// The people to map, each matched to a WeKan user of the same username when
|
|
// there is one. `rows` are the file's rows, or `names` the usernames the
|
|
// server read from an uploaded file (csvUploadPeople).
|
|
export function csvMembersFromNames(names) {
|
|
return names.map(username => {
|
|
const member = { username, id: username };
|
|
const wekanUser = ReactiveCache.getUser({ username });
|
|
if (wekanUser) member.wekanId = wekanUser._id;
|
|
return member;
|
|
});
|
|
}
|
|
|
|
export function csvGetMembersToMap(data, columns) {
|
|
return csvMembersFromNames(csvPeopleNames(data, columns));
|
|
}
|