Skip to content

Commit

Permalink
Merged changes from dtq-dev and fixed conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmajchrak committed Feb 21, 2024
2 parents 36214ec + ebfe8dc commit 0becdb9
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 0becdb9

Please sign in to comment.