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

[API] Add support to export faceted search result with template file #3737

Open
ekazachkova opened this issue Oct 8, 2024 · 0 comments
Open
Assignees
Labels
kind/enhancement New feature or request

Comments

@ekazachkova
Copy link
Contributor

ekazachkova commented Oct 8, 2024

Background
At the moment, Cloud Pipeline does not allow to export facet search result with predefined format and it would be nice to support it.

Approach

  • Introduce a new system preference search.export.template.mapping with the following format:
{
    "TemplateName": {
        "save_to": "<...>",  # optional, cloud path to save search report
        "friendly_name": "<..>",  # optional, short file description
        "template_path": "<...>",   # required, path to template file that shall be available for API
        "permissions": [{
            "name": "<..>",  # user or group name
            "principal": true,  # boolean, 'true' for users 'false' for groups
        }, ... ],
        "mapping": {  # required, describes template columns mappings
            "Sheet1": [ # the name of the sheet
                    {
                        "column": "AA",  # string, indicates an column index
                        "start_row": "2",  # 1-base start index for rows
                        "value": "{Placeholder1}  some text {Placeholder2}", # content for cells with placeholders to replace
                        "unique": false,  # optional, bool, default: false, indicates if values in this column shall be unique
                        "keep_unresolved": false,  #  optional, bool, default: false, indicates if unresolved placeholders shall be left as is
                                                   #  if false unresolved placeholders shall be replaced with empty strings
                    }, {
                    }, ...
            ]
        }
    }
}

Configuration field save_to shall support placeholders:
- Template_ID - the name of template
- Export_Date - the current date
- Export_Date:yyyyMMdd-HH:mm:ss - current date with datetime format
- User - the name of the user initiated template generation
Example: s3://bucket_name/{User}/{Export_Date:yyyyMMdd-HH:mm:ss}/{Template_ID}.xls

  • Introduce a new API method POST /search/facet/export/templates that streams template content. Request parameters:
    • templateId - required, the name of template (the key from template configuration)
    • fileName - optional, the name of the result report file. If not specified a file name <TemplateId>-<DateTime>.xls shall be generated.
  • Introduce a new API method POST /search/facet/export/templates/save that saves search results report to save_to path from template configuration. Request params:
    • templateId - required, the name of template (the key from template configuration)
      Request body:
{
     "fullPath": "s3://bucket_name/folder/export.xls",
     "storageId": 1,  # this storage registered by path `s3://bucket_name/folder/`
     "storagePath": "export.xls" 
}

Also, it would be nice to support storage files filter: if user manually specified multiple storage files, only this files shall be present in export reports. A new field files shall be added to request body:

{ ....,
    "files": [
        {
            "path": "file1.txt",  # path from facet response
            "storageId": 1  # parentId from facet response
        },
        {
            "path": "file2.txt",
            "storageId": 2
        },
        {
            "path": "file3.txt",
            "storageId": 3
        }
    ], ...
}

If files provides query and filters shall be ignored.

@ekazachkova ekazachkova added the kind/enhancement New feature or request label Oct 8, 2024
@ekazachkova ekazachkova self-assigned this Oct 8, 2024
rodichenko pushed a commit that referenced this issue Oct 14, 2024
* GUI Issue-#3737: faceted search export templates control

* GUI Issue-#3737: export template modal text adjustments

* GUI Issue-#3737: export template modal text adjustments

* GUI Issue-#3737: export template modal small fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant