Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merging dataquest-dev/dtq-dev #18

Merged
merged 35 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2214559
UFAL/Share submission with user not only admin (#728)
milanmajchrak Nov 12, 2024
057632d
Updated messages following last commit to upstream. (#731)
milanmajchrak Nov 14, 2024
aa6e71b
Updated dspace prefix to lindat (#734)
milanmajchrak Nov 15, 2024
d506074
Added notification when the shibboleth authentication is failed (#732)
milanmajchrak Nov 19, 2024
5e21da0
Removed two IT: (#737)
milanmajchrak Nov 20, 2024
753594d
Update all static licenses (#726)
Paurikova2 Nov 20, 2024
f9f6e62
Use NAMESPACES from the .env (#727)
milanmajchrak Nov 20, 2024
a6310f0
Update deploy.yml to increase timeout (#738)
milanmajchrak Nov 21, 2024
a2a3e53
Use only 4000, not the {UI_PORT} from the .env because in the contain…
milanmajchrak Nov 21, 2024
09e1167
Update docker-compose-rest.yml
milanmajchrak Nov 21, 2024
c5bc34b
Update docker-compose-rest.yml
milanmajchrak Nov 21, 2024
8d68def
Use only / and /server namespaces, not the values from the .env becau…
milanmajchrak Nov 21, 2024
4e108e6
Expose tomcat `/server` on `/repository/server`
milanmajchrak Nov 21, 2024
5843e54
Take a customized docker-compose-rest.yml which exposes the server on…
milanmajchrak Nov 21, 2024
e7e8185
Updated a path to take right docker-compose files
milanmajchrak Nov 21, 2024
3d052e6
Undo using only default namespaced `/` and `/server`
milanmajchrak Nov 21, 2024
dced963
Merge remote-tracking branch 'dataquest/dtq-dev' into HEAD
kosarko Nov 21, 2024
56f0730
Use custom `docker-compose.yml` from the testing server
milanmajchrak Nov 22, 2024
01b4a93
UFAL/Shibboleth fixed wrong redirect after login with verification to…
milanmajchrak Nov 22, 2024
ea056b2
Use path `./assets` instead of `/assets` (#742)
milanmajchrak Nov 22, 2024
6e281ba
new download instruction for cmd using zip from backend (#739)
Paurikova2 Nov 26, 2024
c335482
Get UI base URL from BE (#744)
milanmajchrak Nov 26, 2024
b782d78
Check that the custom type bind field in configured in the `submissio…
milanmajchrak Nov 28, 2024
42040a6
Searching by type is changed to 'type' instead of 'itemtype' because …
milanmajchrak Nov 29, 2024
6ffc7e5
Use `autoLogin` method (#747)
milanmajchrak Nov 29, 2024
e7e1577
UFAL/Matomo statistics using angulartics2 (#748)
milanmajchrak Nov 29, 2024
0d69bcc
Update db-import action
milanmajchrak Nov 30, 2024
8126cb7
Update import-db action - use main branch
milanmajchrak Nov 30, 2024
374c062
Added a translation for the searching filter `subjectFirstValue` (red…
milanmajchrak Dec 2, 2024
60e2983
Ensure the redirect URL starts with a slash (#753)
milanmajchrak Dec 2, 2024
fc70fcb
Added volume into docker-compose (#754)
milanmajchrak Dec 3, 2024
4c2e997
UFAL/Load the matomo configuration from the environment (#755)
milanmajchrak Dec 3, 2024
e4dcb89
Fetch the matomo properties from the config, not from the environment…
milanmajchrak Dec 3, 2024
1cc31c6
Load the szn license in oninit method (#757)
milanmajchrak Dec 4, 2024
7dc1ec8
Merge remote-tracking branch 'dataquest/dtq-dev' into HEAD
kosarko Dec 4, 2024
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
12 changes: 8 additions & 4 deletions .github/disabled-workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ jobs:
working-directory: build-scripts/run/
run: |
./start.sh dspace-$INSTANCE
cd ../..
# use customized docker-compose file for the `85` port because the server is exposed with the namespace `repository`
# `/repository/server`
docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/5/docker-compose-rest.yml -f /opt/dspace-envs/5/docker-compose.yml up -d --no-build

deploy-8:
if: inputs.INSTANCE == '*' || inputs.INSTANCE == '8'
Expand Down Expand Up @@ -147,7 +151,7 @@ jobs:
playwright-after-deploy8:
runs-on: ubuntu-latest
needs: deploy-8
timeout-minutes: 15
timeout-minutes: 45
if: '!inputs.IMPORT'
steps:
- name: run playwright
Expand Down Expand Up @@ -184,7 +188,7 @@ jobs:
rest-tests-after-deploy8:
runs-on: ubuntu-latest
needs: playwright-after-deploy8
timeout-minutes: 15
timeout-minutes: 45
steps:
- name: run rest-tests
run: |
Expand Down Expand Up @@ -219,7 +223,7 @@ jobs:
runs-on: ubuntu-latest
needs: import-8
if: inputs.IMPORT
timeout-minutes: 15
timeout-minutes: 45
steps:
- name: run playwright
run: |
Expand Down Expand Up @@ -256,7 +260,7 @@ jobs:
rest-tests-after-import8:
runs-on: ubuntu-latest
needs: playwright-after-import8
timeout-minutes: 15
timeout-minutes: 45
steps:
- name: run rest-tests
run: |
Expand Down
4 changes: 4 additions & 0 deletions config/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,7 @@ vocabularies:
comcolSelectionSort:
sortField: 'dc.title'
sortDirection: 'ASC'

matomo:
hostUrl: http://localhost:8135/
siteId: 1
22 changes: 0 additions & 22 deletions cypress/e2e/submission-ui.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,6 @@ describe('Create a new submission', () => {
createItemProcess.showErrorNotSupportedLicense();
});

// Author field should consist of two input fields
it('Author field should consist of two input fields', {
retries: {
runMode: 6,
openMode: 6,
},
defaultCommandTimeout: 10000
},() => {
createItemProcess.checkAuthorFirstnameField();
createItemProcess.checkAuthorLastnameField();
});

it('The submission should not have the Notice Step', {
retries: {
runMode: 6,
Expand All @@ -261,16 +249,6 @@ describe('Create a new submission in the clariah collection', () => {
// This page is restricted, so we will be shown the login form. Fill it out & submit.
cy.loginViaForm(TEST_ADMIN_USER, TEST_ADMIN_PASSWORD);
});

it('The submission should have the Notice Step', {
retries: {
runMode: 6,
openMode: 6,
},
defaultCommandTimeout: 10000
},() => {
createItemProcess.checkClarinNoticeStep();
});
});

function addEUSponsor(euSponsorOrder) {
Expand Down
12 changes: 8 additions & 4 deletions docker/docker-compose-rest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ services:
# BE server port
- published: 808${INSTANCE}
target: 8080
host_ip: 127.0.0.1
host_ip: ${HOST_IP:-127.0.0.1}
# original debug port
- published: 800${INSTANCE}
target: 8000
host_ip: 127.0.0.1
host_ip: ${HOST_IP:-127.0.0.1}
# handle binary port as per https://www.handle.net/hnr_support.html (5th paragraph)
- published: 264${INSTANCE}
target: 2641
Expand All @@ -93,6 +93,10 @@ services:
entrypoint:
- /bin/bash
- '-c'
# When customizing the namespace, add the following command to the entrypoint command below (after `while ...`):
# `pushd ../webapps && unlink server && ln -s /dspace/webapps/server/ 'repository#server' && popd`
# This will create a symlink from the webapps directory to the server directory with the custom namespace
# (e.g. /dspace/webapps/server -> /dspace/webapps/repository#server)
- |
while (!</dev/tcp/dspacedb/543${INSTANCE}) > /dev/null 2>&1; do sleep 1; done;
/dspace/bin/dspace database migrate force
Expand All @@ -112,7 +116,7 @@ services:
ports:
- published: 543${INSTANCE}
target: 543${INSTANCE}
host_ip: 127.0.0.1
host_ip: ${HOST_IP:-127.0.0.1}
stdin_open: true
tty: true
volumes:
Expand All @@ -133,7 +137,7 @@ services:
ports:
- published: 898${INSTANCE}
target: 898${INSTANCE}
host_ip: 127.0.0.1
host_ip: ${HOST_IP:-127.0.0.1}
stdin_open: true
tty: true
working_dir: /var/solr/data
Expand Down
12 changes: 7 additions & 5 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ services:
TZ: ${TIMEZONE:-Europe/Bratislava}
DSPACE_UI_SSL: 'false'
DSPACE_UI_HOST: dspace-angular
# Use only `4000`, not the {UI_PORT} from the .env because in the container it is always `4000`
DSPACE_UI_PORT: 4000
DSPACE_UI_NAMESPACE: /
DSPACE_UI_NAMESPACE: ${DSPACE_UI_NAMESPACE:-/}
DSPACE_REST_SSL: ${DSPACE_SSL:-false}
DSPACE_REST_HOST: ${DSPACE_HOST:-localhost}
DSPACE_REST_PORT: ${DSPACE_REST_PORT}
DSPACE_REST_NAMESPACE: /server
DSPACE_REST_PORT: ${DSPACE_REST_PORT:-8080}
DSPACE_REST_NAMESPACE: ${DSPACE_REST_NAMESPACE:-/server}
image: ${DSPACE_UI_IMAGE:-ufal/dspace-angular:dspace-7_x}
volumes:
- ./config.prod.yml:/app/config/config.prod.yml
# - ./aai.js:/app/dist/browser/aai.js
# - ./dspace-ui.json:/app/docker/dspace-ui.json:rw
build:
context: ..
Expand All @@ -36,9 +38,9 @@ services:
ports:
- published: 400${INSTANCE}
target: 4000
host_ip: 127.0.0.1
host_ip: ${HOST_IP:-127.0.0.1}
- published: 987${INSTANCE}
target: 987${INSTANCE}
host_ip: 127.0.0.1
host_ip: ${HOST_IP:-127.0.0.1}
stdin_open: true
tty: true
7 changes: 7 additions & 0 deletions docker/matomo-settings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Matomo settings for tracking statistics. This file could be mounted in the docker container.
*/
export const matomoSettings = {
hostUrl: 'http://localhost:8135/',
siteId: '1'
};
19 changes: 18 additions & 1 deletion src/aai/aai.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@

if (redirectUrlFromLogin != null && redirectUrlFromLogin !== '') {
// Redirect from the login page with retrieved redirect URL
redirectUrl = window.location.origin + (namespace === '' ? namespace : '/' + namespace) + redirectUrlFromLogin;
var baseUrl = window.location.origin + formatNamespace(namespace);
var redirectPath = ensureLeadingSlash(redirectUrlFromLogin);

redirectUrl = baseUrl + redirectPath;
}

// Encode the redirect URL
Expand Down Expand Up @@ -129,6 +132,20 @@
var cookieString = name + '=' + value + ';expires=' + expirationDate.toUTCString() + ';path=/';
document.cookie = cookieString;
}

/**
* Return empty string if namespace is empty, otherwise return namespace with leading slash.
*/
function formatNamespace(namespace) {
return namespace === '' ? '' : ensureLeadingSlash(namespace);
}

/**
* Ensure that the path starts with a leading slash.
*/
function ensureLeadingSlash(path) {
return path.startsWith('/') ? path : '/' + path;
}
}

if (!window.aai) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h2 id="header" class="border-bottom pb-2">{{'clarin.license.agreement.title' |
<div class="card bg-clarin-yellow border-clarin-yellow">
<div class="card-body text-center">
<a [href]="clarinLicense?.definition">{{clarinLicense?.name}}</a>
<div *ngIf="clarinLicense?.name === LICENSE_NAME_SEZNAM && loadLicenseContentSeznam()"
<div *ngIf="clarinLicense?.name === LICENSE_NAME_SEZNAM"
class="pt-3"
[innerHTML]="(licenseContentSeznam | async) | dsSafeHtml">
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ export class ClarinLicenseAgreementPageComponent implements OnInit {
// The user is signed in and has record in the userRegistration
// Load userRegistration and userMetadata from userRegistration repository
this.loadUserRegistrationAndUserMetadata();

// Load the Seznam dataset license content
this.loadLicenseContentSeznam();
}

/**
Expand Down
33 changes: 25 additions & 8 deletions src/app/change-submitter-page/change-submitter-page.component.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
<div class="container pt-2 pb-4" *ngVar="submitter | async as sub">
<h3>{{'share.submission.page.title' | translate}}</h3>
<span>{{'change.submitter.page.message' | translate}}</span>
<span>{{getSubmitterName(sub)}}</span>
<span> ({{sub?.email}})</span>
<div class="pt-4">
<button class="btn btn-info" (click)="changeSubmitter()">
<div *ngVar="item | async as item" >
<h3>{{'share.submission.page.title' | translate}}</h3>
<div *ngIf="sub">
<span>{{'change.submitter.page.message' | translate}}</span>
<span class="font-weight-bold">{{getName(sub)}}</span>
<span class="font-weight-bold"> ({{sub?.email}})</span>
</div>
<div *ngIf="sub == null">
<span>{{'change.submitter.page.cannot.see.submitter.message' | translate}}</span>
</div>

<div>
<span>{{'change.submitter.page.items.handle.message' | translate}}</span>
<span class="font-weight-bold">{{item?.handle}}</span>
</div>
<div>
<span>{{'change.submitter.page.items.name.message' | translate}}</span>
<span class="font-weight-bold">{{getName(item)}}</span>
</div>

<div class="pt-4">
<button class="btn btn-info" (click)="changeSubmitter()">
<span *ngIf="changeSubmitterSpinner"
class="spinner-border spinner-border-sm spinner-button mr-1" role="status" aria-hidden="true">
</span>
<span>{{'change.submitter.page.button.take-it' | translate}}</span>
</button>
<span>{{'change.submitter.page.button.take-it' | translate}}</span>
</button>
</div>
</div>
</div>

Expand Down
60 changes: 48 additions & 12 deletions src/app/change-submitter-page/change-submitter-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ import { isNullOrUndef } from 'chart.js/helpers';
import { HALEndpointService } from '../core/shared/hal-endpoint.service';
import { RemoteDataBuildService } from '../core/cache/builders/remote-data-build.service';
import { RequestService } from '../core/data/request.service';
import { PostRequest } from '../core/data/request.models';
import { GetRequest } from '../core/data/request.models';
import { RemoteData } from '../core/data/remote-data';
import { NotificationsService } from '../shared/notifications/notifications.service';
import { TranslateService } from '@ngx-translate/core';
import { HttpHeaders } from '@angular/common/http';
import { HttpOptions } from '../core/dspace-rest/dspace-rest.service';
import { Item } from '../core/shared/item.model';

@Component({
selector: 'ds-change-submitter-page',
Expand All @@ -34,11 +37,22 @@ export class ChangeSubmitterPageComponent implements OnInit {
*/
private shareToken = '';

/**
* WorkspaceItem id from the url.
* This id is used to get authorization rights to call REST API to change the submitter.
*/
private workspaceitemid = '';

/**
* BehaviorSubject that contains the submitter of the WorkspaceItem.
*/
submitter: BehaviorSubject<EPerson> = new BehaviorSubject(null);

/**
* BehaviorSubject that contains the Item.
*/
item: BehaviorSubject<Item> = new BehaviorSubject(null);

/**
* BehaviorSubject that contains the WorkspaceItem.
*/
Expand All @@ -61,6 +75,8 @@ export class ChangeSubmitterPageComponent implements OnInit {
ngOnInit(): void {
// Load `share_token` param value from the url
this.shareToken = this.route.snapshot.queryParams.share_token;
// Load `workspaceitem_id` param value from the url
this.workspaceitemid = this.route.snapshot.queryParams.workspaceitemid;
this.loadWorkspaceItemAndAssignSubmitter(this.shareToken);
}

Expand All @@ -70,17 +86,36 @@ export class ChangeSubmitterPageComponent implements OnInit {
loadWorkspaceItemAndAssignSubmitter(shareToken: string) {
this.findWorkspaceItemByShareToken(shareToken)?.subscribe((workspaceItem: WorkspaceItem) => {
this.workspaceItem.next(workspaceItem);
this.loadItemFromWorkspaceItem(workspaceItem);
this.loadAndAssignSubmitter(workspaceItem);
});
}

/**
* Load the Item from the WorkspaceItem and assign it to the item BehaviorSubject.
*/
loadItemFromWorkspaceItem(workspaceItem: WorkspaceItem) {
if (workspaceItem.item instanceof Observable<Item>) {
workspaceItem.item
.pipe(getFirstSucceededRemoteDataPayload())
.subscribe((item: Item) => {
this.item.next(item);
});
}
}

/**
* Find a WorkspaceItem by its shareToken.
*/
findWorkspaceItemByShareToken(shareToken: string): Observable<WorkspaceItem> {
let requestHeaders = new HttpHeaders();
const requestOptions: HttpOptions = Object.create({});
requestHeaders = requestHeaders.append('shareToken', shareToken);
requestOptions.headers = requestHeaders;

return this.workspaceItemService.searchBy('shareToken', {
searchParams: [Object.assign(new RequestParam('shareToken', shareToken))]
}, false, false, followLink('submitter')).pipe(getFirstSucceededRemoteListPayload(),
}, false, false, followLink('item'), followLink('submitter')).pipe(getFirstSucceededRemoteListPayload(),
map((workspaceItems: WorkspaceItem[]) => workspaceItems?.[0]));
}

Expand Down Expand Up @@ -112,27 +147,28 @@ export class ChangeSubmitterPageComponent implements OnInit {
}

/**
* Get the name of the submitter using the DSONameService.
* @param submitter
* Get the name of the submitter or item using the DSONameService.
*/
getSubmitterName(submitter: EPerson): string {
if (isNullOrUndef(submitter)) {
getName(object: EPerson | Item) {
if (isNullOrUndef(object)) {
return '';
}
return this.dsoNameService.getName(submitter);
return this.dsoNameService.getName(object);
}

/**
* Change the submitter of the WorkspaceItem using the shareToken. This will send a POST request to the backend when
* Change the submitter of the WorkspaceItem using the shareToken. This will send a GET request to the backend when
* the submitter of the Item is changed.
*/
changeSubmitter() {
const requestId = this.requestService.generateRequestId();

const url = this.halService.getRootHref() + '/submission/setOwner?shareToken=' + this.shareToken;
const postRequest = new PostRequest(requestId, url);
// Send POST request
this.requestService.send(postRequest);
const url = this.halService.getRootHref() + '/submission/setOwner?shareToken=' + this.shareToken +
'&workspaceitemid=' + this.workspaceitemid;

const getRequest = new GetRequest(requestId, url);
// Send GET request
this.requestService.send(getRequest);
this.changeSubmitterSpinner = true;
// Get response
const response = this.rdbService.buildFromRequestUUID(requestId);
Expand Down
Loading
Loading