mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Request-a-copy: Angular flow control changes
This commit is contained in:
@@ -3,10 +3,13 @@
|
|||||||
[target]="isBlank ? '_blank': '_self'"
|
[target]="isBlank ? '_blank': '_self'"
|
||||||
[ngClass]="cssClasses"
|
[ngClass]="cssClasses"
|
||||||
[attr.aria-label]="('file-download-link.download' | translate) + dsoNameService.getName(bitstream)">
|
[attr.aria-label]="('file-download-link.download' | translate) + dsoNameService.getName(bitstream)">
|
||||||
<!-- If the user cannot download the file by auth or token, show a lock icon -->
|
@if ((canDownload$ | async) === false && (canDownloadWithToken$ | async) === false) {
|
||||||
<span role="img" *ngIf="(canDownload$ | async) === false && (canDownloadWithToken$ | async) === false" [attr.aria-label]="'file-download-link.restricted' | translate" class="pr-1"><i class="fas fa-lock"></i></span>
|
<!-- If the user cannot download the file by auth or token, show a lock icon -->
|
||||||
<!-- If the user can download the file by token, and NOT normally show a lock open icon -->
|
<span role="img" [attr.aria-label]="'file-download-link.restricted' | translate" class="pr-1"><i class="fas fa-lock"></i></span>
|
||||||
<span role="img" *ngIf="(canDownloadWithToken$ | async) && (canDownload$ | async) === false" [attr.aria-label]="'file-download-link.secure-access' | translate" class="pr-1"><i class="fa-solid fa-lock-open" style="color: #26a269;"></i></span>
|
} @else if ((canDownloadWithToken$ | async) && (canDownload$ | async) === false) {
|
||||||
|
<!-- If the user can download the file by token, and NOT normally show a lock open icon -->
|
||||||
|
<span role="img" [attr.aria-label]="'file-download-link.secure-access' | translate" class="pr-1"><i class="fa-solid fa-lock-open" style="color: #26a269;"></i></span>
|
||||||
|
}
|
||||||
<!-- Otherwise, show no icon (normal download by authorized user), public access etc. -->
|
<!-- Otherwise, show no icon (normal download by authorized user), public access etc. -->
|
||||||
<ng-container *ngTemplateOutlet="content"></ng-container>
|
<ng-container *ngTemplateOutlet="content"></ng-container>
|
||||||
</a>
|
</a>
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
NgClass,
|
NgClass,
|
||||||
NgIf,
|
|
||||||
NgTemplateOutlet,
|
NgTemplateOutlet,
|
||||||
} from '@angular/common';
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
@@ -41,7 +40,7 @@ import {
|
|||||||
styleUrls: ['./item-secure-file-download-link.component.scss'],
|
styleUrls: ['./item-secure-file-download-link.component.scss'],
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [
|
imports: [
|
||||||
RouterLink, NgClass, NgIf, NgTemplateOutlet, AsyncPipe, TranslateModule,
|
RouterLink, NgClass, NgTemplateOutlet, AsyncPipe, TranslateModule,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
|
@@ -3,7 +3,8 @@
|
|||||||
<ds-metadata-field-wrapper [label]="label | translate">
|
<ds-metadata-field-wrapper [label]="label | translate">
|
||||||
<div class="file-section">
|
<div class="file-section">
|
||||||
@for (file of bitstreams; track file; let last = $last) {
|
@for (file of bitstreams; track file; let last = $last) {
|
||||||
<ds-file-download-link [bitstream]="file" [item]="item">
|
@if (hasAccessToken() === true) {
|
||||||
|
<ds-item-secure-file-download-link [bitstream]="file" [item]="item">
|
||||||
<span>
|
<span>
|
||||||
@if (primaryBitsreamId === file.id) {
|
@if (primaryBitsreamId === file.id) {
|
||||||
<span class="badge bg-primary">{{ 'item.page.bitstreams.primary' | translate }}</span>
|
<span class="badge bg-primary">{{ 'item.page.bitstreams.primary' | translate }}</span>
|
||||||
@@ -14,7 +15,21 @@
|
|||||||
@if (!last) {
|
@if (!last) {
|
||||||
<span innerHTML="{{separator}}"></span>
|
<span innerHTML="{{separator}}"></span>
|
||||||
}
|
}
|
||||||
</ds-file-download-link>
|
</ds-item-secure-file-download-link>
|
||||||
|
} @else {
|
||||||
|
<ds-file-download-link [bitstream]="file" [item]="item">
|
||||||
|
<span>
|
||||||
|
@if (primaryBitsreamId === file.id) {
|
||||||
|
<span class="badge bg-primary">{{ 'item.page.bitstreams.primary' | translate }}</span>
|
||||||
|
}
|
||||||
|
{{ dsoNameService.getName(file) }}
|
||||||
|
</span>
|
||||||
|
<span> ({{(file?.sizeBytes) | dsFileSize }})</span>
|
||||||
|
@if (!last) {
|
||||||
|
<span innerHTML="{{separator}}"></span>
|
||||||
|
}
|
||||||
|
</ds-file-download-link>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@if (isLoading) {
|
@if (isLoading) {
|
||||||
<ds-loading message="{{'loading.default' | translate}}" [showMessage]="false"></ds-loading>
|
<ds-loading message="{{'loading.default' | translate}}" [showMessage]="false"></ds-loading>
|
||||||
|
@@ -36,8 +36,9 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
<!-- Display the "already handled" message if there is a decision date, and either no access token (attachment was sent in email) or the request was denied -->
|
<!-- Display the "already handled" message if there is a decision date, and either no access token (attachment was sent in email) or the request was denied -->
|
||||||
@if (itemRequestRD.payload.decisionDate && (itemRequestRD.payload.acceptRequest === false || !itemRequestRD.payload.accessToken)) {
|
@if (itemRequestRD.payload.decisionDate && (!itemRequestRD.payload.acceptRequest || !itemRequestRD.payload.accessToken)) {
|
||||||
<div class="processed-message">
|
<div class="processed-message">
|
||||||
<p>{{ 'grant-deny-request-copy.processed' | translate }}</p>
|
<p>{{ 'grant-deny-request-copy.processed' | translate }}</p>
|
||||||
<p class="text-center">
|
<p class="text-center">
|
||||||
@@ -45,7 +46,6 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (!itemRequestRD || itemRequestRD?.isLoading) {
|
@if (!itemRequestRD || itemRequestRD?.isLoading) {
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
ComponentFixture,
|
ComponentFixture,
|
||||||
|
fakeAsync,
|
||||||
TestBed,
|
TestBed,
|
||||||
|
tick,
|
||||||
waitForAsync,
|
waitForAsync,
|
||||||
} from '@angular/core/testing';
|
} from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
@@ -138,14 +140,16 @@ describe('GrantDenyRequestCopyComponent', () => {
|
|||||||
expect(message).toBeNull();
|
expect(message).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be displayed when decisionDate is defined', () => {
|
it('should be displayed when decisionDate is defined', fakeAsync(() => {
|
||||||
component.itemRequestRD$ = createSuccessfulRemoteDataObject$(Object.assign(new ItemRequest(), itemRequest, {
|
component.itemRequestRD$ = createSuccessfulRemoteDataObject$(Object.assign(new ItemRequest(), itemRequest, {
|
||||||
decisionDate: 'defined-date',
|
decisionDate: 'defined-date',
|
||||||
}));
|
}));
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
tick(); // Simulate passage of time
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
const message = fixture.debugElement.query(By.css('.processed-message'));
|
const message = fixture.debugElement.query(By.css('.processed-message'));
|
||||||
expect(message).not.toBeNull();
|
expect(message).not.toBeNull();
|
||||||
});
|
}));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -47,7 +47,7 @@ import { ThemedEmailRequestCopyComponent } from '../email-request-copy/themed-em
|
|||||||
styleUrls: ['./grant-request-copy.component.scss'],
|
styleUrls: ['./grant-request-copy.component.scss'],
|
||||||
templateUrl: './grant-request-copy.component.html',
|
templateUrl: './grant-request-copy.component.html',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, VarDirective, NgIf, ThemedEmailRequestCopyComponent, FormsModule, ThemedLoadingComponent, AsyncPipe, TranslateModule, RouterLink, NgClass],
|
imports: [CommonModule, VarDirective, ThemedEmailRequestCopyComponent, FormsModule, ThemedLoadingComponent, AsyncPipe, TranslateModule, RouterLink, NgClass],
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* Component for granting an item request
|
* Component for granting an item request
|
||||||
|
@@ -8,7 +8,6 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||||||
import { AlertComponent } from 'src/app/shared/alert/alert.component';
|
import { AlertComponent } from 'src/app/shared/alert/alert.component';
|
||||||
import { GoogleRecaptchaComponent } from 'src/app/shared/google-recaptcha/google-recaptcha.component';
|
import { GoogleRecaptchaComponent } from 'src/app/shared/google-recaptcha/google-recaptcha.component';
|
||||||
|
|
||||||
import { AltchaCaptchaComponent } from '../../../../app/item-page/bitstreams/request-a-copy/altcha-captcha.component';
|
|
||||||
import { RegisterEmailFormComponent as BaseComponent } from '../../../../app/register-email-form/register-email-form.component';
|
import { RegisterEmailFormComponent as BaseComponent } from '../../../../app/register-email-form/register-email-form.component';
|
||||||
import { BtnDisabledDirective } from '../../../../app/shared/btn-disabled.directive';
|
import { BtnDisabledDirective } from '../../../../app/shared/btn-disabled.directive';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user