MM 60222 - apply filter to export csv (#28212)

* MM-60222_apply filter to export csv

* get the report exporting with the filters ready

* add unit tests

* cover one more file with some tests

* style the confirm modal note

* add translations

* remove unnecessary print line

* disable export button if there is no data to export

* fix linter issues

* fix linter errors

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Pablo Vélez
2024-10-02 12:23:39 +02:00
коммит произвёл GitHub
родитель 5098669cfb
Коммит 1690e48db6
13 изменённых файлов: 370 добавлений и 39 удалений

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

@@ -28,6 +28,7 @@ func getUsersForReporting(c *Context, w http.ResponseWriter, r *http.Request) {
baseOptions := fillReportingBaseOptions(r.URL.Query())
options, err := fillUserReportOptions(r.URL.Query())
if err != nil {
c.Err = err
return
@@ -80,13 +81,21 @@ func startUsersBatchExport(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
dateRange := r.URL.Query().Get("date_range")
baseOptions := fillReportingBaseOptions(r.URL.Query())
options, err := fillUserReportOptions(r.URL.Query())
if err != nil {
c.Err = err
return
}
options.ReportingBaseOptions = baseOptions
dateRange := options.ReportingBaseOptions.DateRange
if dateRange == "" {
dateRange = "all_time"
}
startAt, endAt := model.GetReportDateRange(dateRange, time.Now())
if err := c.App.StartUsersBatchExport(c.AppContext, dateRange, startAt, endAt); err != nil {
if err := c.App.StartUsersBatchExport(c.AppContext, options, startAt, endAt); err != nil {
c.Err = err
return
}
@@ -136,7 +145,6 @@ func fillUserReportOptions(values url.Values) (*model.UserReportOptions, *model.
}
return &model.UserReportOptions{
Team: teamFilter,
Role: values.Get("role_filter"),
HasNoTeam: values.Get("has_no_team") == "true",