Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 19 additions & 4 deletions src/app/core/submission/correctiontype-data.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { Injectable } from '@angular/core';

Check failure on line 1 in src/app/core/submission/correctiontype-data.service.ts

View workflow job for this annotation

GitHub Actions / tests (22.x)

Run autofix to sort these imports!

Check failure on line 1 in src/app/core/submission/correctiontype-data.service.ts

View workflow job for this annotation

GitHub Actions / tests (20.x)

Run autofix to sort these imports!
import {
map,
Observable,
of,
} from 'rxjs';

import {

Check failure on line 8 in src/app/core/submission/correctiontype-data.service.ts

View workflow job for this annotation

GitHub Actions / tests (22.x)

Imports must not be broken into multiple lines if there are 1 or less elements

Check failure on line 8 in src/app/core/submission/correctiontype-data.service.ts

View workflow job for this annotation

GitHub Actions / tests (20.x)

Imports must not be broken into multiple lines if there are 1 or less elements
switchMap,
} from 'rxjs/operators';

import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
import { RequestParam } from '../cache/models/request-param.model';
import { ObjectCacheService } from '../cache/object-cache.service';
Expand All @@ -21,6 +26,8 @@
} from '../shared/operators';
import { CorrectionType } from './models/correctiontype.model';

import { AuthService } from '../../core/auth/auth.service';

/**
* A service that provides methods to make REST requests with correctiontypes endpoint.
*/
Expand All @@ -37,6 +44,7 @@
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
protected notificationsService: NotificationsService,
protected authService: AuthService,
) {
super('correctiontypes', requestService, rdbService, objectCache, halService);

Expand All @@ -60,10 +68,17 @@
* @param useCachedVersionIfAvailable use the cached version if available
* @returns the list of correction types for the item
*/
findByItem(itemUuid: string, useCachedVersionIfAvailable): Observable<RemoteData<PaginatedList<CorrectionType>>> {
const options = new FindListOptions();
options.searchParams = [new RequestParam('uuid', itemUuid)];
return this.searchData.searchBy(this.searchFindByItem, options, useCachedVersionIfAvailable);
findByItem(itemUuid: string, useCachedVersionIfAvailable): Observable<any[] | RemoteData<PaginatedList<CorrectionType>>> {
return this.authService.isAuthenticated().pipe(
switchMap(auth => {
if (!auth) {
return of ([]);

Check failure on line 75 in src/app/core/submission/correctiontype-data.service.ts

View workflow job for this annotation

GitHub Actions / tests (22.x)

Expected indentation of 10 spaces but found 11

Check failure on line 75 in src/app/core/submission/correctiontype-data.service.ts

View workflow job for this annotation

GitHub Actions / tests (20.x)

Expected indentation of 10 spaces but found 11
}

Check failure on line 76 in src/app/core/submission/correctiontype-data.service.ts

View workflow job for this annotation

GitHub Actions / tests (22.x)

Expected indentation of 8 spaces but found 1 tab

Check failure on line 76 in src/app/core/submission/correctiontype-data.service.ts

View workflow job for this annotation

GitHub Actions / tests (20.x)

Expected indentation of 8 spaces but found 1 tab
const options = new FindListOptions();
options.searchParams = [new RequestParam('uuid', itemUuid)];
return this.searchData.searchBy(this.searchFindByItem, options, useCachedVersionIfAvailable);
})

Check failure on line 80 in src/app/core/submission/correctiontype-data.service.ts

View workflow job for this annotation

GitHub Actions / tests (22.x)

Missing trailing comma

Check failure on line 80 in src/app/core/submission/correctiontype-data.service.ts

View workflow job for this annotation

GitHub Actions / tests (20.x)

Missing trailing comma
);
}

/**
Expand Down
10 changes: 7 additions & 3 deletions src/app/item-page/full/full-item-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
<div class="item-page" @fadeInOut>
@if (itemRD?.payload; as item) {
<div>
<ds-item-alerts [item]="item"></ds-item-alerts>
<ds-item-versions-notice [item]="item"></ds-item-versions-notice>
@if ((isLoggedIn$|async)) {
<ds-item-alerts [item]="item"></ds-item-alerts>
<ds-item-versions-notice [item]="item"></ds-item-versions-notice>
}
@if (!item.isWithdrawn || (isAdmin$|async)) {
<div class="full-item-info">
<div class="d-flex flex-row">
Expand Down Expand Up @@ -35,7 +37,9 @@
</div>
<ds-item-page-full-file-section [item]="item"></ds-item-page-full-file-section>
<ds-item-page-collections [item]="item"></ds-item-page-collections>
<ds-item-versions class="mt-2" [item]="item"></ds-item-versions>
@if ((isLoggedIn$|async)) {
<ds-item-versions class="mt-2" [item]="item"></ds-item-versions>
}
@if (fromSubmissionObject) {
<div class="button-row bottom">
<div class="text-end">
Expand Down
12 changes: 11 additions & 1 deletion src/app/item-page/full/full-item-page.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {

Check failure on line 1 in src/app/item-page/full/full-item-page.component.ts

View workflow job for this annotation

GitHub Actions / tests (22.x)

Run autofix to sort these imports!

Check failure on line 1 in src/app/item-page/full/full-item-page.component.ts

View workflow job for this annotation

GitHub Actions / tests (20.x)

Run autofix to sort these imports!
AsyncPipe,
KeyValuePipe,
Location,
Expand Down Expand Up @@ -50,6 +50,8 @@
import { ItemVersionsNoticeComponent } from '../versions/notice/item-versions-notice.component';
import { ThemedFullFileSectionComponent } from './field-components/file-section/themed-full-file-section.component';

import { AuthService } from '../../core/auth/auth.service';

/**
* This component renders a full item page.
* The route parameter 'id' is used to request the item it represents.
Expand Down Expand Up @@ -84,6 +86,11 @@

metadata$: Observable<MetadataMap>;

/**
* Whether the current user is logged in
*/
isLoggedIn$: Observable<boolean>;

/**
* True when the itemRD has been originated from its workspaceite/workflowitem, false otherwise.
*/
Expand All @@ -101,9 +108,10 @@
protected signpostingDataService: SignpostingDataService,
protected linkHeadService: LinkHeadService,
protected notifyInfoService: NotifyInfoService,
protected auth: AuthService,
@Inject(PLATFORM_ID) protected platformId: string,
) {
super(route, router, items, authorizationService, responseService, signpostingDataService, linkHeadService, notifyInfoService, platformId);
super(route, router, items, authorizationService, responseService, signpostingDataService, linkHeadService, notifyInfoService, auth, platformId);
}

/*** AoT inheritance fix, will hopefully be resolved in the near future **/
Expand All @@ -118,6 +126,8 @@
this.fromSubmissionObject = hasValue(data.wfi) || hasValue(data.wsi);
}),
);

this.isLoggedIn$ = this.auth.isAuthenticated();
}

/**
Expand Down
17 changes: 10 additions & 7 deletions src/app/item-page/simple/item-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
<div class="item-page" @fadeInOut>
@if (itemRD?.payload; as item) {
<div>

<ds-item-alerts [item]="item"></ds-item-alerts>
<ds-access-by-token-notification></ds-access-by-token-notification>
<ds-qa-event-notification [item]="item"></ds-qa-event-notification>
<ds-notify-requests-status [itemUuid]="item.uuid"></ds-notify-requests-status>
<ds-item-versions-notice [item]="item"></ds-item-versions-notice>
@if ((isLoggedIn$|async)) {
<ds-item-alerts [item]="item"></ds-item-alerts>
<ds-access-by-token-notification></ds-access-by-token-notification>
<ds-qa-event-notification [item]="item"></ds-qa-event-notification>
<ds-notify-requests-status [itemUuid]="item.uuid"></ds-notify-requests-status>
<ds-item-versions-notice [item]="item"></ds-item-versions-notice>
}
@if (!item.isWithdrawn || (isAdmin$|async)) {
<ds-listable-object-component-loader [object]="item" [viewMode]="viewMode"></ds-listable-object-component-loader>
}
<ds-item-versions class="mt-2" [item]="item" [displayActions]="false"></ds-item-versions>
@if ((isLoggedIn$|async)) {
<ds-item-versions class="mt-2" [item]="item" [displayActions]="false"></ds-item-versions>
}
</div>
}
</div>
Expand Down
10 changes: 10 additions & 0 deletions src/app/item-page/simple/item-page.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {

Check failure on line 1 in src/app/item-page/simple/item-page.component.ts

View workflow job for this annotation

GitHub Actions / tests (22.x)

Run autofix to sort these imports!

Check failure on line 1 in src/app/item-page/simple/item-page.component.ts

View workflow job for this annotation

GitHub Actions / tests (20.x)

Run autofix to sort these imports!
AsyncPipe,
isPlatformServer,
} from '@angular/common';
Expand Down Expand Up @@ -61,6 +61,8 @@
import { NotifyRequestsStatusComponent } from './notify-requests-status/notify-requests-status-component/notify-requests-status.component';
import { QaEventNotificationComponent } from './qa-event-notification/qa-event-notification.component';

import { AuthService } from '../../core/auth/auth.service';

/**
* This component renders a simple item page.
* The route parameter 'id' is used to request the item it represents.
Expand Down Expand Up @@ -121,6 +123,11 @@
*/
isAdmin$: Observable<boolean>;

/**
* Whether the current user is logged in
*/
isLoggedIn$: Observable<boolean>;

itemUrl: string;

/**
Expand Down Expand Up @@ -152,6 +159,7 @@
protected signpostingDataService: SignpostingDataService,
protected linkHeadService: LinkHeadService,
protected notifyInfoService: NotifyInfoService,
protected auth: AuthService,
@Inject(PLATFORM_ID) protected platformId: string,
) {
this.initPageLinks();
Expand Down Expand Up @@ -182,6 +190,8 @@
return null;
}),
);

this.isLoggedIn$ = this.auth.isAuthenticated();
}

/**
Expand Down
Loading