Skip to content

Commit

Permalink
Customer/uk it 15 (#521)
Browse files Browse the repository at this point in the history
* Update docker.yml (#452)

It was run only for `dspace` repository

* The BE was started without instance (#453)

* Copying of solr configs were missing from the docker-compose-rest (#454)

* configured path (#455)

try to append server/ to test gh action

* Internal/run container in production mode (#456)

* Added NODE_ENV=production because the container is trying to run in development mode

* Use Vanilla dspace-ui.json instead of ours from root.

* Updated path for running `dspace-ui.json`

* Use ENV - production in the dspace-ui.json (#457)

* The docker-compose-rest has defined network which is not the same like in the cli.yml - it throws an error (#458)

* Update deploy.yml (#459)

Allowed S3

* Update deploy.yml (#461)

Use .env file from the dev5 instead of createing a new one in the github action

* Update deploy.yml (#462)

Working directory was missing

* ufal/cannot-login-after-upgrade

Merge pull request DSpace#2731 from DSpace/backport-2670-to-main (#512)

[Port main] Ensure HALEndpointService doesn't use stale responses

Co-authored-by: Tim Donohue <[email protected]>

* ufal/cannot-load-user-metadata

Added searchData because it was null (#514)

* ufal/license-agreement-multiple-records (#516)

* Load required input fields only if are loaded user metadata or the user is anonymous

* Added ID into ClarinUserRegistration model

* Added a search method in the userMetadataService

* The filtered user metadata are loaded from the BE

* internal/update-deploy-s3-props (#448)

* Update deploying customer/uk - there weren't right S3 properties.

* ufal/discojuice-not-popped-up (#515)

* Use cookie to popup discojuice login.

* Added Cookie Service into tests

* Close discojuice if it is popped up

* Do not import commands in the constants file.

* commands must be imported in the e2e.ts

* ufal/search-page-without-results (#517)

* Use ClarinSearch instead of Vanilla one - updated themed component

* Added updates from the vanilla upgrade into clarin-search.component.ts

* Removed empty my-dspace file

* Maybe IT will be passed with vanilla search component

* Fixed my-dspace integration tests, they failed because the clarin-search was filtering only Items and integration tests exceted publication and other types

* Do not close discojuice login if it is not popped up

* internal/fix-deploy-s3-props

* ufal/s3-checksum-improvements (#518)

* Do not compute checksum on null object..

* The checksum is computed only after the download button is clicked.

* Added tests to check the checksum won't be loaded on init

* Fixed accidentally updated message key

---------

Co-authored-by: Jozef Misutka <[email protected]>
Co-authored-by: MajoBerger <[email protected]>
  • Loading branch information
3 people authored Feb 21, 2024
1 parent 36214ec commit 3b00c21
Show file tree
Hide file tree
Showing 34 changed files with 909 additions and 255 deletions.
43 changes: 10 additions & 33 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,45 +34,23 @@ jobs:
if: github.event.inputs.INSTANCE == '*' || github.event.inputs.INSTANCE == '2'
runs-on: dspace-dep-1
timeout-minutes: 5
env:
INSTANCE: '2'
ENVFILE: /opt/dspace-envs/.env.dspace.dev-5
steps:
- uses: actions/checkout@v4

- name: deploy to dev-5
working-directory: build-scripts/run/
run: |
cd $GITHUB_WORKSPACE/build-scripts/run/
pwd
touch .env.dev-5 || true
echo INSTANCE=2 >> .env.dev-5
echo DSPACE_HOST=dev-5.pc >> .env.dev-5
echo DSPACE_VER=customer-uk >> .env.dev-5
echo DSPACE_SSL=false >> .env.dev-5
echo DOCKER_OWNER=dataquest >> .env.dev-5
echo DSPACE_UI_IMAGE=\${DOCKER_OWNER}/dspace-angular:\$DSPACE_VER >> .env.dev-5
echo DSPACE_REST_IMAGE=\${DOCKER_OWNER}/dspace:\$DSPACE_VER >> .env.dev-5
echo DSPACE_REST_PORT=8\$INSTANCE >> .env.dev-5
echo REST_URL=http://\${DSPACE_HOST}:\${DSPACE_REST_PORT}/server >> .env.dev-5
echo UI_URL=http://\${DSPACE_HOST}:\${DSPACE_REST_PORT} >> .env.dev-5
echo S3_STORAGE=1 >> .env.dev-5
echo S3_ENABLED=true >> .env.dev-5
echo S3_RELATIVE_PATH=true >> .env.dev-5
echo S3_BUCKET=testbucket >> .env.dev-5
echo S3_SUBFOLDER=eighty-two >> .env.dev-5
echo S3_ACCESS=${{ secrets.AMAZON_ACCESS }} >> .env.dev-5
echo S3_SECRET=${{ secrets.AMAZON_SECRET }} >> .env.dev-5
echo S3_REGION_NAME=us-east-1 >> .env.dev-5
echo S3_ENDPOINT=https://s3.cl4.du.cesnet.cz >> .env.dev-5
export ENVFILE=$(pwd)/.env.dev-5
./start.sh dspace-${{ env.INSTANCE }}
./start.sh dspace-$INSTANCE
deploy-2:
deploy-8:
if: github.event.inputs.INSTANCE == '*' || github.event.inputs.INSTANCE == '8'
runs-on: dspace-dep-1
timeout-minutes: 120
env:
INSTANCE: '2'
INSTANCE: '8'
ENVFILE: /opt/dspace-envs/.env.dspace.imported.dev-5
steps:
- uses: actions/checkout@v4
Expand All @@ -89,13 +67,12 @@ jobs:
/bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://dev-5.pc:8$INSTANCE/server/api)" != "200" ]]; do sleep 5; done'
import-2:
import-8:
runs-on: dspace-dep-1
if: github.event.inputs.IMPORT == 'true'
needs: deploy-2
needs: deploy-8
env:
INSTANCE: '2'
INSTANCE: '8'
ENVFILE: /opt/dspace-envs/.env.dspace.imported.dev-5
steps:
- uses: ./.github/actions/import-db
Expand Down
31 changes: 20 additions & 11 deletions cypress/e2e/my-dspace.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ describe('My DSpace page', () => {

cy.get('ds-my-dspace-page').should('be.visible');

// CLARIN
// CLARIN-search component show only Items, so there are no records in the /mydspace page
// At least one recent submission should be displayed
cy.get('[data-test="list-object"]').should('be.visible');
// cy.get('[data-test="list-object"]').should('be.visible');
// CLARIN

// Click each filter toggle to open *every* filter
// (As we want to scan filter section for accessibility issues as well)
Expand All @@ -36,7 +39,10 @@ describe('My DSpace page', () => {
// Click button in sidebar to display detailed view
cy.get('ds-search-sidebar [data-test="detail-view"]').click();

cy.get('ds-object-detail').should('be.visible');
// CLARIN
// CLARIN-search component show only Items, so there are no records in the /mydspace page
// cy.get('ds-object-detail').should('be.visible');
// CLARIN

// Analyze <ds-search-page> for accessibility issues
// CLARIN
Expand Down Expand Up @@ -111,18 +117,21 @@ describe('My DSpace page', () => {
// Wait for search results to come back from the above GET command
cy.wait('@search-results');

// CLARIN
// CLARIN-search component show only Items, so there are no records in the /mydspace page
// Click the Edit button for this in-progress submission
cy.get('#edit_' + id).click();
// cy.get('#edit_' + id).click();

// Should send us back to the submission form
cy.url().should('include', '/workspaceitems/' + id + '/edit');

// Discard our new submission by clicking Discard in Submission form & confirming
cy.get('ds-submission-form-footer [data-test="discard"]').click();
cy.get('button#discard_submit').click();

// Discarding should send us back to MyDSpace
cy.url().should('include', '/mydspace');
// cy.url().should('include', '/workspaceitems/' + id + '/edit');
//
// // Discard our new submission by clicking Discard in Submission form & confirming
// cy.get('ds-submission-form-footer [data-test="discard"]').click();
// cy.get('button#discard_submit').click();
//
// // Discarding should send us back to MyDSpace
// cy.url().should('include', '/mydspace');
// CLARIN
});
});

Expand Down
8 changes: 2 additions & 6 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ Cypress.Commands.add('login', login);
* @param password password to login as
*/
function loginViaForm(email: string, password: string): void {
cy.wait(500);
cy.get('.discojuice_close').should('exist').click();
// Enter email
cy.get('ds-log-in [data-test="email"]').type(email);
// Enter password
Expand Down Expand Up @@ -226,12 +228,6 @@ export const loginProcess = {
};

export const createItemProcess = {
typeCollectionName() {
cy.get('.modal-body input[type = "search"]').type(TEST_COLLECTION_NAME);
},
selectCollection() {
cy.get('.modal-body .scrollable-menu button[title = "' + TEST_COLLECTION_NAME + '"]').eq(0).click();
},
checkLocalHasCMDIVisibility() {
cy.get('#traditionalpageone form div[role = "group"] label[for = "local_hasCMDI"]').should('be.visible');
},
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ services:
# __D__ => "-" (e.g. google__D__metadata => google-metadata)
# dspace.dir, dspace.server.url and dspace.ui.url
dspace__P__dir: /dspace
dspace__P__server__P__url: http://127.0.0.1:8080/server
dspace__P__ui__P__url: http://127.0.0.1:4000
dspace__P__server__P__url: ${REST_URL:-http://127.0.0.1:8080/server}
dspace__P__ui__P__url: ${UI_URL:-http://127.0.0.1:4000}
# db.url: Ensure we are using the 'dspacedb' image for our database
db__P__url: 'jdbc:postgresql://dspacedb:5432/dspace'
# solr.server: Ensure we are using the 'dspacesolr' image for Solr
Expand Down
11 changes: 11 additions & 0 deletions src/aai/aai.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
case 'local':
// DiscoJuice.UI.setScreen(opts.localauth);
// jQuery('input#login').focus();
// Use cookie to toggle discojuice popup.
setCookie('SHOW_DISCOJUICE_POPUP', false, 1)
window.location = window.location.origin + (namespace === '' ? namespace : '/' + namespace) + "/login?redirectUrl=" + window.location.href;
break;
//case 'saml':
Expand All @@ -111,6 +113,15 @@
return djc;
} //if jQuery(selector)
};

// Set a cookie
function setCookie(name, value, daysToExpire) {
var expirationDate = new Date();
expirationDate.setDate(expirationDate.getDate() + daysToExpire);

var cookieString = name + '=' + value + ';expires=' + expirationDate.toUTCString() + ';path=/';
document.cookie = cookieString;
}
}

if (!window.aai) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ <h2 id="header" class="border-bottom pb-2">{{'clarin.license.agreement.title' |
<td><b>{{'clarin.license.agreement.item.handle' | translate}}</b></td>
<td><input type="text" disabled class="rounded-sm max-width border-gray" [value]="(item$ | async)?.handle"></td>
</tr>
<tr *ngFor="let requiredInfo of requiredInfo$ | async">
<td><b>{{requiredInfo.value}}</b></td>
<td class="input-group">
<input #requiredInfoRef class="rounded-sm max-width border-gray"
[value]="getMetadataValueByKey(requiredInfo.name)"
(blur)="setMetadataValue(requiredInfo.name, requiredInfoRef.value)"/>
</td>
</tr>
<ng-container *ngIf="(currentUser$ | async) == null || (userMetadata$ | async)">
<tr *ngFor="let requiredInfo of requiredInfo$ | async">
<td><b>{{requiredInfo.value}}</b></td>
<td class="input-group">
<input #requiredInfoRef class="rounded-sm max-width border-gray"
[value]="getMetadataValueByKey(requiredInfo.name)"
(blur)="setMetadataValue(requiredInfo.name, requiredInfoRef.value)"/>
</td>
</tr>
</ng-container>
<tr>
<td><b>{{'clarin.license.agreement.bitstream.name' | translate}}</b></td>
<td><input type="text" disabled class="rounded-sm max-width border-gray" [value]="(bitstream$ | async)?.name"></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ import { Router } from '@angular/router';
import { getItemPageRoute } from '../../item-page/item-page-routing-paths';
import { getBitstreamDownloadRoute } from '../../app-routing-paths';
import { hasFailed } from 'src/app/core/data/request-entry-state.model';
import {FindListOptions} from '../../core/data/find-list-options.model';
import { FindListOptions } from '../../core/data/find-list-options.model';
import isEqual from 'lodash/isEqual';
import cloneDeep from 'lodash/cloneDeep';
import { ClarinUserMetadataDataService } from '../../core/data/clarin/clarin-user-metadata.service';

/**
* The component shows the user's filled in user metadata and the user can fill in other required user metadata.
Expand Down Expand Up @@ -119,7 +120,8 @@ export class ClarinLicenseAgreementPageComponent implements OnInit {
protected halService: HALEndpointService,
protected rdbService: RemoteDataBuildService,
private hardRedirectService: HardRedirectService,
private requestService: RequestService) { }
private requestService: RequestService,
private clarinUserMetadataDataService: ClarinUserMetadataDataService) { }

ngOnInit(): void {
// Load CurrentItem by bitstreamID to show itemHandle
Expand Down Expand Up @@ -282,7 +284,7 @@ export class ClarinLicenseAgreementPageComponent implements OnInit {
this.clarinLicense$.next(clarinLicense?.payload);
// Load required info from ClarinLicense
// @ts-ignore
this.requiredInfo$.next(clarinLicense?.payload?.requiredInfo);
this.requiredInfo$.next(clarinLicense?.payload?.requiredInfo);
});
});
}
Expand Down Expand Up @@ -314,16 +316,22 @@ export class ClarinLicenseAgreementPageComponent implements OnInit {
}
this.userRegistration$.next(userRegistration);

// Load userMetadata from userRegistration
userRegistration.userMetadata
// Load user metadata for the current user only from the last transaction
const params = [
new RequestParam('userRegUUID', userRegistration.id),
new RequestParam('bitstreamUUID', this.getBitstreamUUID())];
const paramOptions = Object.assign(new FindListOptions(), {
searchParams: [...params]
});
this.clarinUserMetadataDataService.searchBy('byUserRegistrationAndBitstream', paramOptions, false)
.pipe(
getFirstCompletedRemoteData())
.subscribe(userMetadata$ => {
if (hasFailed(userMetadata$.state)) {
.subscribe(userMetadata => {
if (hasFailed(userMetadata.state)) {
this.error$.value.push('Cannot load userMetadata');
return;
}
this.userMetadata$.next(userMetadata$.payload);
this.userMetadata$.next(userMetadata.payload);
});
});
}
Expand Down
Loading

0 comments on commit 3b00c21

Please sign in to comment.