Skip to content

Conversation

@martin-trajanovski
Copy link
Collaborator

@martin-trajanovski martin-trajanovski commented Aug 25, 2025

Description

This PR refactors the datafiles action as a configurable components that can be used in other pages of the app.
The configuration has been updated to make the configurable actions more flexible.

Motivation

Up to this point, SciCat had only configurable actions for the data files associated to each dataset.
In the last year, it have become clear that we need to expand this concept also to dataset as a whole, the datasets list, all the way to the selection.

Changes:

Please provide a list of the changes implemented by this PR

  • created configurable actions component
  • migrate datafiles action to use configurable actions component

Tests included

  • Included for each change/fix?
  • Passing? (Merge will not be approved unless this is checked)

Documentation

  • swagger documentation updated [required] Not needed
  • official documentation updated [nice-to-have]

Backend version

  • Does it require a specific version of the backend
  • which version of the backend is required:

Summary by Sourcery

Extract datafiles action buttons into a shared, configurable component and remove the legacy dataset-specific implementations

New Features:

  • Introduce a shared ConfigurableActionsModule providing reusable ConfigurableActionsComponent and ConfigurableActionComponent for rendering action buttons

Enhancements:

  • Replace dataset-specific DatafilesActions and DatafilesAction components and templates with the generic configurable actions component
  • Refactor component logic to use optional chaining for file inputs and update input type annotations

Tests:

  • Update specs to reference ConfigurableActionComponent and ConfigurableActionsComponent instead of the old datafiles action components
  • Remove obsolete mocks and commented-out test code

Chores:

  • Add ConfigurableActionsModule to SharedScicatFrontendModule and remove legacy DatafilesAction declarations from DatasetsModule
  • Delete deprecated datafiles-actions component files and SCSS

Summary by Sourcery

Introduce a reusable configurable action buttons component and migrate the existing datafiles actions to use it, generalize action settings in the app config, and clean up the legacy implementations. Also add a suite of shared dataset filter components and update tests accordingly.

New Features:

  • Add ConfigurableActionsModule with ConfigurableActionsComponent and ConfigurableActionComponent for rendering action buttons based on configuration.
  • Add new shared dataset filter components (keyword, location, group, type, date range, PID, text, and condition filters) under shared/modules/filters.

Enhancements:

  • Migrate datafiles action buttons (and scaffold batch-view and dataset-detail) to use the generic configurable actions component and extend AppConfigInterface with datasetActions, datasetDetailsActions, and datasetSelectionActions.
  • Simplify DatafilesComponent lifecycle and data handling by delegating form and request logic to the shared ConfigurableActionComponent.

Tests:

  • Update existing specs to reference ConfigurableActionsComponent and add comprehensive mock data and tests for configurable actions.
  • Remove obsolete mocks, commented-out code, and legacy datafiles-actions component tests.

Chores:

  • Remove deprecated DatafilesActionsComponent/DatafilesActionComponent files and update module declarations to import ConfigurableActionsModule.
  • Clean up shared module imports by removing unused Material modules and adding ConfigurableActionsModule and TranslateModule.

@martin-trajanovski martin-trajanovski self-assigned this Sep 16, 2025
@martin-trajanovski martin-trajanovski added the DCS DAPHNE Contribution to SciCat label Sep 16, 2025
@cchndl
Copy link

cchndl commented Sep 17, 2025

Hi,

two points I noticed while testing:

  • would it be possible to have a type_json that does not expect a download in return? If not the form is fine on my end.
  • in the batch view the type_json_download fails, because files seems to not be defined.

In general, would it make sense to unify the different methods a little bit? Building the info as an object in a shared way and then transforming it into json/the form etc?

I tested it when the PR was at 3f4de3, so I haven't run the most recent state yet, but as far as I can see, these points didn't change.

@nitrosx nitrosx marked this pull request as ready for review November 19, 2025 12:21
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New security issues found

sourcery-ai[bot]
sourcery-ai bot previously requested changes Nov 25, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New security issues found

@nitrosx nitrosx merged commit acb1010 into master Nov 25, 2025
6 checks passed
@nitrosx nitrosx deleted the SWAP-4889-configurable-action-buttons branch November 25, 2025 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DCS DAPHNE Contribution to SciCat doing ESS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants