Skip to content

Commit

Permalink
Merge branch 'dtq-dev' of github.com:dataquest-dev/dspace-angular int…
Browse files Browse the repository at this point in the history
…o dtq-dev
  • Loading branch information
jm committed Nov 7, 2023
2 parents 40fdef0 + a1b476c commit a88670e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,7 @@ export class FileDescriptionComponent {
constructor(protected halService: HALEndpointService, private router: Router) { }

public downloadFiles() {
console.log('${this.fileInput.href}', `${this.fileInput.href}`);
console.log('gile', this.fileInput);
// console.log('this.halService.getRootHref()', );
// const href$ = this.halService.getEndpoint('bitstreams');
this.router.navigateByUrl('bitstreams/' + this.fileInput.id + '/download');
// href$.pipe(
// find((href: string) => hasValue(href)),
// ).subscribe((endpoint: string) => {
// console.log('endpoint', endpoint + '/' + this.fileInput.id + '/download');
// });
// window.location.href = this.halService.getRootHref()
void this.router.navigateByUrl('bitstreams/' + this.fileInput.id + '/download');
}

public isTxt() {
Expand Down
34 changes: 19 additions & 15 deletions src/app/item-page/versions/item-versions.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@

</div>
<ng-template #tableFromMetadata>
<h2 *ngIf="displayTitle">{{"item.version.history.head" | translate}}</h2>
<table class="table table-striped table-bordered align-middle my-2">
<thead>
<tr>
<th scope="col">{{'item.version.history.table.name' | translate}}</th>
<th scope="col">{{'item.version.history.table.handle' | translate}}</th>
</tr>
</thead>
<tbody *ngFor="let versionFromMetadata of (getVersionsFromMetadata(item) | async)">
<tr>
<td><a [href]="versionFromMetadata.handle">{{versionFromMetadata.name}}</a></td>
<td><a [href]="versionFromMetadata.handle">{{versionFromMetadata.handle}}</a></td>
</tr>
</tbody>
</table>
<div *ngVar="(getVersionsFromMetadata(item) | async) as versionsFromMetadata">
<div *ngIf="versionsFromMetadata?.length != 0">
<h2 *ngIf="displayTitle">{{"item.version.history.head" | translate}}</h2>
<table class="table table-striped table-bordered align-middle my-2">
<thead>
<tr>
<th scope="col">{{'item.version.history.table.name' | translate}}</th>
<th scope="col">{{'item.version.history.table.handle' | translate}}</th>
</tr>
</thead>
<tbody *ngFor="let versionFromMetadata of versionsFromMetadata">
<tr>
<td><a [href]="versionFromMetadata.handle">{{versionFromMetadata.name}}</a></td>
<td><a [href]="versionFromMetadata.handle">{{versionFromMetadata.handle}}</a></td>
</tr>
</tbody>
</table>
</div>
</div>
</ng-template>
<ng-template #tableFromDatabase>
<div *ngVar="(versionsRD$ | async)?.payload as versions">
Expand Down
18 changes: 18 additions & 0 deletions src/app/item-page/versions/item-versions.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,11 +719,29 @@ export class ItemVersionsComponent implements OnInit {
getFirstSucceededRemoteListPayload())
.subscribe((itemList: Item[]) => {
this.nameCache[handle] = this.dsoNameService.getName(itemList?.[0]);
this.updateVersionsFromMetadata(handle, this.nameCache[handle]);
});
}
return this.nameCache[handle];
}

/**
* Update the name in the `versionsFromMetadata` for the current record with matching handle.
*
* @param handle of the record which will be updated
* @param name of the version record
*/
updateVersionsFromMetadata(handle: string, name: string) {
const versionsCopy = this.versionsFromMetadata.value;
versionsCopy.forEach((versionFromMetadata: RelationNameHandle) => {
if (!isEqual(versionFromMetadata.handle, handle)) {
return;
}
versionFromMetadata.name = name;
});
this.versionsFromMetadata.next(versionsCopy);
}

ngOnDestroy(): void {
this.cleanupSubscribes();
this.paginationService.clearPagination(this.options.id);
Expand Down

0 comments on commit a88670e

Please sign in to comment.