You've already forked mattermost-webapp
mirror of
https://github.com/zerotier/mattermost-webapp.git
synced 2026-05-22 16:23:25 -07:00
MM-23038: Compliance report fixes (#5280)
* implement displaying warning for missing files * fix lint errors * update strings * update warning string Co-authored-by: mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
@@ -115,6 +115,18 @@ class JobTable extends React.PureComponent {
|
||||
/>
|
||||
</span>
|
||||
);
|
||||
} else if (job.status === JobStatuses.WARNING) {
|
||||
return (
|
||||
<span
|
||||
className='status-icon-warning'
|
||||
title={formatMessage({id: 'admin.jobTable.jobId', defaultMessage: 'Job ID: '}) + job.id}
|
||||
>
|
||||
<FormattedMessage
|
||||
id='admin.jobTable.statusWarning'
|
||||
defaultMessage='Warning'
|
||||
/>
|
||||
</span>
|
||||
);
|
||||
} else if (job.status === JobStatuses.ERROR) {
|
||||
return (
|
||||
<span
|
||||
|
||||
@@ -73,6 +73,12 @@ describe('components/admin_console/jobs/table', () => {
|
||||
id: '1236',
|
||||
status: 'error',
|
||||
type: 'data_retention',
|
||||
}, {
|
||||
created_at: 1540834294674,
|
||||
last_activity_at: 1540834294674,
|
||||
id: '1236',
|
||||
status: 'warning',
|
||||
type: 'data_retention',
|
||||
}],
|
||||
};
|
||||
|
||||
|
||||
@@ -57,16 +57,33 @@ export default class MessageExportSettings extends AdminSettings {
|
||||
}
|
||||
|
||||
getJobDetails = (job) => {
|
||||
if (job.data && job.data.messages_exported) {
|
||||
return (
|
||||
<FormattedMessage
|
||||
id='admin.complianceExport.messagesExportedCount'
|
||||
defaultMessage='{count} messages exported.'
|
||||
values={{
|
||||
count: job.data.messages_exported,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
if (job.data) {
|
||||
const message = [];
|
||||
if (job.data.messages_exported) {
|
||||
message.push(
|
||||
<FormattedMessage
|
||||
id='admin.complianceExport.messagesExportedCount'
|
||||
defaultMessage='{count} messages exported.'
|
||||
values={{
|
||||
count: job.data.messages_exported,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (job.data.warning_count > 0) {
|
||||
message.push(
|
||||
<div>
|
||||
<FormattedMessage
|
||||
id='admin.complianceExport.warningCount'
|
||||
defaultMessage='{count} warning(s) were encountered, see warning.txt for details'
|
||||
values={{
|
||||
count: job.data.warning_count,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -157,3 +157,56 @@ describe('components/MessageExportSettings', () => {
|
||||
expect(wrapper.find('#globalRelayEmailAddress').prop('value')).toBe('globalRelay@mattermost.com');
|
||||
});
|
||||
});
|
||||
|
||||
describe('components/MessageExportSettings/getJobDetails', () => {
|
||||
const baseProps = {
|
||||
config: {
|
||||
MessageExportSettings: {
|
||||
EnableExport: true,
|
||||
ExportFormat: 'actiance',
|
||||
DailyRunTime: '01:00',
|
||||
ExportFromTimestamp: 12345678,
|
||||
BatchSize: 10000,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const wrapper = shallow(<MessageExportSettings {...baseProps}/>);
|
||||
|
||||
function runTest(testJob, expectNull, expectedCount) {
|
||||
const jobDetails = wrapper.instance().getJobDetails(testJob);
|
||||
if (expectNull) {
|
||||
expect(jobDetails).toBe(null);
|
||||
} else {
|
||||
expect(jobDetails.length).toBe(expectedCount);
|
||||
}
|
||||
}
|
||||
|
||||
const job = {};
|
||||
test('test no data', () => {
|
||||
runTest(job, true, 0);
|
||||
});
|
||||
|
||||
test('test success message, missing warnings', () => {
|
||||
job.data = {
|
||||
messages_exported: 3,
|
||||
};
|
||||
runTest(job, false, 1);
|
||||
});
|
||||
|
||||
test('test success message, 0 warnings', () => {
|
||||
job.data = {
|
||||
messages_exported: 3,
|
||||
warning_count: 0,
|
||||
};
|
||||
runTest(job, false, 1);
|
||||
});
|
||||
|
||||
test('test warning message', () => {
|
||||
job.data = {
|
||||
messages_exported: 3,
|
||||
warning_count: 2,
|
||||
};
|
||||
runTest(job, false, 2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -342,6 +342,7 @@
|
||||
"admin.complianceExport.globalRelaySmtpUsername.title": "Global Relay SMTP Username:",
|
||||
"admin.complianceExport.messagesExportedCount": "{count} messages exported.",
|
||||
"admin.complianceExport.title": "Compliance Export (Beta)",
|
||||
"admin.complianceExport.warningCount": "{count} warning(s) encountered, see warning.txt for details",
|
||||
"admin.complianceMonitoring.userActivityLogsTitle": "User Activity Logs",
|
||||
"admin.connectionSecurityNone": "None",
|
||||
"admin.connectionSecurityNoneDescription": "Mattermost will connect over an insecure connection.",
|
||||
@@ -813,6 +814,7 @@
|
||||
"admin.jobTable.statusInProgress": "In Progress",
|
||||
"admin.jobTable.statusPending": "Pending",
|
||||
"admin.jobTable.statusSuccess": "Success",
|
||||
"admin.jobTable.statusWarning": "Warning",
|
||||
"admin.ldap.adminFilterEx": "E.g.: \"(objectClass=admins)\"",
|
||||
"admin.ldap.adminFilterFilterDesc": "(Optional) Enter an AD/LDAP filter to use for designating System Admins. The users selected by the query will have access to your Mattermost server as System Admins. By default, System Admins have complete access to the Mattermost System Console.\n \nExisting members that are identified by this attribute will be promoted from member to System Admin upon next login. The next login is based upon Session lengths set in **System Console > Session Lengths**. It is highly recommend to manually demote users to members in **System Console > User Management** to ensure access is restricted immediately.\n \nNote: If this filter is removed/changed, System Admins that were promoted via this filter will be demoted to members and will not retain access to the System Console. When this filter is not in use, System Admins can be manually promoted/demoted in **System Console > User Management**.",
|
||||
"admin.ldap.adminFilterTitle": "Admin Filter:",
|
||||
|
||||
@@ -488,6 +488,7 @@ export const JobStatuses = {
|
||||
ERROR: 'error',
|
||||
CANCEL_REQUESTED: 'cancel_requested',
|
||||
CANCELED: 'canceled',
|
||||
WARNING: 'warning',
|
||||
};
|
||||
|
||||
export const AnnouncementBarTypes = {
|
||||
|
||||
Reference in New Issue
Block a user