Skip to content

Commit 014d646

Browse files
New Release merge - 2025/Mar/07 (#803)
* Fixed CMD download command - added file name (#798) * Fixed editing the license - required info is removed/added following the checked checkbox * Copy the refbox content correctly (#801) * The current version redirect - get the base href using the DOCUMENT (#800)
1 parent 3d1ba84 commit 014d646

10 files changed

Lines changed: 124 additions & 48 deletions

File tree

.github/actions/import-db/action.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@ runs:
5050
cid=$(docker run -d --rm --name $DB5NAME -v $(pwd):/dq/scripts -v $DATADIR/dump:/dq/dump -p 127.0.0.1:$DB5PORT:5432 -e POSTGRES_DB=empty -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=dspace postgres /bin/bash -c "cd /dq/scripts && ./init.dspacedb5.sh")
5151
echo "cid=$cid" >> $GITHUB_OUTPUT
5252
sleep 60
53-
echo "====="
54-
# Generate the current timestamp for the log filename
55-
timestamp=$(date +"%y%m%d%H%M")
56-
log_file="${{ inputs.LOGDIR }}python.${timestamp}.log"
57-
echo $log_file
58-
docker logs $DB5NAME > "$log_file" || true
59-
echo "====="
6053
# copy assetstore
6154
echo Preparing assetstore
6255
if [[ -z ${{ inputs.ASSETSTORE }} ]]; then
@@ -73,6 +66,15 @@ runs:
7366
rm __temp/resume/*.json || true
7467
# arguments of the script
7568
# required
69+
echo "====="
70+
# Generate the current timestamp for the log filename
71+
timestamp=$(date +"%y%m%d%H%M")
72+
log_file_timestamp="${{ inputs.LOGDIR }}python.${timestamp}.log"
73+
echo $log_file_timestamp
74+
mkdir ../__logs
75+
# Continuously append to the log file $log_file_timestamp. Start appending when the first file is added to the __logs folder.
76+
inotifywait -m -e create --format "%w%f" ../__logs/ | while IFS= read -r file; do tail -F --retry "$file" >> "$log_file_timestamp" 2>/dev/null & done &
77+
echo "====="
7678
args=(
7779
--resume=false
7880
--config=backend.endpoint=$BEURL

.github/workflows/deploy.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
name: Deploy DSpace
33

44
on:
5+
schedule:
6+
- cron: '0 21 * * 6' # Runs every Saturday at 9 PM
57
workflow_call:
68
inputs:
79
INSTANCE:
@@ -37,6 +39,18 @@ on:
3739
type: boolean
3840

3941
jobs:
42+
import-every-week:
43+
# Only run this job when triggered by the schedule event
44+
if: github.event_name == 'schedule'
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Call the deploy action with predefined inputs
48+
uses: ./.github/actions/deploy-dspace # Path to your custom action
49+
with:
50+
INSTANCE: '8'
51+
IMPORT: true
52+
ERASE_DB: true
53+
4054
deploy-5:
4155
if: inputs.INSTANCE == '*' || inputs.INSTANCE == '5'
4256
runs-on: dspace-dep-1
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Trigger Build for All Customer Branches
2+
3+
on:
4+
schedule:
5+
- cron: "0 */4 * * *" # Runs every 4 hours
6+
workflow_dispatch: # Allows manual triggering
7+
8+
permissions:
9+
actions: write # Grants permission to trigger workflows
10+
contents: read # Access to repository contents
11+
12+
jobs:
13+
trigger-builds:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4 # Ensures the repository is available
18+
19+
- name: Get and Trigger Customer Branch Builds
20+
run: |
21+
# Authenticate with GitHub CLI using the token
22+
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
23+
24+
git fetch --prune origin # Ensure remote refs are fetched
25+
BRANCHES=$(git ls-remote --heads origin | awk -F'/' '{print $3"/"$4}' | grep '^customer/')
26+
for branch in $(echo "$BRANCHES" | sed -e 's/[\[\]"]//g' -e 's/,/\n/g'); do
27+
echo "Triggering build for branch: $branch"
28+
gh workflow run build.yml --ref $branch
29+
done

src/app/clarin-licenses/clarin-license-table/modal/define-license-form/define-license-form.component.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,8 @@ export class DefineLicenseFormComponent implements OnInit {
169169
if (event.target.checked) {
170170
form.push(checkBoxValue);
171171
} else {
172-
form.forEach((formValue, index) => {
173-
if (formValue?.id === checkBoxValue.id) {
174-
form.splice(index, 1);
175-
}
176-
});
172+
let index = form.findIndex(item => item.name === checkBoxValue.name);
173+
form.splice(index, 1);
177174
}
178175
}
179176

src/app/item-page/clarin-files-section/clarin-files-section.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export class ClarinFilesSectionComponent implements OnInit {
107107
return file.name;
108108
});
109109

110-
this.command = `curl --remote-name-all ` + this.halService.getRootHref() + `/core/items/${this.item.id}/allzip?handleId=${this.itemHandle}`;
110+
this.command = `curl -o allzip.zip ` + this.halService.getRootHref() + `/core/items/${this.item.id}/allzip?handleId=${this.itemHandle}`;
111111
}
112112

113113
loadDownloadZipConfigProperties() {

src/app/item-page/clarin-ref-citation-modal/clarin-ref-citation-modal.component.ts

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
1111
})
1212
export class ClarinRefCitationModalComponent implements AfterViewInit {
1313

14-
constructor(public activeModal: NgbActiveModal) {
15-
}
14+
/**
15+
* Reference to the textarea for selecting text.
16+
*/
17+
@ViewChild('copyCitationModal', { static: false }) citationContentRef!: ElementRef<HTMLTextAreaElement>;
1618

1719
/**
18-
* The reference to make possible automatically select whole content.
20+
* The citation context - data retrieved from OAI-PMH
1921
*/
20-
@ViewChild('copyCitationModal', { static: true }) citationContentRef: ElementRef;
22+
@Input()
23+
citationText = '';
2124

2225
/**
2326
* The name of the showed Item
@@ -31,19 +34,31 @@ export class ClarinRefCitationModalComponent implements AfterViewInit {
3134
@Input()
3235
citationType = '';
3336

34-
/**
35-
* The citation context - data retrieved from OAI-PMH
36-
*/
37-
@Input()
38-
citationText = '';
37+
38+
private isViewInitialized = false;
39+
40+
constructor(public activeModal: NgbActiveModal) {} // Inject modal service
3941

4042
ngAfterViewInit(): void {
41-
setTimeout(() => {
43+
this.isViewInitialized = true;
44+
if (this.citationText) {
4245
this.selectContent();
43-
}, 300);
46+
}
47+
}
48+
49+
/**
50+
* Selects the content of the citation text area.
51+
*/
52+
selectContent(): void {
53+
setTimeout(() => {
54+
this.citationContentRef?.nativeElement.select();
55+
}, 0); // Ensure DOM is updated before selection
4456
}
4557

46-
selectContent() {
47-
this.citationContentRef?.nativeElement?.select();
58+
/**
59+
* Allows external triggers for content selection.
60+
*/
61+
selectContentOnLoad(): void {
62+
this.selectContent();
4863
}
4964
}

src/app/item-page/clarin-ref-citation/clarin-ref-citation.component.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,20 +230,26 @@ export class ClarinRefCitationComponent implements OnInit {
230230
* Open the citation modal with the data retrieved from the OAI-PMH.
231231
* @param citationType
232232
*/
233-
async openModal(citationType) {
233+
async openModal(citationType: string) {
234234
const modal = this.modalService.open(ClarinRefCitationModalComponent, {
235235
size: 'xl',
236236
ariaLabelledBy: 'modal-basic-title'
237237
});
238+
239+
// Set initial properties
238240
modal.componentInstance.itemName = this.itemNameText;
239241
modal.componentInstance.citationType = citationType;
242+
240243
// Fetch the citation text from the API
241244
let citationText = '';
242245
await this.getCitationText(citationType)
243246
.then(res => {
244-
citationText = res.payload?.metadata;
247+
citationText = res.payload?.metadata || ''; // Fallback to empty string if metadata is undefined
248+
modal.componentInstance.citationText = citationText; // Set citationText after fetching
245249
});
246-
modal.componentInstance.citationText = citationText;
250+
251+
// Ensure the modal content is selected after rendering
252+
modal.componentInstance.selectContentOnLoad();
247253
}
248254

249255
/**
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<ds-alert *ngIf="showLatestVersionNotice$ && (showLatestVersionNotice$ | async)"
2-
[content]="('item.version.notice' | translate:{ destination: getItemPage(((latestVersion$ | async)?.item | async)?.payload) })"
2+
[content]="('item.version.notice' | translate:{ destination: (destinationUrl$ | async) })"
33
[dismissible]="false"
44
[type]="AlertTypeEnum.Warning">
55
</ds-alert>

src/app/item-page/versions/notice/item-versions-notice.component.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ describe('ItemVersionsNoticeComponent', () => {
5757
);
5858

5959
beforeEach(waitForAsync(() => {
60-
6160
TestBed.configureTestingModule({
6261
declarations: [ItemVersionsNoticeComponent],
6362
imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([])],

src/app/item-page/versions/notice/item-versions-notice.component.ts

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Component, Input, OnInit } from '@angular/core';
1+
import { Component, Inject, Input, OnInit } from '@angular/core';
22
import { Item } from '../../../core/shared/item.model';
3-
import { Observable } from 'rxjs';
3+
import { Observable, of } from 'rxjs';
44
import { RemoteData } from '../../../core/data/remote-data';
55
import { VersionHistory } from '../../../core/shared/version-history.model';
66
import { Version } from '../../../core/shared/version.model';
@@ -13,7 +13,7 @@ import {
1313
import { map, startWith, switchMap } from 'rxjs/operators';
1414
import { VersionHistoryDataService } from '../../../core/data/version-history-data.service';
1515
import { AlertType } from '../../../shared/alert/alert-type';
16-
import { getItemPageRoute } from '../../item-page-routing-paths';
16+
import { DOCUMENT } from '@angular/common';
1717

1818
@Component({
1919
selector: 'ds-item-versions-notice',
@@ -50,17 +50,19 @@ export class ItemVersionsNoticeComponent implements OnInit {
5050
*/
5151
showLatestVersionNotice$: Observable<boolean>;
5252

53-
/**
54-
* Pagination options to fetch a single version on the first page (this is the latest version in the history)
55-
*/
56-
5753
/**
5854
* The AlertType enumeration
5955
* @type {AlertType}
6056
*/
6157
public AlertTypeEnum = AlertType;
6258

63-
constructor(private versionHistoryService: VersionHistoryDataService) {
59+
/**
60+
* New observable for the full redirect URL (with namespace)
61+
*/
62+
destinationUrl$: Observable<string>;
63+
64+
constructor(private versionHistoryService: VersionHistoryDataService,
65+
@Inject(DOCUMENT) private document: Document ) {
6466
}
6567

6668
/**
@@ -88,15 +90,27 @@ export class ItemVersionsNoticeComponent implements OnInit {
8890
startWith(false),
8991
);
9092
}
91-
}
9293

93-
/**
94-
* Get the item page url
95-
* @param item The item for which the url is requested
96-
*/
97-
getItemPage(item: Item): string {
98-
if (hasValue(item)) {
99-
return getItemPageRoute(item);
100-
}
94+
// Compute the destination URL from latestVersion$ with the namespace
95+
this.destinationUrl$ = this.latestVersion$.pipe(
96+
switchMap(latestVersion => latestVersion?.item || of(null)),
97+
map(item => {
98+
const itemId = item?.payload?.uuid;
99+
100+
if (!itemId) {
101+
console.error('No valid UUID found in payload');
102+
return this.document.location.pathname; // Fallback to the current path if extraction fails
103+
}
104+
105+
// Get the base URL dynamically - with the namespace. Remove the last part of the path (the item UUID).
106+
const baseUrl = this.document.location.pathname.split('/').slice(0, -1).join('/');
107+
108+
// Construct the final URL dynamically
109+
const finalUrl = `${baseUrl}/${itemId}`;
110+
111+
return finalUrl;
112+
})
113+
);
101114
}
115+
102116
}

0 commit comments

Comments
 (0)