Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BREAK][ENTERPRISE] Missing headers in CSV files downloaded from the Engagement Dashboard #23223

Merged
merged 5 commits into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,16 @@ const TableSection = () => {
}, [data]);

const downloadData = () => {
const data = channels.map(({
createdAt,
messagesCount,
name,
t,
updatedAt,
}) => [t, name, messagesCount, updatedAt, createdAt]);
const data = [
['Room type', 'Name', 'Messages', 'Last Update Date', 'Creation Date'],
...channels.map(({
createdAt,
messagesCount,
name,
t,
updatedAt,
}) => [t, name, messagesCount, updatedAt, createdAt]),
];
downloadCsvAs(data, `Channels_start_${ params.start }_end_${ params.end }`);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ const MessagesPerChannelSection = () => {
}, [pieData, tableData]);

const downloadData = () => {
const data = pieData.origins.map(({ t, messages }) => [t, messages]);
const data = [
['Room Type', 'Messages'],
...pieData.origins.map(({ t, messages }) => [t, messages]),
];
downloadCsvAs(data, `MessagesPerChannelSection_start_${ params.start }_end_${ params.end }`);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ const MessagesSentSection = () => {
}, [data, period]);

const downloadData = () => {
const data = values.map(({ date, newMessages }) => [date, newMessages]);
const data = [
['Date', 'Messages'],
...values.map(({ date, newMessages }) => [date, newMessages]),
];
downloadCsvAs(data, `MessagesSentSection_start_${ params.start }_end_${ params.end }`);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,21 @@ const UsersByTimeOfTheDaySection = ({ timezone }) => {
}, [data, period.end, period.start, utc]);

const downloadData = () => {
const _data = data.week.map(({
users,
hour,
day,
month,
year,
}) => ({
date: moment([year, month - 1, day, hour, 0, 0, 0]),
users,
}))
.sort((a, b) => a > b)
.map(({ date, users }) => [date.toISOString(), users]);
const _data = [
['Date', 'Users'],
...data.week.map(({
users,
hour,
day,
month,
year,
}) => ({
date: moment([year, month - 1, day, hour, 0, 0, 0]),
users,
}))
.sort((a, b) => a > b)
.map(({ date, users }) => [date.toISOString(), users]),
];
downloadCsvAs(_data, `UsersByTimeOfTheDaySection_start_${ params.start }_end_${ params.end }`);
};
return <Section
Expand Down