[MM-19640] Retrieve Compliance files from the System Console (#14976)

* add query param for downloading file

* Address PR comments

* sanitize error messages

* revert error santization

* address PR comments

* Log Error

* Comment for clarification

* Add test + Opt In Option

* Fix typo

* Remove line number

* Check is downloadable in server

* Don't use constants

* Check for downloadExportResults in API

* make actiance export zip

* make i18n strings

* Remove translations

* Add translations

* Revert "Add translations"

This reverts commit adc5d28b3e7712f51cd3eff565e30fb8ddfd6f65.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Hossein Ahmadian-Yazdi
2020-07-27 08:37:04 -04:00
коммит произвёл GitHub
родитель 77f7a97bee
Коммит 935ddaa251
5 изменённых файлов: 164 добавлений и 5 удалений

Просмотреть файл

@@ -4698,6 +4698,21 @@ func (c *Client4) CancelJob(jobId string) (bool, *Response) {
return CheckStatusOK(r), BuildResponse(r)
}
// DownloadJob downloads the results of the job
func (c *Client4) DownloadJob(jobId string) ([]byte, *Response) {
r, appErr := c.DoApiGet(c.GetJobsRoute()+fmt.Sprintf("/%v/download", jobId), "")
if appErr != nil {
return nil, BuildErrorResponse(r, appErr)
}
defer closeBody(r)
data, err := ioutil.ReadAll(r.Body)
if err != nil {
return nil, BuildErrorResponse(r, NewAppError("GetFile", "model.client.read_job_result_file.app_error", nil, err.Error(), r.StatusCode))
}
return data, BuildResponse(r)
}
// Roles Section
// GetRole gets a single role by ID.

Просмотреть файл

@@ -2615,11 +2615,12 @@ func (s *GlobalRelayMessageExportSettings) SetDefaults() {
}
type MessageExportSettings struct {
EnableExport *bool
ExportFormat *string
DailyRunTime *string
ExportFromTimestamp *int64
BatchSize *int
EnableExport *bool
DownloadExportResults *bool
ExportFormat *string
DailyRunTime *string
ExportFromTimestamp *int64
BatchSize *int
// formatter-specific settings - these are only expected to be non-nil if ExportFormat is set to the associated format
GlobalRelaySettings *GlobalRelayMessageExportSettings
@@ -2630,6 +2631,10 @@ func (s *MessageExportSettings) SetDefaults() {
s.EnableExport = NewBool(false)
}
if s.DownloadExportResults == nil {
s.DownloadExportResults = NewBool(false)
}
if s.ExportFormat == nil {
s.ExportFormat = NewString(COMPLIANCE_EXPORT_TYPE_ACTIANCE)
}