Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions CI/e2e/frontend.config.e2e.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,70 @@
"target": "_blank"
}
],
"publishedDataActionsEnabled": true,
"publishedDataActions": [
{
"id": "publish-published-data",
"description": "Publish published data",
"order": 1,
"label": "Publish",
"type": "xhr",
"mat_icon": "publish",
"method": "PATCH",
"url": "http://localhost:3000/api/v3/publisheddata/{{ @doi }}/",
"variables": {
"doi": "#PublishedData0Doi",
"status": "#PublishedData0Status"
},
"enabled": "@status === 'private'",
"payload": "{\"isPublished\":\"true\"}",
Comment thread
belfhi marked this conversation as resolved.
Outdated
"headers": {
"Content-Type": "application/json",
"Authorization": "#tokenBearer"
},
"authorization": ["true"]
},
{
"id": "register-published-data",
"description": "Register published data",
"order": 2,
"label": "Register",
"type": "xhr",
"mat_icon": "registration",
"method": "PATCH",
"url": "http://localhost:3000/api/v3/publisheddata/{{ @doi }}/",
Comment thread
belfhi marked this conversation as resolved.
Outdated
"variables": {
"doi": "#PublishedData0Doi",
"status": "#PublishedData0Status"
},
"enabled": "@status === 'public'",
"headers": {
"Content-Type": "application/json",
"Authorization": "#tokenBearer"
},
"authorization": ["true"]
},
{
"id": "amend-published-data",
"description": "Amend published data",
"order": 3,
"label": "Amend",
"type": "xhr",
"mat_icon": "edit",
"method": "PATCH",
"url": "http://localhost:3000/api/v3/publisheddata/{{ @doi }}/",
Comment thread
belfhi marked this conversation as resolved.
Outdated
"variables": {
"doi": "#PublishedData0Doi",
"status": "#PublishedData0Status"
},
"enabled": "@status === 'registered'",
"headers": {
"Content-Type": "application/json",
"Authorization": "#tokenBearer"
},
"authorization": ["true"]
}
],
"datasetDetailsActionsEnabled": false,
"datasetDetailsActions": [],
"selectionActionsEnabled": true,
Expand Down
13 changes: 8 additions & 5 deletions cypress/e2e/published-data/published-data.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,12 @@ describe("Datasets general", () => {

cy.get('[data-cy="status"]').contains("private");

cy.get('[data-cy="publishButton"]').click();
cy.get("configurable-action button").contains("Publish").click();

cy.get("simple-snack-bar").should("contain", "Publishing Failed.");
cy.get("simple-snack-bar").should(
"contain",
"error performing the action",
);
Comment thread
belfhi marked this conversation as resolved.
Outdated
});

it("admins should be able to edit their private published data", () => {
Expand Down Expand Up @@ -360,7 +363,7 @@ describe("Datasets general", () => {

cy.get('[data-cy="status"]').contains("private");

cy.get('[data-cy="publishButton"]').click();
cy.get("configurable-action button").contains("Publish").click();

cy.get('[data-cy="status"]').contains("public");
});
Expand Down Expand Up @@ -428,7 +431,7 @@ describe("Datasets general", () => {

cy.get('[data-cy="status"]').contains("public");

cy.get('[data-cy="registerButton"]').click();
cy.get("configurable-action button").contains("Register").click();

cy.get('[data-cy="status"]').contains("registered");
});
Expand Down Expand Up @@ -517,7 +520,7 @@ describe("Datasets general", () => {

cy.get('[data-cy="status"]').contains("private");

cy.get('[data-cy="publishButton"]').click();
cy.get("configurable-action button").contains("Publish").click();

cy.get('[data-cy="status"]').contains("public");

Expand Down
147 changes: 147 additions & 0 deletions src/app/admin/schema/frontend.config.jsonforms.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,62 @@
}
}
},
"publishedDataActionsEnabled": { "type": "boolean" },
"publishedDataActions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"label": { "type": "string" },
"id": { "type": "string" },
"description": { "type": "string" },
"order": { "type": "number" },
"mat_icon": { "type": "string" },
"url": { "type": "string" },
"target": { "type": "string" },
"enabled": { "type": "string" },
"authorization": { "type": "array", "items": { "type": "string" } },
"inputs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": { "type": "string" },
"value": { "type": "string" }
}
}
},
"variables": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": { "type": "string" },
"value": { "type": "string" }
}
}
},
Comment on lines +185 to +204
"headers": {
"type": "object",
"properties": {
"content-type": { "type": "string" },
"Authorization": { "type": "string" }
}
},
"method": {
"type": "string",
"enum": ["GET", "POST", "PUT", "DELETE", "PATCH"]
},
"type": {
"type": "string",
"enum": ["form", "xhr", "link", "json-download"]
},
"icon": { "type": "string" },
"payload": { "type": "string" },
"filename": { "type": "string" }
}
}
},

"defaultDatasetsListSettings": {
"type": "object",
Expand Down Expand Up @@ -696,6 +752,97 @@
}
]
},
{
"type": "Group",
"label": "Published Data Actions",
"options": {
"expandable": true
},
"elements": [
{
"type": "Control",
"scope": "#/properties/publishedDataActionsEnabled"
},
{
"type": "ListWithDetail",
"scope": "#/properties/publishedDataActions",
"options": {
"detail": {
"type": "VerticalLayout",
"elements": [
{ "type": "Control", "scope": "#/properties/label" },
{ "type": "Control", "scope": "#/properties/id" },
{
"type": "Control",
"scope": "#/properties/description"
},
{ "type": "Control", "scope": "#/properties/order" },
{ "type": "Control", "scope": "#/properties/mat_icon" },
{ "type": "Control", "scope": "#/properties/url" },
{ "type": "Control", "scope": "#/properties/target" },
{ "type": "Control", "scope": "#/properties/enabled" },
{
"type": "Control",
"scope": "#/properties/method"
},
{ "type": "Control", "scope": "#/properties/type" },
{ "type": "Control", "scope": "#/properties/icon" },
{
"type": "Control",
"scope": "#/properties/payload",
"options": { "multi": true }
},
{ "type": "Control", "scope": "#/properties/filename" },
{
"type": "Control",
"scope": "#/properties/authorization"
},
{
"type": "Control",
"scope": "#/properties/variables",
"options": {
"detail": {
"type": "HorizontalLayout",
"elements": [
{ "type": "Control", "scope": "#/properties/key" },
{ "type": "Control", "scope": "#/properties/value" }
]
}
}
},
{
"type": "Control",
"scope": "#/properties/inputs",
"options": {
"detail": {
"type": "HorizontalLayout",
"elements": [
{ "type": "Control", "scope": "#/properties/key" },
{ "type": "Control", "scope": "#/properties/value" }
]
}
}
},
{
"type": "Group",
"label": "Headers",
"elements": [
{
"type": "Control",
"scope": "#/properties/headers/properties/content-type"
},
{
"type": "Control",
"scope": "#/properties/headers/properties/Authorization"
}
]
}
]
}
}
}
]
},
{
"type": "Group",
"label": "Localization",
Expand Down
3 changes: 2 additions & 1 deletion src/app/app-config.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
AppConfigService,
HelpMessages,
} from "app-config.service";
import { time } from "node:console";
import { Observable, of } from "rxjs";
import { MockHttp } from "shared/MockStubs";

Expand Down Expand Up @@ -94,6 +93,8 @@ const appConfig: AppConfigInterface = {
datafilesActions: [],
datasetSelectionActionsEnabled: false,
datasetSelectionActions: [],
publishedDataActionsEnabled: false,
publishedDataActions: [],
defaultDatasetsListSettings: {
columns: [
{
Expand Down
2 changes: 2 additions & 0 deletions src/app/app-config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ export interface AppConfigInterface {
datasetDetailsActions: ActionConfig[];
datasetSelectionActionsEnabled: boolean;
datasetSelectionActions: ActionConfig[];
publishedDataActions: ActionConfig[];
publishedDataActionsEnabled: boolean;
editDatasetEnabled: boolean;
editDatasetSampleEnabled: boolean;
editMetadataEnabled: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,13 @@
</table>
</mat-card-content>

<mat-card-actions *ngIf="isLoggedIn$ | async">
<button
mat-raised-button
color="primary"
*ngIf="publishedData.status === 'registered'"
(click)="onAmendClick(publishedData.doi)"
>
Amend
</button>
<button
mat-raised-button
color="primary"
*ngIf="publishedData.status === 'public'"
(click)="onRegisterClick(publishedData.doi)"
data-cy="registerButton"
>
Register
</button>
<button
mat-raised-button
color="primary"
*ngIf="publishedData.status === 'private'"
(click)="onPublishClick(publishedData.doi)"
data-cy="publishButton"
>
Publish
</button>
<mat-card-actions>
<configurable-actions
*ngIf="appConfig.publishedDataActionsEnabled"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Imo this should default to the old actions if none are provided otherwise it's a breaking change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, that is the goal. I added action config to the config.json file as sensible defaults which restore the previous behaviour.

@fpotier fpotier Jun 19, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is the right solution for backward compatibility:

  • if the config comes from the frontend, it's usually overwritten with the facility config
  • if it comes from the backend I believe the frontend will first fetch it and ignore the frontend one (not 100% sure)

In both cases it requires some config changes

[actionsConfig]="appConfig.publishedDataActions"
[actionItems]="actionItems"
(actionFinished)="onActionFinished($event)">
</configurable-actions>
Comment on lines +29 to +35

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: Avoid rendering an empty mat-card-actions container when actions are disabled

mat-card-actions is always rendered, so when publishedDataActionsEnabled is false you end up with an empty actions row that can affect spacing. Please move the *ngIf to the <mat-card-actions> element so the container is not rendered when there are no actions.

Comment on lines +29 to +35
</mat-card-actions>
</mat-card>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ mat-card {
margin: 0 1em;
}
}

configurable-actions {
display: flex;
flex-direction: row-reverse;
max-width: 80%;
}
Loading
Loading