mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-8597] use endpoint for bulk hold operation status (#10120)
* ACS-8597 add operation status api, use entry for assign response * ACS-8597 review remarks - property order, docs cosistency
This commit is contained in:
committed by
GitHub
parent
61faf92d41
commit
94787b5705
@@ -18,7 +18,7 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { LegalHoldService } from './legal-hold.service';
|
||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||
import { BulkAssignHoldResponse, Hold, HoldEntry, HoldPaging, RequestQuery, SEARCH_LANGUAGE } from '@alfresco/js-api';
|
||||
import { BulkAssignHoldResponseEntry, Hold, HoldBulkStatusEntry, HoldEntry, HoldPaging, RequestQuery, SEARCH_LANGUAGE } from '@alfresco/js-api';
|
||||
|
||||
describe('LegalHoldsService', () => {
|
||||
let service: LegalHoldService;
|
||||
@@ -28,7 +28,29 @@ describe('LegalHoldsService', () => {
|
||||
const filePlanId = 'mockId';
|
||||
const nodeId = 'mockNodeId';
|
||||
const holdId = 'holdId';
|
||||
const mockBulkResponse: BulkAssignHoldResponse = { totalItems: 3, bulkStatusId: 'bulkStatus' };
|
||||
const mockBulkResponse: BulkAssignHoldResponseEntry = {
|
||||
entry: {
|
||||
totalItems: 3,
|
||||
bulkStatusId: 'bulkStatus'
|
||||
}
|
||||
};
|
||||
const mockBulkStatusResponse: HoldBulkStatusEntry = {
|
||||
entry: {
|
||||
bulkStatusId: 'bulkStatus',
|
||||
status: 'IN_PROGRESS',
|
||||
totalItems: 3,
|
||||
processedItems: 2,
|
||||
errorsCount: 0,
|
||||
startTime: new Date('2024'),
|
||||
holdBulkOperation: {
|
||||
op: 'ADD',
|
||||
query: {
|
||||
query: 'mockQuery',
|
||||
language: SEARCH_LANGUAGE.AFTS
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@@ -184,4 +206,17 @@ describe('LegalHoldsService', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('getBulkOperationStatus', () => {
|
||||
it('should get bulk operation status based on bulkStatusId and nodeId', (done) => {
|
||||
spyOn(service.legalHoldApi, 'getBulkStatus').and.returnValue(Promise.resolve(mockBulkStatusResponse));
|
||||
const bulkStatusId = 'mockBulkStatusId';
|
||||
|
||||
service.getBulkOperationStatus(bulkStatusId, nodeId).subscribe((response) => {
|
||||
expect(response).toEqual(mockBulkStatusResponse);
|
||||
expect(service.legalHoldApi.getBulkStatus).toHaveBeenCalledWith(bulkStatusId, nodeId);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@@ -16,7 +16,17 @@
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { BulkAssignHoldResponse, ContentPagingQuery, Hold, HoldBody, HoldEntry, HoldPaging, LegalHoldApi, RequestQuery } from '@alfresco/js-api';
|
||||
import {
|
||||
BulkAssignHoldResponseEntry,
|
||||
ContentPagingQuery,
|
||||
Hold,
|
||||
HoldBody,
|
||||
HoldBulkStatusEntry,
|
||||
HoldEntry,
|
||||
HoldPaging,
|
||||
LegalHoldApi,
|
||||
RequestQuery
|
||||
} from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
@@ -104,9 +114,9 @@ export class LegalHoldService {
|
||||
*
|
||||
* @param holdId The identifier of a hold
|
||||
* @param query Search query
|
||||
* @returns Observable<BulkAssignHoldResponse>
|
||||
* @returns Observable<BulkAssignHoldResponseEntry>
|
||||
*/
|
||||
bulkAssignHold(holdId: string, query: RequestQuery): Observable<BulkAssignHoldResponse> {
|
||||
bulkAssignHold(holdId: string, query: RequestQuery): Observable<BulkAssignHoldResponseEntry> {
|
||||
return from(this.legalHoldApi.bulkAssignHold(holdId, query));
|
||||
}
|
||||
|
||||
@@ -116,9 +126,9 @@ export class LegalHoldService {
|
||||
* @param holdId The identifier of a hold
|
||||
* @param folderId The identifier of a folder
|
||||
* @param language Language code
|
||||
* @returns Observable<BulkAssignHoldResponse>
|
||||
* @returns Observable<BulkAssignHoldResponseEntry>
|
||||
*/
|
||||
bulkAssignHoldToFolder(holdId: string, folderId: string, language: string): Observable<BulkAssignHoldResponse> {
|
||||
bulkAssignHoldToFolder(holdId: string, folderId: string, language: string): Observable<BulkAssignHoldResponseEntry> {
|
||||
const query: RequestQuery = {
|
||||
query: `ANCESTOR:'workspace://SpacesStore/${folderId}' and TYPE:content`,
|
||||
language
|
||||
@@ -126,4 +136,15 @@ export class LegalHoldService {
|
||||
|
||||
return from(this.legalHoldApi.bulkAssignHold(holdId, query));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status of bulk operation with **bulkStatusId** for **holdId**.
|
||||
*
|
||||
* @param bulkStatusId The identifier of a bulk status
|
||||
* @param holdId The identifier of a hold
|
||||
* @returns Promise<HoldsBulkStatusEntry>
|
||||
*/
|
||||
getBulkOperationStatus(bulkStatusId: string, holdId: string): Observable<HoldBulkStatusEntry> {
|
||||
return from(this.legalHoldApi.getBulkStatus(bulkStatusId, holdId));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user