Skip to content

Commit b08f3d6

Browse files
authored
Release 27-02-2025 (#1767)
## Description Short description of the pull request ## Motivation Background on use case, changes needed ## Fixes: Please provide a list of the fixes implemented in this PR * Items added ## Changes: Please provide a list of the changes implemented by this PR * changes made ## Tests included - [ ] Included for each change/fix? - [ ] Passing? (Merge will not be approved unless this is checked) ## Documentation - [ ] swagger documentation updated \[required\] - [ ] official documentation updated \[nice-to-have\] ### official documentation info If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included ## Backend version - [ ] Does it require a specific version of the backend - which version of the backend is required: ## Summary by Sourcery This pull request introduces several new features and enhancements to the SciCat frontend. It refactors the proposal dashboard to use a dynamic material table, implements related proposals functionality, adds support for customizable dataset detail views, and improves the datasets filter settings component. It also updates proposal effects and adds a route tracking service. New Features: - Implement related proposals functionality in the proposal view page. - Add support for customizable dataset detail views using dynamic components. - Add support for global text search in the proposal dashboard. Enhancements: - Refactor the proposal dashboard to use dynamic material table for improved performance and flexibility. - Improve the datasets filter settings component by enhancing the UI and adding functionalities for managing filters and conditions. - Update proposal effects to use fullquery for fetching proposals and count, and implement related proposals functionality. - Update dataset detail component to support dynamic templates and improve UI. - Add route tracking service to preserve return URL after login.
2 parents e806e96 + e08d6b1 commit b08f3d6

File tree

170 files changed

+8570
-1025
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+8570
-1025
lines changed

CI/e2e/frontend.config.e2e.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"files": "all",
6666
"mat_icon": "download",
6767
"type": "form",
68-
"url": "https://www.scicat.info/download/all",
68+
"url": "http://localhost:4200/download/all",
6969
"target": "_blank",
7070
"enabled": "#SizeLimit",
7171
"authorization": ["#datasetAccess", "#datasetPublic"]
@@ -77,7 +77,7 @@
7777
"files": "selected",
7878
"mat_icon": "download",
7979
"type": "form",
80-
"url": "https://www.scicat.info/download/selected",
80+
"url": "http://localhost:4200/download/selected",
8181
"target": "_blank",
8282
"enabled": "#Selected && #SizeLimit",
8383
"authorization": ["#datasetAccess", "#datasetPublic"]
@@ -89,7 +89,7 @@
8989
"files": "all",
9090
"icon": "/assets/icons/jupyter_logo.png",
9191
"type": "form",
92-
"url": "https://www.scicat.info/notebook/all",
92+
"url": "http://localhost:4200/notebook/all",
9393
"target": "_blank",
9494
"authorization": ["#datasetAccess", "#datasetPublic"]
9595
},
@@ -100,7 +100,7 @@
100100
"files": "selected",
101101
"icon": "/assets/icons/jupyter_logo.png",
102102
"type": "form",
103-
"url": "https://www.scicat.info/notebook/selected",
103+
"url": "http://localhost:4200/notebook/selected",
104104
"target": "_blank",
105105
"enabled": "#Selected",
106106
"authorization": ["#datasetAccess", "#datasetPublic"]

angular.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
},
5959
{
6060
"type": "anyComponentStyle",
61-
"maximumWarning": "2kb",
62-
"maximumError": "4kb"
61+
"maximumWarning": "8kb",
62+
"maximumError": "8kb"
6363
}
6464
],
6565
"fileReplacements": [

cypress/e2e/datasets/datasets-datafiles.cy.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
describe("Dataset datafiles", () => {
22
beforeEach(() => {
3+
cy.readFile("CI/e2e/frontend.config.e2e.json").then((baseConfig) => {
4+
cy.intercept("GET", "**/admin/config", baseConfig).as(
5+
"getFrontendConfig",
6+
);
7+
});
38
cy.login(Cypress.env("username"), Cypress.env("password"));
49
cy.intercept("PATCH", "/api/v3/datasets/**/*").as("change");
510
cy.intercept("GET", "*").as("fetch");
11+
cy.visit("/");
612
});
713

814
after(() => {
@@ -11,10 +17,10 @@ describe("Dataset datafiles", () => {
1117

1218
describe("Datafiles action test", () => {
1319
const actionUrl = {
14-
downloadSelected: "https://www.scicat.info/download/selected",
15-
downloadAll: "https://www.scicat.info/download/all",
16-
notebookSelected: "https://www.scicat.info/notebook/selected",
17-
notebookAll: "https://www.scicat.info/notebook/all",
20+
downloadSelected: "http://localhost:4200/download/selected",
21+
downloadAll: "http://localhost:4200/download/all",
22+
notebookSelected: "http://localhost:4200/notebook/selected",
23+
notebookAll: "http://localhost:4200/notebook/all",
1824
};
1925
it("Should be able to download/notebook with selected/all", () => {
2026
cy.createDataset("raw", undefined, "small");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { testConfig } from "../../fixtures/testData";
2+
import { mergeConfig } from "../../support/utils";
3+
4+
describe("Datasets Detail View Default", () => {
5+
const defaultComponentConfig = testConfig.defaultDetailViewComponent;
6+
7+
beforeEach(() => {
8+
cy.readFile("CI/e2e/frontend.config.e2e.json").then((baseConfig) => {
9+
const mergedConfig = mergeConfig(baseConfig, defaultComponentConfig);
10+
cy.intercept("GET", "**/admin/config", mergedConfig).as(
11+
"getFrontendConfig",
12+
);
13+
});
14+
15+
cy.login(Cypress.env("username"), Cypress.env("password"));
16+
cy.createDataset("raw");
17+
cy.visit("/datasets");
18+
cy.wait("@getFrontendConfig");
19+
});
20+
21+
after(() => {
22+
cy.removeDatasets();
23+
});
24+
25+
it("should load datasets with fallback labels when no custom labels are available", () => {
26+
const fallbackLabelsToCheck = ["Creator Information", "Orcid"];
27+
const customizedLabelsToCheck = [
28+
"Test Dataset name",
29+
"Test General Information",
30+
"Test Description",
31+
];
32+
33+
cy.get(".dataset-table mat-table mat-header-row").should("exist");
34+
35+
cy.finishedLoading();
36+
37+
cy.get('[data-cy="text-search"] input[type="search"]')
38+
.clear()
39+
.type("Cypress");
40+
41+
cy.isLoading();
42+
43+
cy.get("mat-row").contains("Cypress Dataset").click();
44+
45+
cy.isLoading();
46+
47+
cy.wrap([...fallbackLabelsToCheck, ...customizedLabelsToCheck]).each(
48+
(value) => {
49+
cy.get("mat-card").should(($matCards) => {
50+
const matchFound = [...$matCards].some((card) =>
51+
card.innerText.includes(value),
52+
);
53+
expect(matchFound).to.be.true;
54+
});
55+
},
56+
);
57+
});
58+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
import { testConfig } from "../../fixtures/testData";
2+
import { mergeConfig } from "../../support/utils";
3+
4+
describe("Datasets Detail View Dynamic", () => {
5+
const dynamicComponentConfig = testConfig.dynamicDetialViewComponent;
6+
const customizedLabelSets =
7+
dynamicComponentConfig.labelsLocalization.datasetCustom;
8+
const customizedComponents =
9+
dynamicComponentConfig.datasetDetailComponent.customization;
10+
11+
beforeEach(() => {
12+
cy.readFile("CI/e2e/frontend.config.e2e.json").then((baseConfig) => {
13+
const mergedConfig = mergeConfig(baseConfig, dynamicComponentConfig);
14+
cy.intercept("GET", "**/admin/config", mergedConfig).as(
15+
"getFrontendConfig",
16+
);
17+
});
18+
19+
cy.login(Cypress.env("username"), Cypress.env("password"));
20+
cy.createDataset("raw");
21+
cy.visit("/datasets");
22+
cy.wait("@getFrontendConfig");
23+
});
24+
25+
after(() => {
26+
cy.removeDatasets();
27+
});
28+
29+
it("should load datasets with customized labels", () => {
30+
cy.get(".dataset-table mat-table mat-header-row").should("exist");
31+
32+
cy.finishedLoading();
33+
34+
cy.get('[data-cy="text-search"] input[type="search"]')
35+
.clear()
36+
.type("Cypress");
37+
38+
cy.isLoading();
39+
40+
cy.get("mat-row").contains("Cypress Dataset").click();
41+
42+
cy.isLoading();
43+
cy.wrap(Object.values(customizedLabelSets)).each((value) => {
44+
cy.get("body")
45+
.find('[data-cy="section-label"], [data-cy="field-label"]')
46+
.should("contain", value);
47+
});
48+
});
49+
50+
it("should order sections based on customized settings", () => {
51+
cy.get(".dataset-table mat-table mat-header-row").should("exist");
52+
53+
cy.finishedLoading();
54+
55+
cy.get('[data-cy="text-search"] input[type="search"]')
56+
.clear()
57+
.type("Cypress");
58+
59+
cy.isLoading();
60+
61+
cy.get("mat-row").contains("Cypress Dataset").click();
62+
63+
cy.isLoading();
64+
const sortedLabels = customizedComponents
65+
.sort((a, b) => a.order - b.order)
66+
.map((section) => section.label);
67+
68+
cy.wrap(sortedLabels).each((label, index) => {
69+
cy.get('[data-cy="section-label"]')
70+
.eq(index)
71+
.should("contain", customizedLabelSets[label]);
72+
});
73+
});
74+
75+
it("should order fields based on customized settings", () => {
76+
cy.get(".dataset-table mat-table mat-header-row").should("exist");
77+
78+
cy.finishedLoading();
79+
80+
cy.get('[data-cy="text-search"] input[type="search"]')
81+
.clear()
82+
.type("Cypress");
83+
84+
cy.isLoading();
85+
86+
cy.get("mat-row").contains("Cypress Dataset").click();
87+
88+
cy.isLoading();
89+
const componentLabel = "Section Label Regular";
90+
const sectionToTest = customizedComponents.find(
91+
(section) => section.label === componentLabel,
92+
);
93+
cy.wrap(sectionToTest).should("not.be.undefined");
94+
95+
cy.wrap(sectionToTest.fields)
96+
.then((fields) => fields.sort((a, b) => a.order - b.order))
97+
.each((field, index) => {
98+
cy.get('[data-cy="field-label"]')
99+
.eq(index)
100+
.should("contain", customizedLabelSets[field.source]);
101+
});
102+
});
103+
104+
it("should render attachments section with customized settings", () => {
105+
cy.get(".dataset-table mat-table mat-header-row").should("exist");
106+
107+
cy.finishedLoading();
108+
109+
cy.get('[data-cy="text-search"] input[type="search"]')
110+
.clear()
111+
.type("Cypress");
112+
113+
cy.isLoading();
114+
115+
cy.get("mat-row").contains("Cypress Dataset").click();
116+
117+
cy.isLoading();
118+
const componentLabel = "Section Label Attachments";
119+
const sectionToTest = customizedComponents.find(
120+
(section) => section.label === componentLabel,
121+
);
122+
const actualImageCount = 5;
123+
const expectedImageCount = sectionToTest.options.limit;
124+
const expectedSize = sectionToTest.options.size;
125+
126+
cy.get(".mat-mdc-tab-link").contains("Attachments").click();
127+
128+
cy.uploadDatasetAttachments(actualImageCount);
129+
130+
cy.isLoading();
131+
132+
cy.get(".mat-mdc-tab-link").contains("Details").click();
133+
134+
cy.get('[data-cy="section-label"]')
135+
.contains(customizedLabelSets["Section Label Attachments"])
136+
.parent()
137+
.find("img")
138+
.should("have.length", expectedImageCount)
139+
.each(($img) => {
140+
cy.wrap($img).should("have.attr", "class").and("contain", expectedSize);
141+
});
142+
});
143+
});

cypress/e2e/datasets/datasets-general.cy.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ describe("Datasets general", () => {
3838

3939
cy.finishedLoading();
4040

41+
cy.reload();
42+
// Without reloading, the user will land on last visited page before logout
43+
// i.e. the dataset detail page, because the login page "remembers" the previousRoute.
44+
4145
cy.url().should("include", "/login");
4246

4347
cy.get('mat-tab-group [role="tab"]').contains("Local").click();
@@ -94,7 +98,7 @@ describe("Datasets general", () => {
9498
});
9599
});
96100

97-
describe.only("Dataset page filter and scientific condition UI test", () => {
101+
describe("Dataset page filter and scientific condition UI test", () => {
98102
it("should not be able to add duplicated conditions ", () => {
99103
cy.visit("/datasets");
100104

cypress/e2e/datasets/datasets-metadata.cy.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,13 @@ describe("Datasets", () => {
304304
cy.get(".unit-input")
305305
.contains(`${metadataValidJson.unitSI}`)
306306
.within(() => {
307-
cy.get(".unit-input--warning").should("not.exist");
307+
cy.get(".general-warning").should("not.exist");
308308
});
309309

310310
cy.get(".unit-input")
311311
.contains(`${metadataInvalidUnitValue}`)
312312
.within(() => {
313-
cy.get(".unit-input--warning").should("exist");
313+
cy.get(".general-warning").should("exist");
314314
});
315315
});
316316

0 commit comments

Comments
 (0)