Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4ee936a
Initial commit
Sep 5, 2022
db6e8ca
Added `License Administration` to the menu
Sep 8, 2022
dcd5bf6
created clarin-license-page.component
Sep 8, 2022
14adb8e
Create clarin license label component
Sep 9, 2022
96cef9c
Show clarin licenses in the table with clarin license labels
Sep 12, 2022
7a6c189
Created buttons
Sep 12, 2022
776ce12
Created define-license-form
Sep 14, 2022
8497137
Define a new clarin license works
Sep 16, 2022
8dde613
Checked Extended Clarin License Labels and working on checking non ex…
Sep 16, 2022
8060207
Cannot edit extended license labels
Sep 16, 2022
9f7ef38
Define License component is used for updating the License
Sep 19, 2022
dd30ba3
Editing of licenses works
Sep 19, 2022
f41905d
Send the icon as byte array to the BE
Sep 19, 2022
196dcc5
Showed clarin license label image
Sep 20, 2022
51f2849
some functionalities of the license admin should work
Sep 20, 2022
91bf566
created some tests - admin menu and clarin-license-table
Sep 20, 2022
86e7074
created tests for clarin-license-table.component
Sep 21, 2022
4f33ab9
Created tests for define license and define license label
Sep 21, 2022
ff7ec38
revert useless changes
Sep 21, 2022
f20670e
some refactoring
Sep 21, 2022
24bb7ca
Added some docs and refactoring
Sep 21, 2022
180a8b4
Added docs and refactoring
Sep 21, 2022
9db4c1e
Fixed failing tests
Sep 21, 2022
ed6f2dd
Merge branch 'dtq-dev' into feature/lf-4-license-administrator
milanmajchrak Sep 22, 2022
c90b53c
Fixed community-list.spec.ts IT
Sep 22, 2022
e1b8cf3
revert wrong fix
Sep 22, 2022
320bfb6
Added user requirement to the Clarin License
Sep 26, 2022
f8b0858
Fixed parsing clarin license require info
Sep 26, 2022
24267f4
feature/lf-3-license-selector-dtq-lf (#103) design changes, clarin li…
milanmajchrak Oct 6, 2022
e57fa07
Feature/lf 3 license selector (#105)
milanmajchrak Oct 6, 2022
ea3dbfa
Merge branch 'dtq-dev-lf' into feature/lf-4-license-administrator
milanmajchrak Oct 6, 2022
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
5 changes: 4 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@
"bundleName": "dspace-theme"
}
],
"scripts": []
"scripts": [
"src/license-selector.js",
"src/license-selector-creation.js"
]
},
"configurations": {
"development": {
Expand Down
9 changes: 7 additions & 2 deletions cypress/integration/admin-menu.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { loginProcess } from './submission-ui.spec';

describe('Community Page', () => {

/**
* Test menu options for admin
*/
describe('Admin Menu Page', () => {
it('should pass accessibility tests', () => {
// Login as admin
cy.visit('/');
Expand All @@ -12,5 +14,8 @@ describe('Community Page', () => {

// check handles redirect url in the <a> tag
cy.get('.sidebar-top-level-items a[href = "/handle-table"]').scrollIntoView().should('be.visible');

// check licenses redirect url in the <a> tag
cy.get('.sidebar-top-level-items a[href = "/licenses"]').scrollIntoView().should('be.visible');
});
});
21 changes: 21 additions & 0 deletions cypress/integration/clarin-licenses-page.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { loginProcess } from './submission-ui.spec';

/**
* Test for checking if the license administration page is loaded after redirecting.
*/
describe('License Administration Page', () => {

it('should pass accessibility tests', () => {
// Login as admin
cy.visit('/');
loginProcess.clickOnLoginDropdown();
loginProcess.typeEmail();
loginProcess.typePassword();
loginProcess.submit();

cy.visit('/licenses');

// <ds-clarin-license-table> tag must be loaded
cy.get('ds-clarin-license-table').should('exist');
});
});
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"@nguniversal/express-engine": "11.2.1",
"@ngx-translate/core": "^13.0.0",
"@nicky-lenaers/ngx-scroll-to": "^9.0.0",
"@nth-cloud/ng-toggle": "7.0.0",
"angular-idle-preload": "3.0.0",
"angular2-text-mask": "9.0.0",
"angulartics2": "^10.0.0",
Expand All @@ -90,6 +91,7 @@
"font-awesome": "4.7.0",
"http-proxy-middleware": "^1.0.5",
"https": "1.0.0",
"jquery": "^3.6.1",
"js-cookie": "2.2.1",
"js-yaml": "^4.1.0",
"json5": "^2.1.3",
Expand Down
17 changes: 16 additions & 1 deletion src/app/admin/admin-sidebar/admin-sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { MenuService } from '../../shared/menu/menu.service';
import { CSSVariableService } from '../../shared/sass-helper/sass-helper.service';
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
import { Router, ActivatedRoute } from '@angular/router';
import { ActivatedRoute } from '@angular/router';

/**
* Component representing the admin sidebar
Expand Down Expand Up @@ -307,6 +307,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
icon: 'terminal',
index: 10
},

/* Handle table */
{
id: 'handle_table',
Expand All @@ -320,6 +321,20 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
icon: 'table',
index: 12
},

/* License administration */
{
id: 'licenses',
active: false,
visible: true,
model: {
type: MenuItemType.LINK,
text: 'menu.section.licenses',
link: '/licenses'
} as LinkMenuItemModel,
icon: 'scroll',
index: 13
},
];
menuList.forEach((menuSection) => this.menuService.addSection(this.menuID, Object.assign(menuSection, {
shouldPersistOnRouteChange: true
Expand Down
11 changes: 11 additions & 0 deletions src/app/app-routing-paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ export function getRequestCopyModulePath() {
return `/${REQUEST_COPY_MODULE_PATH}`;
}


export const LICENSES_MODULE_PATH = 'licenses';
export function getLicensesModulePath() {
return `/${LICENSES_MODULE_PATH}`;
}

export const STATIC_PAGE_MODULE_PATH = 'contract';
export function getLicenseContractPagePath() {
return `/${STATIC_PAGE_MODULE_PATH}`;
}

export const HANDLE_TABLE_MODULE_PATH = 'handle-table';
export function getHandleTableModulePath() {
return `/${HANDLE_TABLE_MODULE_PATH}`;
Expand Down
16 changes: 14 additions & 2 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import {
HANDLE_TABLE_MODULE_PATH,
INFO_MODULE_PATH,
INTERNAL_SERVER_ERROR,
LEGACY_BITSTREAM_MODULE_PATH,
LEGACY_BITSTREAM_MODULE_PATH, LICENSES_MODULE_PATH,
PROFILE_MODULE_PATH,
REGISTER_PATH,
REQUEST_COPY_MODULE_PATH,
REQUEST_COPY_MODULE_PATH, STATIC_PAGE_MODULE_PATH,
WORKFLOW_ITEM_MODULE_PATH,
} from './app-routing-paths';
import { COLLECTION_MODULE_PATH } from './collection-page/collection-page-routing-paths';
Expand All @@ -31,6 +31,8 @@ import { ThemedForbiddenComponent } from './forbidden/themed-forbidden.component
import { GroupAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/group-administrator.guard';
import { ThemedPageInternalServerErrorComponent } from './page-internal-server-error/themed-page-internal-server-error.component';
import { ServerCheckGuard } from './core/server-check/server-check.guard';
import {LicenseContractPageComponent} from './license-contract-page/license-contract-page.component';
import {LicenseContractPageModule} from './license-contract-page/license-contract-page.module';

@NgModule({
imports: [
Expand Down Expand Up @@ -214,6 +216,16 @@ import { ServerCheckGuard } from './core/server-check/server-check.guard';
loadChildren: () => import('./access-control/access-control.module').then((m) => m.AccessControlModule),
canActivate: [GroupAdministratorGuard],
},
{
path: LICENSES_MODULE_PATH,
loadChildren: () => import('./clarin-licenses/clarin-license.module').then((m) => m.ClarinLicenseModule),
canActivate: [SiteAdministratorGuard],
},
path: STATIC_PAGE_MODULE_PATH,
loadChildren: () => import('./license-contract-page/license-contract-page.module')
.then((m) => m.LicenseContractPageModule),
canActivate: [EndUserAgreementCurrentUserGuard]
},
{
path: HANDLE_TABLE_MODULE_PATH,
loadChildren: () => import('./handle-page/handle-page.module').then((m) => m.HandlePageModule),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="container">
<div class="card">
<h5 class="card-header">{{ 'clarin-license-table.title' | translate }}</h5>
<div class="card-body">
<ds-clarin-license-table></ds-clarin-license-table>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/**
The file for styling `clarin-license-page.component.html`. No styling needed.
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ClarinLicensePageComponent } from './clarin-license-page.component';
import { SharedModule } from '../../shared/shared.module';
import { CommonModule } from '@angular/common';
import { ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
import { RouterTestingModule } from '@angular/router/testing';

describe('ClarinLicensePageComponent', () => {
let component: ClarinLicensePageComponent;
let fixture: ComponentFixture<ClarinLicensePageComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedModule,
CommonModule,
ReactiveFormsModule,
TranslateModule.forRoot(),
RouterTestingModule.withRoutes([])
],
declarations: [ ClarinLicensePageComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(ClarinLicensePageComponent);
component = fixture.componentInstance;
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Component, OnInit } from '@angular/core';

/**
* Component which wraps clarin license table into the container
*/
@Component({
selector: 'ds-clarin-license-page',
templateUrl: './clarin-license-page.component.html',
styleUrls: ['./clarin-license-page.component.scss']
})
export class ClarinLicensePageComponent implements OnInit {

// tslint:disable-next-line:no-empty
constructor() { }

// tslint:disable-next-line:no-empty
ngOnInit(): void {
}

}
23 changes: 23 additions & 0 deletions src/app/clarin-licenses/clarin-license-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { ClarinLicensePageComponent } from './clarin-license-page/clarin-license-page.component';

@NgModule({
imports: [
RouterModule.forChild([
{
path: '',
resolve: { breadcrumb: I18nBreadcrumbResolver },
data: {
breadcrumbKey: 'licenses',
},
component: ClarinLicensePageComponent,
pathMatch: 'full'
}
])
]
})
export class ClarinLicenseRoutingModule {

}
15 changes: 15 additions & 0 deletions src/app/clarin-licenses/clarin-license-table-pagination.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {PaginationComponentOptions} from '../shared/pagination/pagination-component-options.model';
import {SortDirection, SortOptions} from '../core/cache/models/sort-options.model';
/**
* Pagination constants for the license table
*/

export const paginationID = 'cLicense';

export const defaultPagination = Object.assign(new PaginationComponentOptions(), {
id: paginationID,
currentPage: 1,
pageSize: 10
});

export const defaultSortConfiguration = new SortOptions('', SortDirection.DESC);
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<div class="container">
<!-- The table with pagination -->
<div *ngVar="(licensesRD$ | async)?.payload as cLicenses">
<div class="mb-2">
<ds-pagination (paginationChange)="onPageChange()"
[hideGear]="true"
[hidePagerWhenSinglePage]="true"
[paginationOptions]="options"
[pageInfoState]="cLicenses?.pageInfo"
[collectionSize]="cLicenses?.totalElements"
[retainScrollPosition]="true">
<table class="table table-striped table-bordered align-middle my-2">
<thead>
<tr>
<th scope="col"></th>
<th scope="col">{{"clarin-license.table.name" | translate}}</th>
<th scope="col">{{"clarin-license.table.definition" | translate}}</th>
<th scope="col">{{"clarin-license.table.confirmation" | translate}}</th>
<th scope="col">{{"clarin-license.table.required-user-info" | translate}}</th>
<th scope="col">{{"clarin-license.table.label" | translate}}</th>
<th scope="col">{{"clarin-license.table.extended-labels" | translate}}</th>
<th scope="col">{{"clarin-license.table.bitstreams" | translate}}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let cLicense of cLicenses?.page" [id]="'clarin-license-row-' + cLicense.id">
<td><input class="collection-checkbox"
[ngModel]="selectedLicense?.id === cLicense.id"
(change)="switchSelectedLicense(cLicense)"
type="checkbox"
name="{{cLicense.id}}"></td>
<td class="version-row-element-version">
{{cLicense?.name}}
</td>
<td class="version-row-element-version">
{{cLicense?.definition}}
</td>
<td class="version-row-element-version">
{{cLicense?.confirmation}}
</td>
<td class="version-row-element-version">
{{cLicense?.requiredInfo | dsCLicenseRequiredInfo}}
</td>
<td class="version-row-element-version">
{{cLicense?.clarinLicenseLabel?.label}}
</td>
<td class="version-row-element-version">
{{cLicense?.extendedClarinLicenseLabels | dsExtendedCLicense}}
</td>
<td class="version-row-element-version">
{{cLicense?.bitstreams}}
</td>
</tr>
</tbody>
</table>
<ds-loading *ngIf="isLoading" class="text-center"></ds-loading>
</ds-pagination>

<div class="mt-2">
<div class="btn-group">
<div ngbDropdown class="input-group-prepend">
<button id="resultdropdown" type="button"
ngbDropdownToggle
class="btn btn-success dropdown-toggle"
data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
{{"clarin-license.button.define" | translate}}
</button>
<div ngbDropdownMenu aria-labelledby="resultdropdown">
<button class="dropdown-item" (click)="openDefineLicenseForm()">{{"clarin-license.button.define-license" | translate}}</button>
<button class="dropdown-item" (click)="openDefineLicenseLabelForm()">{{"clarin-license.button.define-license-label" | translate}}</button>
</div>
</div>
</div>
<div class="btn-group">
<button type="button" class="btn btn-warning" [disabled]="selectedLicense == null" (click)="openEditLicenseForm()">
{{'clarin-license.button.edit-license' | translate}}
</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-danger" [disabled]="selectedLicense == null" (click)="deleteLicense()">
{{'clarin-license.button.delete-license' | translate}}
</button>
</div>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/**
The file for styling `clarin-license-table.component.html`. No styling needed.
*/
Loading