[CST-12109] porting missing code

This commit is contained in:
Mykhaylo Boychuk
2023-11-24 11:28:38 +01:00
parent 5589c76f54
commit 1c3776b2d3
19 changed files with 185 additions and 83 deletions

View File

@@ -1,5 +1,5 @@
rest:
ssl: true
host: api7.dspace.org
port: 443
ssl: false
host: localhost
port: 8080
nameSpace: /server

View File

@@ -12,6 +12,9 @@ import { AdminQualityAssuranceEventsPageResolver } from './admin-quality-assuran
import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page.component';
import { AdminQualityAssuranceSourcePageResolver } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page-resolver.service';
import { SourceDataResolver } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-data.reslover';
import {
SiteAdministratorGuard
} from '../../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
@NgModule({
imports: [
@@ -32,7 +35,7 @@ import { SourceDataResolver } from './admin-quality-assurance-source-page-compon
}
},
{
canActivate: [ AuthenticatedGuard ],
canActivate: [ SiteAdministratorGuard ],
path: `${QUALITY_ASSURANCE_EDIT_PATH}`,
component: AdminQualityAssuranceSourcePageComponent,
pathMatch: 'full',

View File

@@ -8,6 +8,9 @@ import { I18nBreadcrumbsService } from '../core/breadcrumbs/i18n-breadcrumbs.ser
import { AdminCurationTasksComponent } from './admin-curation-tasks/admin-curation-tasks.component';
import { REGISTRIES_MODULE_PATH, NOTIFICATIONS_MODULE_PATH } from './admin-routing-paths';
import { BatchImportPageComponent } from './admin-import-batch-page/batch-import-page.component';
import {
SiteAdministratorGuard
} from '../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
@NgModule({
imports: [
@@ -21,42 +24,49 @@ import { BatchImportPageComponent } from './admin-import-batch-page/batch-import
path: REGISTRIES_MODULE_PATH,
loadChildren: () => import('./admin-registries/admin-registries.module')
.then((m) => m.AdminRegistriesModule),
canActivate: [SiteAdministratorGuard]
},
{
path: 'search',
resolve: { breadcrumb: I18nBreadcrumbResolver },
component: AdminSearchPageComponent,
data: { title: 'admin.search.title', breadcrumbKey: 'admin.search' }
data: { title: 'admin.search.title', breadcrumbKey: 'admin.search' },
canActivate: [SiteAdministratorGuard]
},
{
path: 'workflow',
resolve: { breadcrumb: I18nBreadcrumbResolver },
component: AdminWorkflowPageComponent,
data: { title: 'admin.workflow.title', breadcrumbKey: 'admin.workflow' }
data: { title: 'admin.workflow.title', breadcrumbKey: 'admin.workflow' },
canActivate: [SiteAdministratorGuard]
},
{
path: 'curation-tasks',
resolve: { breadcrumb: I18nBreadcrumbResolver },
component: AdminCurationTasksComponent,
data: { title: 'admin.curation-tasks.title', breadcrumbKey: 'admin.curation-tasks' }
data: { title: 'admin.curation-tasks.title', breadcrumbKey: 'admin.curation-tasks' },
canActivate: [SiteAdministratorGuard]
},
{
path: 'metadata-import',
resolve: { breadcrumb: I18nBreadcrumbResolver },
component: MetadataImportPageComponent,
data: { title: 'admin.metadata-import.title', breadcrumbKey: 'admin.metadata-import' }
data: { title: 'admin.metadata-import.title', breadcrumbKey: 'admin.metadata-import' },
canActivate: [SiteAdministratorGuard]
},
{
path: 'batch-import',
resolve: { breadcrumb: I18nBreadcrumbResolver },
component: BatchImportPageComponent,
data: { title: 'admin.batch-import.title', breadcrumbKey: 'admin.batch-import' }
data: { title: 'admin.batch-import.title', breadcrumbKey: 'admin.batch-import' },
canActivate: [SiteAdministratorGuard]
},
{
path: 'system-wide-alert',
resolve: { breadcrumb: I18nBreadcrumbResolver },
loadChildren: () => import('../system-wide-alert/system-wide-alert.module').then((m) => m.SystemWideAlertModule),
data: {title: 'admin.system-wide-alert.title', breadcrumbKey: 'admin.system-wide-alert'}
data: {title: 'admin.system-wide-alert.title', breadcrumbKey: 'admin.system-wide-alert'},
canActivate: [SiteAdministratorGuard]
},
])
],

View File

@@ -3,9 +3,6 @@ import { RouterModule, NoPreloading } from '@angular/router';
import { AuthBlockingGuard } from './core/auth/auth-blocking.guard';
import { AuthenticatedGuard } from './core/auth/authenticated.guard';
import {
SiteAdministratorGuard
} from './core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
import {
ACCESS_CONTROL_MODULE_PATH,
ADMIN_MODULE_PATH,
@@ -154,7 +151,7 @@ import { ThemedPageErrorComponent } from './page-error/themed-page-error.compone
path: ADMIN_MODULE_PATH,
loadChildren: () => import('./admin/admin.module')
.then((m) => m.AdminModule),
canActivate: [SiteAdministratorGuard, EndUserAgreementCurrentUserGuard]
canActivate: [EndUserAgreementCurrentUserGuard]
},
{
path: 'login',

View File

@@ -33,5 +33,6 @@ export enum FeatureID {
CanSubmit = 'canSubmit',
CanEditItem = 'canEditItem',
CanRegisterDOI = 'canRegisterDOI',
CanSubscribe = 'canSubscribeDso',
CanSubscribe = 'canSubscribeDso'
}

View File

@@ -16,7 +16,7 @@ import { PaginatedList } from '../../../data/paginated-list.model';
import { FindListOptions } from '../../../data/find-list-options.model';
import { IdentifiableDataService } from '../../../data/base/identifiable-data.service';
import { FindAllData, FindAllDataImpl } from '../../../data/base/find-all-data';
import { SearchData } from '../../../data/base/search-data';
import { SearchData, SearchDataImpl } from '../../../data/base/search-data';
/**
* The service handling all Quality Assurance source REST requests.
@@ -47,6 +47,7 @@ export class QualityAssuranceSourceDataService extends IdentifiableDataService<Q
) {
super('qualityassurancesources', requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
this.searchAllData = new SearchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
}
/**

View File

@@ -15,6 +15,7 @@ import { FindListOptions } from '../../../data/find-list-options.model';
import { IdentifiableDataService } from '../../../data/base/identifiable-data.service';
import { dataService } from '../../../data/base/data-service.decorator';
import { QUALITY_ASSURANCE_TOPIC_OBJECT } from '../models/quality-assurance-topic-object.resource-type';
import { SearchData, SearchDataImpl } from '../../../data/base/search-data';
import { FindAllData, FindAllDataImpl } from '../../../data/base/find-all-data';
/**
@@ -25,6 +26,10 @@ import { FindAllData, FindAllDataImpl } from '../../../data/base/find-all-data';
export class QualityAssuranceTopicDataService extends IdentifiableDataService<QualityAssuranceTopicObject> {
private findAllData: FindAllData<QualityAssuranceTopicObject>;
private searchData: SearchData<QualityAssuranceTopicObject>;
private searchByTargetMethod = 'byTarget';
private searchBySourceMethod = 'bySource';
/**
* Initialize service variables
@@ -43,23 +48,31 @@ export class QualityAssuranceTopicDataService extends IdentifiableDataService<Qu
) {
super('qualityassurancetopics', requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
this.searchData = new SearchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
}
/**
* Return the list of Quality Assurance topics.
*
* @param options Find list options object.
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
* no valid cached version. Defaults to true
* @param reRequestOnStale Whether or not the request should automatically be re-
* requested after the response becomes stale
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
*
* @return Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>>
* The list of Quality Assurance topics.
* Search for Quality Assurance topics.
* @param options The search options.
* @param useCachedVersionIfAvailable Whether to use cached version if available.
* @param reRequestOnStale Whether to re-request on stale.
* @param linksToFollow The links to follow.
* @returns An observable of remote data containing a paginated list of Quality Assurance topics.
*/
public getTopics(options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>> {
return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
public searchTopicsByTarget(options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>> {
return this.searchData.searchBy(this.searchByTargetMethod, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
}
/**
* Searches for quality assurance topics by source.
* @param options The search options.
* @param useCachedVersionIfAvailable Whether to use a cached version if available.
* @param reRequestOnStale Whether to re-request the data if it's stale.
* @param linksToFollow The links to follow.
* @returns An observable of the remote data containing the paginated list of quality assurance topics.
*/
public searchTopicsBySource(options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>> {
return this.searchData.searchBy(this.searchBySourceMethod, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
}
/**

View File

@@ -1,15 +1,12 @@
<ng-container *ngIf="(getQualityAssuranceSources$() | async)?.length > 0">
<ng-container *ngFor="let source of (getQualityAssuranceSources$() | async)">
<div class="alert alert-info d-flex flex-row" *ngIf="source.totalEvents > 0">
<img class="source-logo" src="assets/images/qa-{{(source.id | dsSplit: ':')[0]}}-logo.png" alt="{{source.id}} logo">
<div class="w-100 d-flex justify-content-between">
<div class="pl-4 align-self-center">{{'item.qa-event-notification.check.notification-info' | translate : {num:
source.totalEvents } }} </div>
<button [routerLink]="['/admin/notifications/quality-assurance', source, item.id]"
class="btn btn-primary align-self-center">{{'item.qa-event-notification-info.check.button' | translate
<div class="pl-4 align-self-center">{{'item.qa-event-notification.check.notification-withdrawn' | translate : {num: source.totalEvents } }} </div>
<button [routerLink]="['/admin/notifications/quality-assurance/' + source.id]"
class="btn btn-primary align-self-center">{{'item.qa-event-notification-undo-withdrawn.check.button' | translate
}}</button>
</div>
</div>
</ng-container>
</ng-container>
Added file

View File

@@ -1,12 +1,13 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { Item } from '../../../core/shared/item.model';
import { getFirstCompletedRemoteData, getPaginatedListPayload, getRemoteDataPayload } from '../../../core/shared/operators';
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
import { Observable } from 'rxjs';
import { AlertType } from '../../../shared/alert/aletr-type';
import { FindListOptions } from '../../../core/data/find-list-options.model';
import { RequestParam } from '../../../core/cache/models/request-param.model';
import { QualityAssuranceSourceDataService } from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-data.service';
import { QualityAssuranceSourceObject } from '../../../core/suggestion-notifications/qa/models/quality-assurance-source.model';
import { map, tap } from 'rxjs/operators';
import { RemoteData } from '../../../core/data/remote-data';
@Component({
selector: 'ds-qa-event-notification',
templateUrl: './qa-event-notification.component.html',
@@ -25,9 +26,8 @@ export class QaEventNotificationComponent {
/**
* The type of alert to display for the notification.
*/
AlertTypeInfo = AlertType.Info;
constructor(
private qualityAssuranceSourceDataService: QualityAssuranceSourceDataService,
private qualityAssuranceSourceDataService: QualityAssuranceSourceDataService
) { }
/**
* Returns an Observable of QualityAssuranceSourceObject[] for the current item.
@@ -35,14 +35,20 @@ export class QaEventNotificationComponent {
* Note: sourceId is composed as: id: "sourceName:<target>"
*/
getQualityAssuranceSources$(): Observable<QualityAssuranceSourceObject[]> {
console.log('ciao');
const findListTopicOptions: FindListOptions = {
searchParams: [new RequestParam('target', this.item.uuid)]
};
return this.qualityAssuranceSourceDataService.getSourcesByTarget(findListTopicOptions)
.pipe(
getFirstCompletedRemoteData(),
getRemoteDataPayload(),
getPaginatedListPayload(),
tap(console.log),
map((data: RemoteData<any>) => {
if (data.hasSucceeded) {
return data.payload.page;
}
return [];
})
);
}
}

View File

@@ -8,7 +8,10 @@ import { LinkMenuItemModel } from '../menu/menu-item/models/link.model';
import { Item } from '../../core/shared/item.model';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { OnClickMenuItemModel } from '../menu/menu-item/models/onclick.model';
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
import {
getFirstCompletedRemoteData,
getRemoteDataPayload
} from '../../core/shared/operators';
import { map, switchMap } from 'rxjs/operators';
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
import { URLCombiner } from '../../core/url-combiner/url-combiner';
@@ -22,6 +25,13 @@ import { ResearcherProfileDataService } from '../../core/profile/researcher-prof
import { NotificationsService } from '../notifications/notifications.service';
import { TranslateService } from '@ngx-translate/core';
import { DsoWithdrawnReinstateModalService } from './dso-withdrawn-reinstate-service/dso-withdrawn-reinstate-modal.service';
import { EPerson } from '../../core/eperson/models/eperson.model';
import { AuthService } from '../../core/auth/auth.service';
import {
QualityAssuranceSourceDataService
} from '../../core/suggestion-notifications/qa/source/quality-assurance-source-data.service';
import { FindListOptions } from '../../core/data/find-list-options.model';
import { RequestParam } from '../../core/cache/models/request-param.model';
/**
* Creates the menus for the dspace object pages
@@ -40,7 +50,9 @@ export class DSOEditMenuResolver implements Resolve<{ [key: string]: MenuSection
protected researcherProfileService: ResearcherProfileDataService,
protected notificationsService: NotificationsService,
protected translate: TranslateService,
protected dsoWithdrawnReinstateModalService: DsoWithdrawnReinstateModalService
protected dsoWithdrawnReinstateModalService: DsoWithdrawnReinstateModalService,
private auth: AuthService,
private qualityAssuranceSourceDataService: QualityAssuranceSourceDataService
) {
}
@@ -121,16 +133,20 @@ export class DSOEditMenuResolver implements Resolve<{ [key: string]: MenuSection
*/
protected getItemMenu(dso): Observable<MenuSection[]> {
if (dso instanceof Item) {
const findListTopicOptions: FindListOptions = {
searchParams: [new RequestParam('target', dso.uuid)]
};
return combineLatest([
this.authorizationService.isAuthorized(FeatureID.CanCreateVersion, dso.self),
this.dsoVersioningModalService.isNewVersionButtonDisabled(dso),
this.dsoVersioningModalService.getVersioningTooltipMessage(dso, 'item.page.version.hasDraft', 'item.page.version.create'),
this.authorizationService.isAuthorized(FeatureID.CanSynchronizeWithORCID, dso.self),
this.authorizationService.isAuthorized(FeatureID.CanClaimItem, dso.self),
this.authorizationService.isAuthorized(FeatureID.WithdrawItem, dso.self,),
this.authorizationService.isAuthorized(FeatureID.ReinstateItem, dso.self)
this.qualityAssuranceSourceDataService.getSourcesByTarget(findListTopicOptions).pipe(
getFirstCompletedRemoteData(),
getRemoteDataPayload())
]).pipe(
map(([canCreateVersion, disableVersioning, versionTooltip, canSynchronizeWithOrcid, canClaimItem, canWithdrawItem, canReinstateItem]) => {
map(([canCreateVersion, disableVersioning, versionTooltip, canSynchronizeWithOrcid, canClaimItem, correction]) => {
const isPerson = this.getDsoType(dso) === 'person';
return [
{
@@ -177,12 +193,12 @@ export class DSOEditMenuResolver implements Resolve<{ [key: string]: MenuSection
{
id: 'withdrawn-item',
active: false,
visible: canWithdrawItem,
visible: dso.isArchived && correction.totalElements === 0,
model: {
type: MenuItemType.ONCLICK,
text:'item.page.withdrawn',
function: () => {
this.dsoWithdrawnReinstateModalService.openCreateWithdrawnReinstateModal(dso, 'request-withdrawn', canWithdrawItem);
this.dsoWithdrawnReinstateModalService.openCreateWithdrawnReinstateModal(dso, 'request-withdrawn', dso.isArchived && correction.totalElements === 0);
}
} as OnClickMenuItemModel,
icon: 'lock',
@@ -191,12 +207,12 @@ export class DSOEditMenuResolver implements Resolve<{ [key: string]: MenuSection
{
id: 'reinstate-item',
active: false,
visible: canReinstateItem,
visible: dso.isWithdrawn && correction.totalElements === 0,
model: {
type: MenuItemType.ONCLICK,
text:'item.page.reinstate',
function: () => {
this.dsoWithdrawnReinstateModalService.openCreateWithdrawnReinstateModal(dso, 'request-reinstate', canWithdrawItem);
this.dsoWithdrawnReinstateModalService.openCreateWithdrawnReinstateModal(dso, 'request-reinstate', dso.isWithdrawn && correction.totalElements === 0);
}
} as OnClickMenuItemModel,
icon: 'unlock-keyhole',
@@ -258,4 +274,5 @@ export class DSOEditMenuResolver implements Resolve<{ [key: string]: MenuSection
return menu;
});
}
}

View File

@@ -38,7 +38,7 @@ export class DsoWithdrawnReinstateModalService {
const target = dso.id;
// Open modal
const activeModal = this.modalService.open(ItemWithdrawnReinstateModalComponent);
(activeModal.componentInstance as ItemWithdrawnReinstateModalComponent).setWithdraw(!state);
(activeModal.componentInstance as ItemWithdrawnReinstateModalComponent).setWithdraw(state);
(activeModal.componentInstance as ItemWithdrawnReinstateModalComponent).createQAEvent
.pipe(
take(1)

View File

@@ -288,6 +288,9 @@ import {
QualityAssuranceEventDataService
} from '../core/suggestion-notifications/qa/events/quality-assurance-event-data.service';
import { SplitPipe } from './utils/split.pipe';
import {
QualityAssuranceSourceDataService
} from '../core/suggestion-notifications/qa/source/quality-assurance-source-data.service';
const MODULES = [
CommonModule,
@@ -477,7 +480,8 @@ const PROVIDERS = [
TruncatableService,
MockAdminGuard,
AbstractTrackableComponent,
QualityAssuranceEventDataService
QualityAssuranceEventDataService,
QualityAssuranceSourceDataService
];
const DIRECTIVES = [

View File

@@ -25,6 +25,8 @@ export class RetrieveAllTopicsAction implements Action {
payload: {
elementsPerPage: number;
currentPage: number;
source: string;
target?: string;
};
/**
@@ -35,10 +37,12 @@ export class RetrieveAllTopicsAction implements Action {
* @param currentPage
* The page number to retrieve
*/
constructor(elementsPerPage: number, currentPage: number) {
constructor(elementsPerPage: number, currentPage: number, source: string, target?: string) {
this.payload = {
elementsPerPage,
currentPage
currentPage,
source,
target
};
}
}

View File

@@ -2,7 +2,11 @@
<div class="row">
<div class="col-12">
<h2 class="border-bottom pb-2">{{'quality-assurance.title'| translate}}</h2>
<ds-alert [type]="'alert-info'">{{'quality-assurance.topics.description'| translate:{source: sourceId} }}</ds-alert>
<ds-alert *ngIf="!targetId" [type]="'alert-info'">{{'quality-assurance.topics.description'| translate:{source: sourceId} }}</ds-alert>
<ds-alert *ngIf="targetId" [type]="'alert-info'">
{{'quality-assurance.topics.description-with-target'| translate:{source: sourceId} }}
<a [routerLink]="itemPageUrl">{{(getTargetItemTitle() | async)}}</a>
</ds-alert>
</div>
</div>
<div class="row">
@@ -15,7 +19,7 @@
[collectionSize]="(totalElements$ | async)"
[hideGear]="false"
[hideSortOptions]="true"
(paginationChange)="getQualityAssuranceTopics()">
(paginationChange)="getQualityAssuranceTopics(sourceId, targetId)">
<ds-loading class="container" *ngIf="(isTopicsProcessing() | async)" message="'quality-assurance.loading' | translate"></ds-loading>
<ng-container *ngIf="!(isTopicsProcessing() | async)">

View File

@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { Observable, Subscription } from 'rxjs';
import { distinctUntilChanged, take } from 'rxjs/operators';
import { distinctUntilChanged, map, take, tap } from 'rxjs/operators';
import { SortOptions } from '../../../core/cache/models/sort-options.model';
import {
@@ -15,7 +15,10 @@ import {
} from '../../../admin/admin-notifications/admin-quality-assurance-topics-page/admin-quality-assurance-topics-page-resolver.service';
import { PaginationService } from '../../../core/pagination/pagination.service';
import { ActivatedRoute } from '@angular/router';
import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
import { ItemDataService } from '../../../core/data/item-data.service';
import { getFirstCompletedRemoteData, getRemoteDataPayload } from '../../../core/shared/operators';
import { Item } from '../../../core/shared/item.model';
import { getItemPageRoute } from '../../../item-page/item-page-routing-paths';
/**
* Component to display the Quality Assurance topic list.
@@ -60,6 +63,17 @@ export class QualityAssuranceTopicsComponent implements OnInit {
*/
public sourceId: string;
/**
* This property represents a targetId (item-id) which is used to retrive a topic
* @type {string}
*/
public targetId: string;
/**
* The URL of the item page.
*/
public itemPageUrl: string;
/**
* Initialize the component variables.
* @param {PaginationService} paginationService
@@ -71,16 +85,16 @@ export class QualityAssuranceTopicsComponent implements OnInit {
private paginationService: PaginationService,
private activatedRoute: ActivatedRoute,
private notificationsStateService: SuggestionNotificationsStateService,
private qualityAssuranceTopicsService: QualityAssuranceTopicsService
private itemService: ItemDataService
) {
this.sourceId = this.activatedRoute.snapshot.params.sourceId;
this.targetId = this.activatedRoute.snapshot.params.targetId;
}
/**
* Component initialization.
*/
ngOnInit(): void {
this.sourceId = this.activatedRoute.snapshot.paramMap.get('sourceId');
this.qualityAssuranceTopicsService.setSourceId(this.sourceId);
this.topics$ = this.notificationsStateService.getQualityAssuranceTopics();
this.totalElements$ = this.notificationsStateService.getQualityAssuranceTopicsTotals();
}
@@ -93,7 +107,7 @@ export class QualityAssuranceTopicsComponent implements OnInit {
this.notificationsStateService.isQualityAssuranceTopicsLoaded().pipe(
take(1)
).subscribe(() => {
this.getQualityAssuranceTopics();
this.getQualityAssuranceTopics(this.sourceId, this.targetId);
})
);
}
@@ -121,13 +135,15 @@ export class QualityAssuranceTopicsComponent implements OnInit {
/**
* Dispatch the Quality Assurance topics retrival.
*/
public getQualityAssuranceTopics(): void {
public getQualityAssuranceTopics(source: string, target?: string): void {
this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig).pipe(
distinctUntilChanged(),
).subscribe((options: PaginationComponentOptions) => {
this.notificationsStateService.dispatchRetrieveQualityAssuranceTopics(
options.pageSize,
options.currentPage
options.currentPage,
source,
target
);
});
}
@@ -150,6 +166,32 @@ export class QualityAssuranceTopicsComponent implements OnInit {
}
}
/**
* Returns an Observable that emits the title of the target item.
* The target item is retrieved by its ID using the itemService.
* The title is extracted from the first metadata value of the item.
* The item page URL is also set in the component.
* @returns An Observable that emits the title of the target item.
*/
getTargetItemTitle(): Observable<string> {
return this.itemService.findById(this.targetId).pipe(
take(1),
getFirstCompletedRemoteData(),
getRemoteDataPayload(),
tap((item: Item) => this.itemPageUrl = getItemPageRoute(item)),
map((item: Item) => item.firstMetadataValue('dc.title'))
);
}
/**
* Returns the page route for the given item.
* @param item The item to get the page route for.
* @returns The page route for the given item.
*/
getItemPageRoute(item: Item): string {
return getItemPageRoute(item);
}
/**
* Unsubscribe from all subscriptions.
*/

View File

@@ -37,7 +37,9 @@ export class QualityAssuranceTopicsEffects {
switchMap(([action, currentState]: [RetrieveAllTopicsAction, any]) => {
return this.qualityAssuranceTopicService.getTopics(
action.payload.elementsPerPage,
action.payload.currentPage
action.payload.currentPage,
action.payload.source,
action.payload.target
).pipe(
map((topics: PaginatedList<QualityAssuranceTopicObject>) =>
new AddTopicsAction(topics.page, topics.totalPages, topics.currentPage, topics.totalElements)

View File

@@ -13,6 +13,7 @@ import {
import { RequestParam } from '../../../core/cache/models/request-param.model';
import { FindListOptions } from '../../../core/data/find-list-options.model';
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
import { hasValue } from '../../../shared/empty.util';
/**
* The service handling all Quality Assurance topic requests to the REST service.
@@ -28,10 +29,6 @@ export class QualityAssuranceTopicsService {
private qualityAssuranceTopicRestService: QualityAssuranceTopicDataService
) { }
/**
* sourceId used to get topics
*/
sourceId: string;
/**
* Return the list of Quality Assurance topics managing pagination and errors.
@@ -43,17 +40,25 @@ export class QualityAssuranceTopicsService {
* @return Observable<PaginatedList<QualityAssuranceTopicObject>>
* The list of Quality Assurance topics.
*/
public getTopics(elementsPerPage, currentPage): Observable<PaginatedList<QualityAssuranceTopicObject>> {
public getTopics(elementsPerPage, currentPage, source: string, target?: string): Observable<PaginatedList<QualityAssuranceTopicObject>> {
const sortOptions = new SortOptions('name', SortDirection.ASC);
const findListOptions: FindListOptions = {
elementsPerPage: elementsPerPage,
currentPage: currentPage,
sort: sortOptions,
searchParams: [new RequestParam('source', this.sourceId)]
searchParams: [new RequestParam('source', source)]
};
return this.qualityAssuranceTopicRestService.getTopics(findListOptions).pipe(
let request$: Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>>;
if (hasValue(target)) {
findListOptions.searchParams.push(new RequestParam('target', target));
request$ = this.qualityAssuranceTopicRestService.searchTopicsByTarget(findListOptions);
} else {
request$ = this.qualityAssuranceTopicRestService.searchTopicsBySource(findListOptions);
}
return request$.pipe(
getFirstCompletedRemoteData(),
map((rd: RemoteData<PaginatedList<QualityAssuranceTopicObject>>) => {
if (rd.hasSucceeded) {
@@ -64,12 +69,4 @@ export class QualityAssuranceTopicsService {
})
);
}
/**
* set sourceId which is used to get topics
* @param sourceId string
*/
setSourceId(sourceId: string) {
this.sourceId = sourceId;
}
}

View File

@@ -118,8 +118,8 @@ export class SuggestionNotificationsStateService {
* @param currentPage
* The number of the current page.
*/
public dispatchRetrieveQualityAssuranceTopics(elementsPerPage: number, currentPage: number): void {
this.store.dispatch(new RetrieveAllTopicsAction(elementsPerPage, currentPage));
public dispatchRetrieveQualityAssuranceTopics(elementsPerPage: number, currentPage: number, sourceId: string, targteId?: string): void {
this.store.dispatch(new RetrieveAllTopicsAction(elementsPerPage, currentPage, sourceId, targteId));
}
// Quality Assurance source

View File

@@ -2604,6 +2604,10 @@
"item.qa.withdrawn.modal.submitted.header": "Sending withdrawn request...",
"item.qa-event-notification.check.notification-withdrawn": "You have requested to withdrawn this item.",
"item.qa-event-notification-undo-withdrawn.check.button": "Undo request withdrawal",
"item.version.create.modal.submitted.text": "The new version is being created. This may take some time if the item has a lot of relationships.",
"item.version.create.notification.success": "New version has been created with version number {{version}}",