diff --git a/cypress/integration/submission-ui.spec.ts b/cypress/integration/submission-ui.spec.ts index cc8e28dc019..5b819980388 100644 --- a/cypress/integration/submission-ui.spec.ts +++ b/cypress/integration/submission-ui.spec.ts @@ -416,52 +416,6 @@ describe('Create a new submission', () => { createItemProcess.checkAuthorLastnameField(); }); - it('should show warning messages if was selected non-supported license', { - retries: { - runMode: 6, - openMode: 6, - }, - defaultCommandTimeout: 10000 - },() => { - createItemProcess.checkLicenseResourceStep(); - // check default value in the license dropdown selection - createItemProcess.checkLicenseSelectionValue('Select a License ...'); - // check step status - it should be as warning - createItemProcess.checkResourceLicenseStatus('Warnings'); - // select `Select a License ...` from the selection - this license is not supported - createItemProcess.selectValueFromLicenseSelection('Select a License ...'); - // selected value should be seen as selected value in the selection - createItemProcess.checkLicenseSelectionValue('Select a License ...'); - // check step status - it should an error - createItemProcess.checkResourceLicenseStatus('Errors'); - // error messages should be popped up - createItemProcess.showErrorMustChooseLicense(); - createItemProcess.showErrorNotSupportedLicense(); - }); - - it('the submission should have the Notice Step', { - retries: { - runMode: 6, - openMode: 6, - }, - defaultCommandTimeout: 10000 - },() => { - createItemProcess.checkLicenseResourceStep(); - // check default value in the license dropdown selection - createItemProcess.checkLicenseSelectionValue('Select a License ...'); - // check step status - it should be as warning - createItemProcess.checkResourceLicenseStatus('Warnings'); - // select `Select a License ...` from the selection - this license is not supported - createItemProcess.selectValueFromLicenseSelection('Select a License ...'); - // selected value should be seen as selected value in the selection - createItemProcess.checkLicenseSelectionValue('Select a License ...'); - // check step status - it should an error - createItemProcess.checkResourceLicenseStatus('Errors'); - // error messages should be popped up - createItemProcess.showErrorMustChooseLicense(); - createItemProcess.showErrorNotSupportedLicense(); - }); - it('The submission should not have the Notice Step', { retries: { runMode: 6, diff --git a/src/app/clarin-licenses/clarin-license-table-pagination.ts b/src/app/clarin-licenses/clarin-license-table-pagination.ts index baa89242836..23f18a655df 100644 --- a/src/app/clarin-licenses/clarin-license-table-pagination.ts +++ b/src/app/clarin-licenses/clarin-license-table-pagination.ts @@ -10,8 +10,8 @@ export const paginationID = 'cLicense'; // pageSize: 200; get all licenses export const defaultPagination = Object.assign(new PaginationComponentOptions(), { id: paginationID, - currentPage: 0, - pageSize: 200 + currentPage: 1, + pageSize: 10 }); export const defaultSortConfiguration = new SortOptions('', SortDirection.DESC); diff --git a/src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.html b/src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.html index 5a582b667c3..afc5e3c1ef3 100644 --- a/src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.html +++ b/src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.html @@ -1,4 +1,15 @@
+
+ + + + +
diff --git a/src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.spec.ts b/src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.spec.ts index 2bd4c41b9b8..baffd58245e 100644 --- a/src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.spec.ts +++ b/src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.spec.ts @@ -41,6 +41,7 @@ describe('ClarinLicenseTableComponent', () => { findAll: mockLicenseRD$, create: createdLicenseRD$, put: createdLicenseRD$, + searchBy: mockLicenseRD$, getLinkPath: observableOf('') }); clarinLicenseLabelDataService = jasmine.createSpyObj('clarinLicenseLabelService', { @@ -98,7 +99,7 @@ describe('ClarinLicenseTableComponent', () => { it('should onInit should initialize clarin license table data', () => { (component as ClarinLicenseTableComponent).ngOnInit(); - expect((component as any).clarinLicenseService.findAll).toHaveBeenCalled(); + expect((component as any).clarinLicenseService.searchBy).toHaveBeenCalled(); expect((component as ClarinLicenseTableComponent).licensesRD$).not.toBeNull(); }); @@ -108,7 +109,7 @@ describe('ClarinLicenseTableComponent', () => { // notificate successful response expect((component as any).notificationService.success).toHaveBeenCalled(); // load table data - expect((component as any).clarinLicenseService.findAll).toHaveBeenCalled(); + expect((component as any).clarinLicenseService.searchBy).toHaveBeenCalled(); expect((component as ClarinLicenseTableComponent).licensesRD$).not.toBeNull(); }); @@ -127,7 +128,7 @@ describe('ClarinLicenseTableComponent', () => { // notificate successful response expect((component as any).notificationService.success).toHaveBeenCalled(); // load table data - expect((component as any).clarinLicenseService.findAll).toHaveBeenCalled(); + expect((component as any).clarinLicenseService.searchBy).toHaveBeenCalled(); expect((component as ClarinLicenseTableComponent).licensesRD$).not.toBeNull(); }); })); @@ -141,7 +142,7 @@ describe('ClarinLicenseTableComponent', () => { // notificate successful response expect((component as any).notificationService.success).toHaveBeenCalled(); // load table data - expect((component as any).clarinLicenseService.findAll).toHaveBeenCalled(); + expect((component as any).clarinLicenseService.searchBy).toHaveBeenCalled(); expect((component as ClarinLicenseTableComponent).licensesRD$).not.toBeNull(); }); }); diff --git a/src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.ts b/src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.ts index 205d94392af..6a04f622010 100644 --- a/src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.ts +++ b/src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.ts @@ -21,6 +21,7 @@ import { ClarinLicenseLabelDataService } from '../../core/data/clarin/clarin-lic import { ClarinLicenseLabelExtendedSerializer } from '../../core/shared/clarin/clarin-license-label-extended-serializer'; import { ClarinLicenseRequiredInfoSerializer } from '../../core/shared/clarin/clarin-license-required-info-serializer'; import { cloneDeep } from 'lodash'; +import { RequestParam } from '../../core/cache/models/request-param.model'; /** * Component for managing clarin licenses and defining clarin license labels. @@ -61,6 +62,11 @@ export class ClarinLicenseTableComponent implements OnInit { */ isLoading = false; + /** + * License name typed into search input field, it is passed to the BE as searching value. + */ + searchingLicenseName = ''; + ngOnInit(): void { this.initializePaginationOptions(); this.loadAllLicenses(); @@ -311,10 +317,11 @@ export class ClarinLicenseTableComponent implements OnInit { observableCombineLatest([currentPagination$, currentSort$]).pipe( switchMap(([currentPagination, currentSort]) => { - return this.clarinLicenseService.findAll({ + return this.clarinLicenseService.searchBy('byNameLike',{ currentPage: currentPagination.currentPage, elementsPerPage: currentPagination.pageSize, - sort: {field: currentSort.field, direction: currentSort.direction} + sort: {field: currentSort.field, direction: currentSort.direction}, + searchParams: [Object.assign(new RequestParam('name', this.searchingLicenseName))] }, false ); }), diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index a391f629751..667cbf8cc04 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -3520,6 +3520,10 @@ "clarin-license.button.delete-license": "Delete License", + "clarin-license.button.search": "Search", + + "clarin-license.button.search.placeholder": "Search by the license name ...", + "clarin-license.define-license-form.form-name": "Define new license",