Skip to content

Commit 9dfc92d

Browse files
authored
Merge pull request #864 from europeana/develop
Merge develop into master
2 parents 25df20b + 8bbc576 commit 9dfc92d

File tree

114 files changed

+2692
-593
lines changed

Some content is hidden

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

114 files changed

+2692
-593
lines changed

.github/workflows/_deploy-sandbox.js.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ jobs:
113113
tags: |
114114
type=sha
115115
${{ env.TAG_ESCAPED }}
116-
# type=schedule
117-
# type=ref,event=branch
118-
# type=ref,event=pr
119-
# type=semver,pattern={{version}}
120-
# type=semver,pattern={{major}}.{{minor}}
121-
# type=semver,pattern={{major}}
122-
# type=raw,value=latest,enable={{is_default_branch}}
123-
# ${{ env.PROJECT_VERSION }}
116+
type=schedule
117+
type=ref,event=branch
118+
type=ref,event=pr
119+
type=semver,pattern={{version}}
120+
type=semver,pattern={{major}}.{{minor}}
121+
type=semver,pattern={{major}}
122+
type=raw,value=latest,enable={{is_default_branch}}
123+
${{ env.PROJECT_VERSION }}
124124
125125
- name: Build and push
126126
uses: docker/build-push-action@v5

.github/workflows/ci.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: '* CI'
2+
on:
3+
push
4+
jobs:
5+
run-unit:
6+
name: 'tests'
7+
uses: ./.github/workflows/run-tests.yaml
8+
secrets: inherit
9+
run-sonar:
10+
needs: [run-unit]
11+
uses: ./.github/workflows/run-sonar.yaml
12+
secrets: inherit

.github/workflows/deploy-image.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.event.inputs.tag_name }}
1921
- name: Get Env File
2022
uses: actions/download-artifact@master
2123
with:

.github/workflows/run-sonar.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ name: '- helper (sonar)'
22
on: workflow_call
33
jobs:
44
run-sonar:
5-
if: ${{ github.event.inputs.run_build == 'true' }}
65
runs-on: ubuntu-latest
76
steps:
87
- name: Checkout
98
uses: actions/checkout@v4
109
with:
11-
ref: ${{ github.event.inputs.tag_name }}
10+
ref: ${{ github.event.inputs.tag_name || github.event.pull_request.head.ref }}
1211

1312
- name: Get Metis LCOV
1413
uses: actions/download-artifact@master

.github/workflows/run-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
- name: Checkout
88
uses: actions/checkout@v4
99
with:
10-
ref: ${{ github.event.inputs.tag_name }}
10+
ref: ${{ github.event.inputs.tag_name || github.event.pull_request.head.ref }}
1111
- uses: actions/setup-node@v4
1212
with:
1313
node-version: '18.18.0'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"tsc": "npm run tsc-test-data --project=metis && npm run tsc-test-data --project=sandbox",
5656
"cypress:ci-any": "run-p --race start:ci-any cypress:run --project=${npm_config_project}",
5757
"cypress:ci-accessibility-any": "run-p --race start:ci-any cypress:run-accessibility --project=${npm_config_project}",
58-
"cypress:run": "sleep 10 && cypress run --project projects/${npm_config_project} --config '{\"component\": {}, \"e2e\": { \"excludeSpecPattern\": \"**/**a11y.cy.ts\"}}'",
58+
"cypress:run": "sleep 10 && cypress run --project projects/${npm_config_project} --browser=chrome --config '{\"component\": {}, \"e2e\": { \"excludeSpecPattern\": \"**/**a11y.cy.ts\"}}'",
5959
"cypress:run-accessibility": "sleep 10 && cypress run --project projects/${npm_config_project} --spec **/*a11y.cy.ts",
6060
"cypress:open-sandbox": "cypress open --project projects/sandbox",
6161
"cypress": "cypress open --project projects/metis",

projects/metis/cypress/e2e/dataset.cy.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { DepublicationReasonHash } from '../../test-data/_data/depublication-reasons';
12
import { checkAHref, cleanupUser, setupUser } from '../support/helpers';
23

34
function setupDatasetPage(name: string, index: number): void {
@@ -27,6 +28,12 @@ context('metis-ui', () => {
2728
cy.get('.search-form').should('have.length', 1);
2829
});
2930

31+
it('should show the depublication reason', () => {
32+
cy.get('.pill')
33+
.contains(DepublicationReasonHash['REMOVED_DATA_AT_SOURCE'])
34+
.should('exist');
35+
});
36+
3037
it('should show the throttle level', () => {
3138
cy.get('.last-execution')
3239
.contains(`Weak Throttle`)
@@ -100,8 +107,8 @@ context('metis-ui', () => {
100107
});
101108

102109
it('should show the indexing_deleted_records status', () => {
103-
getHistoryRow(2).contains('Transform');
104-
getHistoryRow(2)
110+
getHistoryRow(3).contains('Transform');
111+
getHistoryRow(3)
105112
.get('.status-identifying_deleted_records')
106113
.should('have.length', 1);
107114
});

projects/metis/cypress/e2e/depublications.cy.ts

Lines changed: 66 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ context('metis-ui', () => {
1313
const selMenuContentDepublish = '.dropdown-content.depublish';
1414
const selMenuOpenAdd = '.dropdown-options.add > a';
1515
const selMenuOpenDepublish = '.dropdown-options.depublish > a';
16+
const selModalTitle = '.modal .head';
1617
const selItemDRecords = `${selMenuContentDepublish} :first-child a`;
1718
const selItemDDataset = `${selMenuContentDepublish} :last-child a`;
1819

@@ -22,19 +23,30 @@ context('metis-ui', () => {
2223
const selItemInput = `${selMenuContentAdd} :last-child a`;
2324
const selLoadMore = '.tab-content .load-more-btn';
2425

25-
const submitEntries = (entries: string): void => {
26+
const selSelectReason = '[name=depublicationReason]';
27+
const testTexts = ['Test1', 'Test2'];
28+
29+
const submitEntriesOpen = (fileInput = false): void => {
2630
cy.get(selMenuOpenAdd).click(force);
27-
cy.get(selItemInput)
31+
const selInput = fileInput ? selItemFile : selItemInput;
32+
cy.get(selInput)
2833
.scrollIntoView()
2934
.click(force);
35+
};
36+
37+
const submitEntries = (entries: string, submit = true): void => {
38+
submitEntriesOpen();
3039
cy.get('[name=recordIds]').type(entries);
31-
cy.get('.modal [type="button"]').click();
40+
if (submit) {
41+
cy.get('.modal [type="submit"]').click();
42+
}
3243
cy.wait(100);
3344
};
3445

3546
const deleteVisibleEntries = (): void => {
47+
const selDeleteBtn = `${selCtrls} .btn-delete`;
3648
cy.get(selCheckboxes).click({ force: true, multiple: true });
37-
cy.get('.depublication-ctrls .btn-delete').click(force);
49+
cy.get(selDeleteBtn).click(force);
3850
cy.wait(100);
3951
};
4052

@@ -53,7 +65,18 @@ context('metis-ui', () => {
5365
describe('grid', () => {
5466
it('should show the grid and menus', () => {
5567
cy.get(selGrid).should('have.length', 1);
56-
cy.get('.depublication-ctrls').should('have.length', 1);
68+
cy.get(selCtrls).should('have.length', 1);
69+
});
70+
71+
it('should show the grid headers', () => {
72+
const selGridHeader = '.state-arrow';
73+
['Record Id', 'Record Status', 'Depublication Reason', 'Unpublished Date'].forEach(
74+
(headerText: string) => {
75+
cy.get(selGridHeader)
76+
.contains(headerText)
77+
.should('have.length', 1);
78+
}
79+
);
5780
});
5881
});
5982

@@ -79,36 +102,42 @@ context('metis-ui', () => {
79102

80103
describe('forms', () => {
81104
describe('successful operations', () => {
105+
const modalTitle = 'Add record ids to depublish';
106+
82107
it('should open and close the file dialog form', () => {
83108
cy.get(selDialogFile).should('not.exist');
84-
cy.get(selMenuOpenAdd).click(force);
85-
cy.get(selItemFile)
86-
.scrollIntoView()
87-
.click(force);
109+
cy.get(selModalTitle).should('not.exist');
110+
submitEntriesOpen(true);
88111

112+
cy.get(selModalTitle)
113+
.contains(modalTitle)
114+
.should('exist');
89115
cy.get(selDialogFile).should('be.visible');
90116
cy.get(selDialogClose).click();
91117
cy.get(selDialogFile).should('not.exist');
118+
cy.get(selModalTitle).should('not.exist');
92119
});
93120

94121
it('should open and close the input dialog form', () => {
95122
cy.get(selDialogInput).should('not.exist');
96-
cy.get(selMenuOpenAdd).click(force);
97-
cy.get(selItemInput)
98-
.scrollIntoView()
99-
.click(force);
123+
cy.get(selModalTitle).should('not.exist');
124+
submitEntriesOpen();
100125

126+
cy.get(selModalTitle)
127+
.contains(modalTitle)
128+
.should('exist');
101129
cy.get(selDialogInput).should('be.visible');
102130
cy.get(selDialogClose).click();
131+
103132
cy.get(selDialogInput).should('not.exist');
133+
cy.get(selModalTitle).should('not.exist');
104134
});
105135

106136
it('should submit new entries', () => {
107-
const testTexts = ['Test1', 'Test2'];
108137
submitEntries(testTexts.join('\n'));
109138

110139
testTexts.forEach((txt) => {
111-
cy.get('.record-url')
140+
cy.get('[data-e2e=record-id]')
112141
.contains(txt)
113142
.should('have.length', 1);
114143
});
@@ -154,7 +183,7 @@ context('metis-ui', () => {
154183
cy.screenshot();
155184

156185
testMore.slice(2).forEach((txt) => {
157-
cy.get('.record-url')
186+
cy.get('[data-e2e=record-id]')
158187
.contains(txt)
159188
.should('have.length', 1);
160189
});
@@ -184,29 +213,49 @@ context('metis-ui', () => {
184213
});
185214

186215
describe('confirmations', () => {
216+
const modalTitle = 'Depublish';
187217
const selDialogConfirm = '.modal-wrapper';
188-
const selDialogConfirmClose = selDialogConfirm + ' .btn-close';
218+
const selDialogConfirmClose = `${selDialogConfirm} .btn-close`;
189219

190220
it('should ask confirmation for dataset depublication', () => {
191221
cy.get(selDialogConfirm).should('not.exist');
192222
cy.wait(1000);
193223
openDepublishMenu();
224+
cy.get(selModalTitle).should('not.exist');
225+
cy.get(selMenuContentDepublish).should('exist');
226+
194227
cy.get(selItemDDataset).click(force);
228+
cy.get(selModalTitle)
229+
.contains(modalTitle)
230+
.should('exist');
195231
cy.get(selDialogConfirm).should('be.visible');
232+
cy.get(selSelectReason).should('exist');
233+
cy.get(selSelectReason).should('be.visible');
234+
196235
cy.get(selDialogConfirmClose).click();
197236
cy.get(selDialogConfirm).should('not.exist');
237+
cy.get(selMenuContentDepublish).should('not.exist');
238+
cy.get(selModalTitle).should('not.exist');
198239
});
199240

200241
it('should ask confirmation for record id depublication', () => {
242+
submitEntries(testTexts.join('\n'));
201243
submitEntries('Test1\nTest2');
202244
cy.get(selDialogConfirm).should('not.exist');
245+
cy.get(selModalTitle).should('not.exist');
203246
cy.wait(1000);
204247
cy.get(selCheckbox).click({ force: true, multiple: true });
205248
openDepublishMenu();
249+
cy.get(selMenuContentDepublish).should('exist');
206250
cy.get(selItemDRecords).click(force);
207251
cy.get(selDialogConfirm).should('be.visible');
252+
cy.get(selModalTitle)
253+
.contains(modalTitle)
254+
.should('exist');
208255
cy.get(selDialogConfirmClose).click();
209256
cy.get(selDialogConfirm).should('not.exist');
257+
cy.get(selMenuContentDepublish).should('not.exist');
258+
cy.get(selModalTitle).should('not.exist');
210259
deleteVisibleEntries();
211260
});
212261
});

projects/metis/cypress/e2e/history.cy.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { DepublicationReasonHash } from '../../test-data/_data/depublication-reasons';
12
import { cleanupUser, setupUser } from '../support/helpers';
23

34
context('metis-ui', () => {
@@ -59,5 +60,12 @@ context('metis-ui', () => {
5960
.contains(`Strong Throttle`)
6061
.should('exist');
6162
});
63+
64+
it('should show the depublish reason', () => {
65+
cy.visit('/dataset/log/3');
66+
cy.get('.pill')
67+
.contains(DepublicationReasonHash['GDPR'])
68+
.should('exist');
69+
});
6270
});
6371
});

projects/metis/src/app/_mocked/mockeddepublication.service.ts

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { HttpEvent } from '@angular/common/http';
22
import { Observable, of as observableOf, throwError, timer } from 'rxjs';
33
import { delay, switchMap } from 'rxjs/operators';
44

5-
import { DatasetDepublicationInfo, DepublicationStatus, RecordDepublicationInfo } from '../_models';
5+
import {
6+
DatasetDepublicationInfo,
7+
DepublicationReason,
8+
DepublicationStatus,
9+
RecordDepublicationInfo
10+
} from '../_models';
611

712
export const mockPublicationInfo = [
813
{
@@ -59,17 +64,23 @@ export class MockDepublicationService {
5964
return observableOf(true);
6065
}
6166

62-
depublishDataset(datasetId: string): Observable<boolean> {
67+
depublishDataset(datasetId: string, depublicationReason: string): Observable<boolean> {
6368
if (this.errorMode) {
64-
return throwError(new Error(`mock depublishDataset(${datasetId}) throws error...`));
69+
return throwError(
70+
new Error(`mock depublishDataset(${datasetId}/${depublicationReason}) throws error...`)
71+
);
6572
}
6673
return observableOf(true);
6774
}
6875

69-
depublishRecordIds(datasetId: string, recordIds: Array<string>): Observable<boolean> {
76+
depublishRecordIds(
77+
datasetId: string,
78+
reason: string,
79+
recordIds: Array<string>
80+
): Observable<boolean> {
7081
if (this.errorMode) {
7182
return throwError(
72-
new Error(`mock depublishRecordIds(${datasetId}, ${recordIds}) throws error...`)
83+
new Error(`mock depublishRecordIds(${datasetId}, ${reason}, ${recordIds}) throws error...`)
7384
);
7485
}
7586
return observableOf(true);
@@ -96,6 +107,17 @@ export class MockDepublicationService {
96107
}
97108
return observableOf(true);
98109
}
110+
111+
getDepublicationReasons(): Observable<Array<DepublicationReason>> {
112+
return observableOf(
113+
['GDPS', 'etc.'].map((s: string) => {
114+
return {
115+
name: s,
116+
valueAsString: s
117+
};
118+
})
119+
);
120+
}
99121
}
100122

101123
export class MockDepublicationServiceErrors extends MockDepublicationService {

0 commit comments

Comments
 (0)