Skip to content
Merged
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
46 changes: 0 additions & 46 deletions cypress/integration/submission-ui.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/app/clarin-licenses/clarin-license-table-pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
<div class="container">
<div class="form-group input-group">
<input type="text"
name="query"
[(ngModel)]="searchingLicenseName"
class="form-control ng-pristine ng-valid ng-touched"
[placeholder]="'clarin-license.button.search.placeholder' | translate"/>
<span class="input-group-append" (click)="loadAllLicenses()">
<button type="submit" class="btn btn-primary search-button">
<i class="fas fa-search"></i>{{'clarin-license.button.search' | translate}}</button>
</span>
</div>
<!-- The table with pagination -->
<div *ngVar="(licensesRD$ | async)?.payload as cLicenses">
<div class="mb-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ describe('ClarinLicenseTableComponent', () => {
findAll: mockLicenseRD$,
create: createdLicenseRD$,
put: createdLicenseRD$,
searchBy: mockLicenseRD$,
getLinkPath: observableOf('')
});
clarinLicenseLabelDataService = jasmine.createSpyObj('clarinLicenseLabelService', {
Expand Down Expand Up @@ -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();
});

Expand All @@ -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();
});

Expand All @@ -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();
});
}));
Expand All @@ -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();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
);
}),
Expand Down
4 changes: 4 additions & 0 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand Down