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 удалений

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

@@ -4,6 +4,7 @@
package export_users_to_csv
import (
"fmt"
"strconv"
"time"
@@ -60,6 +61,22 @@ func parseJobMetadata(data model.StringMap) (*model.UserReportOptions, error) {
return nil, err
}
hideInactive := false
if val, ok := data["hide_inactive"]; ok && val != "" {
hideInactive, err = strconv.ParseBool(val)
if err != nil {
return nil, fmt.Errorf("failed to parse hide_inactive: %w", err)
}
}
hideActive := false
if val, ok := data["hide_active"]; ok && val != "" {
hideActive, err = strconv.ParseBool(val)
if err != nil {
return nil, fmt.Errorf("failed to parse hide_active: %w", err)
}
}
options := model.UserReportOptions{
ReportingBaseOptions: model.ReportingBaseOptions{
SortColumn: "Username",
@@ -69,6 +86,10 @@ func parseJobMetadata(data model.StringMap) (*model.UserReportOptions, error) {
StartAt: startAt,
EndAt: endAt,
},
HideInactive: hideInactive,
HideActive: hideActive,
Role: data["role"],
Team: data["team"],
}
return &options, nil