Skip to content

Commit

Permalink
Merge remote-tracking branch 'dataquest/dtq-dev' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarko committed Dec 4, 2024
2 parents dced963 + 1cc31c6 commit 7dc1ec8
Show file tree
Hide file tree
Showing 29 changed files with 164 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .github/disabled-workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
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 up -d --no-build
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
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
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
24 changes: 1 addition & 23 deletions src/app/footer/footer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,7 @@ <h4><a href="https://lindat.cz/services">Services</a></h4>
ga('create', 'UA-27008245-2', 'cuni.cz');
ga('send', 'pageview');
//]]>
</script>
<!-- Piwik LINDAT/CLARIAH-CZ tracker -->
<script type="text/javascript">
//<![CDATA[
var _paq = _paq || [];
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(["setCookieDomain", "*.mff.cuni.cz"]);
_paq.push(["setDomains", ["*.mff.cuni.cz"]]);
_paq.push(['setCustomVariable', 1, "source", "common-theme", "page"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u='//lindat.mff.cuni.cz/piwik/';
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 2]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
//]]>
</script>
<noscript><p><img src="//lindat.mff.cuni.cz/piwik/piwik.php?idsite=2" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
<!-- End TRACKING CODE -->
</script>
</footer>
</div>
</footer>
6 changes: 0 additions & 6 deletions src/app/footer/footer.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { CUSTOM_ELEMENTS_SCHEMA, DebugElement } from '@angular/core';

import { CommonModule } from '@angular/common';

import { By } from '@angular/platform-browser';

import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { StoreModule } from '@ngrx/store';

Expand Down Expand Up @@ -62,10 +60,6 @@ describe('Footer component', () => {
fixture = TestBed.createComponent(FooterComponent);

comp = fixture.componentInstance; // component test instance

// query for the title <p> by CSS element selector
de = fixture.debugElement.query(By.css('p'));
el = de.nativeElement;
});

it('should create footer', inject([FooterComponent], (app: FooterComponent) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ export class ClarinFilesSectionComponent implements OnInit {
return file.name;
});

this.command = `curl --remote-name-all ` + this.halService.getRootHref() + `/core/bitstreams/handle/${
this.itemHandle
}/{${fileNames.join(',')}}`;
this.command = `curl --remote-name-all ` + this.halService.getRootHref() + `/core/items/${this.item.id}/allzip?handleId=${this.itemHandle}`;
}

loadDownloadZipConfigProperties() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const allowedPreviewFormats = ['text/plain', 'text/html', 'application/zip', 'ap
styleUrls: ['./file-description.component.scss'],
})
export class FileDescriptionComponent {
MIME_TYPE_IMAGES_PATH = '/assets/images/mime/';
MIME_TYPE_IMAGES_PATH = './assets/images/mime/';
MIME_TYPE_DEFAULT_IMAGE_NAME = 'application-octet-stream.png';

@Input()
Expand Down
43 changes: 23 additions & 20 deletions src/app/login-page/autoregistration/autoregistration.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { GetRequest, PostRequest } from '../../core/data/request.models';
import { getFirstCompletedRemoteData,getFirstSucceededRemoteListPayload } from '../../core/shared/operators';
import { ActivatedRoute, Router } from '@angular/router';
import {
getFirstCompletedRemoteData, getFirstSucceededRemoteData,
getFirstSucceededRemoteListPayload
} from '../../core/shared/operators';
import { ActivatedRoute } from '@angular/router';
import { RequestService } from '../../core/data/request.service';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
Expand All @@ -19,11 +22,11 @@ import { HttpHeaders } from '@angular/common/http';
import { AuthTokenInfo } from '../../core/auth/models/auth-token-info.model';
import { isEmpty } from '../../shared/empty.util';
import { CoreState } from 'src/app/core/core-state.model';
import { hasSucceeded } from 'src/app/core/data/request-entry-state.model';
import { FindListOptions } from '../../core/data/find-list-options.model';
import { getBaseUrl } from '../../shared/clarin-shared-util';
import { ConfigurationProperty } from '../../core/shared/configuration-property.model';
import { RemoteData } from '../../core/data/remote-data';
import { HardRedirectService } from '../../core/services/hard-redirect.service';

/**
* This component is showed up when the user has clicked on the `verification token`.
Expand Down Expand Up @@ -69,16 +72,16 @@ export class AutoregistrationComponent implements OnInit {
*/
showAttributes: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);

constructor(protected router: Router,
public route: ActivatedRoute,
constructor(public route: ActivatedRoute,
private requestService: RequestService,
protected halService: HALEndpointService,
protected rdbService: RemoteDataBuildService,
private notificationService: NotificationsService,
private translateService: TranslateService,
private configurationService: ConfigurationDataService,
private verificationTokenService: ClarinVerificationTokenDataService,
private store: Store<CoreState>
private store: Store<CoreState>,
private hardRedirectService: HardRedirectService
) { }

async ngOnInit(): Promise<void> {
Expand All @@ -95,7 +98,7 @@ export class AutoregistrationComponent implements OnInit {
});

if (this.showAttributes.value === false) {
this.sendAutoLoginRequest();
this.autologin();
}
}

Expand All @@ -115,11 +118,9 @@ export class AutoregistrationComponent implements OnInit {
const response = this.rdbService.buildFromRequestUUID(requestId);
// Process response
response
.pipe(getFirstCompletedRemoteData())
.pipe(getFirstSucceededRemoteData())
.subscribe(responseRD$ => {
if (hasSucceeded(responseRD$.state)) {
// Show successful message
this.notificationService.success(this.translateService.instant('clarin.autoregistration.successful.message'));
if (responseRD$.hasSucceeded) {
// Call autologin
this.sendAutoLoginRequest();
} else {
Expand Down Expand Up @@ -159,22 +160,24 @@ export class AutoregistrationComponent implements OnInit {
this.requestService.send(postRequest);
// Get response
const response = this.rdbService.buildFromRequestUUID(requestId);
// Process response
response
.pipe(getFirstCompletedRemoteData())
response.pipe(getFirstSucceededRemoteData())
.subscribe(responseRD$ => {
if (hasSucceeded(responseRD$.state)) {
// Retrieve the token from the response. The token is returned as array of string.
if (responseRD$.hasSucceeded) {
const token = Object.values(responseRD$?.payload).join('');
const authToken = new AuthTokenInfo(token);
this.deleteVerificationToken();
this.store.dispatch(new AuthenticatedAction(authToken));
this.router.navigate(['home']);
this.deleteVerificationToken();
// Use hard redirect to load all components from the beginning as the logged-in user. Because some components
// are not loaded correctly when the user is logged in e.g., `log in` button is still visible instead of
// log out button.
const redirectUrl = this.baseUrl.endsWith('/')
? `${this.baseUrl}home`
: `${this.baseUrl}/home`;
this.hardRedirectService.redirect(redirectUrl);
} else {
this.notificationService.error(this.translateService.instant('clarin.autologin.error.message'));
console.error(responseRD$.errorMessage);
}
});
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class ClarinItemBoxViewComponent implements OnInit {

protected readonly AUTHOR_METADATA_FIELDS = AUTHOR_METADATA_FIELDS;

ITEM_TYPE_IMAGES_PATH = '/assets/images/item-types/';
ITEM_TYPE_IMAGES_PATH = './assets/images/item-types/';
ITEM_TYPE_DEFAULT_IMAGE_NAME = 'application-x-zerosize.png';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/clarin-shared-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function convertMetadataFieldIntoSearchType(field: string[]) {
case field.includes('dc.contributor.author') || field.includes('dc.creator'):
return 'author';
case field.includes('dc.type'):
return 'itemtype';
return 'type';
case field.includes('dc.publisher') || field.includes('creativework.publisher'):
return 'publisher';
case field.includes('dc.language.iso') || field.includes('local.language.name'):
Expand Down
25 changes: 17 additions & 8 deletions src/app/shared/form/builder/form-builder.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import { FormRowModel } from '../../../core/config/models/config-submission-form
/**
* The key for the default type bind field. {'default': 'dc_type'}
*/
export const TYPE_BIND_DEFAULT = 'default';
export const TYPE_BIND_DEFAULT_KEY = 'default';

@Injectable()
export class FormBuilderService extends DynamicFormService {
Expand Down Expand Up @@ -91,7 +91,7 @@ export class FormBuilderService extends DynamicFormService {
this.typeFields = new Map();
this.typeBindModel = new Map();

this.typeFields.set(TYPE_BIND_DEFAULT, 'dc_type');
this.typeFields.set(TYPE_BIND_DEFAULT_KEY, 'dc_type');
// If optional config service was passed, perform an initial set of type field (default dc_type) for type binds
if (hasValue(this.configService)) {
this.setTypeBindFieldFromConfig();
Expand All @@ -118,9 +118,18 @@ export class FormBuilderService extends DynamicFormService {
getTypeBindModel(typeBingField: string): DynamicFormControlModel {
let typeBModelKey = this.typeFields.get(typeBingField);
if (isUndefined(typeBModelKey)) {
typeBModelKey = this.typeFields.get(TYPE_BIND_DEFAULT);
typeBModelKey = this.typeFields.get(TYPE_BIND_DEFAULT_KEY);
}
return this.typeBindModel.get(typeBModelKey);
// 1. The candidate is undefined when the custom field is configured for a specific metadata field
// e.g., `dc.language.iso=>edm.type`, but the custom field is not configured in the
// `submission-forms` configuration (type-bind without custom `field`)
// 2. If candidateTypeBindModel does not have custom `field` property, return the default typeBindModel, also
// that means that the custom field is not configured in the `submission-forms` configuration
const candidateTypeBindModel = this.typeBindModel.get(typeBModelKey);
if (isUndefined(candidateTypeBindModel) || isNotUndefined((candidateTypeBindModel as any).typeBindField)) {
return this.typeBindModel.get(this.typeFields.get(TYPE_BIND_DEFAULT_KEY));
}
return candidateTypeBindModel;
}

setTypeBindModel(model: DynamicFormControlModel) {
Expand Down Expand Up @@ -587,7 +596,7 @@ export class FormBuilderService extends DynamicFormService {
}

// Always update the typeFields map with the default value, normalized
this.typeFields.set(TYPE_BIND_DEFAULT, typeFieldConfigValue.replace(/\./g, '_'));
this.typeFields.set(TYPE_BIND_DEFAULT_KEY, typeFieldConfigValue.replace(/\./g, '_'));
});
});
}
Expand All @@ -599,11 +608,11 @@ export class FormBuilderService extends DynamicFormService {
getTypeField(metadataField: string): string {
if (hasValue(this.configService) && isEmpty(this.typeFields.values())) {
this.setTypeBindFieldFromConfig(metadataField);
} else if (hasNoValue(this.typeFields.get(TYPE_BIND_DEFAULT))) {
this.typeFields.set(TYPE_BIND_DEFAULT, 'dc_type');
} else if (hasNoValue(this.typeFields.get(TYPE_BIND_DEFAULT_KEY))) {
this.typeFields.set(TYPE_BIND_DEFAULT_KEY, 'dc_type');
}

return this.typeFields.get(metadataField) || this.typeFields.get(TYPE_BIND_DEFAULT);
return this.typeFields.get(metadataField) || this.typeFields.get(TYPE_BIND_DEFAULT_KEY);
}

}
3 changes: 3 additions & 0 deletions src/app/shared/form/builder/models/form-field.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,7 @@ export class FormFieldModel {

@autoserialize
autocompleteCustom: string;

@autoserialize
typeBindField: string;
}
3 changes: 3 additions & 0 deletions src/app/shared/form/builder/parsers/field-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ export abstract class FieldParser {
this.parserOptions.typeField);
}

if (isNotEmpty(this.configData.typeBindField)) {
controlModel.typeBindField = this.configData.typeBindField;
}
return controlModel;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export class ViewTrackerComponent implements OnInit, OnDestroy {
action: 'page_view',
properties: {
object: this.object,
referrer
referrer,
category: 'page_view',
},
});
});
Expand Down
18 changes: 10 additions & 8 deletions src/assets/i18n/cs.json5
Original file line number Diff line number Diff line change
Expand Up @@ -5277,12 +5277,14 @@
// "search.filters.applied.f.original_bundle_descriptions": "File description",
// TODO New key - Add a translation
"search.filters.applied.f.original_bundle_descriptions": "File description",
// "search.filters.applied.f.itemtype": "Type",
"search.filters.applied.f.itemtype": "Typ",
// "search.filters.applied.f.type": "Type",
"search.filters.applied.f.type": "Typ",
// "search.filters.applied.f.namedresourcetype": "Status",
"search.filters.applied.f.namedresourcetype": "Status",
// "search.filters.applied.f.subject": "Subject",
"search.filters.applied.f.subject": "Předmět",
// "search.filters.applied.f.subjectFirstValue": "Subject",
"search.filters.applied.f.subjectFirstValue": "Předmět",
// "search.filters.applied.f.submitter": "Submitter",
"search.filters.applied.f.submitter": "Odesílatel",
// "search.filters.applied.f.jobTitle": "Job Title",
Expand Down Expand Up @@ -5422,12 +5424,12 @@
// "search.filters.filter.original_bundle_descriptions.label": "Search File description",
// TODO New key - Add a translation
"search.filters.filter.original_bundle_descriptions.label": "Search File description",
// "search.filters.filter.itemtype.head": "Type",
"search.filters.filter.itemtype.head": "Typ",
// "search.filters.filter.itemtype.placeholder": "Type",
"search.filters.filter.itemtype.placeholder": "Typ",
// "search.filters.filter.itemtype.label": "Search type",
"search.filters.filter.itemtype.label": "Hledat typ",
// "search.filters.filter.type.head": "Type",
"search.filters.filter.type.head": "Typ",
// "search.filters.filter.type.placeholder": "Type",
"search.filters.filter.type.placeholder": "Typ",
// "search.filters.filter.type.label": "Search type",
"search.filters.filter.type.label": "Hledat typ",
// "search.filters.filter.jobTitle.head": "Job Title",
"search.filters.filter.jobTitle.head": "Název pracovní pozice",
// "search.filters.filter.jobTitle.placeholder": "Job Title",
Expand Down
Loading

0 comments on commit 7dc1ec8

Please sign in to comment.