mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge branch 'main' into main-optimize-metadata-represenation-rendering
# Conflicts: # src/app/item-page/simple/field-components/specific-field/item-page-field.component.ts # src/app/item-page/simple/metadata-representation-list/metadata-representation-list.component.ts
This commit is contained in:
@@ -8,7 +8,10 @@
|
|||||||
"eslint-plugin-deprecation",
|
"eslint-plugin-deprecation",
|
||||||
"unused-imports",
|
"unused-imports",
|
||||||
"eslint-plugin-lodash",
|
"eslint-plugin-lodash",
|
||||||
"eslint-plugin-jsonc"
|
"eslint-plugin-jsonc",
|
||||||
|
"eslint-plugin-rxjs",
|
||||||
|
"eslint-plugin-simple-import-sort",
|
||||||
|
"eslint-plugin-import-newlines"
|
||||||
],
|
],
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
@@ -27,17 +30,29 @@
|
|||||||
"plugin:@typescript-eslint/recommended",
|
"plugin:@typescript-eslint/recommended",
|
||||||
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||||
"plugin:@angular-eslint/recommended",
|
"plugin:@angular-eslint/recommended",
|
||||||
"plugin:@angular-eslint/template/process-inline-templates"
|
"plugin:@angular-eslint/template/process-inline-templates",
|
||||||
|
"plugin:rxjs/recommended"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"indent": [
|
||||||
|
"error",
|
||||||
|
2,
|
||||||
|
{
|
||||||
|
"SwitchCase": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
"max-classes-per-file": [
|
"max-classes-per-file": [
|
||||||
"error",
|
"error",
|
||||||
1
|
1
|
||||||
],
|
],
|
||||||
"comma-dangle": [
|
"comma-dangle": [
|
||||||
"off",
|
"error",
|
||||||
"always-multiline"
|
"always-multiline"
|
||||||
],
|
],
|
||||||
|
"object-curly-spacing": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
"eol-last": [
|
"eol-last": [
|
||||||
"error",
|
"error",
|
||||||
"always"
|
"always"
|
||||||
@@ -104,15 +119,13 @@
|
|||||||
"allowTernary": true
|
"allowTernary": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"prefer-const": "off", // todo: re-enable & fix errors (more strict than it used to be in TSLint)
|
"prefer-const": "error",
|
||||||
|
"no-case-declarations": "error",
|
||||||
|
"no-extra-boolean-cast": "error",
|
||||||
"prefer-spread": "off",
|
"prefer-spread": "off",
|
||||||
"no-underscore-dangle": "off",
|
"no-underscore-dangle": "off",
|
||||||
|
|
||||||
// todo: disabled rules from eslint:recommended, consider re-enabling & fixing
|
|
||||||
"no-prototype-builtins": "off",
|
"no-prototype-builtins": "off",
|
||||||
"no-useless-escape": "off",
|
"no-useless-escape": "off",
|
||||||
"no-case-declarations": "off",
|
|
||||||
"no-extra-boolean-cast": "off",
|
|
||||||
|
|
||||||
"@angular-eslint/directive-selector": [
|
"@angular-eslint/directive-selector": [
|
||||||
"error",
|
"error",
|
||||||
@@ -183,7 +196,7 @@
|
|||||||
],
|
],
|
||||||
"@typescript-eslint/type-annotation-spacing": "error",
|
"@typescript-eslint/type-annotation-spacing": "error",
|
||||||
"@typescript-eslint/unified-signatures": "error",
|
"@typescript-eslint/unified-signatures": "error",
|
||||||
"@typescript-eslint/ban-types": "warn", // todo: deal with {} type issues & re-enable
|
"@typescript-eslint/ban-types": "error",
|
||||||
"@typescript-eslint/no-floating-promises": "warn",
|
"@typescript-eslint/no-floating-promises": "warn",
|
||||||
"@typescript-eslint/no-misused-promises": "warn",
|
"@typescript-eslint/no-misused-promises": "warn",
|
||||||
"@typescript-eslint/restrict-plus-operands": "warn",
|
"@typescript-eslint/restrict-plus-operands": "warn",
|
||||||
@@ -203,14 +216,45 @@
|
|||||||
|
|
||||||
"deprecation/deprecation": "warn",
|
"deprecation/deprecation": "warn",
|
||||||
|
|
||||||
|
"simple-import-sort/imports": "error",
|
||||||
|
"simple-import-sort/exports": "error",
|
||||||
"import/order": "off",
|
"import/order": "off",
|
||||||
|
"import/first": "error",
|
||||||
|
"import/newline-after-import": "error",
|
||||||
|
"import/no-duplicates": "error",
|
||||||
"import/no-deprecated": "warn",
|
"import/no-deprecated": "warn",
|
||||||
"import/no-namespace": "error",
|
"import/no-namespace": "error",
|
||||||
|
"import-newlines/enforce": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"items": 1,
|
||||||
|
"semi": true,
|
||||||
|
"forceSingleLine": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
"unused-imports/no-unused-imports": "error",
|
"unused-imports/no-unused-imports": "error",
|
||||||
"lodash/import-scope": [
|
"lodash/import-scope": [
|
||||||
"error",
|
"error",
|
||||||
"method"
|
"method"
|
||||||
]
|
],
|
||||||
|
|
||||||
|
"rxjs/no-nested-subscribe": "off" // todo: go over _all_ cases
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.spec.ts"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"project": [
|
||||||
|
"./tsconfig.json",
|
||||||
|
"./cypress/tsconfig.json"
|
||||||
|
],
|
||||||
|
"createDefaultProgram": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"prefer-const": "off"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -219,12 +263,7 @@
|
|||||||
],
|
],
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@angular-eslint/template/recommended"
|
"plugin:@angular-eslint/template/recommended"
|
||||||
],
|
]
|
||||||
"rules": {
|
|
||||||
// todo: re-enable & fix errors
|
|
||||||
"@angular-eslint/template/no-negated-async": "off",
|
|
||||||
"@angular-eslint/template/eqeqeq": "off"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": [
|
"files": [
|
||||||
|
@@ -21,7 +21,6 @@ import './commands';
|
|||||||
import 'cypress-axe';
|
import 'cypress-axe';
|
||||||
import { DSPACE_XSRF_COOKIE } from 'src/app/core/xsrf/xsrf.constants';
|
import { DSPACE_XSRF_COOKIE } from 'src/app/core/xsrf/xsrf.constants';
|
||||||
|
|
||||||
|
|
||||||
// Runs once before all tests
|
// Runs once before all tests
|
||||||
before(() => {
|
before(() => {
|
||||||
// Cypress doesn't have access to the running application in Node.js.
|
// Cypress doesn't have access to the running application in Node.js.
|
||||||
|
@@ -170,9 +170,12 @@
|
|||||||
"eslint": "^8.39.0",
|
"eslint": "^8.39.0",
|
||||||
"eslint-plugin-deprecation": "^1.4.1",
|
"eslint-plugin-deprecation": "^1.4.1",
|
||||||
"eslint-plugin-import": "^2.27.5",
|
"eslint-plugin-import": "^2.27.5",
|
||||||
|
"eslint-plugin-import-newlines": "^1.3.1",
|
||||||
"eslint-plugin-jsdoc": "^45.0.0",
|
"eslint-plugin-jsdoc": "^45.0.0",
|
||||||
"eslint-plugin-jsonc": "^2.6.0",
|
"eslint-plugin-jsonc": "^2.6.0",
|
||||||
"eslint-plugin-lodash": "^7.4.0",
|
"eslint-plugin-lodash": "^7.4.0",
|
||||||
|
"eslint-plugin-rxjs": "^5.0.3",
|
||||||
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
||||||
"eslint-plugin-unused-imports": "^2.0.0",
|
"eslint-plugin-unused-imports": "^2.0.0",
|
||||||
"express-static-gzip": "^2.1.7",
|
"express-static-gzip": "^2.1.7",
|
||||||
"jasmine-core": "^3.8.0",
|
"jasmine-core": "^3.8.0",
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { URLCombiner } from '../core/url-combiner/url-combiner';
|
|
||||||
import { getAccessControlModuleRoute } from '../app-routing-paths';
|
import { getAccessControlModuleRoute } from '../app-routing-paths';
|
||||||
|
import { URLCombiner } from '../core/url-combiner/url-combiner';
|
||||||
|
|
||||||
export const EPERSON_PATH = 'epeople';
|
export const EPERSON_PATH = 'epeople';
|
||||||
|
|
||||||
|
@@ -1,20 +1,20 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { EPeopleRegistryComponent } from './epeople-registry/epeople-registry.component';
|
|
||||||
import { GroupFormComponent } from './group-registry/group-form/group-form.component';
|
|
||||||
import { GroupsRegistryComponent } from './group-registry/groups-registry.component';
|
|
||||||
import { EPERSON_PATH, GROUP_PATH } from './access-control-routing-paths';
|
|
||||||
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
import { GroupPageGuard } from './group-registry/group-page.guard';
|
import { GroupAdministratorGuard } from '../core/data/feature-authorization/feature-authorization-guard/group-administrator.guard';
|
||||||
|
import { SiteAdministratorGuard } from '../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
||||||
import {
|
import {
|
||||||
GroupAdministratorGuard
|
EPERSON_PATH,
|
||||||
} from '../core/data/feature-authorization/feature-authorization-guard/group-administrator.guard';
|
GROUP_PATH,
|
||||||
import {
|
} from './access-control-routing-paths';
|
||||||
SiteAdministratorGuard
|
|
||||||
} from '../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
|
||||||
import { BulkAccessComponent } from './bulk-access/bulk-access.component';
|
import { BulkAccessComponent } from './bulk-access/bulk-access.component';
|
||||||
|
import { EPeopleRegistryComponent } from './epeople-registry/epeople-registry.component';
|
||||||
import { EPersonFormComponent } from './epeople-registry/eperson-form/eperson-form.component';
|
import { EPersonFormComponent } from './epeople-registry/eperson-form/eperson-form.component';
|
||||||
import { EPersonResolver } from './epeople-registry/eperson-resolver.service';
|
import { EPersonResolver } from './epeople-registry/eperson-resolver.service';
|
||||||
|
import { GroupFormComponent } from './group-registry/group-form/group-form.component';
|
||||||
|
import { GroupPageGuard } from './group-registry/group-page.guard';
|
||||||
|
import { GroupsRegistryComponent } from './group-registry/groups-registry.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -23,10 +23,10 @@ import { EPersonResolver } from './epeople-registry/eperson-resolver.service';
|
|||||||
path: EPERSON_PATH,
|
path: EPERSON_PATH,
|
||||||
component: EPeopleRegistryComponent,
|
component: EPeopleRegistryComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
breadcrumb: I18nBreadcrumbResolver
|
breadcrumb: I18nBreadcrumbResolver,
|
||||||
},
|
},
|
||||||
data: { title: 'admin.access-control.epeople.title', breadcrumbKey: 'admin.access-control.epeople' },
|
data: { title: 'admin.access-control.epeople.title', breadcrumbKey: 'admin.access-control.epeople' },
|
||||||
canActivate: [SiteAdministratorGuard]
|
canActivate: [SiteAdministratorGuard],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: `${EPERSON_PATH}/create`,
|
path: `${EPERSON_PATH}/create`,
|
||||||
@@ -51,40 +51,40 @@ import { EPersonResolver } from './epeople-registry/eperson-resolver.service';
|
|||||||
path: GROUP_PATH,
|
path: GROUP_PATH,
|
||||||
component: GroupsRegistryComponent,
|
component: GroupsRegistryComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
breadcrumb: I18nBreadcrumbResolver
|
breadcrumb: I18nBreadcrumbResolver,
|
||||||
},
|
},
|
||||||
data: { title: 'admin.access-control.groups.title', breadcrumbKey: 'admin.access-control.groups' },
|
data: { title: 'admin.access-control.groups.title', breadcrumbKey: 'admin.access-control.groups' },
|
||||||
canActivate: [GroupAdministratorGuard]
|
canActivate: [GroupAdministratorGuard],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: `${GROUP_PATH}/create`,
|
path: `${GROUP_PATH}/create`,
|
||||||
component: GroupFormComponent,
|
component: GroupFormComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
breadcrumb: I18nBreadcrumbResolver
|
breadcrumb: I18nBreadcrumbResolver,
|
||||||
},
|
},
|
||||||
data: { title: 'admin.access-control.groups.title.addGroup', breadcrumbKey: 'admin.access-control.groups.addGroup' },
|
data: { title: 'admin.access-control.groups.title.addGroup', breadcrumbKey: 'admin.access-control.groups.addGroup' },
|
||||||
canActivate: [GroupAdministratorGuard]
|
canActivate: [GroupAdministratorGuard],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: `${GROUP_PATH}/:groupId/edit`,
|
path: `${GROUP_PATH}/:groupId/edit`,
|
||||||
component: GroupFormComponent,
|
component: GroupFormComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
breadcrumb: I18nBreadcrumbResolver
|
breadcrumb: I18nBreadcrumbResolver,
|
||||||
},
|
},
|
||||||
data: { title: 'admin.access-control.groups.title.singleGroup', breadcrumbKey: 'admin.access-control.groups.singleGroup' },
|
data: { title: 'admin.access-control.groups.title.singleGroup', breadcrumbKey: 'admin.access-control.groups.singleGroup' },
|
||||||
canActivate: [GroupPageGuard]
|
canActivate: [GroupPageGuard],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'bulk-access',
|
path: 'bulk-access',
|
||||||
component: BulkAccessComponent,
|
component: BulkAccessComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
breadcrumb: I18nBreadcrumbResolver
|
breadcrumb: I18nBreadcrumbResolver,
|
||||||
},
|
},
|
||||||
data: { title: 'admin.access-control.bulk-access.title', breadcrumbKey: 'admin.access-control.bulk-access' },
|
data: { title: 'admin.access-control.bulk-access.title', breadcrumbKey: 'admin.access-control.bulk-access' },
|
||||||
canActivate: [SiteAdministratorGuard]
|
canActivate: [SiteAdministratorGuard],
|
||||||
},
|
},
|
||||||
])
|
]),
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* Routing module for the AccessControl section of the admin sidebar
|
* Routing module for the AccessControl section of the admin sidebar
|
||||||
|
@@ -1,23 +1,27 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
|
import { AbstractControl } from '@angular/forms';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
|
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import {
|
||||||
|
DYNAMIC_ERROR_MESSAGES_MATCHER,
|
||||||
|
DynamicErrorMessagesMatcher,
|
||||||
|
} from '@ng-dynamic-forms/core';
|
||||||
|
|
||||||
|
import { AccessControlFormModule } from '../shared/access-control-form-container/access-control-form.module';
|
||||||
|
import { FormModule } from '../shared/form/form.module';
|
||||||
|
import { SearchModule } from '../shared/search/search.module';
|
||||||
import { SharedModule } from '../shared/shared.module';
|
import { SharedModule } from '../shared/shared.module';
|
||||||
import { AccessControlRoutingModule } from './access-control-routing.module';
|
import { AccessControlRoutingModule } from './access-control-routing.module';
|
||||||
|
import { BulkAccessBrowseComponent } from './bulk-access/browse/bulk-access-browse.component';
|
||||||
|
import { BulkAccessComponent } from './bulk-access/bulk-access.component';
|
||||||
|
import { BulkAccessSettingsComponent } from './bulk-access/settings/bulk-access-settings.component';
|
||||||
import { EPeopleRegistryComponent } from './epeople-registry/epeople-registry.component';
|
import { EPeopleRegistryComponent } from './epeople-registry/epeople-registry.component';
|
||||||
import { EPersonFormComponent } from './epeople-registry/eperson-form/eperson-form.component';
|
import { EPersonFormComponent } from './epeople-registry/eperson-form/eperson-form.component';
|
||||||
import { GroupFormComponent } from './group-registry/group-form/group-form.component';
|
import { GroupFormComponent } from './group-registry/group-form/group-form.component';
|
||||||
import { MembersListComponent } from './group-registry/group-form/members-list/members-list.component';
|
import { MembersListComponent } from './group-registry/group-form/members-list/members-list.component';
|
||||||
import { SubgroupsListComponent } from './group-registry/group-form/subgroup-list/subgroups-list.component';
|
import { SubgroupsListComponent } from './group-registry/group-form/subgroup-list/subgroups-list.component';
|
||||||
import { GroupsRegistryComponent } from './group-registry/groups-registry.component';
|
import { GroupsRegistryComponent } from './group-registry/groups-registry.component';
|
||||||
import { FormModule } from '../shared/form/form.module';
|
|
||||||
import { DYNAMIC_ERROR_MESSAGES_MATCHER, DynamicErrorMessagesMatcher } from '@ng-dynamic-forms/core';
|
|
||||||
import { AbstractControl } from '@angular/forms';
|
|
||||||
import { BulkAccessComponent } from './bulk-access/bulk-access.component';
|
|
||||||
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
|
|
||||||
import { BulkAccessBrowseComponent } from './bulk-access/browse/bulk-access-browse.component';
|
|
||||||
import { BulkAccessSettingsComponent } from './bulk-access/settings/bulk-access-settings.component';
|
|
||||||
import { SearchModule } from '../shared/search/search.module';
|
|
||||||
import { AccessControlFormModule } from '../shared/access-control-form-container/access-control-form.module';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Condition for displaying error messages on email form field
|
* Condition for displaying error messages on email form field
|
||||||
@@ -55,9 +59,9 @@ export const ValidateEmailErrorStateMatcher: DynamicErrorMessagesMatcher =
|
|||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: DYNAMIC_ERROR_MESSAGES_MATCHER,
|
provide: DYNAMIC_ERROR_MESSAGES_MATCHER,
|
||||||
useValue: ValidateEmailErrorStateMatcher
|
useValue: ValidateEmailErrorStateMatcher,
|
||||||
},
|
},
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* This module handles all components related to the access control pages
|
* This module handles all components related to the access control pages
|
||||||
|
@@ -1,16 +1,22 @@
|
|||||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import {
|
||||||
import { of } from 'rxjs';
|
ComponentFixture,
|
||||||
import { NgbAccordionModule, NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
|
TestBed,
|
||||||
|
waitForAsync,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
NgbAccordionModule,
|
||||||
|
NgbNavModule,
|
||||||
|
} from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
|
||||||
import { BulkAccessBrowseComponent } from './bulk-access-browse.component';
|
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
import { SelectableListService } from '../../../shared/object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
import { SelectableObject } from '../../../shared/object-list/selectable-list/selectable-list.service.spec';
|
import { SelectableObject } from '../../../shared/object-list/selectable-list/selectable-list.service.spec';
|
||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
|
||||||
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||||
|
import { BulkAccessBrowseComponent } from './bulk-access-browse.component';
|
||||||
|
|
||||||
describe('BulkAccessBrowseComponent', () => {
|
describe('BulkAccessBrowseComponent', () => {
|
||||||
let component: BulkAccessBrowseComponent;
|
let component: BulkAccessBrowseComponent;
|
||||||
@@ -31,13 +37,13 @@ describe('BulkAccessBrowseComponent', () => {
|
|||||||
imports: [
|
imports: [
|
||||||
NgbAccordionModule,
|
NgbAccordionModule,
|
||||||
NgbNavModule,
|
NgbNavModule,
|
||||||
TranslateModule.forRoot()
|
TranslateModule.forRoot(),
|
||||||
],
|
],
|
||||||
declarations: [BulkAccessBrowseComponent],
|
declarations: [BulkAccessBrowseComponent],
|
||||||
providers: [ { provide: SelectableListService, useValue: selectableListService }, ],
|
providers: [ { provide: SelectableListService, useValue: selectableListService } ],
|
||||||
schemas: [
|
schemas: [
|
||||||
NO_ERRORS_SCHEMA
|
NO_ERRORS_SCHEMA,
|
||||||
]
|
],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -72,7 +78,7 @@ describe('BulkAccessBrowseComponent', () => {
|
|||||||
'elementsPerPage': 5,
|
'elementsPerPage': 5,
|
||||||
'totalElements': 2,
|
'totalElements': 2,
|
||||||
'totalPages': 1,
|
'totalPages': 1,
|
||||||
'currentPage': 1
|
'currentPage': 1,
|
||||||
}), [selected1, selected2]) ;
|
}), [selected1, selected2]) ;
|
||||||
const rd = createSuccessfulRemoteDataObject(list);
|
const rd = createSuccessfulRemoteDataObject(list);
|
||||||
|
|
||||||
|
@@ -1,19 +1,32 @@
|
|||||||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
import {
|
||||||
|
Component,
|
||||||
|
Input,
|
||||||
|
OnDestroy,
|
||||||
|
OnInit,
|
||||||
|
} from '@angular/core';
|
||||||
|
import {
|
||||||
|
BehaviorSubject,
|
||||||
|
Subscription,
|
||||||
|
} from 'rxjs';
|
||||||
|
import {
|
||||||
|
distinctUntilChanged,
|
||||||
|
map,
|
||||||
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
import {
|
||||||
import { distinctUntilChanged, map } from 'rxjs/operators';
|
buildPaginatedList,
|
||||||
|
PaginatedList,
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-page.component';
|
} from '../../../core/data/paginated-list.model';
|
||||||
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
|
||||||
import { SelectableListService } from '../../../shared/object-list/selectable-list/selectable-list.service';
|
|
||||||
import { SelectableListState } from '../../../shared/object-list/selectable-list/selectable-list.reducer';
|
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { buildPaginatedList, PaginatedList } from '../../../core/data/paginated-list.model';
|
|
||||||
import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model';
|
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
|
||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
||||||
|
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-page.component';
|
||||||
import { hasValue } from '../../../shared/empty.util';
|
import { hasValue } from '../../../shared/empty.util';
|
||||||
|
import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model';
|
||||||
|
import { SelectableListState } from '../../../shared/object-list/selectable-list/selectable-list.reducer';
|
||||||
|
import { SelectableListService } from '../../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
|
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||||
|
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-bulk-access-browse',
|
selector: 'ds-bulk-access-browse',
|
||||||
@@ -22,9 +35,9 @@ import { hasValue } from '../../../shared/empty.util';
|
|||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: SEARCH_CONFIG_SERVICE,
|
provide: SEARCH_CONFIG_SERVICE,
|
||||||
useClass: SearchConfigurationService
|
useClass: SearchConfigurationService,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
export class BulkAccessBrowseComponent implements OnInit, OnDestroy {
|
export class BulkAccessBrowseComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
@@ -49,7 +62,7 @@ export class BulkAccessBrowseComponent implements OnInit, OnDestroy {
|
|||||||
paginationOptions$: BehaviorSubject<PaginationComponentOptions> = new BehaviorSubject<PaginationComponentOptions>(Object.assign(new PaginationComponentOptions(), {
|
paginationOptions$: BehaviorSubject<PaginationComponentOptions> = new BehaviorSubject<PaginationComponentOptions>(Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'bas',
|
id: 'bas',
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,20 +80,20 @@ export class BulkAccessBrowseComponent implements OnInit, OnDestroy {
|
|||||||
this.subs.push(
|
this.subs.push(
|
||||||
this.selectableListService.getSelectableList(this.listId).pipe(
|
this.selectableListService.getSelectableList(this.listId).pipe(
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
map((list: SelectableListState) => this.generatePaginatedListBySelectedElements(list))
|
map((list: SelectableListState) => this.generatePaginatedListBySelectedElements(list)),
|
||||||
).subscribe(this.objectsSelected$)
|
).subscribe(this.objectsSelected$),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pageNext() {
|
pageNext() {
|
||||||
this.paginationOptions$.next(Object.assign(new PaginationComponentOptions(), this.paginationOptions$.value, {
|
this.paginationOptions$.next(Object.assign(new PaginationComponentOptions(), this.paginationOptions$.value, {
|
||||||
currentPage: this.paginationOptions$.value.currentPage + 1
|
currentPage: this.paginationOptions$.value.currentPage + 1,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
pagePrev() {
|
pagePrev() {
|
||||||
this.paginationOptions$.next(Object.assign(new PaginationComponentOptions(), this.paginationOptions$.value, {
|
this.paginationOptions$.next(Object.assign(new PaginationComponentOptions(), this.paginationOptions$.value, {
|
||||||
currentPage: this.paginationOptions$.value.currentPage - 1
|
currentPage: this.paginationOptions$.value.currentPage - 1,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,12 +112,12 @@ export class BulkAccessBrowseComponent implements OnInit, OnDestroy {
|
|||||||
elementsPerPage: this.paginationOptions$.value.pageSize,
|
elementsPerPage: this.paginationOptions$.value.pageSize,
|
||||||
totalElements: list?.selection.length,
|
totalElements: list?.selection.length,
|
||||||
totalPages: this.calculatePageCount(this.paginationOptions$.value.pageSize, list?.selection.length),
|
totalPages: this.calculatePageCount(this.paginationOptions$.value.pageSize, list?.selection.length),
|
||||||
currentPage: this.paginationOptions$.value.currentPage
|
currentPage: this.paginationOptions$.value.currentPage,
|
||||||
});
|
});
|
||||||
if (pageInfo.currentPage > pageInfo.totalPages) {
|
if (pageInfo.currentPage > pageInfo.totalPages) {
|
||||||
pageInfo.currentPage = pageInfo.totalPages;
|
pageInfo.currentPage = pageInfo.totalPages;
|
||||||
this.paginationOptions$.next(Object.assign(new PaginationComponentOptions(), this.paginationOptions$.value, {
|
this.paginationOptions$.next(Object.assign(new PaginationComponentOptions(), this.paginationOptions$.value, {
|
||||||
currentPage: pageInfo.currentPage
|
currentPage: pageInfo.currentPage,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
return createSuccessfulRemoteDataObject(buildPaginatedList(pageInfo, list?.selection || []));
|
return createSuccessfulRemoteDataObject(buildPaginatedList(pageInfo, list?.selection || []));
|
||||||
|
@@ -1,18 +1,20 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import {
|
||||||
|
ComponentFixture,
|
||||||
|
TestBed,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
|
|
||||||
import { BulkAccessComponent } from './bulk-access.component';
|
|
||||||
import { BulkAccessControlService } from '../../shared/access-control-form-container/bulk-access-control.service';
|
|
||||||
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
|
|
||||||
import { SelectableListState } from '../../shared/object-list/selectable-list/selectable-list.reducer';
|
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
|
||||||
import { Process } from '../../process-page/processes/process.model';
|
import { Process } from '../../process-page/processes/process.model';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { BulkAccessControlService } from '../../shared/access-control-form-container/bulk-access-control.service';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
|
import { SelectableListState } from '../../shared/object-list/selectable-list/selectable-list.reducer';
|
||||||
|
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
||||||
|
import { BulkAccessComponent } from './bulk-access.component';
|
||||||
|
|
||||||
describe('BulkAccessComponent', () => {
|
describe('BulkAccessComponent', () => {
|
||||||
let component: BulkAccessComponent;
|
let component: BulkAccessComponent;
|
||||||
@@ -31,35 +33,35 @@ describe('BulkAccessComponent', () => {
|
|||||||
'startDate': {
|
'startDate': {
|
||||||
'year': 2026,
|
'year': 2026,
|
||||||
'month': 5,
|
'month': 5,
|
||||||
'day': 31
|
'day': 31,
|
||||||
|
},
|
||||||
|
'endDate': null,
|
||||||
},
|
},
|
||||||
'endDate': null
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
'state': {
|
'state': {
|
||||||
'item': {
|
'item': {
|
||||||
'toggleStatus': true,
|
'toggleStatus': true,
|
||||||
'accessMode': 'replace'
|
'accessMode': 'replace',
|
||||||
},
|
},
|
||||||
'bitstream': {
|
'bitstream': {
|
||||||
'toggleStatus': false,
|
'toggleStatus': false,
|
||||||
'accessMode': '',
|
'accessMode': '',
|
||||||
'changesLimit': '',
|
'changesLimit': '',
|
||||||
'selectedBitstreams': []
|
'selectedBitstreams': [],
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const mockFile = {
|
const mockFile = {
|
||||||
'uuids': [
|
'uuids': [
|
||||||
'1234', '5678'
|
'1234', '5678',
|
||||||
],
|
],
|
||||||
'file': { }
|
'file': { },
|
||||||
};
|
};
|
||||||
|
|
||||||
const mockSettings: any = jasmine.createSpyObj('AccessControlFormContainerComponent', {
|
const mockSettings: any = jasmine.createSpyObj('AccessControlFormContainerComponent', {
|
||||||
getValue: jasmine.createSpy('getValue'),
|
getValue: jasmine.createSpy('getValue'),
|
||||||
reset: jasmine.createSpy('reset')
|
reset: jasmine.createSpy('reset'),
|
||||||
});
|
});
|
||||||
const selection: any[] = [{ indexableObject: { uuid: '1234' } }, { indexableObject: { uuid: '5678' } }];
|
const selection: any[] = [{ indexableObject: { uuid: '1234' } }, { indexableObject: { uuid: '5678' } }];
|
||||||
const selectableListState: SelectableListState = { id: 'test', selection };
|
const selectableListState: SelectableListState = { id: 'test', selection };
|
||||||
@@ -71,15 +73,15 @@ describe('BulkAccessComponent', () => {
|
|||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
RouterTestingModule,
|
RouterTestingModule,
|
||||||
TranslateModule.forRoot()
|
TranslateModule.forRoot(),
|
||||||
],
|
],
|
||||||
declarations: [ BulkAccessComponent ],
|
declarations: [ BulkAccessComponent ],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: BulkAccessControlService, useValue: bulkAccessControlServiceMock },
|
{ provide: BulkAccessControlService, useValue: bulkAccessControlServiceMock },
|
||||||
{ provide: NotificationsService, useValue: NotificationsServiceStub },
|
{ provide: NotificationsService, useValue: NotificationsServiceStub },
|
||||||
{ provide: SelectableListService, useValue: selectableListServiceMock }
|
{ provide: SelectableListService, useValue: selectableListServiceMock },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
});
|
});
|
||||||
|
@@ -1,17 +1,26 @@
|
|||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
import {
|
||||||
|
Component,
|
||||||
|
OnInit,
|
||||||
|
ViewChild,
|
||||||
|
} from '@angular/core';
|
||||||
|
import {
|
||||||
|
BehaviorSubject,
|
||||||
|
Subscription,
|
||||||
|
} from 'rxjs';
|
||||||
|
import {
|
||||||
|
distinctUntilChanged,
|
||||||
|
map,
|
||||||
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
|
||||||
import { distinctUntilChanged, map } from 'rxjs/operators';
|
|
||||||
|
|
||||||
import { BulkAccessSettingsComponent } from './settings/bulk-access-settings.component';
|
|
||||||
import { BulkAccessControlService } from '../../shared/access-control-form-container/bulk-access-control.service';
|
import { BulkAccessControlService } from '../../shared/access-control-form-container/bulk-access-control.service';
|
||||||
import { SelectableListState } from '../../shared/object-list/selectable-list/selectable-list.reducer';
|
import { SelectableListState } from '../../shared/object-list/selectable-list/selectable-list.reducer';
|
||||||
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
|
import { BulkAccessSettingsComponent } from './settings/bulk-access-settings.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-bulk-access',
|
selector: 'ds-bulk-access',
|
||||||
templateUrl: './bulk-access.component.html',
|
templateUrl: './bulk-access.component.html',
|
||||||
styleUrls: ['./bulk-access.component.scss']
|
styleUrls: ['./bulk-access.component.scss'],
|
||||||
})
|
})
|
||||||
export class BulkAccessComponent implements OnInit {
|
export class BulkAccessComponent implements OnInit {
|
||||||
|
|
||||||
@@ -37,7 +46,7 @@ export class BulkAccessComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private bulkAccessControlService: BulkAccessControlService,
|
private bulkAccessControlService: BulkAccessControlService,
|
||||||
private selectableListService: SelectableListService
|
private selectableListService: SelectableListService,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,8 +54,8 @@ export class BulkAccessComponent implements OnInit {
|
|||||||
this.subs.push(
|
this.subs.push(
|
||||||
this.selectableListService.getSelectableList(this.listId).pipe(
|
this.selectableListService.getSelectableList(this.listId).pipe(
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
map((list: SelectableListState) => this.generateIdListBySelectedElements(list))
|
map((list: SelectableListState) => this.generateIdListBySelectedElements(list)),
|
||||||
).subscribe(this.objectsSelected$)
|
).subscribe(this.objectsSelected$),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,12 +83,12 @@ export class BulkAccessComponent implements OnInit {
|
|||||||
const { file } = this.bulkAccessControlService.createPayloadFile({
|
const { file } = this.bulkAccessControlService.createPayloadFile({
|
||||||
bitstreamAccess,
|
bitstreamAccess,
|
||||||
itemAccess,
|
itemAccess,
|
||||||
state: settings.state
|
state: settings.state,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.bulkAccessControlService.executeScript(
|
this.bulkAccessControlService.executeScript(
|
||||||
this.objectsSelected$.value || [],
|
this.objectsSelected$.value || [],
|
||||||
file
|
file,
|
||||||
).subscribe();
|
).subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,8 +1,12 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import {
|
||||||
|
ComponentFixture,
|
||||||
|
TestBed,
|
||||||
|
} from '@angular/core/testing';
|
||||||
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { BulkAccessSettingsComponent } from './bulk-access-settings.component';
|
import { BulkAccessSettingsComponent } from './bulk-access-settings.component';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
||||||
|
|
||||||
describe('BulkAccessSettingsComponent', () => {
|
describe('BulkAccessSettingsComponent', () => {
|
||||||
let component: BulkAccessSettingsComponent;
|
let component: BulkAccessSettingsComponent;
|
||||||
@@ -15,35 +19,35 @@ describe('BulkAccessSettingsComponent', () => {
|
|||||||
'startDate': {
|
'startDate': {
|
||||||
'year': 2026,
|
'year': 2026,
|
||||||
'month': 5,
|
'month': 5,
|
||||||
'day': 31
|
'day': 31,
|
||||||
|
},
|
||||||
|
'endDate': null,
|
||||||
},
|
},
|
||||||
'endDate': null
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
'state': {
|
'state': {
|
||||||
'item': {
|
'item': {
|
||||||
'toggleStatus': true,
|
'toggleStatus': true,
|
||||||
'accessMode': 'replace'
|
'accessMode': 'replace',
|
||||||
},
|
},
|
||||||
'bitstream': {
|
'bitstream': {
|
||||||
'toggleStatus': false,
|
'toggleStatus': false,
|
||||||
'accessMode': '',
|
'accessMode': '',
|
||||||
'changesLimit': '',
|
'changesLimit': '',
|
||||||
'selectedBitstreams': []
|
'selectedBitstreams': [],
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const mockControl: any = jasmine.createSpyObj('AccessControlFormContainerComponent', {
|
const mockControl: any = jasmine.createSpyObj('AccessControlFormContainerComponent', {
|
||||||
getFormValue: jasmine.createSpy('getFormValue'),
|
getFormValue: jasmine.createSpy('getFormValue'),
|
||||||
reset: jasmine.createSpy('reset')
|
reset: jasmine.createSpy('reset'),
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [NgbAccordionModule, TranslateModule.forRoot()],
|
imports: [NgbAccordionModule, TranslateModule.forRoot()],
|
||||||
declarations: [BulkAccessSettingsComponent],
|
declarations: [BulkAccessSettingsComponent],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -1,13 +1,15 @@
|
|||||||
import { Component, ViewChild } from '@angular/core';
|
|
||||||
import {
|
import {
|
||||||
AccessControlFormContainerComponent
|
Component,
|
||||||
} from '../../../shared/access-control-form-container/access-control-form-container.component';
|
ViewChild,
|
||||||
|
} from '@angular/core';
|
||||||
|
|
||||||
|
import { AccessControlFormContainerComponent } from '../../../shared/access-control-form-container/access-control-form-container.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-bulk-access-settings',
|
selector: 'ds-bulk-access-settings',
|
||||||
templateUrl: 'bulk-access-settings.component.html',
|
templateUrl: 'bulk-access-settings.component.html',
|
||||||
styleUrls: ['./bulk-access-settings.component.scss'],
|
styleUrls: ['./bulk-access-settings.component.scss'],
|
||||||
exportAs: 'dsBulkSettings'
|
exportAs: 'dsBulkSettings',
|
||||||
})
|
})
|
||||||
export class BulkAccessSettingsComponent {
|
export class BulkAccessSettingsComponent {
|
||||||
|
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
/* eslint-disable max-classes-per-file */
|
/* eslint-disable max-classes-per-file */
|
||||||
import { Action } from '@ngrx/store';
|
import { Action } from '@ngrx/store';
|
||||||
|
|
||||||
import { EPerson } from '../../core/eperson/models/eperson.model';
|
import { EPerson } from '../../core/eperson/models/eperson.model';
|
||||||
import { type } from '../../shared/ngrx/type';
|
import { type } from '../../shared/ngrx/type';
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
<ds-themed-loading *ngIf="searching$ | async"></ds-themed-loading>
|
<ds-themed-loading *ngIf="searching$ | async"></ds-themed-loading>
|
||||||
<ds-pagination
|
<ds-pagination
|
||||||
*ngIf="(pageInfoState$ | async)?.totalElements > 0 && !(searching$ | async)"
|
*ngIf="(pageInfoState$ | async)?.totalElements > 0 && (searching$ | async) !== true"
|
||||||
[paginationOptions]="config"
|
[paginationOptions]="config"
|
||||||
[pageInfoState]="pageInfoState$"
|
[pageInfoState]="pageInfoState$"
|
||||||
[collectionSize]="(pageInfoState$ | async)?.totalElements"
|
[collectionSize]="(pageInfoState$ | async)?.totalElements"
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
|
|
||||||
</ds-pagination>
|
</ds-pagination>
|
||||||
|
|
||||||
<div *ngIf="(pageInfoState$ | async)?.totalElements == 0" class="alert alert-info w-100 mb-2" role="alert">
|
<div *ngIf="(pageInfoState$ | async)?.totalElements === 0" class="alert alert-info w-100 mb-2" role="alert">
|
||||||
{{labelPrefix + 'no-items' | translate}}
|
{{labelPrefix + 'no-items' | translate}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,30 +1,58 @@
|
|||||||
import { Router } from '@angular/router';
|
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
|
import {
|
||||||
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
DebugElement,
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
NO_ERRORS_SCHEMA,
|
||||||
import { BrowserModule, By } from '@angular/platform-browser';
|
} from '@angular/core';
|
||||||
import { NgbModule, NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import {
|
||||||
|
ComponentFixture,
|
||||||
|
fakeAsync,
|
||||||
|
TestBed,
|
||||||
|
tick,
|
||||||
|
waitForAsync,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
} from '@angular/forms';
|
||||||
|
import {
|
||||||
|
BrowserModule,
|
||||||
|
By,
|
||||||
|
} from '@angular/platform-browser';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import {
|
||||||
|
NgbModal,
|
||||||
|
NgbModule,
|
||||||
|
} from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { buildPaginatedList, PaginatedList } from '../../core/data/paginated-list.model';
|
import {
|
||||||
|
Observable,
|
||||||
|
of as observableOf,
|
||||||
|
} from 'rxjs';
|
||||||
|
|
||||||
|
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
||||||
|
import { FindListOptions } from '../../core/data/find-list-options.model';
|
||||||
|
import {
|
||||||
|
buildPaginatedList,
|
||||||
|
PaginatedList,
|
||||||
|
} from '../../core/data/paginated-list.model';
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
|
import { RequestService } from '../../core/data/request.service';
|
||||||
import { EPersonDataService } from '../../core/eperson/eperson-data.service';
|
import { EPersonDataService } from '../../core/eperson/eperson-data.service';
|
||||||
import { EPerson } from '../../core/eperson/models/eperson.model';
|
import { EPerson } from '../../core/eperson/models/eperson.model';
|
||||||
|
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
import { FormBuilderService } from '../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../shared/form/builder/form-builder.service';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
|
||||||
import { EPeopleRegistryComponent } from './epeople-registry.component';
|
|
||||||
import { EPersonMock, EPersonMock2 } from '../../shared/testing/eperson.mock';
|
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
|
||||||
import { getMockFormBuilderService } from '../../shared/mocks/form-builder-service.mock';
|
import { getMockFormBuilderService } from '../../shared/mocks/form-builder-service.mock';
|
||||||
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
|
import {
|
||||||
|
EPersonMock,
|
||||||
|
EPersonMock2,
|
||||||
|
} from '../../shared/testing/eperson.mock';
|
||||||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
||||||
import { RouterStub } from '../../shared/testing/router.stub';
|
|
||||||
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
|
||||||
import { RequestService } from '../../core/data/request.service';
|
|
||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
|
||||||
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
||||||
import { FindListOptions } from '../../core/data/find-list-options.model';
|
import { RouterStub } from '../../shared/testing/router.stub';
|
||||||
|
import { EPeopleRegistryComponent } from './epeople-registry.component';
|
||||||
|
|
||||||
describe('EPeopleRegistryComponent', () => {
|
describe('EPeopleRegistryComponent', () => {
|
||||||
let component: EPeopleRegistryComponent;
|
let component: EPeopleRegistryComponent;
|
||||||
@@ -48,7 +76,7 @@ describe('EPeopleRegistryComponent', () => {
|
|||||||
elementsPerPage: this.allEpeople.length,
|
elementsPerPage: this.allEpeople.length,
|
||||||
totalElements: this.allEpeople.length,
|
totalElements: this.allEpeople.length,
|
||||||
totalPages: 1,
|
totalPages: 1,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
}), this.allEpeople));
|
}), this.allEpeople));
|
||||||
},
|
},
|
||||||
getActiveEPerson(): Observable<EPerson> {
|
getActiveEPerson(): Observable<EPerson> {
|
||||||
@@ -63,7 +91,7 @@ describe('EPeopleRegistryComponent', () => {
|
|||||||
elementsPerPage: [result].length,
|
elementsPerPage: [result].length,
|
||||||
totalElements: [result].length,
|
totalElements: [result].length,
|
||||||
totalPages: 1,
|
totalPages: 1,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
}), [result]));
|
}), [result]));
|
||||||
}
|
}
|
||||||
if (scope === 'metadata') {
|
if (scope === 'metadata') {
|
||||||
@@ -72,7 +100,7 @@ describe('EPeopleRegistryComponent', () => {
|
|||||||
elementsPerPage: this.allEpeople.length,
|
elementsPerPage: this.allEpeople.length,
|
||||||
totalElements: this.allEpeople.length,
|
totalElements: this.allEpeople.length,
|
||||||
totalPages: 1,
|
totalPages: 1,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
}), this.allEpeople));
|
}), this.allEpeople));
|
||||||
}
|
}
|
||||||
const result = this.allEpeople.find((ePerson: EPerson) => {
|
const result = this.allEpeople.find((ePerson: EPerson) => {
|
||||||
@@ -82,14 +110,14 @@ describe('EPeopleRegistryComponent', () => {
|
|||||||
elementsPerPage: [result].length,
|
elementsPerPage: [result].length,
|
||||||
totalElements: [result].length,
|
totalElements: [result].length,
|
||||||
totalPages: 1,
|
totalPages: 1,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
}), [result]));
|
}), [result]));
|
||||||
}
|
}
|
||||||
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
||||||
elementsPerPage: this.allEpeople.length,
|
elementsPerPage: this.allEpeople.length,
|
||||||
totalElements: this.allEpeople.length,
|
totalElements: this.allEpeople.length,
|
||||||
totalPages: 1,
|
totalPages: 1,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
}), this.allEpeople));
|
}), this.allEpeople));
|
||||||
},
|
},
|
||||||
deleteEPerson(ePerson: EPerson): Observable<boolean> {
|
deleteEPerson(ePerson: EPerson): Observable<boolean> {
|
||||||
@@ -109,10 +137,10 @@ describe('EPeopleRegistryComponent', () => {
|
|||||||
},
|
},
|
||||||
getEPeoplePageRouterLink(): string {
|
getEPeoplePageRouterLink(): string {
|
||||||
return '/access-control/epeople';
|
return '/access-control/epeople';
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
authorizationService = jasmine.createSpyObj('authorizationService', {
|
authorizationService = jasmine.createSpyObj('authorizationService', {
|
||||||
isAuthorized: observableOf(true)
|
isAuthorized: observableOf(true),
|
||||||
});
|
});
|
||||||
builderService = getMockFormBuilderService();
|
builderService = getMockFormBuilderService();
|
||||||
|
|
||||||
@@ -129,9 +157,9 @@ describe('EPeopleRegistryComponent', () => {
|
|||||||
{ provide: FormBuilderService, useValue: builderService },
|
{ provide: FormBuilderService, useValue: builderService },
|
||||||
{ provide: Router, useValue: new RouterStub() },
|
{ provide: Router, useValue: new RouterStub() },
|
||||||
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) },
|
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) },
|
||||||
{ provide: PaginationService, useValue: paginationService }
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -202,7 +230,7 @@ describe('EPeopleRegistryComponent', () => {
|
|||||||
const deleteButtons = fixture.debugElement.queryAll(By.css('.access-control-deleteEPersonButton'));
|
const deleteButtons = fixture.debugElement.queryAll(By.css('.access-control-deleteEPersonButton'));
|
||||||
deleteButtons[0].triggerEventHandler('click', {
|
deleteButtons[0].triggerEventHandler('click', {
|
||||||
preventDefault: () => {/**/
|
preventDefault: () => {/**/
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
tick();
|
tick();
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@@ -1,28 +1,51 @@
|
|||||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
import {
|
||||||
|
Component,
|
||||||
|
OnDestroy,
|
||||||
|
OnInit,
|
||||||
|
} from '@angular/core';
|
||||||
import { UntypedFormBuilder } from '@angular/forms';
|
import { UntypedFormBuilder } from '@angular/forms';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { BehaviorSubject, combineLatest, Observable, Subscription } from 'rxjs';
|
import {
|
||||||
import { map, switchMap, take } from 'rxjs/operators';
|
BehaviorSubject,
|
||||||
import { buildPaginatedList, PaginatedList } from '../../core/data/paginated-list.model';
|
combineLatest,
|
||||||
|
Observable,
|
||||||
|
Subscription,
|
||||||
|
} from 'rxjs';
|
||||||
|
import {
|
||||||
|
map,
|
||||||
|
switchMap,
|
||||||
|
take,
|
||||||
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
||||||
|
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
||||||
|
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
|
||||||
|
import {
|
||||||
|
buildPaginatedList,
|
||||||
|
PaginatedList,
|
||||||
|
} from '../../core/data/paginated-list.model';
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
|
import { RequestService } from '../../core/data/request.service';
|
||||||
import { EPersonDataService } from '../../core/eperson/eperson-data.service';
|
import { EPersonDataService } from '../../core/eperson/eperson-data.service';
|
||||||
import { EPerson } from '../../core/eperson/models/eperson.model';
|
import { EPerson } from '../../core/eperson/models/eperson.model';
|
||||||
|
import { EpersonDtoModel } from '../../core/eperson/models/eperson-dto.model';
|
||||||
|
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||||
|
import { NoContent } from '../../core/shared/NoContent.model';
|
||||||
|
import {
|
||||||
|
getAllSucceededRemoteData,
|
||||||
|
getFirstCompletedRemoteData,
|
||||||
|
} from '../../core/shared/operators';
|
||||||
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
|
import { ConfirmationModalComponent } from '../../shared/confirmation-modal/confirmation-modal.component';
|
||||||
import { hasValue } from '../../shared/empty.util';
|
import { hasValue } from '../../shared/empty.util';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
import { EpersonDtoModel } from '../../core/eperson/models/eperson-dto.model';
|
import {
|
||||||
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
|
getEPersonEditRoute,
|
||||||
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
getEPersonsRoute,
|
||||||
import { getAllSucceededRemoteData, getFirstCompletedRemoteData } from '../../core/shared/operators';
|
} from '../access-control-routing-paths';
|
||||||
import { ConfirmationModalComponent } from '../../shared/confirmation-modal/confirmation-modal.component';
|
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
|
||||||
import { RequestService } from '../../core/data/request.service';
|
|
||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
|
||||||
import { NoContent } from '../../core/shared/NoContent.model';
|
|
||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
|
||||||
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
|
||||||
import { getEPersonEditRoute, getEPersonsRoute } from '../access-control-routing-paths';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-epeople-registry',
|
selector: 'ds-epeople-registry',
|
||||||
@@ -62,7 +85,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
|
|||||||
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'elp',
|
id: 'elp',
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
// The search form
|
// The search form
|
||||||
@@ -121,7 +144,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
|
|||||||
epersonDtoModel.ableToDelete = authorized;
|
epersonDtoModel.ableToDelete = authorized;
|
||||||
epersonDtoModel.eperson = eperson;
|
epersonDtoModel.eperson = eperson;
|
||||||
return epersonDtoModel;
|
return epersonDtoModel;
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
})).pipe(map((dtos: EpersonDtoModel[]) => {
|
})).pipe(map((dtos: EpersonDtoModel[]) => {
|
||||||
return buildPaginatedList(epeople.pageInfo, dtos);
|
return buildPaginatedList(epeople.pageInfo, dtos);
|
||||||
@@ -151,14 +174,14 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
|
|||||||
const scope: string = data.scope;
|
const scope: string = data.scope;
|
||||||
if (query != null && this.currentSearchQuery !== query) {
|
if (query != null && this.currentSearchQuery !== query) {
|
||||||
void this.router.navigate([getEPersonsRoute()], {
|
void this.router.navigate([getEPersonsRoute()], {
|
||||||
queryParamsHandling: 'merge'
|
queryParamsHandling: 'merge',
|
||||||
});
|
});
|
||||||
this.currentSearchQuery = query;
|
this.currentSearchQuery = query;
|
||||||
this.paginationService.resetPage(this.config.id);
|
this.paginationService.resetPage(this.config.id);
|
||||||
}
|
}
|
||||||
if (scope != null && this.currentSearchScope !== scope) {
|
if (scope != null && this.currentSearchScope !== scope) {
|
||||||
void this.router.navigate([getEPersonsRoute()], {
|
void this.router.navigate([getEPersonsRoute()], {
|
||||||
queryParamsHandling: 'merge'
|
queryParamsHandling: 'merge',
|
||||||
});
|
});
|
||||||
this.currentSearchScope = scope;
|
this.currentSearchScope = scope;
|
||||||
this.paginationService.resetPage(this.config.id);
|
this.paginationService.resetPage(this.config.id);
|
||||||
@@ -166,15 +189,15 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
return this.epersonService.searchByScope(this.currentSearchScope, this.currentSearchQuery, {
|
return this.epersonService.searchByScope(this.currentSearchScope, this.currentSearchQuery, {
|
||||||
currentPage: findListOptions.currentPage,
|
currentPage: findListOptions.currentPage,
|
||||||
elementsPerPage: findListOptions.pageSize
|
elementsPerPage: findListOptions.pageSize,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
),
|
),
|
||||||
getAllSucceededRemoteData(),
|
getAllSucceededRemoteData(),
|
||||||
).subscribe((peopleRD) => {
|
).subscribe((peopleRD) => {
|
||||||
this.ePeople$.next(peopleRD.payload);
|
this.ePeople$.next(peopleRD.payload);
|
||||||
this.pageInfoState$.next(peopleRD.payload.pageInfo);
|
this.pageInfoState$.next(peopleRD.payload.pageInfo);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +207,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
isActive(eperson: EPerson): Observable<boolean> {
|
isActive(eperson: EPerson): Observable<boolean> {
|
||||||
return this.getActiveEPerson().pipe(
|
return this.getActiveEPerson().pipe(
|
||||||
map((activeEPerson) => eperson === activeEPerson)
|
map((activeEPerson) => eperson === activeEPerson),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,12 @@
|
|||||||
import { EPeopleRegistryCancelEPersonAction, EPeopleRegistryEditEPersonAction } from './epeople-registry.actions';
|
|
||||||
import { ePeopleRegistryReducer, EPeopleRegistryState } from './epeople-registry.reducers';
|
|
||||||
import { EPersonMock } from '../../shared/testing/eperson.mock';
|
import { EPersonMock } from '../../shared/testing/eperson.mock';
|
||||||
|
import {
|
||||||
|
EPeopleRegistryCancelEPersonAction,
|
||||||
|
EPeopleRegistryEditEPersonAction,
|
||||||
|
} from './epeople-registry.actions';
|
||||||
|
import {
|
||||||
|
ePeopleRegistryReducer,
|
||||||
|
EPeopleRegistryState,
|
||||||
|
} from './epeople-registry.reducers';
|
||||||
|
|
||||||
const initialState: EPeopleRegistryState = {
|
const initialState: EPeopleRegistryState = {
|
||||||
editEPerson: null,
|
editEPerson: null,
|
||||||
|
@@ -2,7 +2,7 @@ import { EPerson } from '../../core/eperson/models/eperson.model';
|
|||||||
import {
|
import {
|
||||||
EPeopleRegistryAction,
|
EPeopleRegistryAction,
|
||||||
EPeopleRegistryActionTypes,
|
EPeopleRegistryActionTypes,
|
||||||
EPeopleRegistryEditEPersonAction
|
EPeopleRegistryEditEPersonAction,
|
||||||
} from './epeople-registry.actions';
|
} from './epeople-registry.actions';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,13 +30,13 @@ export function ePeopleRegistryReducer(state = initialState, action: EPeopleRegi
|
|||||||
|
|
||||||
case EPeopleRegistryActionTypes.EDIT_EPERSON: {
|
case EPeopleRegistryActionTypes.EDIT_EPERSON: {
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
editEPerson: (action as EPeopleRegistryEditEPersonAction).eperson
|
editEPerson: (action as EPeopleRegistryEditEPersonAction).eperson,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
case EPeopleRegistryActionTypes.CANCEL_EDIT_EPERSON: {
|
case EPeopleRegistryActionTypes.CANCEL_EDIT_EPERSON: {
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
editEPerson: null
|
editEPerson: null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="displayResetPassword" between class="btn-group">
|
<div *ngIf="displayResetPassword" between class="btn-group">
|
||||||
<button class="btn btn-primary" [disabled]="!(canReset$ | async)" type="button" (click)="resetPassword()">
|
<button class="btn btn-primary" [disabled]="(canReset$ | async) !== true" type="button" (click)="resetPassword()">
|
||||||
<i class="fa fa-key"></i> {{'admin.access-control.epeople.actions.reset' | translate}}
|
<i class="fa fa-key"></i> {{'admin.access-control.epeople.actions.reset' | translate}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -47,13 +47,13 @@
|
|||||||
<div *ngIf="epersonService.getActiveEPerson() | async">
|
<div *ngIf="epersonService.getActiveEPerson() | async">
|
||||||
<h2>{{messagePrefix + '.groupsEPersonIsMemberOf' | translate}}</h2>
|
<h2>{{messagePrefix + '.groupsEPersonIsMemberOf' | translate}}</h2>
|
||||||
|
|
||||||
<ds-themed-loading [showMessage]="false" *ngIf="!(groups | async)"></ds-themed-loading>
|
<ds-themed-loading [showMessage]="false" *ngIf="groups$ | async | dsHasNoValue"></ds-themed-loading>
|
||||||
|
|
||||||
<ds-pagination
|
<ds-pagination
|
||||||
*ngIf="(groups | async)?.payload?.totalElements > 0"
|
*ngIf="(groups$ | async)?.payload?.totalElements > 0"
|
||||||
[paginationOptions]="config"
|
[paginationOptions]="config"
|
||||||
[pageInfoState]="(groups | async)?.payload"
|
[pageInfoState]="groupsPageInfoState$"
|
||||||
[collectionSize]="(groups | async)?.payload?.totalElements"
|
[collectionSize]="(groups$ | async)?.payload?.totalElements"
|
||||||
[hideGear]="true"
|
[hideGear]="true"
|
||||||
[hidePagerWhenSinglePage]="true"
|
[hidePagerWhenSinglePage]="true"
|
||||||
(pageChange)="onPageChange($event)">
|
(pageChange)="onPageChange($event)">
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let group of (groups | async)?.payload?.page">
|
<tr *ngFor="let group of (groups$ | async)?.payload?.page">
|
||||||
<td class="align-middle">{{group.id}}</td>
|
<td class="align-middle">{{group.id}}</td>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
<a (click)="groupsDataService.startEditingNewGroup(group)"
|
<a (click)="groupsDataService.startEditingNewGroup(group)"
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
|
|
||||||
</ds-pagination>
|
</ds-pagination>
|
||||||
|
|
||||||
<div *ngIf="(groups | async)?.payload?.totalElements == 0" class="alert alert-info w-100 mb-2" role="alert">
|
<div *ngIf="(groups$ | async)?.payload?.totalElements === 0" class="alert alert-info w-100 mb-2" role="alert">
|
||||||
<div>{{messagePrefix + '.memberOfNoGroups' | translate}}</div>
|
<div>{{messagePrefix + '.memberOfNoGroups' | translate}}</div>
|
||||||
<div>
|
<div>
|
||||||
<button [routerLink]="[groupsDataService.getGroupRegistryRouterLink()]"
|
<button [routerLink]="[groupsDataService.getGroupRegistryRouterLink()]"
|
||||||
|
@@ -1,40 +1,70 @@
|
|||||||
import { Observable, of as observableOf } from 'rxjs';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
import {
|
||||||
import { UntypedFormControl, UntypedFormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
ComponentFixture,
|
||||||
import { BrowserModule, By } from '@angular/platform-browser';
|
TestBed,
|
||||||
|
waitForAsync,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
UntypedFormControl,
|
||||||
|
UntypedFormGroup,
|
||||||
|
Validators,
|
||||||
|
} from '@angular/forms';
|
||||||
|
import {
|
||||||
|
BrowserModule,
|
||||||
|
By,
|
||||||
|
} from '@angular/platform-browser';
|
||||||
|
import {
|
||||||
|
ActivatedRoute,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
import {
|
||||||
import { buildPaginatedList, PaginatedList } from '../../../core/data/paginated-list.model';
|
TranslateLoader,
|
||||||
|
TranslateModule,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
|
import {
|
||||||
|
Observable,
|
||||||
|
of as observableOf,
|
||||||
|
} from 'rxjs';
|
||||||
|
|
||||||
|
import { AuthService } from '../../../core/auth/auth.service';
|
||||||
|
import { EpersonRegistrationService } from '../../../core/data/eperson-registration.service';
|
||||||
|
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
|
||||||
|
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||||
|
import {
|
||||||
|
buildPaginatedList,
|
||||||
|
PaginatedList,
|
||||||
|
} from '../../../core/data/paginated-list.model';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
import { EPersonDataService } from '../../../core/eperson/eperson-data.service';
|
import { EPersonDataService } from '../../../core/eperson/eperson-data.service';
|
||||||
|
import { GroupDataService } from '../../../core/eperson/group-data.service';
|
||||||
import { EPerson } from '../../../core/eperson/models/eperson.model';
|
import { EPerson } from '../../../core/eperson/models/eperson.model';
|
||||||
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||||
|
import { getMockFormBuilderService } from '../../../shared/mocks/form-builder-service.mock';
|
||||||
|
import { TranslateLoaderMock } from '../../../shared/mocks/translate-loader.mock';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
|
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
||||||
|
import { AuthServiceStub } from '../../../shared/testing/auth-service.stub';
|
||||||
|
import {
|
||||||
|
EPersonMock,
|
||||||
|
EPersonMock2,
|
||||||
|
} from '../../../shared/testing/eperson.mock';
|
||||||
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
|
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||||
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
|
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
||||||
|
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
||||||
|
import { HasNoValuePipe } from '../../../shared/utils/has-no-value.pipe';
|
||||||
import { EPeopleRegistryComponent } from '../epeople-registry.component';
|
import { EPeopleRegistryComponent } from '../epeople-registry.component';
|
||||||
import { EPersonFormComponent } from './eperson-form.component';
|
import { EPersonFormComponent } from './eperson-form.component';
|
||||||
import { EPersonMock, EPersonMock2 } from '../../../shared/testing/eperson.mock';
|
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
|
||||||
import { getMockFormBuilderService } from '../../../shared/mocks/form-builder-service.mock';
|
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
|
||||||
import { TranslateLoaderMock } from '../../../shared/mocks/translate-loader.mock';
|
|
||||||
import { AuthService } from '../../../core/auth/auth.service';
|
|
||||||
import { AuthServiceStub } from '../../../shared/testing/auth-service.stub';
|
|
||||||
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
|
|
||||||
import { GroupDataService } from '../../../core/eperson/group-data.service';
|
|
||||||
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
|
||||||
import { RequestService } from '../../../core/data/request.service';
|
|
||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
|
||||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
|
||||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
|
||||||
import { ValidateEmailNotTaken } from './validators/email-taken.validator';
|
import { ValidateEmailNotTaken } from './validators/email-taken.validator';
|
||||||
import { EpersonRegistrationService } from '../../../core/data/eperson-registration.service';
|
|
||||||
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
|
||||||
import { RouterStub } from '../../../shared/testing/router.stub';
|
|
||||||
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
|
||||||
|
|
||||||
describe('EPersonFormComponent', () => {
|
describe('EPersonFormComponent', () => {
|
||||||
let component: EPersonFormComponent;
|
let component: EPersonFormComponent;
|
||||||
@@ -115,7 +145,7 @@ describe('EPersonFormComponent', () => {
|
|||||||
},
|
},
|
||||||
findById(_id: string, _useCachedVersionIfAvailable = true, _reRequestOnStale = true, ..._linksToFollow: FollowLinkConfig<EPerson>[]): Observable<RemoteData<EPerson>> {
|
findById(_id: string, _useCachedVersionIfAvailable = true, _reRequestOnStale = true, ..._linksToFollow: FollowLinkConfig<EPerson>[]): Observable<RemoteData<EPerson>> {
|
||||||
return createSuccessfulRemoteDataObject$(null);
|
return createSuccessfulRemoteDataObject$(null);
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
builderService = Object.assign(getMockFormBuilderService(),{
|
builderService = Object.assign(getMockFormBuilderService(),{
|
||||||
createFormGroup(formModel, options = null) {
|
createFormGroup(formModel, options = null) {
|
||||||
@@ -178,7 +208,7 @@ describe('EPersonFormComponent', () => {
|
|||||||
},
|
},
|
||||||
isObject(value) {
|
isObject(value) {
|
||||||
return typeof value === 'object' && value !== null;
|
return typeof value === 'object' && value !== null;
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
authService = new AuthServiceStub();
|
authService = new AuthServiceStub();
|
||||||
authorizationService = jasmine.createSpyObj('authorizationService', {
|
authorizationService = jasmine.createSpyObj('authorizationService', {
|
||||||
@@ -187,7 +217,7 @@ describe('EPersonFormComponent', () => {
|
|||||||
});
|
});
|
||||||
groupsDataService = jasmine.createSpyObj('groupsDataService', {
|
groupsDataService = jasmine.createSpyObj('groupsDataService', {
|
||||||
findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
|
findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
|
||||||
getGroupRegistryRouterLink: ''
|
getGroupRegistryRouterLink: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
paginationService = new PaginationServiceStub();
|
paginationService = new PaginationServiceStub();
|
||||||
@@ -198,11 +228,14 @@ describe('EPersonFormComponent', () => {
|
|||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: TranslateLoaderMock
|
useClass: TranslateLoaderMock,
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
declarations: [EPersonFormComponent],
|
declarations: [
|
||||||
|
EPersonFormComponent,
|
||||||
|
HasNoValuePipe,
|
||||||
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: EPersonDataService, useValue: ePersonDataServiceStub },
|
{ provide: EPersonDataService, useValue: ePersonDataServiceStub },
|
||||||
{ provide: GroupDataService, useValue: groupsDataService },
|
{ provide: GroupDataService, useValue: groupsDataService },
|
||||||
@@ -215,14 +248,14 @@ describe('EPersonFormComponent', () => {
|
|||||||
{ provide: EpersonRegistrationService, useValue: epersonRegistrationService },
|
{ provide: EpersonRegistrationService, useValue: epersonRegistrationService },
|
||||||
{ provide: ActivatedRoute, useValue: route },
|
{ provide: ActivatedRoute, useValue: route },
|
||||||
{ provide: Router, useValue: router },
|
{ provide: Router, useValue: router },
|
||||||
EPeopleRegistryComponent
|
EPeopleRegistryComponent,
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
epersonRegistrationService = jasmine.createSpyObj('epersonRegistrationService', {
|
epersonRegistrationService = jasmine.createSpyObj('epersonRegistrationService', {
|
||||||
registerEmail: createSuccessfulRemoteDataObject$(null)
|
registerEmail: createSuccessfulRemoteDataObject$(null),
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -254,12 +287,12 @@ describe('EPersonFormComponent', () => {
|
|||||||
metadata: {
|
metadata: {
|
||||||
'eperson.firstname': [
|
'eperson.firstname': [
|
||||||
{
|
{
|
||||||
value: firstName
|
value: firstName,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
'eperson.lastname': [
|
'eperson.lastname': [
|
||||||
{
|
{
|
||||||
value: lastName
|
value: lastName,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -328,7 +361,7 @@ describe('EPersonFormComponent', () => {
|
|||||||
const ePersonServiceWithEperson = Object.assign(ePersonDataServiceStub,{
|
const ePersonServiceWithEperson = Object.assign(ePersonDataServiceStub,{
|
||||||
getEPersonByEmail(): Observable<RemoteData<EPerson>> {
|
getEPersonByEmail(): Observable<RemoteData<EPerson>> {
|
||||||
return createSuccessfulRemoteDataObject$(EPersonMock);
|
return createSuccessfulRemoteDataObject$(EPersonMock);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
component.formGroup.controls.email.setValue('test@test.com');
|
component.formGroup.controls.email.setValue('test@test.com');
|
||||||
component.formGroup.controls.email.setAsyncValidators(ValidateEmailNotTaken.createValidator(ePersonServiceWithEperson));
|
component.formGroup.controls.email.setAsyncValidators(ValidateEmailNotTaken.createValidator(ePersonServiceWithEperson));
|
||||||
@@ -363,12 +396,12 @@ describe('EPersonFormComponent', () => {
|
|||||||
metadata: {
|
metadata: {
|
||||||
'eperson.firstname': [
|
'eperson.firstname': [
|
||||||
{
|
{
|
||||||
value: firstName
|
value: firstName,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
'eperson.lastname': [
|
'eperson.lastname': [
|
||||||
{
|
{
|
||||||
value: lastName
|
value: lastName,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -404,19 +437,19 @@ describe('EPersonFormComponent', () => {
|
|||||||
metadata: {
|
metadata: {
|
||||||
'eperson.firstname': [
|
'eperson.firstname': [
|
||||||
{
|
{
|
||||||
value: firstName
|
value: firstName,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
'eperson.lastname': [
|
'eperson.lastname': [
|
||||||
{
|
{
|
||||||
value: lastName
|
value: lastName,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
email: email,
|
email: email,
|
||||||
canLogIn: canLogIn,
|
canLogIn: canLogIn,
|
||||||
requireCertificate: requireCertificate,
|
requireCertificate: requireCertificate,
|
||||||
_links: undefined
|
_links: undefined,
|
||||||
});
|
});
|
||||||
spyOn(ePersonDataServiceStub, 'getActiveEPerson').and.returnValue(observableOf(expectedWithId));
|
spyOn(ePersonDataServiceStub, 'getActiveEPerson').and.returnValue(observableOf(expectedWithId));
|
||||||
component.onSubmit();
|
component.onSubmit();
|
||||||
@@ -436,7 +469,7 @@ describe('EPersonFormComponent', () => {
|
|||||||
spyOn(authService, 'impersonate').and.callThrough();
|
spyOn(authService, 'impersonate').and.callThrough();
|
||||||
ePersonId = 'testEPersonId';
|
ePersonId = 'testEPersonId';
|
||||||
component.epersonInitial = Object.assign(new EPerson(), {
|
component.epersonInitial = Object.assign(new EPerson(), {
|
||||||
id: ePersonId
|
id: ePersonId,
|
||||||
});
|
});
|
||||||
component.impersonate();
|
component.impersonate();
|
||||||
});
|
});
|
||||||
@@ -524,7 +557,7 @@ describe('EPersonFormComponent', () => {
|
|||||||
ePersonEmail = 'person.email@4science.it';
|
ePersonEmail = 'person.email@4science.it';
|
||||||
component.epersonInitial = Object.assign(new EPerson(), {
|
component.epersonInitial = Object.assign(new EPerson(), {
|
||||||
id: ePersonId,
|
id: ePersonId,
|
||||||
email: ePersonEmail
|
email: ePersonEmail,
|
||||||
});
|
});
|
||||||
component.resetPassword();
|
component.resetPassword();
|
||||||
});
|
});
|
||||||
|
@@ -1,45 +1,68 @@
|
|||||||
import { ChangeDetectorRef, Component, EventEmitter, OnDestroy, OnInit, Output } from '@angular/core';
|
import {
|
||||||
|
ChangeDetectorRef,
|
||||||
|
Component,
|
||||||
|
EventEmitter,
|
||||||
|
OnDestroy,
|
||||||
|
OnInit,
|
||||||
|
Output,
|
||||||
|
} from '@angular/core';
|
||||||
import { UntypedFormGroup } from '@angular/forms';
|
import { UntypedFormGroup } from '@angular/forms';
|
||||||
|
import {
|
||||||
|
ActivatedRoute,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import {
|
import {
|
||||||
DynamicCheckboxModel,
|
DynamicCheckboxModel,
|
||||||
DynamicFormControlModel,
|
DynamicFormControlModel,
|
||||||
DynamicFormLayout,
|
DynamicFormLayout,
|
||||||
DynamicInputModel
|
DynamicInputModel,
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { combineLatest as observableCombineLatest, Observable, of as observableOf, Subscription } from 'rxjs';
|
import {
|
||||||
import { debounceTime, finalize, map, switchMap, take } from 'rxjs/operators';
|
combineLatest as observableCombineLatest,
|
||||||
|
Observable,
|
||||||
|
of as observableOf,
|
||||||
|
Subscription,
|
||||||
|
} from 'rxjs';
|
||||||
|
import {
|
||||||
|
debounceTime,
|
||||||
|
finalize,
|
||||||
|
map,
|
||||||
|
switchMap,
|
||||||
|
take,
|
||||||
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { AuthService } from '../../../core/auth/auth.service';
|
||||||
|
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
|
||||||
|
import { EpersonRegistrationService } from '../../../core/data/eperson-registration.service';
|
||||||
|
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
|
||||||
|
import { FeatureID } from '../../../core/data/feature-authorization/feature-id';
|
||||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
import { EPersonDataService } from '../../../core/eperson/eperson-data.service';
|
import { EPersonDataService } from '../../../core/eperson/eperson-data.service';
|
||||||
import { GroupDataService } from '../../../core/eperson/group-data.service';
|
import { GroupDataService } from '../../../core/eperson/group-data.service';
|
||||||
import { EPerson } from '../../../core/eperson/models/eperson.model';
|
import { EPerson } from '../../../core/eperson/models/eperson.model';
|
||||||
import { Group } from '../../../core/eperson/models/group.model';
|
import { Group } from '../../../core/eperson/models/group.model';
|
||||||
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
|
import { NoContent } from '../../../core/shared/NoContent.model';
|
||||||
import {
|
import {
|
||||||
getFirstCompletedRemoteData,
|
getFirstCompletedRemoteData,
|
||||||
getFirstSucceededRemoteData,
|
getFirstSucceededRemoteData,
|
||||||
getRemoteDataPayload
|
getRemoteDataPayload,
|
||||||
} from '../../../core/shared/operators';
|
} from '../../../core/shared/operators';
|
||||||
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
|
import { Registration } from '../../../core/shared/registration.model';
|
||||||
|
import { TYPE_REQUEST_FORGOT } from '../../../register-email-form/register-email-form.component';
|
||||||
|
import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component';
|
||||||
import { hasValue } from '../../../shared/empty.util';
|
import { hasValue } from '../../../shared/empty.util';
|
||||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||||
import { AuthService } from '../../../core/auth/auth.service';
|
|
||||||
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
|
|
||||||
import { FeatureID } from '../../../core/data/feature-authorization/feature-id';
|
|
||||||
import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component';
|
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
|
||||||
import { RequestService } from '../../../core/data/request.service';
|
|
||||||
import { NoContent } from '../../../core/shared/NoContent.model';
|
|
||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
|
||||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||||
import { ValidateEmailNotTaken } from './validators/email-taken.validator';
|
|
||||||
import { Registration } from '../../../core/shared/registration.model';
|
|
||||||
import { EpersonRegistrationService } from '../../../core/data/eperson-registration.service';
|
|
||||||
import { TYPE_REQUEST_FORGOT } from '../../../register-email-form/register-email-form.component';
|
|
||||||
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
|
||||||
import { getEPersonsRoute } from '../../access-control-routing-paths';
|
import { getEPersonsRoute } from '../../access-control-routing-paths';
|
||||||
|
import { ValidateEmailNotTaken } from './validators/email-taken.validator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-eperson-form',
|
selector: 'ds-eperson-form',
|
||||||
@@ -83,28 +106,28 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
formLayout: DynamicFormLayout = {
|
formLayout: DynamicFormLayout = {
|
||||||
firstName: {
|
firstName: {
|
||||||
grid: {
|
grid: {
|
||||||
host: 'row'
|
host: 'row',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
lastName: {
|
lastName: {
|
||||||
grid: {
|
grid: {
|
||||||
host: 'row'
|
host: 'row',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
email: {
|
email: {
|
||||||
grid: {
|
grid: {
|
||||||
host: 'row'
|
host: 'row',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
canLogIn: {
|
canLogIn: {
|
||||||
grid: {
|
grid: {
|
||||||
host: 'col col-sm-6 d-inline-block'
|
host: 'col col-sm-6 d-inline-block',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
requireCertificate: {
|
requireCertificate: {
|
||||||
grid: {
|
grid: {
|
||||||
host: 'col col-sm-6 d-inline-block'
|
host: 'col col-sm-6 d-inline-block',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -147,7 +170,12 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
/**
|
/**
|
||||||
* A list of all the groups this EPerson is a member of
|
* A list of all the groups this EPerson is a member of
|
||||||
*/
|
*/
|
||||||
groups: Observable<RemoteData<PaginatedList<Group>>>;
|
groups$: Observable<RemoteData<PaginatedList<Group>>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The pagination of the {@link groups$} list.
|
||||||
|
*/
|
||||||
|
groupsPageInfoState$: Observable<PageInfo>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pagination config used to display the list of groups
|
* Pagination config used to display the list of groups
|
||||||
@@ -155,7 +183,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'gem',
|
id: 'gem',
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -257,23 +285,23 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
required: true,
|
required: true,
|
||||||
errorMessages: {
|
errorMessages: {
|
||||||
emailTaken: 'error.validation.emailTaken',
|
emailTaken: 'error.validation.emailTaken',
|
||||||
pattern: 'error.validation.NotValidEmail'
|
pattern: 'error.validation.NotValidEmail',
|
||||||
},
|
},
|
||||||
hint: emailHint
|
hint: emailHint,
|
||||||
});
|
});
|
||||||
this.canLogIn = new DynamicCheckboxModel(
|
this.canLogIn = new DynamicCheckboxModel(
|
||||||
{
|
{
|
||||||
id: 'canLogIn',
|
id: 'canLogIn',
|
||||||
label: canLogIn,
|
label: canLogIn,
|
||||||
name: 'canLogIn',
|
name: 'canLogIn',
|
||||||
value: (this.epersonInitial != null ? this.epersonInitial.canLogIn : true)
|
value: (this.epersonInitial != null ? this.epersonInitial.canLogIn : true),
|
||||||
});
|
});
|
||||||
this.requireCertificate = new DynamicCheckboxModel(
|
this.requireCertificate = new DynamicCheckboxModel(
|
||||||
{
|
{
|
||||||
id: 'requireCertificate',
|
id: 'requireCertificate',
|
||||||
label: requireCertificate,
|
label: requireCertificate,
|
||||||
name: 'requireCertificate',
|
name: 'requireCertificate',
|
||||||
value: (this.epersonInitial != null ? this.epersonInitial.requireCertificate : false)
|
value: (this.epersonInitial != null ? this.epersonInitial.requireCertificate : false),
|
||||||
});
|
});
|
||||||
this.formModel = [
|
this.formModel = [
|
||||||
this.firstName,
|
this.firstName,
|
||||||
@@ -285,9 +313,9 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
||||||
this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => {
|
this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => {
|
||||||
if (eperson != null) {
|
if (eperson != null) {
|
||||||
this.groups = this.groupsDataService.findListByHref(eperson._links.groups.href, {
|
this.groups$ = this.groupsDataService.findListByHref(eperson._links.groups.href, {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
elementsPerPage: this.config.pageSize
|
elementsPerPage: this.config.pageSize,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.formGroup.patchValue({
|
this.formGroup.patchValue({
|
||||||
@@ -295,7 +323,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
lastName: eperson != null ? eperson.firstMetadataValue('eperson.lastname') : '',
|
lastName: eperson != null ? eperson.firstMetadataValue('eperson.lastname') : '',
|
||||||
email: eperson != null ? eperson.email : '',
|
email: eperson != null ? eperson.email : '',
|
||||||
canLogIn: eperson != null ? eperson.canLogIn : true,
|
canLogIn: eperson != null ? eperson.canLogIn : true,
|
||||||
requireCertificate: eperson != null ? eperson.requireCertificate : false
|
requireCertificate: eperson != null ? eperson.requireCertificate : false,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (eperson === null && !!this.formGroup.controls.email) {
|
if (eperson === null && !!this.formGroup.controls.email) {
|
||||||
@@ -308,11 +336,11 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
const activeEPerson$ = this.epersonService.getActiveEPerson();
|
const activeEPerson$ = this.epersonService.getActiveEPerson();
|
||||||
|
|
||||||
this.groups = activeEPerson$.pipe(
|
this.groups$ = activeEPerson$.pipe(
|
||||||
switchMap((eperson) => {
|
switchMap((eperson) => {
|
||||||
return observableCombineLatest([observableOf(eperson), this.paginationService.getFindListOptions(this.config.id, {
|
return observableCombineLatest([observableOf(eperson), this.paginationService.getFindListOptions(this.config.id, {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
elementsPerPage: this.config.pageSize
|
elementsPerPage: this.config.pageSize,
|
||||||
})]);
|
})]);
|
||||||
}),
|
}),
|
||||||
switchMap(([eperson, findListOptions]) => {
|
switchMap(([eperson, findListOptions]) => {
|
||||||
@@ -320,7 +348,11 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
return this.groupsDataService.findListByHref(eperson._links.groups.href, findListOptions, true, true, followLink('object'));
|
return this.groupsDataService.findListByHref(eperson._links.groups.href, findListOptions, true, true, followLink('object'));
|
||||||
}
|
}
|
||||||
return observableOf(undefined);
|
return observableOf(undefined);
|
||||||
})
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
this.groupsPageInfoState$ = this.groups$.pipe(
|
||||||
|
map(groupsRD => groupsRD.payload.pageInfo),
|
||||||
);
|
);
|
||||||
|
|
||||||
this.canImpersonate$ = activeEPerson$.pipe(
|
this.canImpersonate$ = activeEPerson$.pipe(
|
||||||
@@ -330,10 +362,10 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
} else {
|
} else {
|
||||||
return observableOf(false);
|
return observableOf(false);
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
this.canDelete$ = activeEPerson$.pipe(
|
this.canDelete$ = activeEPerson$.pipe(
|
||||||
switchMap((eperson) => this.authorizationService.isAuthorized(FeatureID.CanDelete, hasValue(eperson) ? eperson.self : undefined))
|
switchMap((eperson) => this.authorizationService.isAuthorized(FeatureID.CanDelete, hasValue(eperson) ? eperson.self : undefined)),
|
||||||
);
|
);
|
||||||
this.canReset$ = observableOf(true);
|
this.canReset$ = observableOf(true);
|
||||||
});
|
});
|
||||||
@@ -361,12 +393,12 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
metadata: {
|
metadata: {
|
||||||
'eperson.firstname': [
|
'eperson.firstname': [
|
||||||
{
|
{
|
||||||
value: this.firstName.value
|
value: this.firstName.value,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
'eperson.lastname': [
|
'eperson.lastname': [
|
||||||
{
|
{
|
||||||
value: this.lastName.value
|
value: this.lastName.value,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -379,7 +411,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
} else {
|
} else {
|
||||||
this.editEPerson(ePerson, values);
|
this.editEPerson(ePerson, values);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,7 +424,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
const response = this.epersonService.create(ePersonToCreate);
|
const response = this.epersonService.create(ePersonToCreate);
|
||||||
response.pipe(
|
response.pipe(
|
||||||
getFirstCompletedRemoteData()
|
getFirstCompletedRemoteData(),
|
||||||
).subscribe((rd: RemoteData<EPerson>) => {
|
).subscribe((rd: RemoteData<EPerson>) => {
|
||||||
if (rd.hasSucceeded) {
|
if (rd.hasSucceeded) {
|
||||||
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.created.success', { name: this.dsoNameService.getName(ePersonToCreate) }));
|
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.created.success', { name: this.dsoNameService.getName(ePersonToCreate) }));
|
||||||
@@ -418,12 +450,12 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
metadata: {
|
metadata: {
|
||||||
'eperson.firstname': [
|
'eperson.firstname': [
|
||||||
{
|
{
|
||||||
value: (this.firstName.value ? this.firstName.value : ePerson.firstMetadataValue('eperson.firstname'))
|
value: (this.firstName.value ? this.firstName.value : ePerson.firstMetadataValue('eperson.firstname')),
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
'eperson.lastname': [
|
'eperson.lastname': [
|
||||||
{
|
{
|
||||||
value: (this.lastName.value ? this.lastName.value : ePerson.firstMetadataValue('eperson.lastname'))
|
value: (this.lastName.value ? this.lastName.value : ePerson.firstMetadataValue('eperson.lastname')),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -457,7 +489,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
onPageChange(event) {
|
onPageChange(event) {
|
||||||
this.updateGroups({
|
this.updateGroups({
|
||||||
currentPage: event,
|
currentPage: event,
|
||||||
elementsPerPage: this.config.pageSize
|
elementsPerPage: this.config.pageSize,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,15 +525,15 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
this.canDelete$ = observableOf(false);
|
this.canDelete$ = observableOf(false);
|
||||||
return this.epersonService.deleteEPerson(eperson).pipe(
|
return this.epersonService.deleteEPerson(eperson).pipe(
|
||||||
getFirstCompletedRemoteData(),
|
getFirstCompletedRemoteData(),
|
||||||
map((restResponse: RemoteData<NoContent>) => ({ restResponse, eperson }))
|
map((restResponse: RemoteData<NoContent>) => ({ restResponse, eperson })),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return observableOf(null);
|
return observableOf(null);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
finalize(() => this.canDelete$ = observableOf(true))
|
finalize(() => this.canDelete$ = observableOf(true)),
|
||||||
);
|
);
|
||||||
})
|
}),
|
||||||
).subscribe(({ restResponse, eperson }: { restResponse: RemoteData<NoContent> | null, eperson: EPerson }) => {
|
).subscribe(({ restResponse, eperson }: { restResponse: RemoteData<NoContent> | null, eperson: EPerson }) => {
|
||||||
if (restResponse?.hasSucceeded) {
|
if (restResponse?.hasSucceeded) {
|
||||||
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.deleted.success', { name: this.dsoNameService.getName(eperson) }));
|
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.deleted.success', { name: this.dsoNameService.getName(eperson) }));
|
||||||
@@ -536,7 +568,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
this.notificationsService.error(this.translateService.get('forgot-email.form.error.head'),
|
this.notificationsService.error(this.translateService.get('forgot-email.form.error.head'),
|
||||||
this.translateService.get('forgot-email.form.error.content', { email: this.epersonInitial.email }));
|
this.translateService.get('forgot-email.form.error.content', { email: this.epersonInitial.email }));
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -562,13 +594,13 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
// Relevant message for email in use
|
// Relevant message for email in use
|
||||||
this.subs.push(this.epersonService.searchByScope('email', ePerson.email, {
|
this.subs.push(this.epersonService.searchByScope('email', ePerson.email, {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
elementsPerPage: 0
|
elementsPerPage: 0,
|
||||||
}).pipe(getFirstSucceededRemoteData(), getRemoteDataPayload())
|
}).pipe(getFirstSucceededRemoteData(), getRemoteDataPayload())
|
||||||
.subscribe((list: PaginatedList<EPerson>) => {
|
.subscribe((list: PaginatedList<EPerson>) => {
|
||||||
if (list.totalElements > 0) {
|
if (list.totalElements > 0) {
|
||||||
this.notificationsService.error(this.translateService.get(this.labelPrefix + 'notification.' + notificationSection + '.failure.emailInUse', {
|
this.notificationsService.error(this.translateService.get(this.labelPrefix + 'notification.' + notificationSection + '.failure.emailInUse', {
|
||||||
name: this.dsoNameService.getName(ePerson),
|
name: this.dsoNameService.getName(ePerson),
|
||||||
email: ePerson.email
|
email: ePerson.email,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@@ -579,7 +611,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
private updateGroups(options) {
|
private updateGroups(options) {
|
||||||
this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => {
|
this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => {
|
||||||
this.groups = this.groupsDataService.findListByHref(eperson._links.groups.href, options);
|
this.groups$ = this.groupsDataService.findListByHref(eperson._links.groups.href, options);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,12 @@
|
|||||||
import { AbstractControl, ValidationErrors } from '@angular/forms';
|
import {
|
||||||
|
AbstractControl,
|
||||||
|
ValidationErrors,
|
||||||
|
} from '@angular/forms';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
import { EPersonDataService } from '../../../../core/eperson/eperson-data.service';
|
import { EPersonDataService } from '../../../../core/eperson/eperson-data.service';
|
||||||
import { getFirstSucceededRemoteData, } from '../../../../core/shared/operators';
|
import { getFirstSucceededRemoteData } from '../../../../core/shared/operators';
|
||||||
|
|
||||||
export class ValidateEmailNotTaken {
|
export class ValidateEmailNotTaken {
|
||||||
|
|
||||||
@@ -17,8 +20,8 @@ export class ValidateEmailNotTaken {
|
|||||||
.pipe(
|
.pipe(
|
||||||
getFirstSucceededRemoteData(),
|
getFirstSucceededRemoteData(),
|
||||||
map(res => {
|
map(res => {
|
||||||
return !!res.payload ? { emailTaken: true } : null;
|
return res.payload ? { emailTaken: true } : null;
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -1,13 +1,21 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
|
import {
|
||||||
import { Observable } from 'rxjs';
|
ActivatedRouteSnapshot,
|
||||||
import { EPerson } from '../../core/eperson/models/eperson.model';
|
Resolve,
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
RouterStateSnapshot,
|
||||||
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
} from '@angular/router';
|
||||||
import { ResolvedAction } from '../../core/resolving/resolver.actions';
|
|
||||||
import { EPersonDataService } from '../../core/eperson/eperson-data.service';
|
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
|
import { EPersonDataService } from '../../core/eperson/eperson-data.service';
|
||||||
|
import { EPerson } from '../../core/eperson/models/eperson.model';
|
||||||
|
import { ResolvedAction } from '../../core/resolving/resolver.actions';
|
||||||
|
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
||||||
|
import {
|
||||||
|
followLink,
|
||||||
|
FollowLinkConfig,
|
||||||
|
} from '../../shared/utils/follow-link-config.model';
|
||||||
|
|
||||||
export const EPERSON_EDIT_FOLLOW_LINKS: FollowLinkConfig<EPerson>[] = [
|
export const EPERSON_EDIT_FOLLOW_LINKS: FollowLinkConfig<EPerson>[] = [
|
||||||
followLink('groups'),
|
followLink('groups'),
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<ds-alert *ngIf="groupBeingEdited?.permanent" [type]="AlertTypeEnum.Warning"
|
<ds-alert *ngIf="groupBeingEdited?.permanent" [type]="AlertTypeEnum.Warning"
|
||||||
[content]="messagePrefix + '.alert.permanent'"></ds-alert>
|
[content]="messagePrefix + '.alert.permanent'"></ds-alert>
|
||||||
<ds-alert *ngIf="!(canEdit$ | async) && (groupDataService.getActiveGroup() | async)" [type]="AlertTypeEnum.Warning"
|
<ds-alert *ngIf="(canEdit$ | async) !== true && (groupDataService.getActiveGroup() | async)" [type]="AlertTypeEnum.Warning"
|
||||||
[content]="(messagePrefix + '.alert.workflowGroup' | translate:{ name: dsoNameService.getName((getLinkedDSO(groupBeingEdited) | async)?.payload), comcol: (getLinkedDSO(groupBeingEdited) | async)?.payload?.type, comcolEditRolesRoute: (getLinkedEditRolesRoute(groupBeingEdited) | async) })">
|
[content]="(messagePrefix + '.alert.workflowGroup' | translate:{ name: dsoNameService.getName((getLinkedDSO(groupBeingEdited) | async)?.payload), comcol: (getLinkedDSO(groupBeingEdited) | async)?.payload?.type, comcolEditRolesRoute: (getLinkedEditRolesRoute(groupBeingEdited) | async) })">
|
||||||
</ds-alert>
|
</ds-alert>
|
||||||
|
|
||||||
@@ -47,10 +47,10 @@
|
|||||||
</ds-form>
|
</ds-form>
|
||||||
|
|
||||||
<div class="mb-5">
|
<div class="mb-5">
|
||||||
<ds-members-list *ngIf="groupBeingEdited != null"
|
<ds-members-list *ngIf="groupBeingEdited !== undefined"
|
||||||
[messagePrefix]="messagePrefix + '.members-list'"></ds-members-list>
|
[messagePrefix]="messagePrefix + '.members-list'"></ds-members-list>
|
||||||
</div>
|
</div>
|
||||||
<ds-subgroups-list *ngIf="groupBeingEdited != null"
|
<ds-subgroups-list *ngIf="groupBeingEdited !== undefined"
|
||||||
[messagePrefix]="messagePrefix + '.subgroups-list'"></ds-subgroups-list>
|
[messagePrefix]="messagePrefix + '.subgroups-list'"></ds-subgroups-list>
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,43 +1,73 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
import {
|
||||||
import { UntypedFormControl, UntypedFormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
ComponentFixture,
|
||||||
import { BrowserModule, By } from '@angular/platform-browser';
|
TestBed,
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
waitForAsync,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
UntypedFormControl,
|
||||||
|
UntypedFormGroup,
|
||||||
|
Validators,
|
||||||
|
} from '@angular/forms';
|
||||||
|
import {
|
||||||
|
BrowserModule,
|
||||||
|
By,
|
||||||
|
} from '@angular/platform-browser';
|
||||||
|
import {
|
||||||
|
ActivatedRoute,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
|
import {
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
TranslateLoader,
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
|
import { Operation } from 'fast-json-patch';
|
||||||
|
import {
|
||||||
|
Observable,
|
||||||
|
of as observableOf,
|
||||||
|
} from 'rxjs';
|
||||||
|
|
||||||
|
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
|
||||||
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
||||||
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||||
import { DSOChangeAnalyzer } from '../../../core/data/dso-change-analyzer.service';
|
import { DSOChangeAnalyzer } from '../../../core/data/dso-change-analyzer.service';
|
||||||
import { DSpaceObjectDataService } from '../../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../../core/data/dspace-object-data.service';
|
||||||
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
|
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
|
||||||
import { buildPaginatedList, PaginatedList } from '../../../core/data/paginated-list.model';
|
import {
|
||||||
|
buildPaginatedList,
|
||||||
|
PaginatedList,
|
||||||
|
} from '../../../core/data/paginated-list.model';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { EPersonDataService } from '../../../core/eperson/eperson-data.service';
|
import { EPersonDataService } from '../../../core/eperson/eperson-data.service';
|
||||||
import { GroupDataService } from '../../../core/eperson/group-data.service';
|
import { GroupDataService } from '../../../core/eperson/group-data.service';
|
||||||
import { Group } from '../../../core/eperson/models/group.model';
|
import { Group } from '../../../core/eperson/models/group.model';
|
||||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||||
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
||||||
|
import { NoContent } from '../../../core/shared/NoContent.model';
|
||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
import { UUIDService } from '../../../core/shared/uuid.service';
|
import { UUIDService } from '../../../core/shared/uuid.service';
|
||||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
|
||||||
import { GroupMock, GroupMock2 } from '../../../shared/testing/group-mock';
|
|
||||||
import { GroupFormComponent } from './group-form.component';
|
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
|
||||||
import { getMockFormBuilderService } from '../../../shared/mocks/form-builder-service.mock';
|
|
||||||
import { getMockTranslateService } from '../../../shared/mocks/translate.service.mock';
|
|
||||||
import { TranslateLoaderMock } from '../../../shared/testing/translate-loader.mock';
|
|
||||||
import { RouterMock } from '../../../shared/mocks/router.mock';
|
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
|
||||||
import { Operation } from 'fast-json-patch';
|
|
||||||
import { ValidateGroupExists } from './validators/group-exists.validator';
|
|
||||||
import { NoContent } from '../../../core/shared/NoContent.model';
|
|
||||||
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
|
|
||||||
import { DSONameServiceMock } from '../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { getMockFormBuilderService } from '../../../shared/mocks/form-builder-service.mock';
|
||||||
|
import { RouterMock } from '../../../shared/mocks/router.mock';
|
||||||
|
import { getMockTranslateService } from '../../../shared/mocks/translate.service.mock';
|
||||||
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
|
import {
|
||||||
|
GroupMock,
|
||||||
|
GroupMock2,
|
||||||
|
} from '../../../shared/testing/group-mock';
|
||||||
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
|
import { TranslateLoaderMock } from '../../../shared/testing/translate-loader.mock';
|
||||||
|
import { GroupFormComponent } from './group-form.component';
|
||||||
|
import { ValidateGroupExists } from './validators/group-exists.validator';
|
||||||
|
|
||||||
describe('GroupFormComponent', () => {
|
describe('GroupFormComponent', () => {
|
||||||
let component: GroupFormComponent;
|
let component: GroupFormComponent;
|
||||||
@@ -65,8 +95,8 @@ describe('GroupFormComponent', () => {
|
|||||||
metadata: {
|
metadata: {
|
||||||
'dc.description': [
|
'dc.description': [
|
||||||
{
|
{
|
||||||
value: groupDescription
|
value: groupDescription,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -105,7 +135,7 @@ describe('GroupFormComponent', () => {
|
|||||||
create(group: Group): Observable<RemoteData<Group>> {
|
create(group: Group): Observable<RemoteData<Group>> {
|
||||||
this.allGroups = [...this.allGroups, group];
|
this.allGroups = [...this.allGroups, group];
|
||||||
this.createdGroup = Object.assign({}, group, {
|
this.createdGroup = Object.assign({}, group, {
|
||||||
_links: { self: { href: 'group-selflink' } }
|
_links: { self: { href: 'group-selflink' } },
|
||||||
});
|
});
|
||||||
return createSuccessfulRemoteDataObject$(this.createdGroup);
|
return createSuccessfulRemoteDataObject$(this.createdGroup);
|
||||||
},
|
},
|
||||||
@@ -114,15 +144,15 @@ describe('GroupFormComponent', () => {
|
|||||||
},
|
},
|
||||||
getGroupEditPageRouterLinkWithID(id: string) {
|
getGroupEditPageRouterLinkWithID(id: string) {
|
||||||
return `group-edit-page-for-${id}`;
|
return `group-edit-page-for-${id}`;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
authorizationService = jasmine.createSpyObj('authorizationService', {
|
authorizationService = jasmine.createSpyObj('authorizationService', {
|
||||||
isAuthorized: observableOf(true)
|
isAuthorized: observableOf(true),
|
||||||
});
|
});
|
||||||
dsoDataServiceStub = {
|
dsoDataServiceStub = {
|
||||||
findByHref(href: string): Observable<RemoteData<DSpaceObject>> {
|
findByHref(href: string): Observable<RemoteData<DSpaceObject>> {
|
||||||
return null;
|
return null;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
builderService = Object.assign(getMockFormBuilderService(),{
|
builderService = Object.assign(getMockFormBuilderService(),{
|
||||||
createFormGroup(formModel, options = null) {
|
createFormGroup(formModel, options = null) {
|
||||||
@@ -185,7 +215,7 @@ describe('GroupFormComponent', () => {
|
|||||||
},
|
},
|
||||||
isObject(value) {
|
isObject(value) {
|
||||||
return typeof value === 'object' && value !== null;
|
return typeof value === 'object' && value !== null;
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
translateService = getMockTranslateService();
|
translateService = getMockTranslateService();
|
||||||
router = new RouterMock();
|
router = new RouterMock();
|
||||||
@@ -195,8 +225,8 @@ describe('GroupFormComponent', () => {
|
|||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: TranslateLoaderMock
|
useClass: TranslateLoaderMock,
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
declarations: [GroupFormComponent],
|
declarations: [GroupFormComponent],
|
||||||
@@ -216,12 +246,12 @@ describe('GroupFormComponent', () => {
|
|||||||
{ provide: HALEndpointService, useValue: {} },
|
{ provide: HALEndpointService, useValue: {} },
|
||||||
{
|
{
|
||||||
provide: ActivatedRoute,
|
provide: ActivatedRoute,
|
||||||
useValue: { data: observableOf({ dso: { payload: {} } }), params: observableOf({}) }
|
useValue: { data: observableOf({ dso: { payload: {} } }), params: observableOf({}) },
|
||||||
},
|
},
|
||||||
{ provide: Router, useValue: router },
|
{ provide: Router, useValue: router },
|
||||||
{ provide: AuthorizationDataService, useValue: authorizationService },
|
{ provide: AuthorizationDataService, useValue: authorizationService },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -257,8 +287,8 @@ describe('GroupFormComponent', () => {
|
|||||||
metadata: {
|
metadata: {
|
||||||
'dc.description': [
|
'dc.description': [
|
||||||
{
|
{
|
||||||
value: groupDescription
|
value: groupDescription,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -273,11 +303,11 @@ describe('GroupFormComponent', () => {
|
|||||||
const operations = [{
|
const operations = [{
|
||||||
op: 'add',
|
op: 'add',
|
||||||
path: '/metadata/dc.description',
|
path: '/metadata/dc.description',
|
||||||
value: 'testDescription'
|
value: 'testDescription',
|
||||||
}, {
|
}, {
|
||||||
op: 'replace',
|
op: 'replace',
|
||||||
path: '/name',
|
path: '/name',
|
||||||
value: 'newGroupName'
|
value: 'newGroupName',
|
||||||
}];
|
}];
|
||||||
expect(groupsDataServiceStub.patch).toHaveBeenCalledWith(expected, operations);
|
expect(groupsDataServiceStub.patch).toHaveBeenCalledWith(expected, operations);
|
||||||
});
|
});
|
||||||
@@ -289,7 +319,7 @@ describe('GroupFormComponent', () => {
|
|||||||
const operations = [{
|
const operations = [{
|
||||||
op: 'add',
|
op: 'add',
|
||||||
path: '/metadata/dc.description',
|
path: '/metadata/dc.description',
|
||||||
value: 'testDescription'
|
value: 'testDescription',
|
||||||
}];
|
}];
|
||||||
expect(groupsDataServiceStub.patch).toHaveBeenCalledWith(expected, operations);
|
expect(groupsDataServiceStub.patch).toHaveBeenCalledWith(expected, operations);
|
||||||
});
|
});
|
||||||
@@ -301,7 +331,7 @@ describe('GroupFormComponent', () => {
|
|||||||
const operations = [{
|
const operations = [{
|
||||||
op: 'replace',
|
op: 'replace',
|
||||||
path: '/name',
|
path: '/name',
|
||||||
value: 'newGroupName'
|
value: 'newGroupName',
|
||||||
}];
|
}];
|
||||||
expect(groupsDataServiceStub.patch).toHaveBeenCalledWith(expected, operations);
|
expect(groupsDataServiceStub.patch).toHaveBeenCalledWith(expected, operations);
|
||||||
});
|
});
|
||||||
@@ -338,8 +368,8 @@ describe('GroupFormComponent', () => {
|
|||||||
metadata: {
|
metadata: {
|
||||||
'dc.description': [
|
'dc.description': [
|
||||||
{
|
{
|
||||||
value: groupDescription
|
value: groupDescription,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -376,7 +406,7 @@ describe('GroupFormComponent', () => {
|
|||||||
const groupsDataServiceStubWithGroup = Object.assign(groupsDataServiceStub,{
|
const groupsDataServiceStubWithGroup = Object.assign(groupsDataServiceStub,{
|
||||||
searchGroups(query: string): Observable<RemoteData<PaginatedList<Group>>> {
|
searchGroups(query: string): Observable<RemoteData<PaginatedList<Group>>> {
|
||||||
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), [expected]));
|
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), [expected]));
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
component.formGroup.controls.groupName.setValue('testName');
|
component.formGroup.controls.groupName.setValue('testName');
|
||||||
component.formGroup.controls.groupName.setAsyncValidators(ValidateGroupExists.createValidator(groupsDataServiceStubWithGroup));
|
component.formGroup.controls.groupName.setAsyncValidators(ValidateGroupExists.createValidator(groupsDataServiceStubWithGroup));
|
||||||
@@ -400,7 +430,7 @@ describe('GroupFormComponent', () => {
|
|||||||
|
|
||||||
component.canEdit$ = observableOf(true);
|
component.canEdit$ = observableOf(true);
|
||||||
component.groupBeingEdited = {
|
component.groupBeingEdited = {
|
||||||
permanent: false
|
permanent: false,
|
||||||
} as Group;
|
} as Group;
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@@ -1,23 +1,45 @@
|
|||||||
import { Component, EventEmitter, HostListener, OnDestroy, OnInit, Output, ChangeDetectorRef } from '@angular/core';
|
import {
|
||||||
|
ChangeDetectorRef,
|
||||||
|
Component,
|
||||||
|
EventEmitter,
|
||||||
|
HostListener,
|
||||||
|
OnDestroy,
|
||||||
|
OnInit,
|
||||||
|
Output,
|
||||||
|
} from '@angular/core';
|
||||||
import { UntypedFormGroup } from '@angular/forms';
|
import { UntypedFormGroup } from '@angular/forms';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import {
|
||||||
|
ActivatedRoute,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import {
|
import {
|
||||||
DynamicFormControlModel,
|
DynamicFormControlModel,
|
||||||
DynamicFormLayout,
|
DynamicFormLayout,
|
||||||
DynamicInputModel,
|
DynamicInputModel,
|
||||||
DynamicTextAreaModel
|
DynamicTextAreaModel,
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { Operation } from 'fast-json-patch';
|
||||||
import {
|
import {
|
||||||
combineLatest as observableCombineLatest,
|
combineLatest as observableCombineLatest,
|
||||||
Observable,
|
Observable,
|
||||||
of as observableOf,
|
of as observableOf,
|
||||||
Subscription,
|
Subscription,
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
import { catchError, map, switchMap, take, filter, debounceTime } from 'rxjs/operators';
|
import {
|
||||||
|
catchError,
|
||||||
|
debounceTime,
|
||||||
|
filter,
|
||||||
|
map,
|
||||||
|
switchMap,
|
||||||
|
take,
|
||||||
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { environment } from '../../../../environments/environment';
|
||||||
import { getCollectionEditRolesRoute } from '../../../collection-page/collection-page-routing-paths';
|
import { getCollectionEditRolesRoute } from '../../../collection-page/collection-page-routing-paths';
|
||||||
import { getCommunityEditRolesRoute } from '../../../community-page/community-page-routing-paths';
|
import { getCommunityEditRolesRoute } from '../../../community-page/community-page-routing-paths';
|
||||||
|
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSpaceObjectDataService } from '../../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../../core/data/dspace-object-data.service';
|
||||||
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
|
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
|
||||||
import { FeatureID } from '../../../core/data/feature-authorization/feature-id';
|
import { FeatureID } from '../../../core/data/feature-authorization/feature-id';
|
||||||
@@ -30,28 +52,32 @@ import { Group } from '../../../core/eperson/models/group.model';
|
|||||||
import { Collection } from '../../../core/shared/collection.model';
|
import { Collection } from '../../../core/shared/collection.model';
|
||||||
import { Community } from '../../../core/shared/community.model';
|
import { Community } from '../../../core/shared/community.model';
|
||||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||||
|
import { NoContent } from '../../../core/shared/NoContent.model';
|
||||||
import {
|
import {
|
||||||
getRemoteDataPayload,
|
|
||||||
getFirstSucceededRemoteData,
|
|
||||||
getFirstCompletedRemoteData,
|
getFirstCompletedRemoteData,
|
||||||
getFirstSucceededRemoteDataPayload
|
getFirstSucceededRemoteData,
|
||||||
|
getFirstSucceededRemoteDataPayload,
|
||||||
|
getRemoteDataPayload,
|
||||||
} from '../../../core/shared/operators';
|
} from '../../../core/shared/operators';
|
||||||
import { AlertType } from '../../../shared/alert/alert-type';
|
import { AlertType } from '../../../shared/alert/alert-type';
|
||||||
import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component';
|
import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component';
|
||||||
import { hasValue, isNotEmpty, hasValueOperator } from '../../../shared/empty.util';
|
import {
|
||||||
|
hasValue,
|
||||||
|
hasValueOperator,
|
||||||
|
isNotEmpty,
|
||||||
|
} from '../../../shared/empty.util';
|
||||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||||
import { NoContent } from '../../../core/shared/NoContent.model';
|
import {
|
||||||
import { Operation } from 'fast-json-patch';
|
getGroupEditRoute,
|
||||||
|
getGroupsRoute,
|
||||||
|
} from '../../access-control-routing-paths';
|
||||||
import { ValidateGroupExists } from './validators/group-exists.validator';
|
import { ValidateGroupExists } from './validators/group-exists.validator';
|
||||||
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
|
|
||||||
import { environment } from '../../../../environments/environment';
|
|
||||||
import { getGroupEditRoute, getGroupsRoute } from '../../access-control-routing-paths';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-group-form',
|
selector: 'ds-group-form',
|
||||||
templateUrl: './group-form.component.html'
|
templateUrl: './group-form.component.html',
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* A form used for creating and editing groups
|
* A form used for creating and editing groups
|
||||||
@@ -83,13 +109,13 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
formLayout: DynamicFormLayout = {
|
formLayout: DynamicFormLayout = {
|
||||||
groupName: {
|
groupName: {
|
||||||
grid: {
|
grid: {
|
||||||
host: 'row'
|
host: 'row',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
groupDescription: {
|
groupDescription: {
|
||||||
grid: {
|
grid: {
|
||||||
host: 'row'
|
host: 'row',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -176,7 +202,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
observableCombineLatest([
|
observableCombineLatest([
|
||||||
this.translateService.get(`${this.messagePrefix}.groupName`),
|
this.translateService.get(`${this.messagePrefix}.groupName`),
|
||||||
this.translateService.get(`${this.messagePrefix}.groupCommunity`),
|
this.translateService.get(`${this.messagePrefix}.groupCommunity`),
|
||||||
this.translateService.get(`${this.messagePrefix}.groupDescription`)
|
this.translateService.get(`${this.messagePrefix}.groupDescription`),
|
||||||
]).subscribe(([groupName, groupCommunity, groupDescription]) => {
|
]).subscribe(([groupName, groupCommunity, groupDescription]) => {
|
||||||
this.groupName = new DynamicInputModel({
|
this.groupName = new DynamicInputModel({
|
||||||
id: 'groupName',
|
id: 'groupName',
|
||||||
@@ -207,7 +233,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
];
|
];
|
||||||
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
||||||
|
|
||||||
if (!!this.formGroup.controls.groupName) {
|
if (this.formGroup.controls.groupName) {
|
||||||
this.formGroup.controls.groupName.setAsyncValidators(ValidateGroupExists.createValidator(this.groupDataService));
|
this.formGroup.controls.groupName.setAsyncValidators(ValidateGroupExists.createValidator(this.groupDataService));
|
||||||
this.groupNameValueChangeSubscribe = this.groupName.valueChanges.pipe(debounceTime(300)).subscribe(() => {
|
this.groupNameValueChangeSubscribe = this.groupName.valueChanges.pipe(debounceTime(300)).subscribe(() => {
|
||||||
this.changeDetectorRef.detectChanges();
|
this.changeDetectorRef.detectChanges();
|
||||||
@@ -219,7 +245,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
this.groupDataService.getActiveGroup(),
|
this.groupDataService.getActiveGroup(),
|
||||||
this.canEdit$,
|
this.canEdit$,
|
||||||
this.groupDataService.getActiveGroup()
|
this.groupDataService.getActiveGroup()
|
||||||
.pipe(filter((activeGroup) => hasValue(activeGroup)),switchMap((activeGroup) => this.getLinkedDSO(activeGroup).pipe(getFirstSucceededRemoteDataPayload())))
|
.pipe(filter((activeGroup) => hasValue(activeGroup)),switchMap((activeGroup) => this.getLinkedDSO(activeGroup).pipe(getFirstSucceededRemoteDataPayload()))),
|
||||||
]).subscribe(([activeGroup, canEdit, linkedObject]) => {
|
]).subscribe(([activeGroup, canEdit, linkedObject]) => {
|
||||||
|
|
||||||
if (activeGroup != null) {
|
if (activeGroup != null) {
|
||||||
@@ -254,7 +280,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -282,9 +308,9 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
metadata: {
|
metadata: {
|
||||||
'dc.description': [
|
'dc.description': [
|
||||||
{
|
{
|
||||||
value: this.groupDescription.value
|
value: this.groupDescription.value,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if (group === null) {
|
if (group === null) {
|
||||||
@@ -292,7 +318,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
} else {
|
} else {
|
||||||
this.editGroup(group);
|
this.editGroup(group);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,7 +329,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
createNewGroup(values) {
|
createNewGroup(values) {
|
||||||
const groupToCreate = Object.assign(new Group(), values);
|
const groupToCreate = Object.assign(new Group(), values);
|
||||||
this.groupDataService.create(groupToCreate).pipe(
|
this.groupDataService.create(groupToCreate).pipe(
|
||||||
getFirstCompletedRemoteData()
|
getFirstCompletedRemoteData(),
|
||||||
).subscribe((rd: RemoteData<Group>) => {
|
).subscribe((rd: RemoteData<Group>) => {
|
||||||
if (rd.hasSucceeded) {
|
if (rd.hasSucceeded) {
|
||||||
this.notificationsService.success(this.translateService.get(this.messagePrefix + '.notification.created.success', { name: groupToCreate.name }));
|
this.notificationsService.success(this.translateService.get(this.messagePrefix + '.notification.created.success', { name: groupToCreate.name }));
|
||||||
@@ -332,7 +358,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
// Relevant message for group name in use
|
// Relevant message for group name in use
|
||||||
this.subs.push(this.groupDataService.searchGroups(group.name, {
|
this.subs.push(this.groupDataService.searchGroups(group.name, {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
elementsPerPage: 0
|
elementsPerPage: 0,
|
||||||
}).pipe(getFirstSucceededRemoteData(), getRemoteDataPayload())
|
}).pipe(getFirstSucceededRemoteData(), getRemoteDataPayload())
|
||||||
.subscribe((list: PaginatedList<Group>) => {
|
.subscribe((list: PaginatedList<Group>) => {
|
||||||
if (list.totalElements > 0) {
|
if (list.totalElements > 0) {
|
||||||
@@ -354,7 +380,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
operations = [...operations, {
|
operations = [...operations, {
|
||||||
op: 'add',
|
op: 'add',
|
||||||
path: '/metadata/dc.description',
|
path: '/metadata/dc.description',
|
||||||
value: this.groupDescription.value
|
value: this.groupDescription.value,
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,12 +388,12 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
operations = [...operations, {
|
operations = [...operations, {
|
||||||
op: 'replace',
|
op: 'replace',
|
||||||
path: '/name',
|
path: '/name',
|
||||||
value: this.groupName.value
|
value: this.groupName.value,
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.groupDataService.patch(group, operations).pipe(
|
this.groupDataService.patch(group, operations).pipe(
|
||||||
getFirstCompletedRemoteData()
|
getFirstCompletedRemoteData(),
|
||||||
).subscribe((rd: RemoteData<Group>) => {
|
).subscribe((rd: RemoteData<Group>) => {
|
||||||
if (rd.hasSucceeded) {
|
if (rd.hasSucceeded) {
|
||||||
this.notificationsService.success(this.translateService.get(this.messagePrefix + '.notification.edited.success', { name: this.dsoNameService.getName(rd.payload) }));
|
this.notificationsService.success(this.translateService.get(this.messagePrefix + '.notification.edited.success', { name: this.dsoNameService.getName(rd.payload) }));
|
||||||
@@ -506,7 +532,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
return getCollectionEditRolesRoute(rd.payload.id);
|
return getCollectionEditRolesRoute(rd.payload.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
</ds-pagination>
|
</ds-pagination>
|
||||||
|
|
||||||
<div *ngIf="(ePeopleMembersOfGroup | async) == undefined || (ePeopleMembersOfGroup | async)?.totalElements == 0" class="alert alert-info w-100 mb-2"
|
<div *ngIf="(ePeopleMembersOfGroup | async) === undefined || (ePeopleMembersOfGroup | async)?.totalElements === 0" class="alert alert-info w-100 mb-2"
|
||||||
role="alert">
|
role="alert">
|
||||||
{{messagePrefix + '.no-members-yet' | translate}}
|
{{messagePrefix + '.no-members-yet' | translate}}
|
||||||
</div>
|
</div>
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
|
|
||||||
</ds-pagination>
|
</ds-pagination>
|
||||||
|
|
||||||
<div *ngIf="(ePeopleSearch | async)?.totalElements == 0 && searchDone"
|
<div *ngIf="(ePeopleSearch | async)?.totalElements === 0 && searchDone"
|
||||||
class="alert alert-info w-100 mb-2"
|
class="alert alert-info w-100 mb-2"
|
||||||
role="alert">
|
role="alert">
|
||||||
{{messagePrefix + '.no-items' | translate}}
|
{{messagePrefix + '.no-items' | translate}}
|
||||||
|
@@ -1,35 +1,68 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
|
import {
|
||||||
import { ComponentFixture, fakeAsync, flush, inject, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
DebugElement,
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
NO_ERRORS_SCHEMA,
|
||||||
import { BrowserModule, By } from '@angular/platform-browser';
|
} from '@angular/core';
|
||||||
|
import {
|
||||||
|
ComponentFixture,
|
||||||
|
fakeAsync,
|
||||||
|
flush,
|
||||||
|
inject,
|
||||||
|
TestBed,
|
||||||
|
tick,
|
||||||
|
waitForAsync,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
} from '@angular/forms';
|
||||||
|
import {
|
||||||
|
BrowserModule,
|
||||||
|
By,
|
||||||
|
} from '@angular/platform-browser';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
|
import {
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
TranslateLoader,
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
|
import {
|
||||||
|
Observable,
|
||||||
|
of as observableOf,
|
||||||
|
} from 'rxjs';
|
||||||
|
|
||||||
|
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { RestResponse } from '../../../../core/cache/response.models';
|
import { RestResponse } from '../../../../core/cache/response.models';
|
||||||
import { buildPaginatedList, PaginatedList } from '../../../../core/data/paginated-list.model';
|
import {
|
||||||
|
buildPaginatedList,
|
||||||
|
PaginatedList,
|
||||||
|
} from '../../../../core/data/paginated-list.model';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { EPersonDataService } from '../../../../core/eperson/eperson-data.service';
|
import { EPersonDataService } from '../../../../core/eperson/eperson-data.service';
|
||||||
import { GroupDataService } from '../../../../core/eperson/group-data.service';
|
import { GroupDataService } from '../../../../core/eperson/group-data.service';
|
||||||
import { EPerson } from '../../../../core/eperson/models/eperson.model';
|
import { EPerson } from '../../../../core/eperson/models/eperson.model';
|
||||||
import { Group } from '../../../../core/eperson/models/group.model';
|
import { Group } from '../../../../core/eperson/models/group.model';
|
||||||
|
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
||||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||||
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
|
||||||
import { GroupMock } from '../../../../shared/testing/group-mock';
|
|
||||||
import { MembersListComponent } from './members-list.component';
|
|
||||||
import { EPersonMock, EPersonMock2 } from '../../../../shared/testing/eperson.mock';
|
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
|
||||||
import { getMockTranslateService } from '../../../../shared/mocks/translate.service.mock';
|
|
||||||
import { getMockFormBuilderService } from '../../../../shared/mocks/form-builder-service.mock';
|
|
||||||
import { TranslateLoaderMock } from '../../../../shared/testing/translate-loader.mock';
|
|
||||||
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
|
||||||
import { RouterMock } from '../../../../shared/mocks/router.mock';
|
|
||||||
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
|
||||||
import { PaginationServiceStub } from '../../../../shared/testing/pagination-service.stub';
|
|
||||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
|
||||||
import { DSONameServiceMock } from '../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { getMockFormBuilderService } from '../../../../shared/mocks/form-builder-service.mock';
|
||||||
|
import { RouterMock } from '../../../../shared/mocks/router.mock';
|
||||||
|
import { getMockTranslateService } from '../../../../shared/mocks/translate.service.mock';
|
||||||
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
||||||
|
import {
|
||||||
|
EPersonMock,
|
||||||
|
EPersonMock2,
|
||||||
|
} from '../../../../shared/testing/eperson.mock';
|
||||||
|
import { GroupMock } from '../../../../shared/testing/group-mock';
|
||||||
|
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
||||||
|
import { PaginationServiceStub } from '../../../../shared/testing/pagination-service.stub';
|
||||||
|
import { TranslateLoaderMock } from '../../../../shared/testing/translate-loader.mock';
|
||||||
|
import { MembersListComponent } from './members-list.component';
|
||||||
|
|
||||||
|
// todo: optimize imports
|
||||||
|
|
||||||
describe('MembersListComponent', () => {
|
describe('MembersListComponent', () => {
|
||||||
let component: MembersListComponent;
|
let component: MembersListComponent;
|
||||||
@@ -109,7 +142,7 @@ describe('MembersListComponent', () => {
|
|||||||
// Add eperson to list of non-members
|
// Add eperson to list of non-members
|
||||||
this.epersonNonMembers = [...this.epersonNonMembers, epersonToDelete];
|
this.epersonNonMembers = [...this.epersonNonMembers, epersonToDelete];
|
||||||
return observableOf(new RestResponse(true, 200, 'Success'));
|
return observableOf(new RestResponse(true, 200, 'Success'));
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
builderService = getMockFormBuilderService();
|
builderService = getMockFormBuilderService();
|
||||||
translateService = getMockTranslateService();
|
translateService = getMockTranslateService();
|
||||||
@@ -120,8 +153,8 @@ describe('MembersListComponent', () => {
|
|||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: TranslateLoaderMock
|
useClass: TranslateLoaderMock,
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
declarations: [MembersListComponent],
|
declarations: [MembersListComponent],
|
||||||
@@ -134,7 +167,7 @@ describe('MembersListComponent', () => {
|
|||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
{ provide: DSONameService, useValue: new DSONameServiceMock() },
|
{ provide: DSONameService, useValue: new DSONameServiceMock() },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@@ -1,30 +1,42 @@
|
|||||||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
import {
|
||||||
|
Component,
|
||||||
|
Input,
|
||||||
|
OnDestroy,
|
||||||
|
OnInit,
|
||||||
|
} from '@angular/core';
|
||||||
import { UntypedFormBuilder } from '@angular/forms';
|
import { UntypedFormBuilder } from '@angular/forms';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
|
BehaviorSubject,
|
||||||
Observable,
|
Observable,
|
||||||
Subscription,
|
Subscription,
|
||||||
BehaviorSubject
|
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
import { map, switchMap, take } from 'rxjs/operators';
|
import {
|
||||||
|
map,
|
||||||
|
switchMap,
|
||||||
|
take,
|
||||||
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { PaginatedList } from '../../../../core/data/paginated-list.model';
|
import { PaginatedList } from '../../../../core/data/paginated-list.model';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { EPersonDataService } from '../../../../core/eperson/eperson-data.service';
|
import { EPersonDataService } from '../../../../core/eperson/eperson-data.service';
|
||||||
import { GroupDataService } from '../../../../core/eperson/group-data.service';
|
import { GroupDataService } from '../../../../core/eperson/group-data.service';
|
||||||
import { EPerson } from '../../../../core/eperson/models/eperson.model';
|
import { EPerson } from '../../../../core/eperson/models/eperson.model';
|
||||||
import { Group } from '../../../../core/eperson/models/group.model';
|
import { Group } from '../../../../core/eperson/models/group.model';
|
||||||
|
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
||||||
import {
|
import {
|
||||||
getFirstCompletedRemoteData,
|
|
||||||
getAllCompletedRemoteData,
|
getAllCompletedRemoteData,
|
||||||
getRemoteDataPayload
|
getFirstCompletedRemoteData,
|
||||||
|
getRemoteDataPayload,
|
||||||
} from '../../../../core/shared/operators';
|
} from '../../../../core/shared/operators';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model';
|
||||||
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
|
||||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
|
||||||
import { getEPersonEditRoute } from '../../../access-control-routing-paths';
|
import { getEPersonEditRoute } from '../../../access-control-routing-paths';
|
||||||
|
|
||||||
|
// todo: optimize imports
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keys to keep track of specific subscriptions
|
* Keys to keep track of specific subscriptions
|
||||||
*/
|
*/
|
||||||
@@ -65,7 +77,7 @@ export interface EPersonListActionConfig {
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-members-list',
|
selector: 'ds-members-list',
|
||||||
templateUrl: './members-list.component.html'
|
templateUrl: './members-list.component.html',
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* The list of members in the edit group page
|
* The list of members in the edit group page
|
||||||
@@ -85,7 +97,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
|||||||
remove: {
|
remove: {
|
||||||
css: 'btn-outline-danger',
|
css: 'btn-outline-danger',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
icon: 'fas fa-trash-alt fa-fw'
|
icon: 'fas fa-trash-alt fa-fw',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -104,7 +116,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
|||||||
configSearch: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
configSearch: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'sml',
|
id: 'sml',
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* Pagination config used to display the list of EPerson Membes of active group being edited
|
* Pagination config used to display the list of EPerson Membes of active group being edited
|
||||||
@@ -112,7 +124,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
|||||||
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'ml',
|
id: 'ml',
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,8 +185,8 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
|||||||
switchMap((currentPagination) => {
|
switchMap((currentPagination) => {
|
||||||
return this.ePersonDataService.findListByHref(this.groupBeingEdited._links.epersons.href, {
|
return this.ePersonDataService.findListByHref(this.groupBeingEdited._links.epersons.href, {
|
||||||
currentPage: currentPagination.currentPage,
|
currentPage: currentPagination.currentPage,
|
||||||
elementsPerPage: currentPagination.pageSize
|
elementsPerPage: currentPagination.pageSize,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
getAllCompletedRemoteData(),
|
getAllCompletedRemoteData(),
|
||||||
@@ -263,7 +275,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
return this.ePersonDataService.searchNonMembers(this.currentSearchQuery, this.groupBeingEdited.id, {
|
return this.ePersonDataService.searchNonMembers(this.currentSearchQuery, this.groupBeingEdited.id, {
|
||||||
currentPage: paginationOptions.currentPage,
|
currentPage: paginationOptions.currentPage,
|
||||||
elementsPerPage: paginationOptions.pageSize
|
elementsPerPage: paginationOptions.pageSize,
|
||||||
}, false, true);
|
}, false, true);
|
||||||
}),
|
}),
|
||||||
getAllCompletedRemoteData(),
|
getAllCompletedRemoteData(),
|
||||||
|
@@ -45,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ds-pagination>
|
</ds-pagination>
|
||||||
|
|
||||||
<div *ngIf="(subGroups$ | async)?.payload?.totalElements == 0" class="alert alert-info w-100 mb-2"
|
<div *ngIf="(subGroups$ | async)?.payload?.totalElements === 0" class="alert alert-info w-100 mb-2"
|
||||||
role="alert">
|
role="alert">
|
||||||
{{messagePrefix + '.no-subgroups-yet' | translate}}
|
{{messagePrefix + '.no-subgroups-yet' | translate}}
|
||||||
</div>
|
</div>
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ds-pagination>
|
</ds-pagination>
|
||||||
|
|
||||||
<div *ngIf="(searchResults$ | async)?.payload?.totalElements == 0 && searchDone" class="alert alert-info w-100 mb-2"
|
<div *ngIf="(searchResults$ | async)?.payload?.totalElements === 0 && searchDone" class="alert alert-info w-100 mb-2"
|
||||||
role="alert">
|
role="alert">
|
||||||
{{messagePrefix + '.no-items' | translate}}
|
{{messagePrefix + '.no-items' | translate}}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,35 +1,63 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { NO_ERRORS_SCHEMA, DebugElement } from '@angular/core';
|
import {
|
||||||
import { ComponentFixture, fakeAsync, flush, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
DebugElement,
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
NO_ERRORS_SCHEMA,
|
||||||
import { BrowserModule, By } from '@angular/platform-browser';
|
} from '@angular/core';
|
||||||
|
import {
|
||||||
|
ComponentFixture,
|
||||||
|
fakeAsync,
|
||||||
|
flush,
|
||||||
|
inject,
|
||||||
|
TestBed,
|
||||||
|
waitForAsync,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
} from '@angular/forms';
|
||||||
|
import {
|
||||||
|
BrowserModule,
|
||||||
|
By,
|
||||||
|
} from '@angular/platform-browser';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
|
import {
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
TranslateLoader,
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
|
import {
|
||||||
|
Observable,
|
||||||
|
of as observableOf,
|
||||||
|
} from 'rxjs';
|
||||||
|
import { EPersonMock2 } from 'src/app/shared/testing/eperson.mock';
|
||||||
|
|
||||||
|
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { RestResponse } from '../../../../core/cache/response.models';
|
import { RestResponse } from '../../../../core/cache/response.models';
|
||||||
import { buildPaginatedList, PaginatedList } from '../../../../core/data/paginated-list.model';
|
import {
|
||||||
|
buildPaginatedList,
|
||||||
|
PaginatedList,
|
||||||
|
} from '../../../../core/data/paginated-list.model';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { GroupDataService } from '../../../../core/eperson/group-data.service';
|
import { GroupDataService } from '../../../../core/eperson/group-data.service';
|
||||||
import { Group } from '../../../../core/eperson/models/group.model';
|
import { Group } from '../../../../core/eperson/models/group.model';
|
||||||
|
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
||||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||||
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
|
||||||
import { GroupMock, GroupMock2 } from '../../../../shared/testing/group-mock';
|
|
||||||
import { SubgroupsListComponent } from './subgroups-list.component';
|
|
||||||
import {
|
|
||||||
createSuccessfulRemoteDataObject$
|
|
||||||
} from '../../../../shared/remote-data.utils';
|
|
||||||
import { RouterMock } from '../../../../shared/mocks/router.mock';
|
|
||||||
import { getMockFormBuilderService } from '../../../../shared/mocks/form-builder-service.mock';
|
|
||||||
import { getMockTranslateService } from '../../../../shared/mocks/translate.service.mock';
|
|
||||||
import { TranslateLoaderMock } from '../../../../shared/testing/translate-loader.mock';
|
|
||||||
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
|
||||||
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
|
||||||
import { PaginationServiceStub } from '../../../../shared/testing/pagination-service.stub';
|
|
||||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
|
||||||
import { DSONameServiceMock } from '../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../shared/mocks/dso-name.service.mock';
|
||||||
import { EPersonMock2 } from 'src/app/shared/testing/eperson.mock';
|
import { getMockFormBuilderService } from '../../../../shared/mocks/form-builder-service.mock';
|
||||||
|
import { RouterMock } from '../../../../shared/mocks/router.mock';
|
||||||
|
import { getMockTranslateService } from '../../../../shared/mocks/translate.service.mock';
|
||||||
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
||||||
|
import {
|
||||||
|
GroupMock,
|
||||||
|
GroupMock2,
|
||||||
|
} from '../../../../shared/testing/group-mock';
|
||||||
|
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
||||||
|
import { PaginationServiceStub } from '../../../../shared/testing/pagination-service.stub';
|
||||||
|
import { TranslateLoaderMock } from '../../../../shared/testing/translate-loader.mock';
|
||||||
|
import { SubgroupsListComponent } from './subgroups-list.component';
|
||||||
|
|
||||||
describe('SubgroupsListComponent', () => {
|
describe('SubgroupsListComponent', () => {
|
||||||
let component: SubgroupsListComponent;
|
let component: SubgroupsListComponent;
|
||||||
@@ -56,7 +84,7 @@ describe('SubgroupsListComponent', () => {
|
|||||||
},
|
},
|
||||||
subgroups: { href: 'https://rest.api/server/api/eperson/groups/activegroupid/subgroups' },
|
subgroups: { href: 'https://rest.api/server/api/eperson/groups/activegroupid/subgroups' },
|
||||||
object: { href: 'https://rest.api/server/api/eperson/groups/activegroupid/object' },
|
object: { href: 'https://rest.api/server/api/eperson/groups/activegroupid/object' },
|
||||||
epersons: { href: 'https://rest.api/server/api/eperson/groups/activegroupid/epersons' }
|
epersons: { href: 'https://rest.api/server/api/eperson/groups/activegroupid/epersons' },
|
||||||
},
|
},
|
||||||
_name: 'activegroupname',
|
_name: 'activegroupname',
|
||||||
id: 'activegroupid',
|
id: 'activegroupid',
|
||||||
@@ -120,7 +148,7 @@ describe('SubgroupsListComponent', () => {
|
|||||||
// Add group to list of non-members
|
// Add group to list of non-members
|
||||||
this.groupNonMembers = [...this.groupNonMembers, subgroupToDelete];
|
this.groupNonMembers = [...this.groupNonMembers, subgroupToDelete];
|
||||||
return observableOf(new RestResponse(true, 200, 'Success'));
|
return observableOf(new RestResponse(true, 200, 'Success'));
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
routerStub = new RouterMock();
|
routerStub = new RouterMock();
|
||||||
builderService = getMockFormBuilderService();
|
builderService = getMockFormBuilderService();
|
||||||
@@ -132,8 +160,8 @@ describe('SubgroupsListComponent', () => {
|
|||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: TranslateLoaderMock
|
useClass: TranslateLoaderMock,
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
declarations: [SubgroupsListComponent],
|
declarations: [SubgroupsListComponent],
|
||||||
@@ -145,7 +173,7 @@ describe('SubgroupsListComponent', () => {
|
|||||||
{ provide: Router, useValue: routerStub },
|
{ provide: Router, useValue: routerStub },
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@@ -1,23 +1,38 @@
|
|||||||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
import {
|
||||||
|
Component,
|
||||||
|
Input,
|
||||||
|
OnDestroy,
|
||||||
|
OnInit,
|
||||||
|
} from '@angular/core';
|
||||||
import { UntypedFormBuilder } from '@angular/forms';
|
import { UntypedFormBuilder } from '@angular/forms';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { BehaviorSubject, Observable, Subscription } from 'rxjs';
|
import {
|
||||||
import { map, switchMap, take } from 'rxjs/operators';
|
BehaviorSubject,
|
||||||
|
Observable,
|
||||||
|
Subscription,
|
||||||
|
} from 'rxjs';
|
||||||
|
import {
|
||||||
|
map,
|
||||||
|
switchMap,
|
||||||
|
take,
|
||||||
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { PaginatedList } from '../../../../core/data/paginated-list.model';
|
import { PaginatedList } from '../../../../core/data/paginated-list.model';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { GroupDataService } from '../../../../core/eperson/group-data.service';
|
import { GroupDataService } from '../../../../core/eperson/group-data.service';
|
||||||
import { Group } from '../../../../core/eperson/models/group.model';
|
import { Group } from '../../../../core/eperson/models/group.model';
|
||||||
|
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
||||||
|
import { NoContent } from '../../../../core/shared/NoContent.model';
|
||||||
import {
|
import {
|
||||||
getAllCompletedRemoteData,
|
getAllCompletedRemoteData,
|
||||||
getFirstCompletedRemoteData
|
getFirstCompletedRemoteData,
|
||||||
} from '../../../../core/shared/operators';
|
} from '../../../../core/shared/operators';
|
||||||
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model';
|
||||||
import { NoContent } from '../../../../core/shared/NoContent.model';
|
|
||||||
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
|
||||||
import { followLink } from '../../../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../../../shared/utils/follow-link-config.model';
|
||||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keys to keep track of specific subscriptions
|
* Keys to keep track of specific subscriptions
|
||||||
@@ -30,7 +45,7 @@ enum SubKey {
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-subgroups-list',
|
selector: 'ds-subgroups-list',
|
||||||
templateUrl: './subgroups-list.component.html'
|
templateUrl: './subgroups-list.component.html',
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* The list of subgroups in the edit group page
|
* The list of subgroups in the edit group page
|
||||||
@@ -49,6 +64,8 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
subGroups$: BehaviorSubject<RemoteData<PaginatedList<Group>>> = new BehaviorSubject(undefined);
|
subGroups$: BehaviorSubject<RemoteData<PaginatedList<Group>>> = new BehaviorSubject(undefined);
|
||||||
|
|
||||||
|
subGroupsPageInfoState$: Observable<PageInfo>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map of active subscriptions
|
* Map of active subscriptions
|
||||||
*/
|
*/
|
||||||
@@ -60,7 +77,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
|
|||||||
configSearch: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
configSearch: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'ssgl',
|
id: 'ssgl',
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* Pagination config used to display the list of subgroups of currently active group being edited
|
* Pagination config used to display the list of subgroups of currently active group being edited
|
||||||
@@ -68,7 +85,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
|
|||||||
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'sgl',
|
id: 'sgl',
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
// The search form
|
// The search form
|
||||||
@@ -105,6 +122,9 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
|
|||||||
this.search({ query: '' });
|
this.search({ query: '' });
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
this.subGroupsPageInfoState$ = this.subGroups$.pipe(
|
||||||
|
map(subGroupsRD => subGroupsRD?.payload?.pageInfo),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,12 +140,12 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
|
|||||||
this.paginationService.getCurrentPagination(this.config.id, this.config).pipe(
|
this.paginationService.getCurrentPagination(this.config.id, this.config).pipe(
|
||||||
switchMap((config) => this.groupDataService.findListByHref(this.groupBeingEdited._links.subgroups.href, {
|
switchMap((config) => this.groupDataService.findListByHref(this.groupBeingEdited._links.subgroups.href, {
|
||||||
currentPage: config.currentPage,
|
currentPage: config.currentPage,
|
||||||
elementsPerPage: config.pageSize
|
elementsPerPage: config.pageSize,
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
followLink('object')
|
followLink('object'),
|
||||||
))
|
)),
|
||||||
).subscribe((rd: RemoteData<PaginatedList<Group>>) => {
|
).subscribe((rd: RemoteData<PaginatedList<Group>>) => {
|
||||||
this.subGroups$.next(rd);
|
this.subGroups$.next(rd);
|
||||||
}));
|
}));
|
||||||
@@ -194,7 +214,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
return this.groupDataService.searchNonMemberGroups(this.currentSearchQuery, this.groupBeingEdited.id, {
|
return this.groupDataService.searchNonMemberGroups(this.currentSearchQuery, this.groupBeingEdited.id, {
|
||||||
currentPage: paginationOptions.currentPage,
|
currentPage: paginationOptions.currentPage,
|
||||||
elementsPerPage: paginationOptions.pageSize
|
elementsPerPage: paginationOptions.pageSize,
|
||||||
}, false, true, followLink('object'));
|
}, false, true, followLink('object'));
|
||||||
}),
|
}),
|
||||||
getAllCompletedRemoteData(),
|
getAllCompletedRemoteData(),
|
||||||
|
@@ -1,10 +1,13 @@
|
|||||||
import { AbstractControl, ValidationErrors } from '@angular/forms';
|
import {
|
||||||
|
AbstractControl,
|
||||||
|
ValidationErrors,
|
||||||
|
} from '@angular/forms';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
import { GroupDataService } from '../../../../core/eperson/group-data.service';
|
import { GroupDataService } from '../../../../core/eperson/group-data.service';
|
||||||
import { getFirstSucceededRemoteListPayload } from '../../../../core/shared/operators';
|
|
||||||
import { Group } from '../../../../core/eperson/models/group.model';
|
import { Group } from '../../../../core/eperson/models/group.model';
|
||||||
|
import { getFirstSucceededRemoteListPayload } from '../../../../core/shared/operators';
|
||||||
|
|
||||||
export class ValidateGroupExists {
|
export class ValidateGroupExists {
|
||||||
|
|
||||||
@@ -17,7 +20,7 @@ export class ValidateGroupExists {
|
|||||||
return (control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null> => {
|
return (control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null> => {
|
||||||
return groupDataService.searchGroups(control.value, {
|
return groupDataService.searchGroups(control.value, {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
elementsPerPage: 100
|
elementsPerPage: 100,
|
||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
getFirstSucceededRemoteListPayload(),
|
getFirstSucceededRemoteListPayload(),
|
||||||
|
@@ -1,10 +1,14 @@
|
|||||||
import { GroupPageGuard } from './group-page.guard';
|
import {
|
||||||
import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
|
ActivatedRouteSnapshot,
|
||||||
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
Router,
|
||||||
import { ActivatedRouteSnapshot, Router } from '@angular/router';
|
} from '@angular/router';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
|
|
||||||
import { AuthService } from '../../core/auth/auth.service';
|
import { AuthService } from '../../core/auth/auth.service';
|
||||||
|
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
||||||
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
|
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
|
||||||
|
import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
|
||||||
|
import { GroupPageGuard } from './group-page.guard';
|
||||||
|
|
||||||
describe('GroupPageGuard', () => {
|
describe('GroupPageGuard', () => {
|
||||||
const groupsEndpointUrl = 'https://test.org/api/eperson/groups';
|
const groupsEndpointUrl = 'https://test.org/api/eperson/groups';
|
||||||
@@ -13,7 +17,7 @@ describe('GroupPageGuard', () => {
|
|||||||
const routeSnapshotWithGroupId = {
|
const routeSnapshotWithGroupId = {
|
||||||
params: {
|
params: {
|
||||||
groupId: groupUuid,
|
groupId: groupUuid,
|
||||||
}
|
},
|
||||||
} as unknown as ActivatedRouteSnapshot;
|
} as unknown as ActivatedRouteSnapshot;
|
||||||
|
|
||||||
let guard: GroupPageGuard;
|
let guard: GroupPageGuard;
|
||||||
@@ -50,10 +54,10 @@ describe('GroupPageGuard', () => {
|
|||||||
|
|
||||||
it('should return true', (done) => {
|
it('should return true', (done) => {
|
||||||
guard.canActivate(
|
guard.canActivate(
|
||||||
routeSnapshotWithGroupId, { url: 'current-url'} as any
|
routeSnapshotWithGroupId, { url: 'current-url' } as any,
|
||||||
).subscribe((result) => {
|
).subscribe((result) => {
|
||||||
expect(authorizationService.isAuthorized).toHaveBeenCalledWith(
|
expect(authorizationService.isAuthorized).toHaveBeenCalledWith(
|
||||||
FeatureID.CanManageGroup, groupEndpointUrl, undefined
|
FeatureID.CanManageGroup, groupEndpointUrl, undefined,
|
||||||
);
|
);
|
||||||
expect(result).toBeTrue();
|
expect(result).toBeTrue();
|
||||||
done();
|
done();
|
||||||
@@ -68,10 +72,10 @@ describe('GroupPageGuard', () => {
|
|||||||
|
|
||||||
it('should not return true', (done) => {
|
it('should not return true', (done) => {
|
||||||
guard.canActivate(
|
guard.canActivate(
|
||||||
routeSnapshotWithGroupId, { url: 'current-url'} as any
|
routeSnapshotWithGroupId, { url: 'current-url' } as any,
|
||||||
).subscribe((result) => {
|
).subscribe((result) => {
|
||||||
expect(authorizationService.isAuthorized).toHaveBeenCalledWith(
|
expect(authorizationService.isAuthorized).toHaveBeenCalledWith(
|
||||||
FeatureID.CanManageGroup, groupEndpointUrl, undefined
|
FeatureID.CanManageGroup, groupEndpointUrl, undefined,
|
||||||
);
|
);
|
||||||
expect(result).not.toBeTrue();
|
expect(result).not.toBeTrue();
|
||||||
done();
|
done();
|
||||||
|
@@ -1,15 +1,23 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router';
|
import {
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
ActivatedRouteSnapshot,
|
||||||
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
|
Router,
|
||||||
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
RouterStateSnapshot,
|
||||||
import { AuthService } from '../../core/auth/auth.service';
|
} from '@angular/router';
|
||||||
import { SomeFeatureAuthorizationGuard } from '../../core/data/feature-authorization/feature-authorization-guard/some-feature-authorization.guard';
|
import {
|
||||||
import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
|
Observable,
|
||||||
|
of as observableOf,
|
||||||
|
} from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { AuthService } from '../../core/auth/auth.service';
|
||||||
|
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
||||||
|
import { SomeFeatureAuthorizationGuard } from '../../core/data/feature-authorization/feature-authorization-guard/some-feature-authorization.guard';
|
||||||
|
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
|
||||||
|
import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class GroupPageGuard extends SomeFeatureAuthorizationGuard {
|
export class GroupPageGuard extends SomeFeatureAuthorizationGuard {
|
||||||
|
|
||||||
@@ -28,7 +36,7 @@ export class GroupPageGuard extends SomeFeatureAuthorizationGuard {
|
|||||||
|
|
||||||
getObjectUrl(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<string> {
|
getObjectUrl(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<string> {
|
||||||
return this.halEndpointService.getEndpoint(this.groupsEndpoint).pipe(
|
return this.halEndpointService.getEndpoint(this.groupsEndpoint).pipe(
|
||||||
map(groupsUrl => `${groupsUrl}/${route?.params?.groupId}`)
|
map(groupsUrl => `${groupsUrl}/${route?.params?.groupId}`),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
/* eslint-disable max-classes-per-file */
|
/* eslint-disable max-classes-per-file */
|
||||||
import { Action } from '@ngrx/store';
|
import { Action } from '@ngrx/store';
|
||||||
|
|
||||||
import { Group } from '../../core/eperson/models/group.model';
|
import { Group } from '../../core/eperson/models/group.model';
|
||||||
import { type } from '../../shared/ngrx/type';
|
import { type } from '../../shared/ngrx/type';
|
||||||
|
|
||||||
|
@@ -1,6 +1,12 @@
|
|||||||
import { GroupMock } from '../../shared/testing/group-mock';
|
import { GroupMock } from '../../shared/testing/group-mock';
|
||||||
import { GroupRegistryCancelGroupAction, GroupRegistryEditGroupAction } from './group-registry.actions';
|
import {
|
||||||
import { groupRegistryReducer, GroupRegistryState } from './group-registry.reducers';
|
GroupRegistryCancelGroupAction,
|
||||||
|
GroupRegistryEditGroupAction,
|
||||||
|
} from './group-registry.actions';
|
||||||
|
import {
|
||||||
|
groupRegistryReducer,
|
||||||
|
GroupRegistryState,
|
||||||
|
} from './group-registry.reducers';
|
||||||
|
|
||||||
const initialState: GroupRegistryState = {
|
const initialState: GroupRegistryState = {
|
||||||
editGroup: null,
|
editGroup: null,
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
import { Group } from '../../core/eperson/models/group.model';
|
import { Group } from '../../core/eperson/models/group.model';
|
||||||
import { GroupRegistryAction, GroupRegistryActionTypes, GroupRegistryEditGroupAction } from './group-registry.actions';
|
import {
|
||||||
|
GroupRegistryAction,
|
||||||
|
GroupRegistryActionTypes,
|
||||||
|
GroupRegistryEditGroupAction,
|
||||||
|
} from './group-registry.actions';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The metadata registry state.
|
* The metadata registry state.
|
||||||
@@ -27,13 +31,13 @@ export function groupRegistryReducer(state = initialState, action: GroupRegistry
|
|||||||
|
|
||||||
case GroupRegistryActionTypes.EDIT_GROUP: {
|
case GroupRegistryActionTypes.EDIT_GROUP: {
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
editGroup: (action as GroupRegistryEditGroupAction).group
|
editGroup: (action as GroupRegistryEditGroupAction).group,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
case GroupRegistryActionTypes.CANCEL_EDIT_GROUP: {
|
case GroupRegistryActionTypes.CANCEL_EDIT_GROUP: {
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
editGroup: null
|
editGroup: null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
<ds-themed-loading *ngIf="loading$ | async"></ds-themed-loading>
|
<ds-themed-loading *ngIf="loading$ | async"></ds-themed-loading>
|
||||||
<ds-pagination
|
<ds-pagination
|
||||||
*ngIf="(pageInfoState$ | async)?.totalElements > 0 && !(loading$ | async)"
|
*ngIf="(pageInfoState$ | async)?.totalElements > 0 && (loading$ | async) !== true"
|
||||||
[paginationOptions]="config"
|
[paginationOptions]="config"
|
||||||
[pageInfoState]="pageInfoState$"
|
[pageInfoState]="pageInfoState$"
|
||||||
[collectionSize]="(pageInfoState$ | async)?.totalElements"
|
[collectionSize]="(pageInfoState$ | async)?.totalElements"
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ds-pagination>
|
</ds-pagination>
|
||||||
|
|
||||||
<div *ngIf="(pageInfoState$ | async)?.totalElements == 0" class="alert alert-info w-100 mb-2" role="alert">
|
<div *ngIf="(pageInfoState$ | async)?.totalElements === 0" class="alert alert-info w-100 mb-2" role="alert">
|
||||||
{{messagePrefix + 'no-items' | translate}}
|
{{messagePrefix + 'no-items' | translate}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -1,39 +1,71 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { ComponentFixture, fakeAsync, inject, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
import {
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
ComponentFixture,
|
||||||
import { BrowserModule, By } from '@angular/platform-browser';
|
fakeAsync,
|
||||||
|
inject,
|
||||||
|
TestBed,
|
||||||
|
tick,
|
||||||
|
waitForAsync,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
} from '@angular/forms';
|
||||||
|
import {
|
||||||
|
BrowserModule,
|
||||||
|
By,
|
||||||
|
} from '@angular/platform-browser';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
import {
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
TranslateLoader,
|
||||||
|
TranslateModule,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
|
import {
|
||||||
|
Observable,
|
||||||
|
of as observableOf,
|
||||||
|
} from 'rxjs';
|
||||||
|
|
||||||
|
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
||||||
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
||||||
import { buildPaginatedList, PaginatedList } from '../../core/data/paginated-list.model';
|
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
|
||||||
|
import {
|
||||||
|
buildPaginatedList,
|
||||||
|
PaginatedList,
|
||||||
|
} from '../../core/data/paginated-list.model';
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
import { RequestService } from '../../core/data/request.service';
|
import { RequestService } from '../../core/data/request.service';
|
||||||
import { EPersonDataService } from '../../core/eperson/eperson-data.service';
|
import { EPersonDataService } from '../../core/eperson/eperson-data.service';
|
||||||
import { GroupDataService } from '../../core/eperson/group-data.service';
|
import { GroupDataService } from '../../core/eperson/group-data.service';
|
||||||
import { EPerson } from '../../core/eperson/models/eperson.model';
|
import { EPerson } from '../../core/eperson/models/eperson.model';
|
||||||
import { Group } from '../../core/eperson/models/group.model';
|
import { Group } from '../../core/eperson/models/group.model';
|
||||||
|
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||||
import { RouteService } from '../../core/services/route.service';
|
import { RouteService } from '../../core/services/route.service';
|
||||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
|
||||||
import { GroupMock, GroupMock2 } from '../../shared/testing/group-mock';
|
|
||||||
import { GroupsRegistryComponent } from './groups-registry.component';
|
|
||||||
import { EPersonMock, EPersonMock2 } from '../../shared/testing/eperson.mock';
|
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
|
||||||
import { TranslateLoaderMock } from '../../shared/testing/translate-loader.mock';
|
|
||||||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
|
||||||
import { routeServiceStub } from '../../shared/testing/route-service.stub';
|
|
||||||
import { RouterMock } from '../../shared/mocks/router.mock';
|
|
||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
|
||||||
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
|
||||||
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
|
|
||||||
import { NoContent } from '../../core/shared/NoContent.model';
|
import { NoContent } from '../../core/shared/NoContent.model';
|
||||||
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
import { DSONameServiceMock, UNDEFINED_NAME } from '../../shared/mocks/dso-name.service.mock';
|
import {
|
||||||
|
DSONameServiceMock,
|
||||||
|
UNDEFINED_NAME,
|
||||||
|
} from '../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { RouterMock } from '../../shared/mocks/router.mock';
|
||||||
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
|
import {
|
||||||
|
EPersonMock,
|
||||||
|
EPersonMock2,
|
||||||
|
} from '../../shared/testing/eperson.mock';
|
||||||
|
import {
|
||||||
|
GroupMock,
|
||||||
|
GroupMock2,
|
||||||
|
} from '../../shared/testing/group-mock';
|
||||||
|
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
||||||
|
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
||||||
|
import { routeServiceStub } from '../../shared/testing/route-service.stub';
|
||||||
|
import { TranslateLoaderMock } from '../../shared/testing/translate-loader.mock';
|
||||||
|
import { GroupsRegistryComponent } from './groups-registry.component';
|
||||||
|
|
||||||
describe('GroupsRegistryComponent', () => {
|
describe('GroupsRegistryComponent', () => {
|
||||||
let component: GroupsRegistryComponent;
|
let component: GroupsRegistryComponent;
|
||||||
@@ -78,24 +110,24 @@ describe('GroupsRegistryComponent', () => {
|
|||||||
elementsPerPage: 1,
|
elementsPerPage: 1,
|
||||||
totalElements: 0,
|
totalElements: 0,
|
||||||
totalPages: 0,
|
totalPages: 0,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
}), []));
|
}), []));
|
||||||
case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid/epersons':
|
case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid/epersons':
|
||||||
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
||||||
elementsPerPage: 1,
|
elementsPerPage: 1,
|
||||||
totalElements: 1,
|
totalElements: 1,
|
||||||
totalPages: 1,
|
totalPages: 1,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
}), [EPersonMock]));
|
}), [EPersonMock]));
|
||||||
default:
|
default:
|
||||||
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
||||||
elementsPerPage: 1,
|
elementsPerPage: 1,
|
||||||
totalElements: 0,
|
totalElements: 0,
|
||||||
totalPages: 0,
|
totalPages: 0,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
}), []));
|
}), []));
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
groupsDataServiceStub = {
|
groupsDataServiceStub = {
|
||||||
allGroups: mockGroups,
|
allGroups: mockGroups,
|
||||||
@@ -106,21 +138,21 @@ describe('GroupsRegistryComponent', () => {
|
|||||||
elementsPerPage: 1,
|
elementsPerPage: 1,
|
||||||
totalElements: 0,
|
totalElements: 0,
|
||||||
totalPages: 0,
|
totalPages: 0,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
}), []));
|
}), []));
|
||||||
case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid/groups':
|
case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid/groups':
|
||||||
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
||||||
elementsPerPage: 1,
|
elementsPerPage: 1,
|
||||||
totalElements: 1,
|
totalElements: 1,
|
||||||
totalPages: 1,
|
totalPages: 1,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
}), [GroupMock2]));
|
}), [GroupMock2]));
|
||||||
default:
|
default:
|
||||||
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
||||||
elementsPerPage: 1,
|
elementsPerPage: 1,
|
||||||
totalElements: 0,
|
totalElements: 0,
|
||||||
totalPages: 0,
|
totalPages: 0,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
}), []));
|
}), []));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -136,7 +168,7 @@ describe('GroupsRegistryComponent', () => {
|
|||||||
elementsPerPage: this.allGroups.length,
|
elementsPerPage: this.allGroups.length,
|
||||||
totalElements: this.allGroups.length,
|
totalElements: this.allGroups.length,
|
||||||
totalPages: 1,
|
totalPages: 1,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
}), this.allGroups));
|
}), this.allGroups));
|
||||||
}
|
}
|
||||||
const result = this.allGroups.find((group: Group) => {
|
const result = this.allGroups.find((group: Group) => {
|
||||||
@@ -146,7 +178,7 @@ describe('GroupsRegistryComponent', () => {
|
|||||||
elementsPerPage: [result].length,
|
elementsPerPage: [result].length,
|
||||||
totalElements: [result].length,
|
totalElements: [result].length,
|
||||||
totalPages: 1,
|
totalPages: 1,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
}), [result]));
|
}), [result]));
|
||||||
},
|
},
|
||||||
delete(objectId: string, copyVirtualMetadata?: string[]): Observable<RemoteData<NoContent>> {
|
delete(objectId: string, copyVirtualMetadata?: string[]): Observable<RemoteData<NoContent>> {
|
||||||
@@ -156,7 +188,7 @@ describe('GroupsRegistryComponent', () => {
|
|||||||
dsoDataServiceStub = {
|
dsoDataServiceStub = {
|
||||||
findByHref(href: string): Observable<RemoteData<DSpaceObject>> {
|
findByHref(href: string): Observable<RemoteData<DSpaceObject>> {
|
||||||
return createSuccessfulRemoteDataObject$(undefined);
|
return createSuccessfulRemoteDataObject$(undefined);
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
authorizationService = jasmine.createSpyObj('authorizationService', ['isAuthorized']);
|
authorizationService = jasmine.createSpyObj('authorizationService', ['isAuthorized']);
|
||||||
@@ -167,8 +199,8 @@ describe('GroupsRegistryComponent', () => {
|
|||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: TranslateLoaderMock
|
useClass: TranslateLoaderMock,
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
declarations: [GroupsRegistryComponent],
|
declarations: [GroupsRegistryComponent],
|
||||||
@@ -182,9 +214,9 @@ describe('GroupsRegistryComponent', () => {
|
|||||||
{ provide: Router, useValue: new RouterMock() },
|
{ provide: Router, useValue: new RouterMock() },
|
||||||
{ provide: AuthorizationDataService, useValue: authorizationService },
|
{ provide: AuthorizationDataService, useValue: authorizationService },
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) }
|
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -237,16 +269,16 @@ describe('GroupsRegistryComponent', () => {
|
|||||||
|
|
||||||
it('should not check the canManageGroup permissions', () => {
|
it('should not check the canManageGroup permissions', () => {
|
||||||
expect(authorizationService.isAuthorized).not.toHaveBeenCalledWith(
|
expect(authorizationService.isAuthorized).not.toHaveBeenCalledWith(
|
||||||
FeatureID.CanManageGroup, mockGroups[0].self
|
FeatureID.CanManageGroup, mockGroups[0].self,
|
||||||
);
|
);
|
||||||
expect(authorizationService.isAuthorized).not.toHaveBeenCalledWith(
|
expect(authorizationService.isAuthorized).not.toHaveBeenCalledWith(
|
||||||
FeatureID.CanManageGroup, mockGroups[0].self, undefined // treated differently
|
FeatureID.CanManageGroup, mockGroups[0].self, undefined, // treated differently
|
||||||
);
|
);
|
||||||
expect(authorizationService.isAuthorized).not.toHaveBeenCalledWith(
|
expect(authorizationService.isAuthorized).not.toHaveBeenCalledWith(
|
||||||
FeatureID.CanManageGroup, mockGroups[1].self
|
FeatureID.CanManageGroup, mockGroups[1].self,
|
||||||
);
|
);
|
||||||
expect(authorizationService.isAuthorized).not.toHaveBeenCalledWith(
|
expect(authorizationService.isAuthorized).not.toHaveBeenCalledWith(
|
||||||
FeatureID.CanManageGroup, mockGroups[1].self, undefined // treated differently
|
FeatureID.CanManageGroup, mockGroups[1].self, undefined, // treated differently
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,8 @@
|
|||||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
import {
|
||||||
|
Component,
|
||||||
|
OnDestroy,
|
||||||
|
OnInit,
|
||||||
|
} from '@angular/core';
|
||||||
import { UntypedFormBuilder } from '@angular/forms';
|
import { UntypedFormBuilder } from '@angular/forms';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
@@ -8,36 +12,46 @@ import {
|
|||||||
EMPTY,
|
EMPTY,
|
||||||
Observable,
|
Observable,
|
||||||
of as observableOf,
|
of as observableOf,
|
||||||
Subscription
|
Subscription,
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
import { catchError, defaultIfEmpty, map, switchMap, tap } from 'rxjs/operators';
|
import {
|
||||||
|
catchError,
|
||||||
|
defaultIfEmpty,
|
||||||
|
map,
|
||||||
|
switchMap,
|
||||||
|
tap,
|
||||||
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
||||||
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
||||||
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
|
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
|
||||||
import { buildPaginatedList, PaginatedList } from '../../core/data/paginated-list.model';
|
import {
|
||||||
|
buildPaginatedList,
|
||||||
|
PaginatedList,
|
||||||
|
} from '../../core/data/paginated-list.model';
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
import { RequestService } from '../../core/data/request.service';
|
import { RequestService } from '../../core/data/request.service';
|
||||||
import { EPersonDataService } from '../../core/eperson/eperson-data.service';
|
import { EPersonDataService } from '../../core/eperson/eperson-data.service';
|
||||||
import { GroupDataService } from '../../core/eperson/group-data.service';
|
import { GroupDataService } from '../../core/eperson/group-data.service';
|
||||||
import { EPerson } from '../../core/eperson/models/eperson.model';
|
import { EPerson } from '../../core/eperson/models/eperson.model';
|
||||||
import { GroupDtoModel } from '../../core/eperson/models/group-dto.model';
|
|
||||||
import { Group } from '../../core/eperson/models/group.model';
|
import { Group } from '../../core/eperson/models/group.model';
|
||||||
|
import { GroupDtoModel } from '../../core/eperson/models/group-dto.model';
|
||||||
|
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||||
import { RouteService } from '../../core/services/route.service';
|
import { RouteService } from '../../core/services/route.service';
|
||||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||||
|
import { NoContent } from '../../core/shared/NoContent.model';
|
||||||
import {
|
import {
|
||||||
getAllSucceededRemoteData,
|
getAllSucceededRemoteData,
|
||||||
getFirstCompletedRemoteData,
|
getFirstCompletedRemoteData,
|
||||||
getFirstSucceededRemoteData,
|
getFirstSucceededRemoteData,
|
||||||
getRemoteDataPayload
|
getRemoteDataPayload,
|
||||||
} from '../../core/shared/operators';
|
} from '../../core/shared/operators';
|
||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
import { hasValue } from '../../shared/empty.util';
|
import { hasValue } from '../../shared/empty.util';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
import { NoContent } from '../../core/shared/NoContent.model';
|
|
||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
|
||||||
import { followLink } from '../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||||
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-groups-registry',
|
selector: 'ds-groups-registry',
|
||||||
@@ -57,7 +71,7 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
|
|||||||
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'gl',
|
id: 'gl',
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -155,7 +169,7 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
|
|||||||
this.canManageGroup$(isSiteAdmin, group),
|
this.canManageGroup$(isSiteAdmin, group),
|
||||||
this.hasLinkedDSO(group),
|
this.hasLinkedDSO(group),
|
||||||
this.getSubgroups(group),
|
this.getSubgroups(group),
|
||||||
this.getMembers(group)
|
this.getMembers(group),
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([canDelete, canManageGroup, hasLinkedDSO, subgroups, members]:
|
map(([canDelete, canManageGroup, hasLinkedDSO, subgroups, members]:
|
||||||
[boolean, boolean, boolean, RemoteData<PaginatedList<Group>>, RemoteData<PaginatedList<EPerson>>]) => {
|
[boolean, boolean, boolean, RemoteData<PaginatedList<Group>>, RemoteData<PaginatedList<EPerson>>]) => {
|
||||||
@@ -166,8 +180,8 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
|
|||||||
groupDtoModel.subgroups = subgroups.payload;
|
groupDtoModel.subgroups = subgroups.payload;
|
||||||
groupDtoModel.epersons = members.payload;
|
groupDtoModel.epersons = members.payload;
|
||||||
return groupDtoModel;
|
return groupDtoModel;
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
@@ -175,9 +189,9 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
|
|||||||
})]).pipe(defaultIfEmpty([]), map((dtos: GroupDtoModel[]) => {
|
})]).pipe(defaultIfEmpty([]), map((dtos: GroupDtoModel[]) => {
|
||||||
return buildPaginatedList(groups.pageInfo, dtos);
|
return buildPaginatedList(groups.pageInfo, dtos);
|
||||||
}));
|
}));
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
})
|
}),
|
||||||
).subscribe((value: PaginatedList<GroupDtoModel>) => {
|
).subscribe((value: PaginatedList<GroupDtoModel>) => {
|
||||||
this.groupsDto$.next(value);
|
this.groupsDto$.next(value);
|
||||||
this.pageInfoState$.next(value.pageInfo);
|
this.pageInfoState$.next(value.pageInfo);
|
||||||
|
@@ -1,7 +1,12 @@
|
|||||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
||||||
import { AdminCurationTasksComponent } from './admin-curation-tasks.component';
|
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
|
||||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
|
import {
|
||||||
|
ComponentFixture,
|
||||||
|
TestBed,
|
||||||
|
waitForAsync,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
import { AdminCurationTasksComponent } from './admin-curation-tasks.component';
|
||||||
|
|
||||||
describe('AdminCurationTasksComponent', () => {
|
describe('AdminCurationTasksComponent', () => {
|
||||||
let comp: AdminCurationTasksComponent;
|
let comp: AdminCurationTasksComponent;
|
||||||
@@ -11,7 +16,7 @@ describe('AdminCurationTasksComponent', () => {
|
|||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot()],
|
imports: [TranslateModule.forRoot()],
|
||||||
declarations: [AdminCurationTasksComponent],
|
declarations: [AdminCurationTasksComponent],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@@ -1,22 +1,31 @@
|
|||||||
import { ComponentFixture, fakeAsync, TestBed, waitForAsync } from '@angular/core/testing';
|
|
||||||
import { BatchImportPageComponent } from './batch-import-page.component';
|
|
||||||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
|
||||||
import { createFailedRemoteDataObject$, createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
|
||||||
import { FormsModule } from '@angular/forms';
|
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
|
||||||
import { FileValueAccessorDirective } from '../../shared/utils/file-value-accessor.directive';
|
|
||||||
import { FileValidator } from '../../shared/utils/require-file.validator';
|
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
|
||||||
import {
|
|
||||||
BATCH_IMPORT_SCRIPT_NAME,
|
|
||||||
ScriptDataService
|
|
||||||
} from '../../core/data/processes/script-data.service';
|
|
||||||
import { Router } from '@angular/router';
|
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import {
|
||||||
|
ComponentFixture,
|
||||||
|
fakeAsync,
|
||||||
|
TestBed,
|
||||||
|
waitForAsync,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
import {
|
||||||
|
BATCH_IMPORT_SCRIPT_NAME,
|
||||||
|
ScriptDataService,
|
||||||
|
} from '../../core/data/processes/script-data.service';
|
||||||
import { ProcessParameter } from '../../process-page/processes/process-parameter.model';
|
import { ProcessParameter } from '../../process-page/processes/process-parameter.model';
|
||||||
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
|
import {
|
||||||
|
createFailedRemoteDataObject$,
|
||||||
|
createSuccessfulRemoteDataObject$,
|
||||||
|
} from '../../shared/remote-data.utils';
|
||||||
|
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
||||||
|
import { FileValueAccessorDirective } from '../../shared/utils/file-value-accessor.directive';
|
||||||
|
import { FileValidator } from '../../shared/utils/require-file.validator';
|
||||||
|
import { BatchImportPageComponent } from './batch-import-page.component';
|
||||||
|
|
||||||
describe('BatchImportPageComponent', () => {
|
describe('BatchImportPageComponent', () => {
|
||||||
let component: BatchImportPageComponent;
|
let component: BatchImportPageComponent;
|
||||||
@@ -31,14 +40,14 @@ describe('BatchImportPageComponent', () => {
|
|||||||
notificationService = new NotificationsServiceStub();
|
notificationService = new NotificationsServiceStub();
|
||||||
scriptService = jasmine.createSpyObj('scriptService',
|
scriptService = jasmine.createSpyObj('scriptService',
|
||||||
{
|
{
|
||||||
invoke: createSuccessfulRemoteDataObject$({ processId: '46' })
|
invoke: createSuccessfulRemoteDataObject$({ processId: '46' }),
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
router = jasmine.createSpyObj('router', {
|
router = jasmine.createSpyObj('router', {
|
||||||
navigateByUrl: jasmine.createSpy('navigateByUrl')
|
navigateByUrl: jasmine.createSpy('navigateByUrl'),
|
||||||
});
|
});
|
||||||
locationStub = jasmine.createSpyObj('location', {
|
locationStub = jasmine.createSpyObj('location', {
|
||||||
back: jasmine.createSpy('back')
|
back: jasmine.createSpy('back'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +57,7 @@ describe('BatchImportPageComponent', () => {
|
|||||||
imports: [
|
imports: [
|
||||||
FormsModule,
|
FormsModule,
|
||||||
TranslateModule.forRoot(),
|
TranslateModule.forRoot(),
|
||||||
RouterTestingModule.withRoutes([])
|
RouterTestingModule.withRoutes([]),
|
||||||
],
|
],
|
||||||
declarations: [BatchImportPageComponent, FileValueAccessorDirective, FileValidator],
|
declarations: [BatchImportPageComponent, FileValueAccessorDirective, FileValidator],
|
||||||
providers: [
|
providers: [
|
||||||
@@ -57,7 +66,7 @@ describe('BatchImportPageComponent', () => {
|
|||||||
{ provide: Router, useValue: router },
|
{ provide: Router, useValue: router },
|
||||||
{ provide: Location, useValue: locationStub },
|
{ provide: Location, useValue: locationStub },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -108,7 +117,7 @@ describe('BatchImportPageComponent', () => {
|
|||||||
it('metadata-import script is invoked with --zip fileName and the mockFile', () => {
|
it('metadata-import script is invoked with --zip fileName and the mockFile', () => {
|
||||||
const parameterValues: ProcessParameter[] = [
|
const parameterValues: ProcessParameter[] = [
|
||||||
Object.assign(new ProcessParameter(), { name: '--add' }),
|
Object.assign(new ProcessParameter(), { name: '--add' }),
|
||||||
Object.assign(new ProcessParameter(), { name: '--zip', value: 'filename.zip' })
|
Object.assign(new ProcessParameter(), { name: '--zip', value: 'filename.zip' }),
|
||||||
];
|
];
|
||||||
expect(scriptService.invoke).toHaveBeenCalledWith(BATCH_IMPORT_SCRIPT_NAME, parameterValues, [fileMock]);
|
expect(scriptService.invoke).toHaveBeenCalledWith(BATCH_IMPORT_SCRIPT_NAME, parameterValues, [fileMock]);
|
||||||
});
|
});
|
||||||
@@ -181,7 +190,7 @@ describe('BatchImportPageComponent', () => {
|
|||||||
it('metadata-import script is invoked with --url and the file url', () => {
|
it('metadata-import script is invoked with --url and the file url', () => {
|
||||||
const parameterValues: ProcessParameter[] = [
|
const parameterValues: ProcessParameter[] = [
|
||||||
Object.assign(new ProcessParameter(), { name: '--add' }),
|
Object.assign(new ProcessParameter(), { name: '--add' }),
|
||||||
Object.assign(new ProcessParameter(), { name: '--url', value: 'example.fileURL.com' })
|
Object.assign(new ProcessParameter(), { name: '--url', value: 'example.fileURL.com' }),
|
||||||
];
|
];
|
||||||
expect(scriptService.invoke).toHaveBeenCalledWith(BATCH_IMPORT_SCRIPT_NAME, parameterValues, [null]);
|
expect(scriptService.invoke).toHaveBeenCalledWith(BATCH_IMPORT_SCRIPT_NAME, parameterValues, [null]);
|
||||||
});
|
});
|
||||||
|
@@ -1,26 +1,31 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { Component } from '@angular/core';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
|
||||||
import { BATCH_IMPORT_SCRIPT_NAME, ScriptDataService } from '../../core/data/processes/script-data.service';
|
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { ProcessParameter } from '../../process-page/processes/process-parameter.model';
|
|
||||||
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
|
||||||
import { Process } from '../../process-page/processes/process.model';
|
|
||||||
import { isEmpty, isNotEmpty } from '../../shared/empty.util';
|
|
||||||
import { getProcessDetailRoute } from '../../process-page/process-page-routing.paths';
|
|
||||||
import {
|
|
||||||
ImportBatchSelectorComponent
|
|
||||||
} from '../../shared/dso-selector/modal-wrappers/import-batch-selector/import-batch-selector.component';
|
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { take } from 'rxjs/operators';
|
import { take } from 'rxjs/operators';
|
||||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
|
||||||
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
||||||
|
import {
|
||||||
|
BATCH_IMPORT_SCRIPT_NAME,
|
||||||
|
ScriptDataService,
|
||||||
|
} from '../../core/data/processes/script-data.service';
|
||||||
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
|
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||||
|
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
||||||
|
import { getProcessDetailRoute } from '../../process-page/process-page-routing.paths';
|
||||||
|
import { Process } from '../../process-page/processes/process.model';
|
||||||
|
import { ProcessParameter } from '../../process-page/processes/process-parameter.model';
|
||||||
|
import { ImportBatchSelectorComponent } from '../../shared/dso-selector/modal-wrappers/import-batch-selector/import-batch-selector.component';
|
||||||
|
import {
|
||||||
|
isEmpty,
|
||||||
|
isNotEmpty,
|
||||||
|
} from '../../shared/empty.util';
|
||||||
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-batch-import-page',
|
selector: 'ds-batch-import-page',
|
||||||
templateUrl: './batch-import-page.component.html'
|
templateUrl: './batch-import-page.component.html',
|
||||||
})
|
})
|
||||||
export class BatchImportPageComponent {
|
export class BatchImportPageComponent {
|
||||||
/**
|
/**
|
||||||
@@ -91,7 +96,7 @@ export class BatchImportPageComponent {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const parameterValues: ProcessParameter[] = [
|
const parameterValues: ProcessParameter[] = [
|
||||||
Object.assign(new ProcessParameter(), { name: '--add' })
|
Object.assign(new ProcessParameter(), { name: '--add' }),
|
||||||
];
|
];
|
||||||
if (this.isUpload) {
|
if (this.isUpload) {
|
||||||
parameterValues.push(Object.assign(new ProcessParameter(), { name: '--zip', value: this.fileObject.name }));
|
parameterValues.push(Object.assign(new ProcessParameter(), { name: '--zip', value: this.fileObject.name }));
|
||||||
|
@@ -1,19 +1,31 @@
|
|||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { ComponentFixture, fakeAsync, TestBed, waitForAsync } from '@angular/core/testing';
|
import {
|
||||||
|
ComponentFixture,
|
||||||
|
fakeAsync,
|
||||||
|
TestBed,
|
||||||
|
waitForAsync,
|
||||||
|
} from '@angular/core/testing';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { METADATA_IMPORT_SCRIPT_NAME, ScriptDataService } from '../../core/data/processes/script-data.service';
|
|
||||||
|
import {
|
||||||
|
METADATA_IMPORT_SCRIPT_NAME,
|
||||||
|
ScriptDataService,
|
||||||
|
} from '../../core/data/processes/script-data.service';
|
||||||
import { ProcessParameter } from '../../process-page/processes/process-parameter.model';
|
import { ProcessParameter } from '../../process-page/processes/process-parameter.model';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
|
import {
|
||||||
|
createFailedRemoteDataObject$,
|
||||||
|
createSuccessfulRemoteDataObject$,
|
||||||
|
} from '../../shared/remote-data.utils';
|
||||||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
||||||
import { FileValueAccessorDirective } from '../../shared/utils/file-value-accessor.directive';
|
import { FileValueAccessorDirective } from '../../shared/utils/file-value-accessor.directive';
|
||||||
import { FileValidator } from '../../shared/utils/require-file.validator';
|
import { FileValidator } from '../../shared/utils/require-file.validator';
|
||||||
import { MetadataImportPageComponent } from './metadata-import-page.component';
|
import { MetadataImportPageComponent } from './metadata-import-page.component';
|
||||||
import { createFailedRemoteDataObject$, createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
|
||||||
|
|
||||||
describe('MetadataImportPageComponent', () => {
|
describe('MetadataImportPageComponent', () => {
|
||||||
let comp: MetadataImportPageComponent;
|
let comp: MetadataImportPageComponent;
|
||||||
@@ -28,14 +40,14 @@ describe('MetadataImportPageComponent', () => {
|
|||||||
notificationService = new NotificationsServiceStub();
|
notificationService = new NotificationsServiceStub();
|
||||||
scriptService = jasmine.createSpyObj('scriptService',
|
scriptService = jasmine.createSpyObj('scriptService',
|
||||||
{
|
{
|
||||||
invoke: createSuccessfulRemoteDataObject$({ processId: '45' })
|
invoke: createSuccessfulRemoteDataObject$({ processId: '45' }),
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
router = jasmine.createSpyObj('router', {
|
router = jasmine.createSpyObj('router', {
|
||||||
navigateByUrl: jasmine.createSpy('navigateByUrl')
|
navigateByUrl: jasmine.createSpy('navigateByUrl'),
|
||||||
});
|
});
|
||||||
locationStub = jasmine.createSpyObj('location', {
|
locationStub = jasmine.createSpyObj('location', {
|
||||||
back: jasmine.createSpy('back')
|
back: jasmine.createSpy('back'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +57,7 @@ describe('MetadataImportPageComponent', () => {
|
|||||||
imports: [
|
imports: [
|
||||||
FormsModule,
|
FormsModule,
|
||||||
TranslateModule.forRoot(),
|
TranslateModule.forRoot(),
|
||||||
RouterTestingModule.withRoutes([])
|
RouterTestingModule.withRoutes([]),
|
||||||
],
|
],
|
||||||
declarations: [MetadataImportPageComponent, FileValueAccessorDirective, FileValidator],
|
declarations: [MetadataImportPageComponent, FileValueAccessorDirective, FileValidator],
|
||||||
providers: [
|
providers: [
|
||||||
@@ -54,7 +66,7 @@ describe('MetadataImportPageComponent', () => {
|
|||||||
{ provide: Router, useValue: router },
|
{ provide: Router, useValue: router },
|
||||||
{ provide: Location, useValue: locationStub },
|
{ provide: Location, useValue: locationStub },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@@ -2,18 +2,22 @@ import { Location } from '@angular/common';
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { METADATA_IMPORT_SCRIPT_NAME, ScriptDataService } from '../../core/data/processes/script-data.service';
|
|
||||||
|
import {
|
||||||
|
METADATA_IMPORT_SCRIPT_NAME,
|
||||||
|
ScriptDataService,
|
||||||
|
} from '../../core/data/processes/script-data.service';
|
||||||
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
|
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
||||||
|
import { getProcessDetailRoute } from '../../process-page/process-page-routing.paths';
|
||||||
|
import { Process } from '../../process-page/processes/process.model';
|
||||||
import { ProcessParameter } from '../../process-page/processes/process-parameter.model';
|
import { ProcessParameter } from '../../process-page/processes/process-parameter.model';
|
||||||
import { isNotEmpty } from '../../shared/empty.util';
|
import { isNotEmpty } from '../../shared/empty.util';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
|
||||||
import { Process } from '../../process-page/processes/process.model';
|
|
||||||
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
|
||||||
import { getProcessDetailRoute } from '../../process-page/process-page-routing.paths';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-metadata-import-page',
|
selector: 'ds-metadata-import-page',
|
||||||
templateUrl: './metadata-import-page.component.html'
|
templateUrl: './metadata-import-page.component.html',
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,10 +1,13 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import {
|
||||||
import { LdnServicesOverviewComponent } from './ldn-services-directory/ldn-services-directory.component';
|
RouterModule,
|
||||||
import { NavigationBreadcrumbResolver } from '../../core/breadcrumbs/navigation-breadcrumb.resolver';
|
Routes,
|
||||||
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
} from '@angular/router';
|
||||||
import { LdnServiceFormComponent } from './ldn-service-form/ldn-service-form.component';
|
|
||||||
|
|
||||||
|
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
|
import { NavigationBreadcrumbResolver } from '../../core/breadcrumbs/navigation-breadcrumb.resolver';
|
||||||
|
import { LdnServiceFormComponent } from './ldn-service-form/ldn-service-form.component';
|
||||||
|
import { LdnServicesOverviewComponent } from './ldn-services-directory/ldn-services-directory.component';
|
||||||
|
|
||||||
const moduleRoutes: Routes = [
|
const moduleRoutes: Routes = [
|
||||||
{
|
{
|
||||||
@@ -18,13 +21,13 @@ const moduleRoutes: Routes = [
|
|||||||
path: 'new',
|
path: 'new',
|
||||||
resolve: { breadcrumb: NavigationBreadcrumbResolver },
|
resolve: { breadcrumb: NavigationBreadcrumbResolver },
|
||||||
component: LdnServiceFormComponent,
|
component: LdnServiceFormComponent,
|
||||||
data: {title: 'ldn-register-new-service.title', breadcrumbKey: 'ldn-register-new-service'}
|
data: { title: 'ldn-register-new-service.title', breadcrumbKey: 'ldn-register-new-service' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'edit/:serviceId',
|
path: 'edit/:serviceId',
|
||||||
resolve: { breadcrumb: NavigationBreadcrumbResolver },
|
resolve: { breadcrumb: NavigationBreadcrumbResolver },
|
||||||
component: LdnServiceFormComponent,
|
component: LdnServiceFormComponent,
|
||||||
data: {title: 'ldn-edit-service.title', breadcrumbKey: 'ldn-edit-service'}
|
data: { title: 'ldn-edit-service.title', breadcrumbKey: 'ldn-edit-service' },
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -37,10 +40,10 @@ const moduleRoutes: Routes = [
|
|||||||
relatedRoutes: moduleRoutes.filter(relatedRoute => relatedRoute.path !== route.path)
|
relatedRoutes: moduleRoutes.filter(relatedRoute => relatedRoute.path !== route.path)
|
||||||
.map((relatedRoute) => {
|
.map((relatedRoute) => {
|
||||||
return { path: relatedRoute.path, data: relatedRoute.data };
|
return { path: relatedRoute.path, data: relatedRoute.data };
|
||||||
})
|
}),
|
||||||
} };
|
} };
|
||||||
}))
|
})),
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
export class AdminLdnServicesRoutingModule {
|
export class AdminLdnServicesRoutingModule {
|
||||||
|
|
||||||
|
@@ -1,25 +1,25 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { AdminLdnServicesRoutingModule } from './admin-ldn-services-routing.module';
|
import { NgModule } from '@angular/core';
|
||||||
import { LdnServicesOverviewComponent } from './ldn-services-directory/ldn-services-directory.component';
|
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
|
||||||
import { LdnServiceFormComponent } from './ldn-service-form/ldn-service-form.component';
|
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { LdnItemfiltersService } from './ldn-services-data/ldn-itemfilters-data.service';
|
|
||||||
|
|
||||||
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
|
import { AdminLdnServicesRoutingModule } from './admin-ldn-services-routing.module';
|
||||||
|
import { LdnServiceFormComponent } from './ldn-service-form/ldn-service-form.component';
|
||||||
|
import { LdnItemfiltersService } from './ldn-services-data/ldn-itemfilters-data.service';
|
||||||
|
import { LdnServicesOverviewComponent } from './ldn-services-directory/ldn-services-directory.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
SharedModule,
|
SharedModule,
|
||||||
AdminLdnServicesRoutingModule,
|
AdminLdnServicesRoutingModule,
|
||||||
FormsModule
|
FormsModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
LdnServicesOverviewComponent,
|
LdnServicesOverviewComponent,
|
||||||
LdnServiceFormComponent,
|
LdnServiceFormComponent,
|
||||||
],
|
],
|
||||||
providers: [LdnItemfiltersService]
|
providers: [LdnItemfiltersService],
|
||||||
})
|
})
|
||||||
export class AdminLdnServicesModule {
|
export class AdminLdnServicesModule {
|
||||||
}
|
}
|
||||||
|
@@ -1,23 +1,49 @@
|
|||||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
import {
|
||||||
|
ChangeDetectorRef,
|
||||||
import {NgbDropdownModule, NgbModal} from '@ng-bootstrap/ng-bootstrap';
|
EventEmitter,
|
||||||
import {LdnServiceFormComponent} from './ldn-service-form.component';
|
} from '@angular/core';
|
||||||
import {ChangeDetectorRef, EventEmitter} from '@angular/core';
|
import {
|
||||||
import { FormArray, FormBuilder, FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
ComponentFixture,
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
fakeAsync,
|
||||||
import {TranslateModule, TranslateService} from '@ngx-translate/core';
|
TestBed,
|
||||||
|
tick,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
FormArray,
|
||||||
|
FormBuilder,
|
||||||
|
FormControl,
|
||||||
|
FormGroup,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
} from '@angular/forms';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
|
import {
|
||||||
|
ActivatedRoute,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
|
import {
|
||||||
|
NgbDropdownModule,
|
||||||
|
NgbModal,
|
||||||
|
} from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { provideMockStore } from '@ngrx/store/testing';
|
||||||
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
import { PaginationService } from 'ngx-pagination';
|
import { PaginationService } from 'ngx-pagination';
|
||||||
|
import {
|
||||||
|
of as observableOf,
|
||||||
|
of,
|
||||||
|
} from 'rxjs';
|
||||||
|
|
||||||
|
import { RouteService } from '../../../core/services/route.service';
|
||||||
|
import { MockActivatedRoute } from '../../../shared/mocks/active-router.mock';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
import { LdnItemfiltersService } from '../ldn-services-data/ldn-itemfilters-data.service';
|
import { LdnItemfiltersService } from '../ldn-services-data/ldn-itemfilters-data.service';
|
||||||
import { LdnServicesService } from '../ldn-services-data/ldn-services-data.service';
|
import { LdnServicesService } from '../ldn-services-data/ldn-services-data.service';
|
||||||
import {RouterStub} from '../../../shared/testing/router.stub';
|
import { LdnServiceFormComponent } from './ldn-service-form.component';
|
||||||
import {MockActivatedRoute} from '../../../shared/mocks/active-router.mock';
|
|
||||||
import {NotificationsServiceStub} from '../../../shared/testing/notifications-service.stub';
|
|
||||||
import { of as observableOf, of } from 'rxjs';
|
|
||||||
import {RouteService} from '../../../core/services/route.service';
|
|
||||||
import {provideMockStore} from '@ngrx/store/testing';
|
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
|
||||||
import { By } from '@angular/platform-browser';
|
|
||||||
|
|
||||||
describe('LdnServiceFormEditComponent', () => {
|
describe('LdnServiceFormEditComponent', () => {
|
||||||
let component: LdnServiceFormComponent;
|
let component: LdnServiceFormComponent;
|
||||||
@@ -52,9 +78,9 @@ describe('LdnServiceFormEditComponent', () => {
|
|||||||
'pattern': '',
|
'pattern': '',
|
||||||
'patternLabel': 'Select a pattern',
|
'patternLabel': 'Select a pattern',
|
||||||
'constraint': '',
|
'constraint': '',
|
||||||
'automatic': false
|
'automatic': false,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -63,7 +89,7 @@ describe('LdnServiceFormEditComponent', () => {
|
|||||||
instant: () => 'translated-text',
|
instant: () => 'translated-text',
|
||||||
onLangChange: new EventEmitter(),
|
onLangChange: new EventEmitter(),
|
||||||
onTranslationChange: new EventEmitter(),
|
onTranslationChange: new EventEmitter(),
|
||||||
onDefaultLangChange: new EventEmitter()
|
onDefaultLangChange: new EventEmitter(),
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
@@ -77,11 +103,11 @@ describe('LdnServiceFormEditComponent', () => {
|
|||||||
findAll: () => of(['item1', 'item2']),
|
findAll: () => of(['item1', 'item2']),
|
||||||
};
|
};
|
||||||
cdRefStub = Object.assign({
|
cdRefStub = Object.assign({
|
||||||
detectChanges: () => fixture.detectChanges()
|
detectChanges: () => fixture.detectChanges(),
|
||||||
});
|
});
|
||||||
modalService = {
|
modalService = {
|
||||||
open: () => {/*comment*/
|
open: () => {/*comment*/
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -103,7 +129,7 @@ describe('LdnServiceFormEditComponent', () => {
|
|||||||
FormBuilder,
|
FormBuilder,
|
||||||
RouteService,
|
RouteService,
|
||||||
provideMockStore({}),
|
provideMockStore({}),
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
@@ -196,13 +222,13 @@ describe('LdnServiceFormEditComponent', () => {
|
|||||||
it('should check patterns', () => {
|
it('should check patterns', () => {
|
||||||
const arrValid = new FormArray([
|
const arrValid = new FormArray([
|
||||||
new FormGroup({
|
new FormGroup({
|
||||||
pattern: new FormControl('pattern')
|
pattern: new FormControl('pattern'),
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const arrInvalid = new FormArray([
|
const arrInvalid = new FormArray([
|
||||||
new FormGroup({
|
new FormGroup({
|
||||||
pattern: new FormControl('')
|
pattern: new FormControl(''),
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@@ -1,38 +1,51 @@
|
|||||||
|
import {
|
||||||
|
animate,
|
||||||
|
state,
|
||||||
|
style,
|
||||||
|
transition,
|
||||||
|
trigger,
|
||||||
|
} from '@angular/animations';
|
||||||
import {
|
import {
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
TemplateRef,
|
TemplateRef,
|
||||||
ViewChild
|
ViewChild,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import {
|
import {
|
||||||
FormArray,
|
FormArray,
|
||||||
FormBuilder,
|
FormBuilder,
|
||||||
FormGroup,
|
FormGroup,
|
||||||
Validators
|
Validators,
|
||||||
} from '@angular/forms';
|
} from '@angular/forms';
|
||||||
import {LDN_SERVICE} from '../ldn-services-model/ldn-service.resource-type';
|
import {
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
ActivatedRoute,
|
||||||
import {LdnServicesService} from '../ldn-services-data/ldn-services-data.service';
|
Router,
|
||||||
import {notifyPatterns} from '../ldn-services-patterns/ldn-service-coar-patterns';
|
} from '@angular/router';
|
||||||
import {animate, state, style, transition, trigger} from '@angular/animations';
|
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import {NotificationsService} from '../../../shared/notifications/notifications.service';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import {LdnService} from '../ldn-services-model/ldn-services.model';
|
|
||||||
import {RemoteData} from 'src/app/core/data/remote-data';
|
|
||||||
import { Operation } from 'fast-json-patch';
|
import { Operation } from 'fast-json-patch';
|
||||||
import {getFirstCompletedRemoteData} from '../../../core/shared/operators';
|
import {
|
||||||
import {LdnItemfiltersService} from '../ldn-services-data/ldn-itemfilters-data.service';
|
combineLatestWith,
|
||||||
import {Itemfilter} from '../ldn-services-model/ldn-service-itemfilters';
|
Observable,
|
||||||
import {PaginatedList} from '../../../core/data/paginated-list.model';
|
Subscription,
|
||||||
import {combineLatestWith, Observable, Subscription} from 'rxjs';
|
} from 'rxjs';
|
||||||
import {PaginationService} from '../../../core/pagination/pagination.service';
|
import { RemoteData } from 'src/app/core/data/remote-data';
|
||||||
import {FindListOptions} from '../../../core/data/find-list-options.model';
|
|
||||||
import {NotifyServicePattern} from '../ldn-services-model/ldn-service-patterns.model';
|
|
||||||
import { IpV4Validator } from '../../../shared/utils/ipV4.validator';
|
|
||||||
|
|
||||||
|
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||||
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
|
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||||
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { IpV4Validator } from '../../../shared/utils/ipV4.validator';
|
||||||
|
import { LdnItemfiltersService } from '../ldn-services-data/ldn-itemfilters-data.service';
|
||||||
|
import { LdnServicesService } from '../ldn-services-data/ldn-services-data.service';
|
||||||
|
import { LDN_SERVICE } from '../ldn-services-model/ldn-service.resource-type';
|
||||||
|
import { Itemfilter } from '../ldn-services-model/ldn-service-itemfilters';
|
||||||
|
import { NotifyServicePattern } from '../ldn-services-model/ldn-service-patterns.model';
|
||||||
|
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
||||||
|
import { notifyPatterns } from '../ldn-services-patterns/ldn-service-coar-patterns';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component for editing LDN service through a form that allows to create or edit the properties of a service
|
* Component for editing LDN service through a form that allows to create or edit the properties of a service
|
||||||
@@ -60,7 +73,7 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
|
|||||||
public areControlsInitialized: boolean;
|
public areControlsInitialized: boolean;
|
||||||
public itemfiltersRD$: Observable<RemoteData<PaginatedList<Itemfilter>>>;
|
public itemfiltersRD$: Observable<RemoteData<PaginatedList<Itemfilter>>>;
|
||||||
public config: FindListOptions = Object.assign(new FindListOptions(), {
|
public config: FindListOptions = Object.assign(new FindListOptions(), {
|
||||||
elementsPerPage: 20
|
elementsPerPage: 20,
|
||||||
});
|
});
|
||||||
public markedForDeletionInboundPattern: number[] = [];
|
public markedForDeletionInboundPattern: number[] = [];
|
||||||
public selectedInboundPatterns: string[];
|
public selectedInboundPatterns: string[];
|
||||||
@@ -83,7 +96,7 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
|
|||||||
protected modalService: NgbModal,
|
protected modalService: NgbModal,
|
||||||
private notificationService: NotificationsService,
|
private notificationService: NotificationsService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
protected paginationService: PaginationService
|
protected paginationService: PaginationService,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.formModel = this.formBuilder.group({
|
this.formModel = this.formBuilder.group({
|
||||||
@@ -103,7 +116,7 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.routeSubscription = this.route.params.pipe(
|
this.routeSubscription = this.route.params.pipe(
|
||||||
combineLatestWith(this.route.url)
|
combineLatestWith(this.route.url),
|
||||||
).subscribe(([params, segment]) => {
|
).subscribe(([params, segment]) => {
|
||||||
this.serviceId = params.serviceId;
|
this.serviceId = params.serviceId;
|
||||||
this.isNewService = segment[0].path === 'new';
|
this.isNewService = segment[0].path === 'new';
|
||||||
@@ -164,7 +177,7 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
|
|||||||
const ldnServiceData = this.ldnServicesService.create(values);
|
const ldnServiceData = this.ldnServicesService.create(values);
|
||||||
|
|
||||||
ldnServiceData.pipe(
|
ldnServiceData.pipe(
|
||||||
getFirstCompletedRemoteData()
|
getFirstCompletedRemoteData(),
|
||||||
).subscribe((rd: RemoteData<LdnService>) => {
|
).subscribe((rd: RemoteData<LdnService>) => {
|
||||||
if (rd.hasSucceeded) {
|
if (rd.hasSucceeded) {
|
||||||
this.notificationService.success(this.translateService.get('ldn-service-notification.created.success.title'),
|
this.notificationService.success(this.translateService.get('ldn-service-notification.created.success.title'),
|
||||||
@@ -204,7 +217,7 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
fetchServiceData(serviceId: string): void {
|
fetchServiceData(serviceId: string): void {
|
||||||
this.ldnServicesService.findById(serviceId).pipe(
|
this.ldnServicesService.findById(serviceId).pipe(
|
||||||
getFirstCompletedRemoteData()
|
getFirstCompletedRemoteData(),
|
||||||
).subscribe(
|
).subscribe(
|
||||||
(data: RemoteData<LdnService>) => {
|
(data: RemoteData<LdnService>) => {
|
||||||
if (data.hasSucceeded) {
|
if (data.hasSucceeded) {
|
||||||
@@ -219,18 +232,18 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
|
|||||||
type: this.ldnService.type,
|
type: this.ldnService.type,
|
||||||
enabled: this.ldnService.enabled,
|
enabled: this.ldnService.enabled,
|
||||||
lowerIp: this.ldnService.lowerIp,
|
lowerIp: this.ldnService.lowerIp,
|
||||||
upperIp: this.ldnService.upperIp
|
upperIp: this.ldnService.upperIp,
|
||||||
});
|
});
|
||||||
this.filterPatternObjectsAndAssignLabel('notifyServiceInboundPatterns');
|
this.filterPatternObjectsAndAssignLabel('notifyServiceInboundPatterns');
|
||||||
let notifyServiceInboundPatternsFormArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
|
const notifyServiceInboundPatternsFormArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
|
||||||
notifyServiceInboundPatternsFormArray.controls.forEach(
|
notifyServiceInboundPatternsFormArray.controls.forEach(
|
||||||
control => {
|
control => {
|
||||||
const controlFormGroup = control as FormGroup;
|
const controlFormGroup = control as FormGroup;
|
||||||
const controlConstraint = controlFormGroup.get('constraint').value;
|
const controlConstraint = controlFormGroup.get('constraint').value;
|
||||||
controlFormGroup.patchValue({
|
controlFormGroup.patchValue({
|
||||||
constraintFormatted: controlConstraint ? this.translateService.instant((controlConstraint as string) + '.label') : ''
|
constraintFormatted: controlConstraint ? this.translateService.instant((controlConstraint as string) + '.label') : '',
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -245,14 +258,13 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
|
|||||||
const PatternsArray = this.formModel.get(formArrayName) as FormArray;
|
const PatternsArray = this.formModel.get(formArrayName) as FormArray;
|
||||||
PatternsArray.clear();
|
PatternsArray.clear();
|
||||||
|
|
||||||
let servicesToUse = this.ldnService.notifyServiceInboundPatterns;
|
const servicesToUse = this.ldnService.notifyServiceInboundPatterns;
|
||||||
|
|
||||||
servicesToUse.forEach((patternObj: NotifyServicePattern) => {
|
servicesToUse.forEach((patternObj: NotifyServicePattern) => {
|
||||||
let patternFormGroup;
|
const patternFormGroup = this.initializeInboundPatternFormGroup();
|
||||||
patternFormGroup = this.initializeInboundPatternFormGroup();
|
|
||||||
const newPatternObjWithLabel = Object.assign(new NotifyServicePattern(), {
|
const newPatternObjWithLabel = Object.assign(new NotifyServicePattern(), {
|
||||||
...patternObj,
|
...patternObj,
|
||||||
patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternObj?.pattern + '.label')
|
patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternObj?.pattern + '.label'),
|
||||||
});
|
});
|
||||||
patternFormGroup.patchValue(newPatternObjWithLabel);
|
patternFormGroup.patchValue(newPatternObjWithLabel);
|
||||||
|
|
||||||
@@ -280,7 +292,7 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
|
|||||||
this.deletedInboundPatterns.forEach(index => {
|
this.deletedInboundPatterns.forEach(index => {
|
||||||
const removeOperation: Operation = {
|
const removeOperation: Operation = {
|
||||||
op: 'remove',
|
op: 'remove',
|
||||||
path: `notifyServiceInboundPatterns[${index}]`
|
path: `notifyServiceInboundPatterns[${index}]`,
|
||||||
};
|
};
|
||||||
patchOperations.push(removeOperation);
|
patchOperations.push(removeOperation);
|
||||||
});
|
});
|
||||||
@@ -323,7 +335,7 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
|
|||||||
const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray);
|
const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray);
|
||||||
filterArray.controls[index].patchValue({
|
filterArray.controls[index].patchValue({
|
||||||
constraint: filterValue,
|
constraint: filterValue,
|
||||||
constraintFormatted: this.translateService.instant((filterValue !== '' ? filterValue : 'ldn.no-filter') + '.label')
|
constraintFormatted: this.translateService.instant((filterValue !== '' ? filterValue : 'ldn.no-filter') + '.label'),
|
||||||
});
|
});
|
||||||
filterArray.markAllAsTouched();
|
filterArray.markAllAsTouched();
|
||||||
}
|
}
|
||||||
@@ -353,12 +365,12 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.ldnServicesService.patch(this.ldnService, [patchOperation]).pipe(
|
this.ldnServicesService.patch(this.ldnService, [patchOperation]).pipe(
|
||||||
getFirstCompletedRemoteData()
|
getFirstCompletedRemoteData(),
|
||||||
).subscribe(
|
).subscribe(
|
||||||
() => {
|
() => {
|
||||||
this.formModel.get('enabled').setValue(newStatus);
|
this.formModel.get('enabled').setValue(newStatus);
|
||||||
this.cdRef.detectChanges();
|
this.cdRef.detectChanges();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,7 +416,7 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.ldnServicesService.patch(this.ldnService, patchOperations).pipe(
|
this.ldnServicesService.patch(this.ldnService, patchOperations).pipe(
|
||||||
getFirstCompletedRemoteData()
|
getFirstCompletedRemoteData(),
|
||||||
).subscribe(
|
).subscribe(
|
||||||
(rd: RemoteData<LdnService>) => {
|
(rd: RemoteData<LdnService>) => {
|
||||||
if (rd.hasSucceeded) {
|
if (rd.hasSucceeded) {
|
||||||
@@ -542,7 +554,7 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
|
|||||||
constraint: '',
|
constraint: '',
|
||||||
constraintFormatted: '',
|
constraintFormatted: '',
|
||||||
automatic: false,
|
automatic: false,
|
||||||
isNew: true
|
isNew: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.isNewService) {
|
if (this.isNewService) {
|
||||||
|
@@ -1,9 +1,13 @@
|
|||||||
import {LdnService} from '../ldn-services-model/ldn-services.model';
|
import {
|
||||||
import {LDN_SERVICE} from '../ldn-services-model/ldn-service.resource-type';
|
Observable,
|
||||||
import {RemoteData} from '../../../core/data/remote-data';
|
of,
|
||||||
|
} from 'rxjs';
|
||||||
|
|
||||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
import {Observable, of} from 'rxjs';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
|
import { LDN_SERVICE } from '../ldn-services-model/ldn-service.resource-type';
|
||||||
|
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
||||||
|
|
||||||
export const mockLdnService: LdnService = {
|
export const mockLdnService: LdnService = {
|
||||||
uuid: '1',
|
uuid: '1',
|
||||||
@@ -31,7 +35,7 @@ export const mockLdnService: LdnService = {
|
|||||||
type: LDN_SERVICE,
|
type: LDN_SERVICE,
|
||||||
_links: {
|
_links: {
|
||||||
self: {
|
self: {
|
||||||
href: 'http://localhost/api/ldn/ldnservices/1'
|
href: 'http://localhost/api/ldn/ldnservices/1',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
get self(): string {
|
get self(): string {
|
||||||
@@ -68,7 +72,7 @@ export const mockLdnServices: LdnService[] = [{
|
|||||||
type: LDN_SERVICE,
|
type: LDN_SERVICE,
|
||||||
_links: {
|
_links: {
|
||||||
self: {
|
self: {
|
||||||
href: 'http://localhost/api/ldn/ldnservices/1'
|
href: 'http://localhost/api/ldn/ldnservices/1',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
get self(): string {
|
get self(): string {
|
||||||
@@ -100,12 +104,12 @@ export const mockLdnServices: LdnService[] = [{
|
|||||||
type: LDN_SERVICE,
|
type: LDN_SERVICE,
|
||||||
_links: {
|
_links: {
|
||||||
self: {
|
self: {
|
||||||
href: 'http://localhost/api/ldn/ldnservices/1'
|
href: 'http://localhost/api/ldn/ldnservices/1',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
get self(): string {
|
get self(): string {
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
export const mockLdnServicesRD$: Observable<RemoteData<PaginatedList<LdnService>>> = of((mockLdnServices as unknown) as RemoteData<PaginatedList<LdnService>>);
|
export const mockLdnServicesRD$: Observable<RemoteData<PaginatedList<LdnService>>> = of((mockLdnServices as unknown) as RemoteData<PaginatedList<LdnService>>);
|
||||||
|
@@ -1,19 +1,23 @@
|
|||||||
|
import {
|
||||||
|
cold,
|
||||||
|
getTestScheduler,
|
||||||
|
} from 'jasmine-marbles';
|
||||||
|
import { of } from 'rxjs';
|
||||||
import { TestScheduler } from 'rxjs/testing';
|
import { TestScheduler } from 'rxjs/testing';
|
||||||
import { LdnItemfiltersService } from './ldn-itemfilters-data.service';
|
|
||||||
import { RequestService } from '../../../core/data/request.service';
|
|
||||||
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
||||||
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||||
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
|
||||||
import { RequestEntry } from '../../../core/data/request-entry.model';
|
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
|
||||||
import { RequestEntryState } from '../../../core/data/request-entry-state.model';
|
|
||||||
import { cold, getTestScheduler } from 'jasmine-marbles';
|
|
||||||
import { RestResponse } from '../../../core/cache/response.models';
|
import { RestResponse } from '../../../core/cache/response.models';
|
||||||
import { of } from 'rxjs';
|
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
|
||||||
import { FindAllData } from '../../../core/data/base/find-all-data';
|
import { FindAllData } from '../../../core/data/base/find-all-data';
|
||||||
import { testFindAllDataImplementation } from '../../../core/data/base/find-all-data.spec';
|
import { testFindAllDataImplementation } from '../../../core/data/base/find-all-data.spec';
|
||||||
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
|
import { RequestEntry } from '../../../core/data/request-entry.model';
|
||||||
|
import { RequestEntryState } from '../../../core/data/request-entry-state.model';
|
||||||
|
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
||||||
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
|
import { LdnItemfiltersService } from './ldn-itemfilters-data.service';
|
||||||
|
|
||||||
describe('LdnItemfiltersService test', () => {
|
describe('LdnItemfiltersService test', () => {
|
||||||
let scheduler: TestScheduler;
|
let scheduler: TestScheduler;
|
||||||
@@ -60,12 +64,12 @@ describe('LdnItemfiltersService test', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
halService = jasmine.createSpyObj('halService', {
|
halService = jasmine.createSpyObj('halService', {
|
||||||
getEndpoint: of(endpointURL)
|
getEndpoint: of(endpointURL),
|
||||||
});
|
});
|
||||||
|
|
||||||
rdbService = jasmine.createSpyObj('rdbService', {
|
rdbService = jasmine.createSpyObj('rdbService', {
|
||||||
buildSingle: createSuccessfulRemoteDataObject$({}, 500),
|
buildSingle: createSuccessfulRemoteDataObject$({}, 500),
|
||||||
buildList: cold('a', { a: remoteDataMocks.Success })
|
buildList: cold('a', { a: remoteDataMocks.Success }),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,21 +1,23 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import {dataService} from '../../../core/data/base/data-service.decorator';
|
import { Observable } from 'rxjs';
|
||||||
import {LDN_SERVICE_CONSTRAINT_FILTERS} from '../ldn-services-model/ldn-service.resource-type';
|
|
||||||
import {IdentifiableDataService} from '../../../core/data/base/identifiable-data.service';
|
|
||||||
import {FindAllData, FindAllDataImpl} from '../../../core/data/base/find-all-data';
|
|
||||||
|
|
||||||
import {RequestService} from '../../../core/data/request.service';
|
|
||||||
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
||||||
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||||
|
import { dataService } from '../../../core/data/base/data-service.decorator';
|
||||||
|
import {
|
||||||
|
FindAllData,
|
||||||
|
FindAllDataImpl,
|
||||||
|
} from '../../../core/data/base/find-all-data';
|
||||||
|
import { IdentifiableDataService } from '../../../core/data/base/identifiable-data.service';
|
||||||
|
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||||
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import {FindListOptions} from '../../../core/data/find-list-options.model';
|
|
||||||
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
||||||
import {Observable} from 'rxjs';
|
import { LDN_SERVICE_CONSTRAINT_FILTERS } from '../ldn-services-model/ldn-service.resource-type';
|
||||||
import {RemoteData} from '../../../core/data/remote-data';
|
|
||||||
import { Itemfilter } from '../ldn-services-model/ldn-service-itemfilters';
|
import { Itemfilter } from '../ldn-services-model/ldn-service-itemfilters';
|
||||||
import {PaginatedList} from '../../../core/data/paginated-list.model';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A service responsible for fetching/sending data from/to the REST API on the itemfilters endpoint
|
* A service responsible for fetching/sending data from/to the REST API on the itemfilters endpoint
|
||||||
|
@@ -1,32 +1,35 @@
|
|||||||
import { TestScheduler } from 'rxjs/testing';
|
import {
|
||||||
import { RequestService } from '../../../core/data/request.service';
|
cold,
|
||||||
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
getTestScheduler,
|
||||||
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
} from 'jasmine-marbles';
|
||||||
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
|
||||||
import { RequestEntry } from '../../../core/data/request-entry.model';
|
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
|
||||||
import { RequestEntryState } from '../../../core/data/request-entry-state.model';
|
|
||||||
import { cold, getTestScheduler } from 'jasmine-marbles';
|
|
||||||
import { RestResponse } from '../../../core/cache/response.models';
|
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
import { TestScheduler } from 'rxjs/testing';
|
||||||
import { FindAllData } from '../../../core/data/base/find-all-data';
|
|
||||||
import { testFindAllDataImplementation } from '../../../core/data/base/find-all-data.spec';
|
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
||||||
import { LdnServicesService } from './ldn-services-data.service';
|
import { RequestParam } from '../../../core/cache/models/request-param.model';
|
||||||
import { testDeleteDataImplementation } from '../../../core/data/base/delete-data.spec';
|
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||||
import { DeleteData } from '../../../core/data/base/delete-data';
|
import { RestResponse } from '../../../core/cache/response.models';
|
||||||
import { testSearchDataImplementation } from '../../../core/data/base/search-data.spec';
|
|
||||||
import { SearchData } from '../../../core/data/base/search-data';
|
|
||||||
import { testPatchDataImplementation } from '../../../core/data/base/patch-data.spec';
|
|
||||||
import { PatchData } from '../../../core/data/base/patch-data';
|
|
||||||
import { CreateData } from '../../../core/data/base/create-data';
|
import { CreateData } from '../../../core/data/base/create-data';
|
||||||
import { testCreateDataImplementation } from '../../../core/data/base/create-data.spec';
|
import { testCreateDataImplementation } from '../../../core/data/base/create-data.spec';
|
||||||
|
import { DeleteData } from '../../../core/data/base/delete-data';
|
||||||
|
import { testDeleteDataImplementation } from '../../../core/data/base/delete-data.spec';
|
||||||
|
import { FindAllData } from '../../../core/data/base/find-all-data';
|
||||||
|
import { testFindAllDataImplementation } from '../../../core/data/base/find-all-data.spec';
|
||||||
|
import { PatchData } from '../../../core/data/base/patch-data';
|
||||||
|
import { testPatchDataImplementation } from '../../../core/data/base/patch-data.spec';
|
||||||
|
import { SearchData } from '../../../core/data/base/search-data';
|
||||||
|
import { testSearchDataImplementation } from '../../../core/data/base/search-data.spec';
|
||||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||||
import { RequestParam } from '../../../core/cache/models/request-param.model';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { mockLdnService } from '../ldn-service-serviceMock/ldnServicesRD$-mock';
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
|
import { RequestEntry } from '../../../core/data/request-entry.model';
|
||||||
|
import { RequestEntryState } from '../../../core/data/request-entry-state.model';
|
||||||
|
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
||||||
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
||||||
|
import { mockLdnService } from '../ldn-service-serviceMock/ldnServicesRD$-mock';
|
||||||
|
import { LdnServicesService } from './ldn-services-data.service';
|
||||||
|
|
||||||
describe('LdnServicesService test', () => {
|
describe('LdnServicesService test', () => {
|
||||||
let scheduler: TestScheduler;
|
let scheduler: TestScheduler;
|
||||||
@@ -73,13 +76,13 @@ describe('LdnServicesService test', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
halService = jasmine.createSpyObj('halService', {
|
halService = jasmine.createSpyObj('halService', {
|
||||||
getEndpoint: observableOf(endpointURL)
|
getEndpoint: observableOf(endpointURL),
|
||||||
});
|
});
|
||||||
|
|
||||||
rdbService = jasmine.createSpyObj('rdbService', {
|
rdbService = jasmine.createSpyObj('rdbService', {
|
||||||
buildSingle: createSuccessfulRemoteDataObject$({}, 500),
|
buildSingle: createSuccessfulRemoteDataObject$({}, 500),
|
||||||
buildFromRequestUUID: createSuccessfulRemoteDataObject$({}, 500),
|
buildFromRequestUUID: createSuccessfulRemoteDataObject$({}, 500),
|
||||||
buildList: cold('a', { a: remoteDataMocks.Success })
|
buildList: cold('a', { a: remoteDataMocks.Success }),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,36 +1,49 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import {dataService} from '../../../core/data/base/data-service.decorator';
|
|
||||||
import {LDN_SERVICE} from '../ldn-services-model/ldn-service.resource-type';
|
|
||||||
import {IdentifiableDataService} from '../../../core/data/base/identifiable-data.service';
|
|
||||||
import {FindAllData, FindAllDataImpl} from '../../../core/data/base/find-all-data';
|
|
||||||
import {DeleteData, DeleteDataImpl} from '../../../core/data/base/delete-data';
|
|
||||||
import {RequestService} from '../../../core/data/request.service';
|
|
||||||
import {RemoteDataBuildService} from '../../../core/cache/builders/remote-data-build.service';
|
|
||||||
import {ObjectCacheService} from '../../../core/cache/object-cache.service';
|
|
||||||
import {HALEndpointService} from '../../../core/shared/hal-endpoint.service';
|
|
||||||
import {NotificationsService} from '../../../shared/notifications/notifications.service';
|
|
||||||
import {FindListOptions} from '../../../core/data/find-list-options.model';
|
|
||||||
import {FollowLinkConfig} from '../../../shared/utils/follow-link-config.model';
|
|
||||||
import {Observable} from 'rxjs';
|
|
||||||
import {RemoteData} from '../../../core/data/remote-data';
|
|
||||||
import {PaginatedList} from '../../../core/data/paginated-list.model';
|
|
||||||
import {NoContent} from '../../../core/shared/NoContent.model';
|
|
||||||
import {map, take} from 'rxjs/operators';
|
|
||||||
import {URLCombiner} from '../../../core/url-combiner/url-combiner';
|
|
||||||
import {MultipartPostRequest} from '../../../core/data/request.models';
|
|
||||||
import {RestRequest} from '../../../core/data/rest-request.model';
|
|
||||||
|
|
||||||
|
|
||||||
import {LdnService} from '../ldn-services-model/ldn-services.model';
|
|
||||||
|
|
||||||
import {PatchData, PatchDataImpl} from '../../../core/data/base/patch-data';
|
|
||||||
import {ChangeAnalyzer} from '../../../core/data/change-analyzer';
|
|
||||||
import { Operation } from 'fast-json-patch';
|
import { Operation } from 'fast-json-patch';
|
||||||
import {RestRequestMethod} from '../../../core/data/rest-request-method';
|
import { Observable } from 'rxjs';
|
||||||
import {CreateData, CreateDataImpl} from '../../../core/data/base/create-data';
|
import {
|
||||||
import {LdnServiceConstrain} from '../ldn-services-model/ldn-service.constrain.model';
|
map,
|
||||||
import {SearchDataImpl} from '../../../core/data/base/search-data';
|
take,
|
||||||
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
||||||
import { RequestParam } from '../../../core/cache/models/request-param.model';
|
import { RequestParam } from '../../../core/cache/models/request-param.model';
|
||||||
|
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||||
|
import {
|
||||||
|
CreateData,
|
||||||
|
CreateDataImpl,
|
||||||
|
} from '../../../core/data/base/create-data';
|
||||||
|
import { dataService } from '../../../core/data/base/data-service.decorator';
|
||||||
|
import {
|
||||||
|
DeleteData,
|
||||||
|
DeleteDataImpl,
|
||||||
|
} from '../../../core/data/base/delete-data';
|
||||||
|
import {
|
||||||
|
FindAllData,
|
||||||
|
FindAllDataImpl,
|
||||||
|
} from '../../../core/data/base/find-all-data';
|
||||||
|
import { IdentifiableDataService } from '../../../core/data/base/identifiable-data.service';
|
||||||
|
import {
|
||||||
|
PatchData,
|
||||||
|
PatchDataImpl,
|
||||||
|
} from '../../../core/data/base/patch-data';
|
||||||
|
import { SearchDataImpl } from '../../../core/data/base/search-data';
|
||||||
|
import { ChangeAnalyzer } from '../../../core/data/change-analyzer';
|
||||||
|
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||||
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
|
import { MultipartPostRequest } from '../../../core/data/request.models';
|
||||||
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
|
import { RestRequest } from '../../../core/data/rest-request.model';
|
||||||
|
import { RestRequestMethod } from '../../../core/data/rest-request-method';
|
||||||
|
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
||||||
|
import { NoContent } from '../../../core/shared/NoContent.model';
|
||||||
|
import { URLCombiner } from '../../../core/url-combiner/url-combiner';
|
||||||
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
||||||
|
import { LdnServiceConstrain } from '../ldn-services-model/ldn-service.constrain.model';
|
||||||
|
import { LDN_SERVICE } from '../ldn-services-model/ldn-service.resource-type';
|
||||||
|
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injectable service responsible for fetching/sending data from/to the REST API on the ldnservices endpoint.
|
* Injectable service responsible for fetching/sending data from/to the REST API on the ldnservices endpoint.
|
||||||
@@ -200,7 +213,7 @@ export class LdnServicesService extends IdentifiableDataService<LdnService> impl
|
|||||||
map((endpoint: string) => {
|
map((endpoint: string) => {
|
||||||
const body = this.getInvocationFormData(parameters, files);
|
const body = this.getInvocationFormData(parameters, files);
|
||||||
return new MultipartPostRequest(requestId, endpoint, body);
|
return new MultipartPostRequest(requestId, endpoint, body);
|
||||||
})
|
}),
|
||||||
).subscribe((request: RestRequest) => this.requestService.send(request));
|
).subscribe((request: RestRequest) => this.requestService.send(request));
|
||||||
|
|
||||||
return this.rdbService.buildFromRequestUUID<LdnService>(requestId);
|
return this.rdbService.buildFromRequestUUID<LdnService>(requestId);
|
||||||
|
@@ -1,19 +1,32 @@
|
|||||||
import {ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';
|
import {
|
||||||
import { ChangeDetectorRef, EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core';
|
ChangeDetectorRef,
|
||||||
import {NotificationsService} from '../../../shared/notifications/notifications.service';
|
EventEmitter,
|
||||||
import {NotificationsServiceStub} from '../../../shared/testing/notifications-service.stub';
|
NO_ERRORS_SCHEMA,
|
||||||
import {TranslateModule, TranslateService} from '@ngx-translate/core';
|
} from '@angular/core';
|
||||||
|
import {
|
||||||
|
ComponentFixture,
|
||||||
|
fakeAsync,
|
||||||
|
TestBed,
|
||||||
|
tick,
|
||||||
|
} from '@angular/core/testing';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import {LdnServicesService} from '../ldn-services-data/ldn-services-data.service';
|
import {
|
||||||
import {PaginationService} from '../../../core/pagination/pagination.service';
|
TranslateModule,
|
||||||
import {PaginationServiceStub} from '../../../shared/testing/pagination-service.stub';
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import {LdnService} from '../ldn-services-model/ldn-services.model';
|
|
||||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import {LdnServicesOverviewComponent} from './ldn-services-directory.component';
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
|
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||||
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
||||||
|
import { LdnServicesService } from '../ldn-services-data/ldn-services-data.service';
|
||||||
|
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
||||||
|
import { LdnServicesOverviewComponent } from './ldn-services-directory.component';
|
||||||
|
|
||||||
describe('LdnServicesOverviewComponent', () => {
|
describe('LdnServicesOverviewComponent', () => {
|
||||||
let component: LdnServicesOverviewComponent;
|
let component: LdnServicesOverviewComponent;
|
||||||
@@ -26,7 +39,7 @@ describe('LdnServicesOverviewComponent', () => {
|
|||||||
get: () => of('translated-text'),
|
get: () => of('translated-text'),
|
||||||
onLangChange: new EventEmitter(),
|
onLangChange: new EventEmitter(),
|
||||||
onTranslationChange: new EventEmitter(),
|
onTranslationChange: new EventEmitter(),
|
||||||
onDefaultLangChange: new EventEmitter()
|
onDefaultLangChange: new EventEmitter(),
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
@@ -42,20 +55,20 @@ describe('LdnServicesOverviewComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: LdnServicesService,
|
provide: LdnServicesService,
|
||||||
useValue: ldnServicesService
|
useValue: ldnServicesService,
|
||||||
},
|
},
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
{
|
{
|
||||||
provide: NgbModal, useValue: {
|
provide: NgbModal, useValue: {
|
||||||
open: () => { /*comment*/
|
open: () => { /*comment*/
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{ provide: ChangeDetectorRef, useValue: {} },
|
{ provide: ChangeDetectorRef, useValue: {} },
|
||||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||||
{ provide: TranslateService, useValue: translateServiceStub },
|
{ provide: TranslateService, useValue: translateServiceStub },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -5,24 +5,30 @@ import {
|
|||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
TemplateRef,
|
TemplateRef,
|
||||||
ViewChild
|
ViewChild,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import {Observable, Subscription} from 'rxjs';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import {RemoteData} from '../../../core/data/remote-data';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import {PaginatedList} from '../../../core/data/paginated-list.model';
|
import { Operation } from 'fast-json-patch';
|
||||||
import {FindListOptions} from '../../../core/data/find-list-options.model';
|
import {
|
||||||
import {LdnService} from '../ldn-services-model/ldn-services.model';
|
Observable,
|
||||||
import {PaginationComponentOptions} from '../../../shared/pagination/pagination-component-options.model';
|
Subscription,
|
||||||
import {map, switchMap} from 'rxjs/operators';
|
} from 'rxjs';
|
||||||
|
import {
|
||||||
|
map,
|
||||||
|
switchMap,
|
||||||
|
} from 'rxjs/operators';
|
||||||
import { LdnServicesService } from 'src/app/admin/admin-ldn-services/ldn-services-data/ldn-services-data.service';
|
import { LdnServicesService } from 'src/app/admin/admin-ldn-services/ldn-services-data/ldn-services-data.service';
|
||||||
import { PaginationService } from 'src/app/core/pagination/pagination.service';
|
import { PaginationService } from 'src/app/core/pagination/pagination.service';
|
||||||
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
|
|
||||||
import {hasValue} from '../../../shared/empty.util';
|
|
||||||
import {Operation} from 'fast-json-patch';
|
|
||||||
import {getFirstCompletedRemoteData} from '../../../core/shared/operators';
|
|
||||||
import {NotificationsService} from '../../../shared/notifications/notifications.service';
|
|
||||||
import {TranslateService} from '@ngx-translate/core';
|
|
||||||
|
|
||||||
|
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||||
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
|
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||||
|
import { hasValue } from '../../../shared/empty.util';
|
||||||
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||||
|
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `LdnServicesOverviewComponent` is a component that provides an overview of LDN (Linked Data Notifications) services.
|
* The `LdnServicesOverviewComponent` is a component that provides an overview of LDN (Linked Data Notifications) services.
|
||||||
@@ -33,7 +39,7 @@ import {TranslateService} from '@ngx-translate/core';
|
|||||||
selector: 'ds-ldn-services-directory',
|
selector: 'ds-ldn-services-directory',
|
||||||
templateUrl: './ldn-services-directory.component.html',
|
templateUrl: './ldn-services-directory.component.html',
|
||||||
styleUrls: ['./ldn-services-directory.component.scss'],
|
styleUrls: ['./ldn-services-directory.component.scss'],
|
||||||
changeDetection: ChangeDetectionStrategy.Default
|
changeDetection: ChangeDetectionStrategy.Default,
|
||||||
})
|
})
|
||||||
export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
|
export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
@@ -42,11 +48,11 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
|
|||||||
@ViewChild('deleteModal', { static: true }) deleteModal: TemplateRef<any>;
|
@ViewChild('deleteModal', { static: true }) deleteModal: TemplateRef<any>;
|
||||||
ldnServicesRD$: Observable<RemoteData<PaginatedList<LdnService>>>;
|
ldnServicesRD$: Observable<RemoteData<PaginatedList<LdnService>>>;
|
||||||
config: FindListOptions = Object.assign(new FindListOptions(), {
|
config: FindListOptions = Object.assign(new FindListOptions(), {
|
||||||
elementsPerPage: 10
|
elementsPerPage: 10,
|
||||||
});
|
});
|
||||||
pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'po',
|
id: 'po',
|
||||||
pageSize: 10
|
pageSize: 10,
|
||||||
});
|
});
|
||||||
isProcessingSub: Subscription;
|
isProcessingSub: Subscription;
|
||||||
modalRef: any;
|
modalRef: any;
|
||||||
@@ -72,8 +78,8 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
|
|||||||
setLdnServices() {
|
setLdnServices() {
|
||||||
this.ldnServicesRD$ = this.paginationService.getFindListOptions(this.pageConfig.id, this.config).pipe(
|
this.ldnServicesRD$ = this.paginationService.getFindListOptions(this.pageConfig.id, this.config).pipe(
|
||||||
switchMap((config) => this.ldnServicesService.findAll(config, false, false).pipe(
|
switchMap((config) => this.ldnServicesService.findAll(config, false, false).pipe(
|
||||||
getFirstCompletedRemoteData()
|
getFirstCompletedRemoteData(),
|
||||||
))
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +134,7 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
|
|||||||
remoteData.payload.page = remoteData.payload.page.filter(service => service.id.toString() !== serviceId);
|
remoteData.payload.page = remoteData.payload.page.filter(service => service.id.toString() !== serviceId);
|
||||||
}
|
}
|
||||||
return remoteData;
|
return remoteData;
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
this.cdRef.detectChanges();
|
this.cdRef.detectChanges();
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
@@ -170,7 +176,7 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
|
|||||||
this.notificationService.error(this.translateService.get('ldn-enable-service.notification.error.title'),
|
this.notificationService.error(this.translateService.get('ldn-enable-service.notification.error.title'),
|
||||||
this.translateService.get('ldn-enable-service.notification.error.content'));
|
this.translateService.get('ldn-enable-service.notification.error.content'));
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,14 @@
|
|||||||
import {autoserialize, deserialize, inheritSerialization} from 'cerialize';
|
import {
|
||||||
import {LDN_SERVICE_CONSTRAINT_FILTER} from './ldn-service.resource-type';
|
autoserialize,
|
||||||
import {CacheableObject} from '../../../core/cache/cacheable-object.model';
|
deserialize,
|
||||||
|
inheritSerialization,
|
||||||
|
} from 'cerialize';
|
||||||
|
|
||||||
import { typedObject } from '../../../core/cache/builders/build-decorators';
|
import { typedObject } from '../../../core/cache/builders/build-decorators';
|
||||||
import {excludeFromEquals} from '../../../core/utilities/equals.decorators';
|
import { CacheableObject } from '../../../core/cache/cacheable-object.model';
|
||||||
import { ResourceType } from '../../../core/shared/resource-type';
|
import { ResourceType } from '../../../core/shared/resource-type';
|
||||||
|
import { excludeFromEquals } from '../../../core/utilities/equals.decorators';
|
||||||
|
import { LDN_SERVICE_CONSTRAINT_FILTER } from './ldn-service.resource-type';
|
||||||
|
|
||||||
/** A single filter value and its properties. */
|
/** A single filter value and its properties. */
|
||||||
@typedObject
|
@typedObject
|
||||||
|
@@ -1,11 +1,16 @@
|
|||||||
import {ResourceType} from '../../../core/shared/resource-type';
|
import {
|
||||||
import {CacheableObject} from '../../../core/cache/cacheable-object.model';
|
autoserialize,
|
||||||
import {autoserialize, deserialize, deserializeAs, inheritSerialization} from 'cerialize';
|
deserialize,
|
||||||
import {LDN_SERVICE} from './ldn-service.resource-type';
|
deserializeAs,
|
||||||
import {excludeFromEquals} from '../../../core/utilities/equals.decorators';
|
inheritSerialization,
|
||||||
import {typedObject} from '../../../core/cache/builders/build-decorators';
|
} from 'cerialize';
|
||||||
import {NotifyServicePattern} from './ldn-service-patterns.model';
|
|
||||||
|
|
||||||
|
import { typedObject } from '../../../core/cache/builders/build-decorators';
|
||||||
|
import { CacheableObject } from '../../../core/cache/cacheable-object.model';
|
||||||
|
import { ResourceType } from '../../../core/shared/resource-type';
|
||||||
|
import { excludeFromEquals } from '../../../core/utilities/equals.decorators';
|
||||||
|
import { LDN_SERVICE } from './ldn-service.resource-type';
|
||||||
|
import { NotifyServicePattern } from './ldn-service-patterns.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LDN Services bounded to each selected pattern, relation set in service creation
|
* LDN Services bounded to each selected pattern, relation set in service creation
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
|
import {
|
||||||
|
ActivatedRouteSnapshot,
|
||||||
|
Resolve,
|
||||||
|
RouterStateSnapshot,
|
||||||
|
} from '@angular/router';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for the route parameters.
|
* Interface for the route parameters.
|
||||||
@@ -26,7 +30,7 @@ export class NotificationsSuggestionTargetsPageResolver implements Resolve<Notif
|
|||||||
return {
|
return {
|
||||||
pageId: route.queryParams.pageId,
|
pageId: route.queryParams.pageId,
|
||||||
pageSize: parseInt(route.queryParams.pageSize, 10),
|
pageSize: parseInt(route.queryParams.pageSize, 10),
|
||||||
currentPage: parseInt(route.queryParams.page, 10)
|
currentPage: parseInt(route.queryParams.page, 10),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,13 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
NotificationsSuggestionTargetsPageComponent
|
async,
|
||||||
} from '../../../quality-assurance-notifications-pages/notifications-suggestion-targets-page/notifications-suggestion-targets-page.component';
|
ComponentFixture,
|
||||||
|
TestBed,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
import { NotificationsSuggestionTargetsPageComponent } from '../../../quality-assurance-notifications-pages/notifications-suggestion-targets-page/notifications-suggestion-targets-page.component';
|
||||||
|
|
||||||
describe('NotificationsSuggestionTargetsPageComponent', () => {
|
describe('NotificationsSuggestionTargetsPageComponent', () => {
|
||||||
let component: NotificationsSuggestionTargetsPageComponent;
|
let component: NotificationsSuggestionTargetsPageComponent;
|
||||||
@@ -15,15 +17,15 @@ describe('NotificationsSuggestionTargetsPageComponent', () => {
|
|||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
TranslateModule.forRoot()
|
TranslateModule.forRoot(),
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
NotificationsSuggestionTargetsPageComponent
|
NotificationsSuggestionTargetsPageComponent,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
NotificationsSuggestionTargetsPageComponent
|
NotificationsSuggestionTargetsPageComponent,
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
@@ -3,7 +3,7 @@ import { Component } from '@angular/core';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-admin-notifications-publication-claim-page',
|
selector: 'ds-admin-notifications-publication-claim-page',
|
||||||
templateUrl: './admin-notifications-publication-claim-page.component.html',
|
templateUrl: './admin-notifications-publication-claim-page.component.html',
|
||||||
styleUrls: ['./admin-notifications-publication-claim-page.component.scss']
|
styleUrls: ['./admin-notifications-publication-claim-page.component.scss'],
|
||||||
})
|
})
|
||||||
export class AdminNotificationsPublicationClaimPageComponent {
|
export class AdminNotificationsPublicationClaimPageComponent {
|
||||||
|
|
||||||
|
@@ -4,39 +4,22 @@ import { RouterModule } from '@angular/router';
|
|||||||
import { AuthenticatedGuard } from '../../core/auth/authenticated.guard';
|
import { AuthenticatedGuard } from '../../core/auth/authenticated.guard';
|
||||||
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
import { I18nBreadcrumbsService } from '../../core/breadcrumbs/i18n-breadcrumbs.service';
|
import { I18nBreadcrumbsService } from '../../core/breadcrumbs/i18n-breadcrumbs.service';
|
||||||
import { PUBLICATION_CLAIMS_PATH } from './admin-notifications-routing-paths';
|
|
||||||
import { AdminNotificationsPublicationClaimPageComponent } from './admin-notifications-publication-claim-page/admin-notifications-publication-claim-page.component';
|
|
||||||
import { QUALITY_ASSURANCE_EDIT_PATH } from './admin-notifications-routing-paths';
|
|
||||||
import {
|
|
||||||
SiteAdministratorGuard
|
|
||||||
} from '../../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
|
||||||
import { QualityAssuranceBreadcrumbResolver } from '../../core/breadcrumbs/quality-assurance-breadcrumb.resolver';
|
import { QualityAssuranceBreadcrumbResolver } from '../../core/breadcrumbs/quality-assurance-breadcrumb.resolver';
|
||||||
import { QualityAssuranceBreadcrumbService } from '../../core/breadcrumbs/quality-assurance-breadcrumb.service';
|
import { QualityAssuranceBreadcrumbService } from '../../core/breadcrumbs/quality-assurance-breadcrumb.service';
|
||||||
|
import { SiteAdministratorGuard } from '../../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
||||||
|
import { AdminNotificationsPublicationClaimPageResolver } from '../../quality-assurance-notifications-pages/notifications-suggestion-targets-page/notifications-suggestion-targets-page-resolver.service';
|
||||||
|
import { QualityAssuranceEventsPageComponent } from '../../quality-assurance-notifications-pages/quality-assurance-events-page/quality-assurance-events-page.component';
|
||||||
|
import { QualityAssuranceEventsPageResolver } from '../../quality-assurance-notifications-pages/quality-assurance-events-page/quality-assurance-events-page.resolver';
|
||||||
|
import { SourceDataResolver } from '../../quality-assurance-notifications-pages/quality-assurance-source-page-component/quality-assurance-source-data.resolver';
|
||||||
|
import { QualityAssuranceSourcePageComponent } from '../../quality-assurance-notifications-pages/quality-assurance-source-page-component/quality-assurance-source-page.component';
|
||||||
|
import { QualityAssuranceSourcePageResolver } from '../../quality-assurance-notifications-pages/quality-assurance-source-page-component/quality-assurance-source-page-resolver.service';
|
||||||
|
import { QualityAssuranceTopicsPageComponent } from '../../quality-assurance-notifications-pages/quality-assurance-topics-page/quality-assurance-topics-page.component';
|
||||||
|
import { QualityAssuranceTopicsPageResolver } from '../../quality-assurance-notifications-pages/quality-assurance-topics-page/quality-assurance-topics-page-resolver.service';
|
||||||
|
import { AdminNotificationsPublicationClaimPageComponent } from './admin-notifications-publication-claim-page/admin-notifications-publication-claim-page.component';
|
||||||
import {
|
import {
|
||||||
QualityAssuranceEventsPageResolver
|
PUBLICATION_CLAIMS_PATH,
|
||||||
} from '../../quality-assurance-notifications-pages/quality-assurance-events-page/quality-assurance-events-page.resolver';
|
QUALITY_ASSURANCE_EDIT_PATH,
|
||||||
import {
|
} from './admin-notifications-routing-paths';
|
||||||
AdminNotificationsPublicationClaimPageResolver
|
|
||||||
} from '../../quality-assurance-notifications-pages/notifications-suggestion-targets-page/notifications-suggestion-targets-page-resolver.service';
|
|
||||||
import {
|
|
||||||
QualityAssuranceTopicsPageComponent
|
|
||||||
} from '../../quality-assurance-notifications-pages/quality-assurance-topics-page/quality-assurance-topics-page.component';
|
|
||||||
import {
|
|
||||||
QualityAssuranceTopicsPageResolver
|
|
||||||
} from '../../quality-assurance-notifications-pages/quality-assurance-topics-page/quality-assurance-topics-page-resolver.service';
|
|
||||||
import {
|
|
||||||
QualityAssuranceSourcePageComponent
|
|
||||||
} from '../../quality-assurance-notifications-pages/quality-assurance-source-page-component/quality-assurance-source-page.component';
|
|
||||||
import {
|
|
||||||
QualityAssuranceSourcePageResolver
|
|
||||||
} from '../../quality-assurance-notifications-pages/quality-assurance-source-page-component/quality-assurance-source-page-resolver.service';
|
|
||||||
import {
|
|
||||||
SourceDataResolver
|
|
||||||
} from '../../quality-assurance-notifications-pages/quality-assurance-source-page-component/quality-assurance-source-data.resolver';
|
|
||||||
import {
|
|
||||||
QualityAssuranceEventsPageComponent
|
|
||||||
} from '../../quality-assurance-notifications-pages/quality-assurance-events-page/quality-assurance-events-page.component';
|
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -48,13 +31,13 @@ import {
|
|||||||
pathMatch: 'full',
|
pathMatch: 'full',
|
||||||
resolve: {
|
resolve: {
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
breadcrumb: I18nBreadcrumbResolver,
|
||||||
suggestionTargetParams: AdminNotificationsPublicationClaimPageResolver
|
suggestionTargetParams: AdminNotificationsPublicationClaimPageResolver,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
title: 'admin.notifications.publicationclaim.page.title',
|
title: 'admin.notifications.publicationclaim.page.title',
|
||||||
breadcrumbKey: 'admin.notifications.publicationclaim',
|
breadcrumbKey: 'admin.notifications.publicationclaim',
|
||||||
showBreadcrumbsFluid: false
|
showBreadcrumbsFluid: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
canActivate: [ AuthenticatedGuard ],
|
canActivate: [ AuthenticatedGuard ],
|
||||||
@@ -63,13 +46,13 @@ import {
|
|||||||
pathMatch: 'full',
|
pathMatch: 'full',
|
||||||
resolve: {
|
resolve: {
|
||||||
breadcrumb: QualityAssuranceBreadcrumbResolver,
|
breadcrumb: QualityAssuranceBreadcrumbResolver,
|
||||||
openaireQualityAssuranceTopicsParams: QualityAssuranceTopicsPageResolver
|
openaireQualityAssuranceTopicsParams: QualityAssuranceTopicsPageResolver,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
title: 'admin.quality-assurance.page.title',
|
title: 'admin.quality-assurance.page.title',
|
||||||
breadcrumbKey: 'admin.quality-assurance',
|
breadcrumbKey: 'admin.quality-assurance',
|
||||||
showBreadcrumbsFluid: false
|
showBreadcrumbsFluid: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
canActivate: [ AuthenticatedGuard ],
|
canActivate: [ AuthenticatedGuard ],
|
||||||
@@ -78,13 +61,13 @@ import {
|
|||||||
pathMatch: 'full',
|
pathMatch: 'full',
|
||||||
resolve: {
|
resolve: {
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
breadcrumb: I18nBreadcrumbResolver,
|
||||||
openaireQualityAssuranceTopicsParams: QualityAssuranceTopicsPageResolver
|
openaireQualityAssuranceTopicsParams: QualityAssuranceTopicsPageResolver,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
title: 'admin.quality-assurance.page.title',
|
title: 'admin.quality-assurance.page.title',
|
||||||
breadcrumbKey: 'admin.quality-assurance',
|
breadcrumbKey: 'admin.quality-assurance',
|
||||||
showBreadcrumbsFluid: false
|
showBreadcrumbsFluid: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
canActivate: [ SiteAdministratorGuard ],
|
canActivate: [ SiteAdministratorGuard ],
|
||||||
@@ -94,13 +77,13 @@ import {
|
|||||||
resolve: {
|
resolve: {
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
breadcrumb: I18nBreadcrumbResolver,
|
||||||
openaireQualityAssuranceSourceParams: QualityAssuranceSourcePageResolver,
|
openaireQualityAssuranceSourceParams: QualityAssuranceSourcePageResolver,
|
||||||
sourceData: SourceDataResolver
|
sourceData: SourceDataResolver,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
title: 'admin.notifications.source.breadcrumbs',
|
title: 'admin.notifications.source.breadcrumbs',
|
||||||
breadcrumbKey: 'admin.notifications.source',
|
breadcrumbKey: 'admin.notifications.source',
|
||||||
showBreadcrumbsFluid: false
|
showBreadcrumbsFluid: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
canActivate: [ AuthenticatedGuard ],
|
canActivate: [ AuthenticatedGuard ],
|
||||||
@@ -109,15 +92,15 @@ import {
|
|||||||
pathMatch: 'full',
|
pathMatch: 'full',
|
||||||
resolve: {
|
resolve: {
|
||||||
breadcrumb: QualityAssuranceBreadcrumbResolver,
|
breadcrumb: QualityAssuranceBreadcrumbResolver,
|
||||||
openaireQualityAssuranceEventsParams: QualityAssuranceEventsPageResolver
|
openaireQualityAssuranceEventsParams: QualityAssuranceEventsPageResolver,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
title: 'admin.notifications.event.page.title',
|
title: 'admin.notifications.event.page.title',
|
||||||
breadcrumbKey: 'admin.notifications.event',
|
breadcrumbKey: 'admin.notifications.event',
|
||||||
showBreadcrumbsFluid: false
|
showBreadcrumbsFluid: false,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
])
|
]),
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
I18nBreadcrumbResolver,
|
I18nBreadcrumbResolver,
|
||||||
@@ -129,8 +112,8 @@ import {
|
|||||||
QualityAssuranceEventsPageResolver,
|
QualityAssuranceEventsPageResolver,
|
||||||
QualityAssuranceSourcePageResolver,
|
QualityAssuranceSourcePageResolver,
|
||||||
QualityAssuranceBreadcrumbResolver,
|
QualityAssuranceBreadcrumbResolver,
|
||||||
QualityAssuranceBreadcrumbService
|
QualityAssuranceBreadcrumbService,
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* Routing module for the Notifications section of the admin sidebar
|
* Routing module for the Notifications section of the admin sidebar
|
||||||
|
@@ -1,16 +1,11 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
import { CoreModule } from '../../core/core.module';
|
import { CoreModule } from '../../core/core.module';
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
|
||||||
import { AdminNotificationsRoutingModule } from './admin-notifications-routing.module';
|
|
||||||
import { AdminNotificationsPublicationClaimPageComponent } from './admin-notifications-publication-claim-page/admin-notifications-publication-claim-page.component';
|
|
||||||
import { NotificationsModule } from '../../notifications/notifications.module';
|
import { NotificationsModule } from '../../notifications/notifications.module';
|
||||||
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
|
import { AdminNotificationsPublicationClaimPageComponent } from './admin-notifications-publication-claim-page/admin-notifications-publication-claim-page.component';
|
||||||
|
import { AdminNotificationsRoutingModule } from './admin-notifications-routing.module';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -18,12 +13,12 @@ import { NotificationsModule } from '../../notifications/notifications.module';
|
|||||||
SharedModule,
|
SharedModule,
|
||||||
CoreModule.forRoot(),
|
CoreModule.forRoot(),
|
||||||
AdminNotificationsRoutingModule,
|
AdminNotificationsRoutingModule,
|
||||||
NotificationsModule
|
NotificationsModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AdminNotificationsPublicationClaimPageComponent,
|
AdminNotificationsPublicationClaimPageComponent,
|
||||||
],
|
],
|
||||||
entryComponents: []
|
entryComponents: [],
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* This module handles all components related to the notifications pages
|
* This module handles all components related to the notifications pages
|
||||||
|
@@ -1,17 +1,12 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
|
|
||||||
import {
|
|
||||||
SiteAdministratorGuard
|
|
||||||
} from '../../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
|
||||||
import {
|
|
||||||
AdminNotifyIncomingComponent
|
|
||||||
} from './admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component';
|
|
||||||
import {
|
|
||||||
AdminNotifyOutgoingComponent
|
|
||||||
} from './admin-notify-logs/admin-notify-outgoing/admin-notify-outgoing.component';
|
|
||||||
import { NotifyInfoGuard } from '../../core/coar-notify/notify-info/notify-info.guard';
|
import { NotifyInfoGuard } from '../../core/coar-notify/notify-info/notify-info.guard';
|
||||||
|
import { SiteAdministratorGuard } from '../../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
||||||
|
import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
|
||||||
|
import { AdminNotifyIncomingComponent } from './admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component';
|
||||||
|
import { AdminNotifyOutgoingComponent } from './admin-notify-logs/admin-notify-outgoing/admin-notify-outgoing.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -52,8 +47,8 @@ import { NotifyInfoGuard } from '../../core/coar-notify/notify-info/notify-info.
|
|||||||
title: 'admin.notify.dashboard.page.title',
|
title: 'admin.notify.dashboard.page.title',
|
||||||
breadcrumbKey: 'admin.notify.dashboard',
|
breadcrumbKey: 'admin.notify.dashboard',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
])
|
]),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
|
@@ -1,13 +1,16 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import {
|
||||||
|
ComponentFixture,
|
||||||
import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
|
TestBed,
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
} from '@angular/core/testing';
|
||||||
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
import { buildPaginatedList } from '../../core/data/paginated-list.model';
|
||||||
import { SearchService } from '../../core/shared/search/search.service';
|
import { SearchService } from '../../core/shared/search/search.service';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
import { buildPaginatedList } from '../../core/data/paginated-list.model';
|
import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
|
||||||
import { AdminNotifySearchResult } from './models/admin-notify-message-search-result.model';
|
|
||||||
import { AdminNotifyMessage } from './models/admin-notify-message.model';
|
import { AdminNotifyMessage } from './models/admin-notify-message.model';
|
||||||
|
import { AdminNotifySearchResult } from './models/admin-notify-message-search-result.model';
|
||||||
|
|
||||||
describe('AdminNotifyDashboardComponent', () => {
|
describe('AdminNotifyDashboardComponent', () => {
|
||||||
let component: AdminNotifyDashboardComponent;
|
let component: AdminNotifyDashboardComponent;
|
||||||
@@ -23,7 +26,7 @@ describe('AdminNotifyDashboardComponent', () => {
|
|||||||
|
|
||||||
const mockBoxes = [
|
const mockBoxes = [
|
||||||
{ title: 'admin-notify-dashboard.received-ldn', boxes: [ undefined, undefined, undefined, undefined, undefined ] },
|
{ title: 'admin-notify-dashboard.received-ldn', boxes: [ undefined, undefined, undefined, undefined, undefined ] },
|
||||||
{ title: 'admin-notify-dashboard.generated-ldn', boxes: [ undefined, undefined, undefined, undefined, undefined ] }
|
{ title: 'admin-notify-dashboard.generated-ldn', boxes: [ undefined, undefined, undefined, undefined, undefined ] },
|
||||||
];
|
];
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
@@ -38,7 +41,7 @@ describe('AdminNotifyDashboardComponent', () => {
|
|||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot(), NgbNavModule],
|
imports: [TranslateModule.forRoot(), NgbNavModule],
|
||||||
declarations: [ AdminNotifyDashboardComponent ],
|
declarations: [ AdminNotifyDashboardComponent ],
|
||||||
providers: [{ provide: SearchService, useValue: { search: () => createSuccessfulRemoteDataObject$(results)}}]
|
providers: [{ provide: SearchService, useValue: { search: () => createSuccessfulRemoteDataObject$(results) } }],
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
|
@@ -1,17 +1,26 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import {
|
||||||
import { SearchService } from '../../core/shared/search/search.service';
|
Component,
|
||||||
import { environment } from '../../../environments/environment';
|
OnInit,
|
||||||
import { PaginatedSearchOptions } from '../../shared/search/models/paginated-search-options.model';
|
} from '@angular/core';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import {
|
||||||
import { forkJoin, Observable } from 'rxjs';
|
forkJoin,
|
||||||
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
Observable,
|
||||||
|
} from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { SearchObjects } from '../../shared/search/models/search-objects.model';
|
|
||||||
import { AdminNotifyMetricsBox, AdminNotifyMetricsRow } from './admin-notify-metrics/admin-notify-metrics.model';
|
|
||||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../my-dspace-page/my-dspace-page.component';
|
|
||||||
import { SearchConfigurationService } from '../../core/shared/search/search-configuration.service';
|
|
||||||
|
|
||||||
|
import { environment } from '../../../environments/environment';
|
||||||
|
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||||
|
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
||||||
|
import { SearchService } from '../../core/shared/search/search.service';
|
||||||
|
import { SearchConfigurationService } from '../../core/shared/search/search-configuration.service';
|
||||||
|
import { SEARCH_CONFIG_SERVICE } from '../../my-dspace-page/my-dspace-page.component';
|
||||||
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
|
import { PaginatedSearchOptions } from '../../shared/search/models/paginated-search-options.model';
|
||||||
|
import { SearchObjects } from '../../shared/search/models/search-objects.model';
|
||||||
|
import {
|
||||||
|
AdminNotifyMetricsBox,
|
||||||
|
AdminNotifyMetricsRow,
|
||||||
|
} from './admin-notify-metrics/admin-notify-metrics.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-admin-notify-dashboard',
|
selector: 'ds-admin-notify-dashboard',
|
||||||
@@ -19,9 +28,9 @@ import { SearchConfigurationService } from '../../core/shared/search/search-conf
|
|||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: SEARCH_CONFIG_SERVICE,
|
provide: SEARCH_CONFIG_SERVICE,
|
||||||
useClass: SearchConfigurationService
|
useClass: SearchConfigurationService,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,7 +43,7 @@ export class AdminNotifyDashboardComponent implements OnInit{
|
|||||||
private metricsConfig = environment.notifyMetrics;
|
private metricsConfig = environment.notifyMetrics;
|
||||||
private singleResultOptions = Object.assign(new PaginationComponentOptions(), {
|
private singleResultOptions = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'single-result-options',
|
id: 'single-result-options',
|
||||||
pageSize: 1
|
pageSize: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
constructor(private searchService: SearchService) {
|
constructor(private searchService: SearchService) {
|
||||||
@@ -47,17 +56,17 @@ export class AdminNotifyDashboardComponent implements OnInit{
|
|||||||
const flatConfigurations = [].concat(...mertricsRowsConfigurations.map((config) => config));
|
const flatConfigurations = [].concat(...mertricsRowsConfigurations.map((config) => config));
|
||||||
const searchConfigurations = flatConfigurations
|
const searchConfigurations = flatConfigurations
|
||||||
.map(config => Object.assign(new PaginatedSearchOptions({}),
|
.map(config => Object.assign(new PaginatedSearchOptions({}),
|
||||||
{ configuration: config, pagination: this.singleResultOptions }
|
{ configuration: config, pagination: this.singleResultOptions },
|
||||||
));
|
));
|
||||||
|
|
||||||
this.notifyMetricsRows$ = forkJoin(searchConfigurations.map(config => this.searchService.search(config)
|
this.notifyMetricsRows$ = forkJoin(searchConfigurations.map(config => this.searchService.search(config)
|
||||||
.pipe(
|
.pipe(
|
||||||
getFirstCompletedRemoteData(),
|
getFirstCompletedRemoteData(),
|
||||||
map(response => this.mapSearchObjectsToMetricsBox(response.payload)),
|
map(response => this.mapSearchObjectsToMetricsBox(response.payload)),
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
).pipe(
|
).pipe(
|
||||||
map(metricBoxes => this.mapUpdatedBoxesToMetricsRows(metricBoxes))
|
map(metricBoxes => this.mapUpdatedBoxesToMetricsRows(metricBoxes)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +83,7 @@ export class AdminNotifyDashboardComponent implements OnInit{
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...metricsBoxes.find(box => box.config === objectConfig),
|
...metricsBoxes.find(box => box.config === objectConfig),
|
||||||
count
|
count,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +97,7 @@ export class AdminNotifyDashboardComponent implements OnInit{
|
|||||||
return this.metricsConfig.map(row => {
|
return this.metricsConfig.map(row => {
|
||||||
return {
|
return {
|
||||||
...row,
|
...row,
|
||||||
boxes: row.boxes.map(rowBox => boxesWithCount.find(boxWithCount => boxWithCount.config === rowBox.config))
|
boxes: row.boxes.map(rowBox => boxesWithCount.find(boxWithCount => boxWithCount.config === rowBox.config)),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,26 +1,25 @@
|
|||||||
|
import {
|
||||||
|
CommonModule,
|
||||||
|
DatePipe,
|
||||||
|
} from '@angular/common';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { CommonModule, DatePipe } from '@angular/common';
|
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { SearchPageModule } from '../../search-page/search-page.module';
|
||||||
|
import { SearchModule } from '../../shared/search/search.module';
|
||||||
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
|
import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
|
||||||
import { AdminNotifyDashboardRoutingModule } from './admin-notify-dashboard-routing.module';
|
import { AdminNotifyDashboardRoutingModule } from './admin-notify-dashboard-routing.module';
|
||||||
import { AdminNotifyMetricsComponent } from './admin-notify-metrics/admin-notify-metrics.component';
|
|
||||||
import { AdminNotifyIncomingComponent } from './admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component';
|
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
|
||||||
import { SearchModule } from '../../shared/search/search.module';
|
|
||||||
import { SearchPageModule } from '../../search-page/search-page.module';
|
|
||||||
import {
|
|
||||||
AdminNotifyOutgoingComponent
|
|
||||||
} from './admin-notify-logs/admin-notify-outgoing/admin-notify-outgoing.component';
|
|
||||||
import { AdminNotifyDetailModalComponent } from './admin-notify-detail-modal/admin-notify-detail-modal.component';
|
import { AdminNotifyDetailModalComponent } from './admin-notify-detail-modal/admin-notify-detail-modal.component';
|
||||||
import {
|
import { AdminNotifyIncomingComponent } from './admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component';
|
||||||
AdminNotifySearchResultComponent
|
|
||||||
} from './admin-notify-search-result/admin-notify-search-result.component';
|
|
||||||
import { AdminNotifyMessagesService } from './services/admin-notify-messages.service';
|
|
||||||
import { AdminNotifyLogsResultComponent } from './admin-notify-logs/admin-notify-logs-result/admin-notify-logs-result.component';
|
import { AdminNotifyLogsResultComponent } from './admin-notify-logs/admin-notify-logs-result/admin-notify-logs-result.component';
|
||||||
|
import { AdminNotifyOutgoingComponent } from './admin-notify-logs/admin-notify-outgoing/admin-notify-outgoing.component';
|
||||||
|
import { AdminNotifyMetricsComponent } from './admin-notify-metrics/admin-notify-metrics.component';
|
||||||
|
import { AdminNotifySearchResultComponent } from './admin-notify-search-result/admin-notify-search-result.component';
|
||||||
|
import { AdminNotifyMessagesService } from './services/admin-notify-messages.service';
|
||||||
|
|
||||||
const ENTRY_COMPONENTS = [
|
const ENTRY_COMPONENTS = [
|
||||||
AdminNotifySearchResultComponent
|
AdminNotifySearchResultComponent,
|
||||||
];
|
];
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -29,11 +28,11 @@ const ENTRY_COMPONENTS = [
|
|||||||
SharedModule,
|
SharedModule,
|
||||||
AdminNotifyDashboardRoutingModule,
|
AdminNotifyDashboardRoutingModule,
|
||||||
SearchModule,
|
SearchModule,
|
||||||
SearchPageModule
|
SearchPageModule,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
AdminNotifyMessagesService,
|
AdminNotifyMessagesService,
|
||||||
DatePipe
|
DatePipe,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
...ENTRY_COMPONENTS,
|
...ENTRY_COMPONENTS,
|
||||||
@@ -43,14 +42,14 @@ const ENTRY_COMPONENTS = [
|
|||||||
AdminNotifyOutgoingComponent,
|
AdminNotifyOutgoingComponent,
|
||||||
AdminNotifyDetailModalComponent,
|
AdminNotifyDetailModalComponent,
|
||||||
AdminNotifySearchResultComponent,
|
AdminNotifySearchResultComponent,
|
||||||
AdminNotifyLogsResultComponent
|
AdminNotifyLogsResultComponent,
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
export class AdminNotifyDashboardModule {
|
export class AdminNotifyDashboardModule {
|
||||||
static withEntryComponents() {
|
static withEntryComponents() {
|
||||||
return {
|
return {
|
||||||
ngModule: AdminNotifyDashboardModule,
|
ngModule: AdminNotifyDashboardModule,
|
||||||
providers: ENTRY_COMPONENTS.map((component) => ({provide: component}))
|
providers: ENTRY_COMPONENTS.map((component) => ({ provide: component })),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,12 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import {
|
||||||
|
ComponentFixture,
|
||||||
import { AdminNotifyDetailModalComponent } from './admin-notify-detail-modal.component';
|
TestBed,
|
||||||
|
} from '@angular/core/testing';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
import { AdminNotifyDetailModalComponent } from './admin-notify-detail-modal.component';
|
||||||
|
|
||||||
describe('AdminNotifyDetailModalComponent', () => {
|
describe('AdminNotifyDetailModalComponent', () => {
|
||||||
let component: AdminNotifyDetailModalComponent;
|
let component: AdminNotifyDetailModalComponent;
|
||||||
let fixture: ComponentFixture<AdminNotifyDetailModalComponent>;
|
let fixture: ComponentFixture<AdminNotifyDetailModalComponent>;
|
||||||
@@ -14,7 +17,7 @@ describe('AdminNotifyDetailModalComponent', () => {
|
|||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot()],
|
imports: [TranslateModule.forRoot()],
|
||||||
declarations: [ AdminNotifyDetailModalComponent ],
|
declarations: [ AdminNotifyDetailModalComponent ],
|
||||||
providers: [{ provide: NgbActiveModal, useValue: modalStub }]
|
providers: [{ provide: NgbActiveModal, useValue: modalStub }],
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
|
@@ -1,16 +1,22 @@
|
|||||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
import {
|
||||||
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
Component,
|
||||||
|
EventEmitter,
|
||||||
|
Input,
|
||||||
|
Output,
|
||||||
|
} from '@angular/core';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { MissingTranslationHelper } from '../../../shared/translate/missing-translation.helper';
|
|
||||||
import { fadeIn } from '../../../shared/animations/fade';
|
import { fadeIn } from '../../../shared/animations/fade';
|
||||||
|
import { MissingTranslationHelper } from '../../../shared/translate/missing-translation.helper';
|
||||||
|
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-admin-notify-detail-modal',
|
selector: 'ds-admin-notify-detail-modal',
|
||||||
templateUrl: './admin-notify-detail-modal.component.html',
|
templateUrl: './admin-notify-detail-modal.component.html',
|
||||||
animations: [
|
animations: [
|
||||||
fadeIn
|
fadeIn,
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* Component for detailed view of LDN messages displayed in search result in AdminNotifyDashboardComponent
|
* Component for detailed view of LDN messages displayed in search result in AdminNotifyDashboardComponent
|
||||||
|
@@ -1,18 +1,21 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import {
|
||||||
|
ComponentFixture,
|
||||||
import { AdminNotifyIncomingComponent } from './admin-notify-incoming.component';
|
TestBed,
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
} from '@angular/core/testing';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { MockActivatedRoute } from '../../../../shared/mocks/active-router.mock';
|
|
||||||
import { provideMockStore } from '@ngrx/store/testing';
|
import { provideMockStore } from '@ngrx/store/testing';
|
||||||
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
|
||||||
import { RouteService } from '../../../../core/services/route.service';
|
|
||||||
import { routeServiceStub } from '../../../../shared/testing/route-service.stub';
|
|
||||||
import { RequestService } from '../../../../core/data/request.service';
|
|
||||||
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
||||||
import { getMockRemoteDataBuildService } from '../../../../shared/mocks/remote-data-build.service.mock';
|
import { RequestService } from '../../../../core/data/request.service';
|
||||||
|
import { RouteService } from '../../../../core/services/route.service';
|
||||||
|
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
||||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
|
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||||
|
import { MockActivatedRoute } from '../../../../shared/mocks/active-router.mock';
|
||||||
|
import { getMockRemoteDataBuildService } from '../../../../shared/mocks/remote-data-build.service.mock';
|
||||||
|
import { routeServiceStub } from '../../../../shared/testing/route-service.stub';
|
||||||
|
import { AdminNotifyIncomingComponent } from './admin-notify-incoming.component';
|
||||||
|
|
||||||
describe('AdminNotifyIncomingComponent', () => {
|
describe('AdminNotifyIncomingComponent', () => {
|
||||||
let component: AdminNotifyIncomingComponent;
|
let component: AdminNotifyIncomingComponent;
|
||||||
@@ -26,7 +29,7 @@ describe('AdminNotifyIncomingComponent', () => {
|
|||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
rdbService = getMockRemoteDataBuildService();
|
rdbService = getMockRemoteDataBuildService();
|
||||||
halService = jasmine.createSpyObj('halService', {
|
halService = jasmine.createSpyObj('halService', {
|
||||||
'getRootHref': '/api'
|
'getRootHref': '/api',
|
||||||
});
|
});
|
||||||
requestService = jasmine.createSpyObj('requestService', {
|
requestService = jasmine.createSpyObj('requestService', {
|
||||||
'generateRequestId': 'client/1234',
|
'generateRequestId': 'client/1234',
|
||||||
@@ -43,7 +46,7 @@ describe('AdminNotifyIncomingComponent', () => {
|
|||||||
{ provide: RequestService, useValue: requestService },
|
{ provide: RequestService, useValue: requestService },
|
||||||
{ provide: RemoteDataBuildService, useValue: rdbService },
|
{ provide: RemoteDataBuildService, useValue: rdbService },
|
||||||
provideMockStore({}),
|
provideMockStore({}),
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import {
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
Component,
|
||||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
Inject,
|
||||||
|
} from '@angular/core';
|
||||||
|
|
||||||
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
|
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-admin-notify-incoming',
|
selector: 'ds-admin-notify-incoming',
|
||||||
@@ -9,9 +12,9 @@ import { SearchConfigurationService } from '../../../../core/shared/search/searc
|
|||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: SEARCH_CONFIG_SERVICE,
|
provide: SEARCH_CONFIG_SERVICE,
|
||||||
useClass: SearchConfigurationService
|
useClass: SearchConfigurationService,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
export class AdminNotifyIncomingComponent {
|
export class AdminNotifyIncomingComponent {
|
||||||
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
|
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
|
||||||
|
@@ -1,17 +1,23 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import {
|
||||||
|
ComponentFixture,
|
||||||
import { AdminNotifyLogsResultComponent } from './admin-notify-logs-result.component';
|
TestBed,
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
} from '@angular/core/testing';
|
||||||
import { MockActivatedRoute } from '../../../../shared/mocks/active-router.mock';
|
import {
|
||||||
|
ActivatedRoute,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
import { provideMockStore } from '@ngrx/store/testing';
|
import { provideMockStore } from '@ngrx/store/testing';
|
||||||
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
||||||
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
||||||
import { RequestService } from '../../../../core/data/request.service';
|
import { RequestService } from '../../../../core/data/request.service';
|
||||||
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
|
||||||
import { RouterStub } from '../../../../shared/testing/router.stub';
|
|
||||||
import { RouteService } from '../../../../core/services/route.service';
|
import { RouteService } from '../../../../core/services/route.service';
|
||||||
|
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
||||||
|
import { MockActivatedRoute } from '../../../../shared/mocks/active-router.mock';
|
||||||
import { routeServiceStub } from '../../../../shared/testing/route-service.stub';
|
import { routeServiceStub } from '../../../../shared/testing/route-service.stub';
|
||||||
|
import { RouterStub } from '../../../../shared/testing/router.stub';
|
||||||
|
import { AdminNotifyLogsResultComponent } from './admin-notify-logs-result.component';
|
||||||
|
|
||||||
describe('AdminNotifyLogsResultComponent', () => {
|
describe('AdminNotifyLogsResultComponent', () => {
|
||||||
let component: AdminNotifyLogsResultComponent;
|
let component: AdminNotifyLogsResultComponent;
|
||||||
@@ -34,7 +40,7 @@ describe('AdminNotifyLogsResultComponent', () => {
|
|||||||
{ provide: RequestService, useValue: requestService },
|
{ provide: RequestService, useValue: requestService },
|
||||||
{ provide: RemoteDataBuildService, useValue: rdbService },
|
{ provide: RemoteDataBuildService, useValue: rdbService },
|
||||||
provideMockStore({}),
|
provideMockStore({}),
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
|
@@ -3,15 +3,20 @@ import {
|
|||||||
Component,
|
Component,
|
||||||
Inject,
|
Inject,
|
||||||
Input,
|
Input,
|
||||||
OnInit
|
OnInit,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
import {
|
||||||
|
ActivatedRoute,
|
||||||
|
ActivatedRouteSnapshot,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
import { Context } from '../../../../core/shared/context.model';
|
import { Context } from '../../../../core/shared/context.model';
|
||||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { ActivatedRoute, ActivatedRouteSnapshot, Router } from '@angular/router';
|
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
import { map } from 'rxjs/operators';
|
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-admin-notify-logs-result',
|
selector: 'ds-admin-notify-logs-result',
|
||||||
@@ -19,9 +24,9 @@ import { map } from 'rxjs/operators';
|
|||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: SEARCH_CONFIG_SERVICE,
|
provide: SEARCH_CONFIG_SERVICE,
|
||||||
useClass: SearchConfigurationService
|
useClass: SearchConfigurationService,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,7 +53,7 @@ export class AdminNotifyLogsResultComponent implements OnInit {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.selectedSearchConfig$ = this.searchConfigService.getCurrentConfiguration(this.defaultConfiguration);
|
this.selectedSearchConfig$ = this.searchConfigService.getCurrentConfiguration(this.defaultConfiguration);
|
||||||
this.isInbound$ = this.selectedSearchConfig$.pipe(
|
this.isInbound$ = this.selectedSearchConfig$.pipe(
|
||||||
map(config => config.startsWith('NOTIFY.incoming'))
|
map(config => config.startsWith('NOTIFY.incoming')),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,18 +1,21 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import {
|
||||||
|
ComponentFixture,
|
||||||
import { AdminNotifyOutgoingComponent } from './admin-notify-outgoing.component';
|
TestBed,
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
} from '@angular/core/testing';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { MockActivatedRoute } from '../../../../shared/mocks/active-router.mock';
|
|
||||||
import { provideMockStore } from '@ngrx/store/testing';
|
import { provideMockStore } from '@ngrx/store/testing';
|
||||||
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
|
||||||
import { RouteService } from '../../../../core/services/route.service';
|
|
||||||
import { routeServiceStub } from '../../../../shared/testing/route-service.stub';
|
|
||||||
import { RequestService } from '../../../../core/data/request.service';
|
|
||||||
import { getMockRemoteDataBuildService } from '../../../../shared/mocks/remote-data-build.service.mock';
|
|
||||||
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
||||||
|
import { RequestService } from '../../../../core/data/request.service';
|
||||||
|
import { RouteService } from '../../../../core/services/route.service';
|
||||||
|
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
||||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
|
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||||
|
import { MockActivatedRoute } from '../../../../shared/mocks/active-router.mock';
|
||||||
|
import { getMockRemoteDataBuildService } from '../../../../shared/mocks/remote-data-build.service.mock';
|
||||||
|
import { routeServiceStub } from '../../../../shared/testing/route-service.stub';
|
||||||
|
import { AdminNotifyOutgoingComponent } from './admin-notify-outgoing.component';
|
||||||
|
|
||||||
describe('AdminNotifyOutgoingComponent', () => {
|
describe('AdminNotifyOutgoingComponent', () => {
|
||||||
let component: AdminNotifyOutgoingComponent;
|
let component: AdminNotifyOutgoingComponent;
|
||||||
@@ -29,7 +32,7 @@ describe('AdminNotifyOutgoingComponent', () => {
|
|||||||
'send': '',
|
'send': '',
|
||||||
});
|
});
|
||||||
halService = jasmine.createSpyObj('halService', {
|
halService = jasmine.createSpyObj('halService', {
|
||||||
'getRootHref': '/api'
|
'getRootHref': '/api',
|
||||||
});
|
});
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot()],
|
imports: [TranslateModule.forRoot()],
|
||||||
@@ -42,7 +45,7 @@ describe('AdminNotifyOutgoingComponent', () => {
|
|||||||
{ provide: RequestService, useValue: requestService },
|
{ provide: RequestService, useValue: requestService },
|
||||||
{ provide: RemoteDataBuildService, useValue: rdbService },
|
{ provide: RemoteDataBuildService, useValue: rdbService },
|
||||||
provideMockStore({}),
|
provideMockStore({}),
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import {
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
Component,
|
||||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
Inject,
|
||||||
|
} from '@angular/core';
|
||||||
|
|
||||||
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
|
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-admin-notify-outgoing',
|
selector: 'ds-admin-notify-outgoing',
|
||||||
@@ -9,9 +12,9 @@ import { SearchConfigurationService } from '../../../../core/shared/search/searc
|
|||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: SEARCH_CONFIG_SERVICE,
|
provide: SEARCH_CONFIG_SERVICE,
|
||||||
useClass: SearchConfigurationService
|
useClass: SearchConfigurationService,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
export class AdminNotifyOutgoingComponent {
|
export class AdminNotifyOutgoingComponent {
|
||||||
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
|
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
|
||||||
|
@@ -1,10 +1,13 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import {
|
||||||
|
ComponentFixture,
|
||||||
import { AdminNotifyMetricsComponent } from './admin-notify-metrics.component';
|
TestBed,
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
} from '@angular/core/testing';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||||
import { RouterStub } from '../../../shared/testing/router.stub';
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
|
import { AdminNotifyMetricsComponent } from './admin-notify-metrics.component';
|
||||||
|
|
||||||
describe('AdminNotifyMetricsComponent', () => {
|
describe('AdminNotifyMetricsComponent', () => {
|
||||||
let component: AdminNotifyMetricsComponent;
|
let component: AdminNotifyMetricsComponent;
|
||||||
@@ -13,14 +16,14 @@ describe('AdminNotifyMetricsComponent', () => {
|
|||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
router = Object.assign(new RouterStub(),
|
router = Object.assign(new RouterStub(),
|
||||||
{url : '/notify-dashboard'}
|
{ url : '/notify-dashboard' },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot()],
|
imports: [TranslateModule.forRoot()],
|
||||||
declarations: [ AdminNotifyMetricsComponent ],
|
declarations: [ AdminNotifyMetricsComponent ],
|
||||||
providers: [{provide: Router, useValue: router}]
|
providers: [{ provide: Router, useValue: router }],
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
@@ -42,21 +45,21 @@ describe('AdminNotifyMetricsComponent', () => {
|
|||||||
const routeExtras = {
|
const routeExtras = {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
configuration: searchConfig,
|
configuration: searchConfig,
|
||||||
view: ViewMode.ListElement
|
view: ViewMode.ListElement,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const routeExtrasTable = {
|
const routeExtrasTable = {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
configuration: incomingConfig,
|
configuration: incomingConfig,
|
||||||
view: ViewMode.Table
|
view: ViewMode.Table,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const routeExtrasTableOutgoing = {
|
const routeExtrasTableOutgoing = {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
configuration: outgoingConfig,
|
configuration: outgoingConfig,
|
||||||
view: ViewMode.Table
|
view: ViewMode.Table,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
component.navigateToSelectedSearchConfig(searchConfig);
|
component.navigateToSelectedSearchConfig(searchConfig);
|
||||||
|
@@ -1,7 +1,11 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import {
|
||||||
import { AdminNotifyMetricsRow } from './admin-notify-metrics.model';
|
Component,
|
||||||
|
Input,
|
||||||
|
} from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||||
|
import { AdminNotifyMetricsRow } from './admin-notify-metrics.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-admin-notify-metrics',
|
selector: 'ds-admin-notify-metrics',
|
||||||
@@ -33,7 +37,7 @@ export class AdminNotifyMetricsComponent {
|
|||||||
this.router.navigate([this.adminSearchPath], {
|
this.router.navigate([this.adminSearchPath], {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
configuration: searchConfig,
|
configuration: searchConfig,
|
||||||
view: ViewMode.ListElement
|
view: ViewMode.ListElement,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -46,7 +50,7 @@ export class AdminNotifyMetricsComponent {
|
|||||||
this.router.navigate([`${this.router.url}${selectedPath}`], {
|
this.router.navigate([`${this.router.url}${selectedPath}`], {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
configuration: searchConfig,
|
configuration: searchConfig,
|
||||||
view: ViewMode.Table
|
view: ViewMode.Table,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,26 +1,32 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
import { AdminNotifySearchResultComponent } from './admin-notify-search-result.component';
|
|
||||||
import { AdminNotifyMessagesService } from '../services/admin-notify-messages.service';
|
|
||||||
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
|
||||||
import { RequestService } from '../../../core/data/request.service';
|
|
||||||
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
|
||||||
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
|
||||||
import { cold } from 'jasmine-marbles';
|
|
||||||
import { ConfigurationProperty } from '../../../core/shared/configuration-property.model';
|
|
||||||
import { RouteService } from '../../../core/services/route.service';
|
|
||||||
import { routeServiceStub } from '../../../shared/testing/route-service.stub';
|
|
||||||
import { ActivatedRoute } from '@angular/router';
|
|
||||||
import { RouterStub } from '../../../shared/testing/router.stub';
|
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
|
||||||
import { of as observableOf, of } from 'rxjs';
|
|
||||||
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
|
||||||
import { AdminNotifyDetailModalComponent } from '../admin-notify-detail-modal/admin-notify-detail-modal.component';
|
|
||||||
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-page.component';
|
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import {
|
||||||
|
ComponentFixture,
|
||||||
|
TestBed,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { cold } from 'jasmine-marbles';
|
||||||
|
import {
|
||||||
|
of as observableOf,
|
||||||
|
of,
|
||||||
|
} from 'rxjs';
|
||||||
|
|
||||||
|
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
||||||
|
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||||
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
|
import { RouteService } from '../../../core/services/route.service';
|
||||||
|
import { ConfigurationProperty } from '../../../core/shared/configuration-property.model';
|
||||||
|
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
||||||
|
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
||||||
|
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-page.component';
|
||||||
|
import { routeServiceStub } from '../../../shared/testing/route-service.stub';
|
||||||
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
|
import { AdminNotifyDetailModalComponent } from '../admin-notify-detail-modal/admin-notify-detail-modal.component';
|
||||||
|
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
||||||
|
import { AdminNotifyMessagesService } from '../services/admin-notify-messages.service';
|
||||||
|
import { AdminNotifySearchResultComponent } from './admin-notify-search-result.component';
|
||||||
|
|
||||||
export const mockAdminNotifyMessages = [
|
export const mockAdminNotifyMessages = [
|
||||||
{
|
{
|
||||||
@@ -40,15 +46,15 @@ export const mockAdminNotifyMessages = [
|
|||||||
'queueStatus': 3,
|
'queueStatus': 3,
|
||||||
'_links': {
|
'_links': {
|
||||||
'self': {
|
'self': {
|
||||||
'href': 'http://localhost:8080/server/api/ldn/messages/urn:uuid:5fb3af44-d4f8-4226-9475-2d09c2d8d9e0'
|
'href': 'http://localhost:8080/server/api/ldn/messages/urn:uuid:5fb3af44-d4f8-4226-9475-2d09c2d8d9e0',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
'thumbnail': 'test',
|
'thumbnail': 'test',
|
||||||
'item': {},
|
'item': {},
|
||||||
'accessStatus': {},
|
'accessStatus': {},
|
||||||
'ldnService': 'NOTIFY inbox - Automatic service',
|
'ldnService': 'NOTIFY inbox - Automatic service',
|
||||||
'relatedItem': 'test coar 2 demo',
|
'relatedItem': 'test coar 2 demo',
|
||||||
'message': '{"@context":["https://www.w3.org/ns/activitystreams","https://purl.org/coar/notify"],"id":"urn:uuid:668f26e0-2e8d-4118-b0d2-ee713523bc45","type":["Reject","coar-notify:IngestAction"],"actor":{"id":"https://generic-service.com","type":["Service"],"name":"Generic Service"},"context":{"id":"https://dspace-coar.4science.cloud/handle/123456789/28","type":["Document"],"ietf:cite-as":"https://doi.org/10.4598/12123488"},"object":{"id":"https://dspace-coar.4science.cloud/handle/123456789/28","type":["Offer"]},"origin":{"id":"https://generic-service.com/system","type":["Service"],"inbox":"https://notify-inbox.info/inbox7"},"target":{"id":"https://some-organisation.org","type":["Organization"],"inbox":"https://dspace-coar.4science.cloud/server/ldn/inbox"},"inReplyTo":"urn:uuid:d9b4010a-f128-4815-abb2-83707a2ee9cf"}'
|
'message': '{"@context":["https://www.w3.org/ns/activitystreams","https://purl.org/coar/notify"],"id":"urn:uuid:668f26e0-2e8d-4118-b0d2-ee713523bc45","type":["Reject","coar-notify:IngestAction"],"actor":{"id":"https://generic-service.com","type":["Service"],"name":"Generic Service"},"context":{"id":"https://dspace-coar.4science.cloud/handle/123456789/28","type":["Document"],"ietf:cite-as":"https://doi.org/10.4598/12123488"},"object":{"id":"https://dspace-coar.4science.cloud/handle/123456789/28","type":["Offer"]},"origin":{"id":"https://generic-service.com/system","type":["Service"],"inbox":"https://notify-inbox.info/inbox7"},"target":{"id":"https://some-organisation.org","type":["Organization"],"inbox":"https://dspace-coar.4science.cloud/server/ldn/inbox"},"inReplyTo":"urn:uuid:d9b4010a-f128-4815-abb2-83707a2ee9cf"}',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'type': 'message',
|
'type': 'message',
|
||||||
@@ -67,16 +73,16 @@ export const mockAdminNotifyMessages = [
|
|||||||
'queueStatus': 6,
|
'queueStatus': 6,
|
||||||
'_links': {
|
'_links': {
|
||||||
'self': {
|
'self': {
|
||||||
'href': 'http://localhost:8080/server/api/ldn/messages/urn:uuid:544c8777-e826-4810-a625-3e394cc3660d'
|
'href': 'http://localhost:8080/server/api/ldn/messages/urn:uuid:544c8777-e826-4810-a625-3e394cc3660d',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
'thumbnail': {},
|
'thumbnail': {},
|
||||||
'item': {},
|
'item': {},
|
||||||
'accessStatus': {},
|
'accessStatus': {},
|
||||||
'ldnService': 'NOTIFY inbox - Automatic service',
|
'ldnService': 'NOTIFY inbox - Automatic service',
|
||||||
'relatedItem': 'test coar demo',
|
'relatedItem': 'test coar demo',
|
||||||
'message': '{"@context":["https://www.w3.org/ns/activitystreams","https://purl.org/coar/notify"],"id":"urn:uuid:668f26e0-2e8d-4118-b0d2-ee713523bc45","type":["Reject","coar-notify:IngestAction"],"actor":{"id":"https://generic-service.com","type":["Service"],"name":"Generic Service"},"context":{"id":"https://dspace-coar.4science.cloud/handle/123456789/28","type":["Document"],"ietf:cite-as":"https://doi.org/10.4598/12123488"},"object":{"id":"https://dspace-coar.4science.cloud/handle/123456789/28","type":["Offer"]},"origin":{"id":"https://generic-service.com/system","type":["Service"],"inbox":"https://notify-inbox.info/inbox7"},"target":{"id":"https://some-organisation.org","type":["Organization"],"inbox":"https://dspace-coar.4science.cloud/server/ldn/inbox"},"inReplyTo":"urn:uuid:d9b4010a-f128-4815-abb2-83707a2ee9cf"}'
|
'message': '{"@context":["https://www.w3.org/ns/activitystreams","https://purl.org/coar/notify"],"id":"urn:uuid:668f26e0-2e8d-4118-b0d2-ee713523bc45","type":["Reject","coar-notify:IngestAction"],"actor":{"id":"https://generic-service.com","type":["Service"],"name":"Generic Service"},"context":{"id":"https://dspace-coar.4science.cloud/handle/123456789/28","type":["Document"],"ietf:cite-as":"https://doi.org/10.4598/12123488"},"object":{"id":"https://dspace-coar.4science.cloud/handle/123456789/28","type":["Offer"]},"origin":{"id":"https://generic-service.com/system","type":["Service"],"inbox":"https://notify-inbox.info/inbox7"},"target":{"id":"https://some-organisation.org","type":["Organization"],"inbox":"https://dspace-coar.4science.cloud/server/ldn/inbox"},"inReplyTo":"urn:uuid:d9b4010a-f128-4815-abb2-83707a2ee9cf"}',
|
||||||
}
|
},
|
||||||
] as unknown as AdminNotifyMessage[];
|
] as unknown as AdminNotifyMessage[];
|
||||||
describe('AdminNotifySearchResultComponent', () => {
|
describe('AdminNotifySearchResultComponent', () => {
|
||||||
let component: AdminNotifySearchResultComponent;
|
let component: AdminNotifySearchResultComponent;
|
||||||
@@ -92,12 +98,12 @@ describe('AdminNotifySearchResultComponent', () => {
|
|||||||
const testObject = {
|
const testObject = {
|
||||||
uuid: 'test-property',
|
uuid: 'test-property',
|
||||||
name: 'test-property',
|
name: 'test-property',
|
||||||
values: ['value-1', 'value-2']
|
values: ['value-1', 'value-2'],
|
||||||
} as ConfigurationProperty;
|
} as ConfigurationProperty;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
halService = jasmine.createSpyObj('halService', {
|
halService = jasmine.createSpyObj('halService', {
|
||||||
getEndpoint: cold('a', { a: '' })
|
getEndpoint: cold('a', { a: '' }),
|
||||||
});
|
});
|
||||||
adminNotifyMessageService = jasmine.createSpyObj('adminNotifyMessageService', {
|
adminNotifyMessageService = jasmine.createSpyObj('adminNotifyMessageService', {
|
||||||
getDetailedMessages: of(mockAdminNotifyMessages),
|
getDetailedMessages: of(mockAdminNotifyMessages),
|
||||||
@@ -105,18 +111,18 @@ describe('AdminNotifySearchResultComponent', () => {
|
|||||||
});
|
});
|
||||||
requestService = jasmine.createSpyObj('requestService', {
|
requestService = jasmine.createSpyObj('requestService', {
|
||||||
generateRequestId: requestUUID,
|
generateRequestId: requestUUID,
|
||||||
send: true
|
send: true,
|
||||||
});
|
});
|
||||||
rdbService = jasmine.createSpyObj('rdbService', {
|
rdbService = jasmine.createSpyObj('rdbService', {
|
||||||
buildSingle: cold('a', {
|
buildSingle: cold('a', {
|
||||||
a: {
|
a: {
|
||||||
payload: testObject
|
payload: testObject,
|
||||||
}
|
},
|
||||||
})
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
searchConfigService = jasmine.createSpyObj('searchConfigService', {
|
searchConfigService = jasmine.createSpyObj('searchConfigService', {
|
||||||
getCurrentConfiguration: of('NOTIFY.outgoing')
|
getCurrentConfiguration: of('NOTIFY.outgoing'),
|
||||||
});
|
});
|
||||||
objectCache = {} as ObjectCacheService;
|
objectCache = {} as ObjectCacheService;
|
||||||
|
|
||||||
@@ -133,9 +139,9 @@ describe('AdminNotifySearchResultComponent', () => {
|
|||||||
{ provide: RequestService, useValue: requestService },
|
{ provide: RequestService, useValue: requestService },
|
||||||
{ provide: RemoteDataBuildService, useValue: rdbService },
|
{ provide: RemoteDataBuildService, useValue: rdbService },
|
||||||
{ provide: SEARCH_CONFIG_SERVICE, useValue: searchConfigService },
|
{ provide: SEARCH_CONFIG_SERVICE, useValue: searchConfigService },
|
||||||
DatePipe
|
DatePipe,
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
|
@@ -1,22 +1,27 @@
|
|||||||
import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
|
|
||||||
import { AdminNotifySearchResult } from '../models/admin-notify-message-search-result.model';
|
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
|
||||||
import { Context } from '../../../core/shared/context.model';
|
|
||||||
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
|
||||||
import {
|
|
||||||
tabulatableObjectsComponent
|
|
||||||
} from '../../../shared/object-collection/shared/tabulatable-objects/tabulatable-objects.decorator';
|
|
||||||
import {
|
|
||||||
TabulatableResultListElementsComponent
|
|
||||||
} from '../../../shared/object-list/search-result-list-element/tabulatable-search-result/tabulatable-result-list-elements.component';
|
|
||||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
|
||||||
import { AdminNotifyDetailModalComponent } from '../admin-notify-detail-modal/admin-notify-detail-modal.component';
|
|
||||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
|
||||||
import { AdminNotifyMessagesService } from '../services/admin-notify-messages.service';
|
|
||||||
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-page.component';
|
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
|
import {
|
||||||
|
Component,
|
||||||
|
Inject,
|
||||||
|
OnDestroy,
|
||||||
|
OnInit,
|
||||||
|
} from '@angular/core';
|
||||||
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import {
|
||||||
|
BehaviorSubject,
|
||||||
|
Subscription,
|
||||||
|
} from 'rxjs';
|
||||||
|
|
||||||
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
|
import { Context } from '../../../core/shared/context.model';
|
||||||
|
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
||||||
|
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||||
|
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-page.component';
|
||||||
|
import { tabulatableObjectsComponent } from '../../../shared/object-collection/shared/tabulatable-objects/tabulatable-objects.decorator';
|
||||||
|
import { TabulatableResultListElementsComponent } from '../../../shared/object-list/search-result-list-element/tabulatable-search-result/tabulatable-result-list-elements.component';
|
||||||
|
import { AdminNotifyDetailModalComponent } from '../admin-notify-detail-modal/admin-notify-detail-modal.component';
|
||||||
|
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
||||||
|
import { AdminNotifySearchResult } from '../models/admin-notify-message-search-result.model';
|
||||||
|
import { AdminNotifyMessagesService } from '../services/admin-notify-messages.service';
|
||||||
|
|
||||||
@tabulatableObjectsComponent(PaginatedList<AdminNotifySearchResult>, ViewMode.Table, Context.CoarNotify)
|
@tabulatableObjectsComponent(PaginatedList<AdminNotifySearchResult>, ViewMode.Table, Context.CoarNotify)
|
||||||
@Component({
|
@Component({
|
||||||
@@ -25,9 +30,9 @@ import { DatePipe } from '@angular/common';
|
|||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: SEARCH_CONFIG_SERVICE,
|
provide: SEARCH_CONFIG_SERVICE,
|
||||||
useClass: SearchConfigurationService
|
useClass: SearchConfigurationService,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* Component for visualization in table format of the search results related to the AdminNotifyDashboardComponent
|
* Component for visualization in table format of the search results related to the AdminNotifyDashboardComponent
|
||||||
@@ -47,7 +52,7 @@ export class AdminNotifySearchResultComponent extends TabulatableResultListEleme
|
|||||||
'QUEUE_STATUS_UNTRUSTED',
|
'QUEUE_STATUS_UNTRUSTED',
|
||||||
'QUEUE_STATUS_UNTRUSTED_IP',
|
'QUEUE_STATUS_UNTRUSTED_IP',
|
||||||
'QUEUE_STATUS_FAILED',
|
'QUEUE_STATUS_FAILED',
|
||||||
'QUEUE_STATUS_UNMAPPED_ACTION'
|
'QUEUE_STATUS_UNMAPPED_ACTION',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@@ -77,7 +82,7 @@ export class AdminNotifySearchResultComponent extends TabulatableResultListEleme
|
|||||||
'queueAttempts',
|
'queueAttempts',
|
||||||
'queueLastStartTime',
|
'queueLastStartTime',
|
||||||
'queueStatusLabel',
|
'queueStatusLabel',
|
||||||
'queueTimeout'
|
'queueTimeout',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,7 +106,7 @@ export class AdminNotifySearchResultComponent extends TabulatableResultListEleme
|
|||||||
this.subs.push(this.searchConfigService.getCurrentConfiguration('')
|
this.subs.push(this.searchConfigService.getCurrentConfiguration('')
|
||||||
.subscribe(configuration => {
|
.subscribe(configuration => {
|
||||||
this.isInbound = configuration.startsWith('NOTIFY.incoming');
|
this.isInbound = configuration.startsWith('NOTIFY.incoming');
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,8 +143,8 @@ export class AdminNotifySearchResultComponent extends TabulatableResultListEleme
|
|||||||
this.adminNotifyMessagesService.reprocessMessage(message, this.messagesSubject$)
|
this.adminNotifyMessagesService.reprocessMessage(message, this.messagesSubject$)
|
||||||
.subscribe(response => {
|
.subscribe(response => {
|
||||||
this.messagesSubject$.next(response);
|
this.messagesSubject$.next(response);
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
import { AdminNotifyMessage } from './admin-notify-message.model';
|
|
||||||
import { searchResultFor } from '../../../shared/search/search-result-element-decorator';
|
|
||||||
import { SearchResult } from '../../../shared/search/models/search-result.model';
|
import { SearchResult } from '../../../shared/search/models/search-result.model';
|
||||||
|
import { searchResultFor } from '../../../shared/search/search-result-element-decorator';
|
||||||
|
import { AdminNotifyMessage } from './admin-notify-message.model';
|
||||||
|
|
||||||
@searchResultFor(AdminNotifyMessage)
|
@searchResultFor(AdminNotifyMessage)
|
||||||
export class AdminNotifySearchResult extends SearchResult<AdminNotifyMessage> {
|
export class AdminNotifySearchResult extends SearchResult<AdminNotifyMessage> {
|
||||||
|
@@ -1,11 +1,17 @@
|
|||||||
import { autoserialize, deserialize, inheritSerialization } from 'cerialize';
|
import {
|
||||||
|
autoserialize,
|
||||||
|
deserialize,
|
||||||
|
inheritSerialization,
|
||||||
|
} from 'cerialize';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import { typedObject } from '../../../core/cache/builders/build-decorators';
|
import { typedObject } from '../../../core/cache/builders/build-decorators';
|
||||||
import { ADMIN_NOTIFY_MESSAGE } from './admin-notify-message.resource-type';
|
|
||||||
import { excludeFromEquals } from '../../../core/utilities/equals.decorators';
|
|
||||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||||
import { GenericConstructor } from '../../../core/shared/generic-constructor';
|
import { GenericConstructor } from '../../../core/shared/generic-constructor';
|
||||||
|
import { excludeFromEquals } from '../../../core/utilities/equals.decorators';
|
||||||
import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model';
|
import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model';
|
||||||
import { Observable } from 'rxjs';
|
import { ADMIN_NOTIFY_MESSAGE } from './admin-notify-message.resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A message that includes admin notify info
|
* A message that includes admin notify info
|
||||||
*/
|
*/
|
||||||
|
@@ -1,23 +1,26 @@
|
|||||||
|
import { deepClone } from 'fast-json-patch';
|
||||||
import { cold } from 'jasmine-marbles';
|
import { cold } from 'jasmine-marbles';
|
||||||
import { AdminNotifyMessagesService } from './admin-notify-messages.service';
|
import {
|
||||||
import { RequestService } from '../../../core/data/request.service';
|
BehaviorSubject,
|
||||||
|
of,
|
||||||
|
} from 'rxjs';
|
||||||
|
import { take } from 'rxjs/operators';
|
||||||
|
|
||||||
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
||||||
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||||
|
import { RestResponse } from '../../../core/cache/response.models';
|
||||||
|
import { ItemDataService } from '../../../core/data/item-data.service';
|
||||||
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
|
import { RequestEntry } from '../../../core/data/request-entry.model';
|
||||||
|
import { RequestEntryState } from '../../../core/data/request-entry-state.model';
|
||||||
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { LdnServicesService } from '../../admin-ldn-services/ldn-services-data/ldn-services-data.service';
|
|
||||||
import { ItemDataService } from '../../../core/data/item-data.service';
|
|
||||||
import { RequestEntry } from '../../../core/data/request-entry.model';
|
|
||||||
import { RestResponse } from '../../../core/cache/response.models';
|
|
||||||
import { BehaviorSubject, of } from 'rxjs';
|
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { LdnServicesService } from '../../admin-ldn-services/ldn-services-data/ldn-services-data.service';
|
||||||
import { RequestEntryState } from '../../../core/data/request-entry-state.model';
|
import { mockAdminNotifyMessages } from '../admin-notify-search-result/admin-notify-search-result.component.spec';
|
||||||
import {
|
|
||||||
mockAdminNotifyMessages} from '../admin-notify-search-result/admin-notify-search-result.component.spec';
|
|
||||||
import { take } from 'rxjs/operators';
|
|
||||||
import { deepClone } from 'fast-json-patch';
|
|
||||||
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
||||||
|
import { AdminNotifyMessagesService } from './admin-notify-messages.service';
|
||||||
|
|
||||||
describe('AdminNotifyMessagesService test', () => {
|
describe('AdminNotifyMessagesService test', () => {
|
||||||
let service: AdminNotifyMessagesService;
|
let service: AdminNotifyMessagesService;
|
||||||
@@ -47,7 +50,7 @@ describe('AdminNotifyMessagesService test', () => {
|
|||||||
halService,
|
halService,
|
||||||
notificationsService,
|
notificationsService,
|
||||||
ldnServicesService,
|
ldnServicesService,
|
||||||
itemDataService
|
itemDataService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,13 +72,13 @@ describe('AdminNotifyMessagesService test', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
halService = jasmine.createSpyObj('halService', {
|
halService = jasmine.createSpyObj('halService', {
|
||||||
getEndpoint: of(endpointURL)
|
getEndpoint: of(endpointURL),
|
||||||
});
|
});
|
||||||
|
|
||||||
rdbService = jasmine.createSpyObj('rdbService', {
|
rdbService = jasmine.createSpyObj('rdbService', {
|
||||||
buildSingle: createSuccessfulRemoteDataObject$({}, 500),
|
buildSingle: createSuccessfulRemoteDataObject$({}, 500),
|
||||||
buildList: cold('a', { a: remoteDataMocks.Success }),
|
buildList: cold('a', { a: remoteDataMocks.Success }),
|
||||||
buildFromRequestUUID: createSuccessfulRemoteDataObject$(mockMessages)
|
buildFromRequestUUID: createSuccessfulRemoteDataObject$(mockMessages),
|
||||||
});
|
});
|
||||||
|
|
||||||
ldnServicesService = jasmine.createSpyObj('ldnServicesService', {
|
ldnServicesService = jasmine.createSpyObj('ldnServicesService', {
|
||||||
|
@@ -1,20 +1,35 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import {dataService} from '../../../core/data/base/data-service.decorator';
|
import {
|
||||||
import {IdentifiableDataService} from '../../../core/data/base/identifiable-data.service';
|
BehaviorSubject,
|
||||||
import {RequestService} from '../../../core/data/request.service';
|
from,
|
||||||
|
Observable,
|
||||||
|
of,
|
||||||
|
scan,
|
||||||
|
} from 'rxjs';
|
||||||
|
import {
|
||||||
|
map,
|
||||||
|
mergeMap,
|
||||||
|
switchMap,
|
||||||
|
tap,
|
||||||
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
||||||
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||||
import {HALEndpointService} from '../../../core/shared/hal-endpoint.service';
|
import { dataService } from '../../../core/data/base/data-service.decorator';
|
||||||
import {NotificationsService} from '../../../shared/notifications/notifications.service';
|
import { IdentifiableDataService } from '../../../core/data/base/identifiable-data.service';
|
||||||
import { BehaviorSubject, from, Observable, of, scan } from 'rxjs';
|
|
||||||
import { ADMIN_NOTIFY_MESSAGE } from '../models/admin-notify-message.resource-type';
|
|
||||||
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
|
||||||
import { map, mergeMap, switchMap, tap } from 'rxjs/operators';
|
|
||||||
import { getAllSucceededRemoteDataPayload, getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
|
||||||
import { LdnServicesService } from '../../admin-ldn-services/ldn-services-data/ldn-services-data.service';
|
|
||||||
import { ItemDataService } from '../../../core/data/item-data.service';
|
import { ItemDataService } from '../../../core/data/item-data.service';
|
||||||
import { PostRequest } from '../../../core/data/request.models';
|
import { PostRequest } from '../../../core/data/request.models';
|
||||||
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
import { RestRequest } from '../../../core/data/rest-request.model';
|
import { RestRequest } from '../../../core/data/rest-request.model';
|
||||||
|
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
||||||
|
import {
|
||||||
|
getAllSucceededRemoteDataPayload,
|
||||||
|
getFirstCompletedRemoteData,
|
||||||
|
} from '../../../core/shared/operators';
|
||||||
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { LdnServicesService } from '../../admin-ldn-services/ldn-services-data/ldn-services-data.service';
|
||||||
|
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
||||||
|
import { ADMIN_NOTIFY_MESSAGE } from '../models/admin-notify-message.resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injectable service responsible for fetching/sending data from/to the REST API on the messages endpoint.
|
* Injectable service responsible for fetching/sending data from/to the REST API on the messages endpoint.
|
||||||
@@ -51,13 +66,13 @@ export class AdminNotifyMessagesService extends IdentifiableDataService<AdminNot
|
|||||||
mergeMap(message =>
|
mergeMap(message =>
|
||||||
message.target || message.origin ? this.ldnServicesService.findById((message.target || message.origin).toString()).pipe(
|
message.target || message.origin ? this.ldnServicesService.findById((message.target || message.origin).toString()).pipe(
|
||||||
getAllSucceededRemoteDataPayload(),
|
getAllSucceededRemoteDataPayload(),
|
||||||
map(detail => ({...message, ldnService: detail.name}))
|
map(detail => ({ ...message, ldnService: detail.name })),
|
||||||
) : of(message),
|
) : of(message),
|
||||||
),
|
),
|
||||||
mergeMap(message =>
|
mergeMap(message =>
|
||||||
message.object || message.context ? this.itemDataService.findById(message.object || message.context).pipe(
|
message.object || message.context ? this.itemDataService.findById(message.object || message.context).pipe(
|
||||||
getAllSucceededRemoteDataPayload(),
|
getAllSucceededRemoteDataPayload(),
|
||||||
map(detail => ({...message, relatedItem: detail.name}))
|
map(detail => ({ ...message, relatedItem: detail.name })),
|
||||||
) : of(message),
|
) : of(message),
|
||||||
),
|
),
|
||||||
scan((acc: any, value: any) => [...acc, value], []),
|
scan((acc: any, value: any) => [...acc, value], []),
|
||||||
@@ -93,7 +108,7 @@ export class AdminNotifyMessagesService extends IdentifiableDataService<AdminNot
|
|||||||
messages[indexOfMessageToUpdate] = detailedReprocessedMessage;
|
messages[indexOfMessageToUpdate] = detailedReprocessedMessage;
|
||||||
|
|
||||||
return messages;
|
return messages;
|
||||||
})
|
}),
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
import { MetadataRegistryComponent } from './metadata-registry/metadata-registry.component';
|
|
||||||
import { RouterModule } from '@angular/router';
|
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component';
|
import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
import { BITSTREAMFORMATS_MODULE_PATH } from './admin-registries-routing-paths';
|
import { BITSTREAMFORMATS_MODULE_PATH } from './admin-registries-routing-paths';
|
||||||
|
import { MetadataRegistryComponent } from './metadata-registry/metadata-registry.component';
|
||||||
|
import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -15,25 +16,25 @@ import { BITSTREAMFORMATS_MODULE_PATH } from './admin-registries-routing-paths';
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: MetadataRegistryComponent
|
component: MetadataRegistryComponent,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':schemaName',
|
path: ':schemaName',
|
||||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||||
component: MetadataSchemaComponent,
|
component: MetadataSchemaComponent,
|
||||||
data: {title: 'admin.registries.schema.title', breadcrumbKey: 'admin.registries.schema'}
|
data: { title: 'admin.registries.schema.title', breadcrumbKey: 'admin.registries.schema' },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: BITSTREAMFORMATS_MODULE_PATH,
|
path: BITSTREAMFORMATS_MODULE_PATH,
|
||||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||||
loadChildren: () => import('./bitstream-formats/bitstream-formats.module')
|
loadChildren: () => import('./bitstream-formats/bitstream-formats.module')
|
||||||
.then((m) => m.BitstreamFormatsModule),
|
.then((m) => m.BitstreamFormatsModule),
|
||||||
data: {title: 'admin.registries.bitstream-formats.title', breadcrumbKey: 'admin.registries.bitstream-formats'}
|
data: { title: 'admin.registries.bitstream-formats.title', breadcrumbKey: 'admin.registries.bitstream-formats' },
|
||||||
},
|
},
|
||||||
])
|
]),
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
export class AdminRegistriesRoutingModule {
|
export class AdminRegistriesRoutingModule {
|
||||||
|
|
||||||
|
@@ -1,14 +1,15 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { MetadataRegistryComponent } from './metadata-registry/metadata-registry.component';
|
|
||||||
import { AdminRegistriesRoutingModule } from './admin-registries-routing.module';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { FormModule } from '../../shared/form/form.module';
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
|
import { AdminRegistriesRoutingModule } from './admin-registries-routing.module';
|
||||||
|
import { BitstreamFormatsModule } from './bitstream-formats/bitstream-formats.module';
|
||||||
|
import { MetadataRegistryComponent } from './metadata-registry/metadata-registry.component';
|
||||||
import { MetadataSchemaFormComponent } from './metadata-registry/metadata-schema-form/metadata-schema-form.component';
|
import { MetadataSchemaFormComponent } from './metadata-registry/metadata-schema-form/metadata-schema-form.component';
|
||||||
import { MetadataFieldFormComponent } from './metadata-schema/metadata-field-form/metadata-field-form.component';
|
import { MetadataFieldFormComponent } from './metadata-schema/metadata-field-form/metadata-field-form.component';
|
||||||
import { BitstreamFormatsModule } from './bitstream-formats/bitstream-formats.module';
|
import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component';
|
||||||
import { FormModule } from '../../shared/form/form.module';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -17,14 +18,14 @@ import { FormModule } from '../../shared/form/form.module';
|
|||||||
RouterModule,
|
RouterModule,
|
||||||
BitstreamFormatsModule,
|
BitstreamFormatsModule,
|
||||||
AdminRegistriesRoutingModule,
|
AdminRegistriesRoutingModule,
|
||||||
FormModule
|
FormModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
MetadataRegistryComponent,
|
MetadataRegistryComponent,
|
||||||
MetadataSchemaComponent,
|
MetadataSchemaComponent,
|
||||||
MetadataSchemaFormComponent,
|
MetadataSchemaFormComponent,
|
||||||
MetadataFieldFormComponent
|
MetadataFieldFormComponent,
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
export class AdminRegistriesModule {
|
export class AdminRegistriesModule {
|
||||||
|
|
||||||
|
@@ -1,19 +1,27 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
import {
|
||||||
|
ComponentFixture,
|
||||||
|
TestBed,
|
||||||
|
waitForAsync,
|
||||||
|
} from '@angular/core/testing';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
|
|
||||||
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||||
import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level';
|
|
||||||
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
||||||
|
import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
|
import {
|
||||||
|
createFailedRemoteDataObject$,
|
||||||
|
createSuccessfulRemoteDataObject$,
|
||||||
|
} from '../../../../shared/remote-data.utils';
|
||||||
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
||||||
import { RouterStub } from '../../../../shared/testing/router.stub';
|
import { RouterStub } from '../../../../shared/testing/router.stub';
|
||||||
import { AddBitstreamFormatComponent } from './add-bitstream-format.component';
|
import { AddBitstreamFormatComponent } from './add-bitstream-format.component';
|
||||||
import { createFailedRemoteDataObject$, createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
|
||||||
|
|
||||||
describe('AddBitstreamFormatComponent', () => {
|
describe('AddBitstreamFormatComponent', () => {
|
||||||
let comp: AddBitstreamFormatComponent;
|
let comp: AddBitstreamFormatComponent;
|
||||||
@@ -38,7 +46,7 @@ describe('AddBitstreamFormatComponent', () => {
|
|||||||
notificationService = new NotificationsServiceStub();
|
notificationService = new NotificationsServiceStub();
|
||||||
bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', {
|
bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', {
|
||||||
createBitstreamFormat: createSuccessfulRemoteDataObject$({}),
|
createBitstreamFormat: createSuccessfulRemoteDataObject$({}),
|
||||||
clearBitStreamFormatRequests: observableOf(null)
|
clearBitStreamFormatRequests: observableOf(null),
|
||||||
});
|
});
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -49,7 +57,7 @@ describe('AddBitstreamFormatComponent', () => {
|
|||||||
{ provide: NotificationsService, useValue: notificationService },
|
{ provide: NotificationsService, useValue: notificationService },
|
||||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
||||||
],
|
],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -78,7 +86,7 @@ describe('AddBitstreamFormatComponent', () => {
|
|||||||
notificationService = new NotificationsServiceStub();
|
notificationService = new NotificationsServiceStub();
|
||||||
bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', {
|
bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', {
|
||||||
createBitstreamFormat: createFailedRemoteDataObject$('Error', 500),
|
createBitstreamFormat: createFailedRemoteDataObject$('Error', 500),
|
||||||
clearBitStreamFormatRequests: observableOf(null)
|
clearBitStreamFormatRequests: observableOf(null),
|
||||||
});
|
});
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -89,7 +97,7 @@ describe('AddBitstreamFormatComponent', () => {
|
|||||||
{ provide: NotificationsService, useValue: notificationService },
|
{ provide: NotificationsService, useValue: notificationService },
|
||||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
||||||
],
|
],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
beforeEach(initBeforeEach);
|
beforeEach(initBeforeEach);
|
||||||
|
@@ -1,12 +1,13 @@
|
|||||||
import { Router } from '@angular/router';
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
import { Router } from '@angular/router';
|
||||||
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths';
|
|
||||||
|
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
|
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
||||||
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
||||||
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
|
import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders the page to create a new bitstream format.
|
* This component renders the page to create a new bitstream format.
|
||||||
@@ -44,7 +45,7 @@ export class AddBitstreamFormatComponent {
|
|||||||
this.notificationService.error(this.translateService.get('admin.registries.bitstream-formats.create.failure.head'),
|
this.notificationService.error(this.translateService.get('admin.registries.bitstream-formats.create.failure.head'),
|
||||||
this.translateService.get('admin.registries.bitstream-formats.create.failure.content'));
|
this.translateService.get('admin.registries.bitstream-formats.create.failure.content'));
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
/* eslint-disable max-classes-per-file */
|
/* eslint-disable max-classes-per-file */
|
||||||
import { Action } from '@ngrx/store';
|
import { Action } from '@ngrx/store';
|
||||||
import { type } from '../../../shared/ngrx/type';
|
|
||||||
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
||||||
|
import { type } from '../../../shared/ngrx/type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For each action type in an action group, make a simple
|
* For each action type in an action group, make a simple
|
||||||
@@ -15,7 +16,7 @@ export const BitstreamFormatsRegistryActionTypes = {
|
|||||||
|
|
||||||
SELECT_FORMAT: type('dspace/bitstream-formats-registry/SELECT_FORMAT'),
|
SELECT_FORMAT: type('dspace/bitstream-formats-registry/SELECT_FORMAT'),
|
||||||
DESELECT_FORMAT: type('dspace/bitstream-formats-registry/DESELECT_FORMAT'),
|
DESELECT_FORMAT: type('dspace/bitstream-formats-registry/DESELECT_FORMAT'),
|
||||||
DESELECT_ALL_FORMAT: type('dspace/bitstream-formats-registry/DESELECT_ALL_FORMAT')
|
DESELECT_ALL_FORMAT: type('dspace/bitstream-formats-registry/DESELECT_ALL_FORMAT'),
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,11 +1,15 @@
|
|||||||
import { Action } from '@ngrx/store';
|
import { Action } from '@ngrx/store';
|
||||||
|
|
||||||
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
||||||
import { bitstreamFormatReducer, BitstreamFormatRegistryState } from './bitstream-format.reducers';
|
|
||||||
import {
|
import {
|
||||||
BitstreamFormatsRegistryDeselectAction,
|
BitstreamFormatsRegistryDeselectAction,
|
||||||
BitstreamFormatsRegistryDeselectAllAction,
|
BitstreamFormatsRegistryDeselectAllAction,
|
||||||
BitstreamFormatsRegistrySelectAction
|
BitstreamFormatsRegistrySelectAction,
|
||||||
} from './bitstream-format.actions';
|
} from './bitstream-format.actions';
|
||||||
|
import {
|
||||||
|
bitstreamFormatReducer,
|
||||||
|
BitstreamFormatRegistryState,
|
||||||
|
} from './bitstream-format.reducers';
|
||||||
|
|
||||||
const bitstreamFormat1: BitstreamFormat = new BitstreamFormat();
|
const bitstreamFormat1: BitstreamFormat = new BitstreamFormat();
|
||||||
bitstreamFormat1.id = 'test-uuid-1';
|
bitstreamFormat1.id = 'test-uuid-1';
|
||||||
@@ -16,15 +20,15 @@ bitstreamFormat2.id = 'test-uuid-2';
|
|||||||
bitstreamFormat2.shortDescription = 'test-short-2';
|
bitstreamFormat2.shortDescription = 'test-short-2';
|
||||||
|
|
||||||
const initialState: BitstreamFormatRegistryState = {
|
const initialState: BitstreamFormatRegistryState = {
|
||||||
selectedBitstreamFormats: []
|
selectedBitstreamFormats: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
const bitstream1SelectedState: BitstreamFormatRegistryState = {
|
const bitstream1SelectedState: BitstreamFormatRegistryState = {
|
||||||
selectedBitstreamFormats: [bitstreamFormat1]
|
selectedBitstreamFormats: [bitstreamFormat1],
|
||||||
};
|
};
|
||||||
|
|
||||||
const bitstream1and2SelectedState: BitstreamFormatRegistryState = {
|
const bitstream1and2SelectedState: BitstreamFormatRegistryState = {
|
||||||
selectedBitstreamFormats: [bitstreamFormat1, bitstreamFormat2]
|
selectedBitstreamFormats: [bitstreamFormat1, bitstreamFormat2],
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('BitstreamFormatReducer', () => {
|
describe('BitstreamFormatReducer', () => {
|
||||||
|
@@ -3,7 +3,7 @@ import {
|
|||||||
BitstreamFormatsRegistryAction,
|
BitstreamFormatsRegistryAction,
|
||||||
BitstreamFormatsRegistryActionTypes,
|
BitstreamFormatsRegistryActionTypes,
|
||||||
BitstreamFormatsRegistryDeselectAction,
|
BitstreamFormatsRegistryDeselectAction,
|
||||||
BitstreamFormatsRegistrySelectAction
|
BitstreamFormatsRegistrySelectAction,
|
||||||
} from './bitstream-format.actions';
|
} from './bitstream-format.actions';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,21 +32,21 @@ export function bitstreamFormatReducer(state = initialState, action: BitstreamFo
|
|||||||
|
|
||||||
case BitstreamFormatsRegistryActionTypes.SELECT_FORMAT: {
|
case BitstreamFormatsRegistryActionTypes.SELECT_FORMAT: {
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
selectedBitstreamFormats: [...state.selectedBitstreamFormats, (action as BitstreamFormatsRegistrySelectAction).bitstreamFormat]
|
selectedBitstreamFormats: [...state.selectedBitstreamFormats, (action as BitstreamFormatsRegistrySelectAction).bitstreamFormat],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
case BitstreamFormatsRegistryActionTypes.DESELECT_FORMAT: {
|
case BitstreamFormatsRegistryActionTypes.DESELECT_FORMAT: {
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
selectedBitstreamFormats: state.selectedBitstreamFormats.filter(
|
selectedBitstreamFormats: state.selectedBitstreamFormats.filter(
|
||||||
(selectedBitstreamFormats) => selectedBitstreamFormats !== (action as BitstreamFormatsRegistryDeselectAction).bitstreamFormat
|
(selectedBitstreamFormats) => selectedBitstreamFormats !== (action as BitstreamFormatsRegistryDeselectAction).bitstreamFormat,
|
||||||
)
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
case BitstreamFormatsRegistryActionTypes.DESELECT_ALL_FORMAT: {
|
case BitstreamFormatsRegistryActionTypes.DESELECT_ALL_FORMAT: {
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
selectedBitstreamFormats: []
|
selectedBitstreamFormats: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { I18nBreadcrumbResolver } from '../../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
|
import { AddBitstreamFormatComponent } from './add-bitstream-format/add-bitstream-format.component';
|
||||||
|
import { BitstreamFormatsComponent } from './bitstream-formats.component';
|
||||||
import { BitstreamFormatsResolver } from './bitstream-formats.resolver';
|
import { BitstreamFormatsResolver } from './bitstream-formats.resolver';
|
||||||
import { EditBitstreamFormatComponent } from './edit-bitstream-format/edit-bitstream-format.component';
|
import { EditBitstreamFormatComponent } from './edit-bitstream-format/edit-bitstream-format.component';
|
||||||
import { BitstreamFormatsComponent } from './bitstream-formats.component';
|
|
||||||
import { AddBitstreamFormatComponent } from './add-bitstream-format/add-bitstream-format.component';
|
|
||||||
import { I18nBreadcrumbResolver } from '../../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
|
||||||
|
|
||||||
const BITSTREAMFORMAT_EDIT_PATH = ':id/edit';
|
const BITSTREAMFORMAT_EDIT_PATH = ':id/edit';
|
||||||
const BITSTREAMFORMAT_ADD_PATH = 'add';
|
const BITSTREAMFORMAT_ADD_PATH = 'add';
|
||||||
@@ -14,28 +15,28 @@ const BITSTREAMFORMAT_ADD_PATH = 'add';
|
|||||||
RouterModule.forChild([
|
RouterModule.forChild([
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: BitstreamFormatsComponent
|
component: BitstreamFormatsComponent,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: BITSTREAMFORMAT_ADD_PATH,
|
path: BITSTREAMFORMAT_ADD_PATH,
|
||||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||||
component: AddBitstreamFormatComponent,
|
component: AddBitstreamFormatComponent,
|
||||||
data: {breadcrumbKey: 'admin.registries.bitstream-formats.create'}
|
data: { breadcrumbKey: 'admin.registries.bitstream-formats.create' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: BITSTREAMFORMAT_EDIT_PATH,
|
path: BITSTREAMFORMAT_EDIT_PATH,
|
||||||
component: EditBitstreamFormatComponent,
|
component: EditBitstreamFormatComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
bitstreamFormat: BitstreamFormatsResolver,
|
bitstreamFormat: BitstreamFormatsResolver,
|
||||||
breadcrumb: I18nBreadcrumbResolver
|
breadcrumb: I18nBreadcrumbResolver,
|
||||||
},
|
},
|
||||||
data: {breadcrumbKey: 'admin.registries.bitstream-formats.edit'}
|
data: { breadcrumbKey: 'admin.registries.bitstream-formats.edit' },
|
||||||
},
|
},
|
||||||
])
|
]),
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
BitstreamFormatsResolver,
|
BitstreamFormatsResolver,
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
export class BitstreamFormatsRoutingModule {
|
export class BitstreamFormatsRoutingModule {
|
||||||
|
|
||||||
|
@@ -47,7 +47,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</ds-pagination>
|
</ds-pagination>
|
||||||
<div *ngIf="(bitstreamFormats | async)?.payload?.totalElements == 0" class="alert alert-info" role="alert">
|
<div *ngIf="(bitstreamFormats | async)?.payload?.totalElements === 0" class="alert alert-info" role="alert">
|
||||||
{{'admin.registries.bitstream-formats.no-items' | translate}}
|
{{'admin.registries.bitstream-formats.no-items' | translate}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -1,31 +1,40 @@
|
|||||||
import { BitstreamFormatsComponent } from './bitstream-formats.component';
|
|
||||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
||||||
import { of as observableOf } from 'rxjs';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import {
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
ComponentFixture,
|
||||||
|
TestBed,
|
||||||
|
waitForAsync,
|
||||||
|
} from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { EnumKeysPipe } from '../../../shared/utils/enum-keys-pipe';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { HostWindowService } from '../../../shared/host-window.service';
|
import {
|
||||||
import { HostWindowServiceStub } from '../../../shared/testing/host-window-service.stub';
|
cold,
|
||||||
|
getTestScheduler,
|
||||||
|
hot,
|
||||||
|
} from 'jasmine-marbles';
|
||||||
|
import { of as observableOf } from 'rxjs';
|
||||||
|
import { TestScheduler } from 'rxjs/testing';
|
||||||
|
|
||||||
import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service';
|
import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
|
||||||
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
||||||
import { BitstreamFormatSupportLevel } from '../../../core/shared/bitstream-format-support-level';
|
import { BitstreamFormatSupportLevel } from '../../../core/shared/bitstream-format-support-level';
|
||||||
import { cold, getTestScheduler, hot } from 'jasmine-marbles';
|
import { HostWindowService } from '../../../shared/host-window.service';
|
||||||
import { TestScheduler } from 'rxjs/testing';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
import {
|
import {
|
||||||
|
createFailedRemoteDataObject$,
|
||||||
createNoContentRemoteDataObject$,
|
createNoContentRemoteDataObject$,
|
||||||
createSuccessfulRemoteDataObject,
|
createSuccessfulRemoteDataObject,
|
||||||
createSuccessfulRemoteDataObject$,
|
createSuccessfulRemoteDataObject$,
|
||||||
createFailedRemoteDataObject$
|
|
||||||
} from '../../../shared/remote-data.utils';
|
} from '../../../shared/remote-data.utils';
|
||||||
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
import { HostWindowServiceStub } from '../../../shared/testing/host-window-service.stub';
|
||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||||
|
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
||||||
|
import { EnumKeysPipe } from '../../../shared/utils/enum-keys-pipe';
|
||||||
|
import { BitstreamFormatsComponent } from './bitstream-formats.component';
|
||||||
|
|
||||||
describe('BitstreamFormatsComponent', () => {
|
describe('BitstreamFormatsComponent', () => {
|
||||||
let comp: BitstreamFormatsComponent;
|
let comp: BitstreamFormatsComponent;
|
||||||
@@ -79,7 +88,7 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
bitstreamFormat1,
|
bitstreamFormat1,
|
||||||
bitstreamFormat2,
|
bitstreamFormat2,
|
||||||
bitstreamFormat3,
|
bitstreamFormat3,
|
||||||
bitstreamFormat4
|
bitstreamFormat4,
|
||||||
];
|
];
|
||||||
const mockFormatsRD = createSuccessfulRemoteDataObject(createPaginatedList(mockFormatsList));
|
const mockFormatsRD = createSuccessfulRemoteDataObject(createPaginatedList(mockFormatsList));
|
||||||
|
|
||||||
@@ -96,7 +105,7 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
deselectBitstreamFormat: {},
|
deselectBitstreamFormat: {},
|
||||||
deselectAllBitstreamFormats: {},
|
deselectAllBitstreamFormats: {},
|
||||||
delete: createSuccessfulRemoteDataObject$({}),
|
delete: createSuccessfulRemoteDataObject$({}),
|
||||||
clearBitStreamFormatRequests: observableOf('cleared')
|
clearBitStreamFormatRequests: observableOf('cleared'),
|
||||||
});
|
});
|
||||||
|
|
||||||
paginationService = new PaginationServiceStub();
|
paginationService = new PaginationServiceStub();
|
||||||
@@ -108,8 +117,8 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
||||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||||
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
||||||
{ provide: PaginationService, useValue: paginationService }
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
]
|
],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -224,7 +233,7 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
deselectBitstreamFormat: {},
|
deselectBitstreamFormat: {},
|
||||||
deselectAllBitstreamFormats: {},
|
deselectAllBitstreamFormats: {},
|
||||||
delete: createNoContentRemoteDataObject$(),
|
delete: createNoContentRemoteDataObject$(),
|
||||||
clearBitStreamFormatRequests: observableOf('cleared')
|
clearBitStreamFormatRequests: observableOf('cleared'),
|
||||||
});
|
});
|
||||||
|
|
||||||
paginationService = new PaginationServiceStub();
|
paginationService = new PaginationServiceStub();
|
||||||
@@ -236,10 +245,10 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
||||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||||
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
||||||
{ provide: PaginationService, useValue: paginationService }
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
]
|
],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}
|
},
|
||||||
));
|
));
|
||||||
|
|
||||||
beforeEach(initBeforeEach);
|
beforeEach(initBeforeEach);
|
||||||
@@ -273,7 +282,7 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
deselectBitstreamFormat: {},
|
deselectBitstreamFormat: {},
|
||||||
deselectAllBitstreamFormats: {},
|
deselectAllBitstreamFormats: {},
|
||||||
delete: createFailedRemoteDataObject$(),
|
delete: createFailedRemoteDataObject$(),
|
||||||
clearBitStreamFormatRequests: observableOf('cleared')
|
clearBitStreamFormatRequests: observableOf('cleared'),
|
||||||
});
|
});
|
||||||
|
|
||||||
paginationService = new PaginationServiceStub();
|
paginationService = new PaginationServiceStub();
|
||||||
@@ -285,10 +294,10 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
||||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||||
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
||||||
{ provide: PaginationService, useValue: paginationService }
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
]
|
],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}
|
},
|
||||||
));
|
));
|
||||||
|
|
||||||
beforeEach(initBeforeEach);
|
beforeEach(initBeforeEach);
|
||||||
|
@@ -1,25 +1,39 @@
|
|||||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
import {
|
||||||
import { combineLatest as observableCombineLatest, Observable} from 'rxjs';
|
Component,
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
OnDestroy,
|
||||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
OnInit,
|
||||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
} from '@angular/core';
|
||||||
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
|
||||||
import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service';
|
|
||||||
import { map, mergeMap, switchMap, take, toArray } from 'rxjs/operators';
|
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { NoContent } from '../../../core/shared/NoContent.model';
|
import {
|
||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
combineLatest as observableCombineLatest,
|
||||||
|
Observable,
|
||||||
|
} from 'rxjs';
|
||||||
|
import {
|
||||||
|
map,
|
||||||
|
mergeMap,
|
||||||
|
switchMap,
|
||||||
|
take,
|
||||||
|
toArray,
|
||||||
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service';
|
||||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||||
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
|
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
||||||
|
import { NoContent } from '../../../core/shared/NoContent.model';
|
||||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||||
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders a list of bitstream formats
|
* This component renders a list of bitstream formats
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-bitstream-formats',
|
selector: 'ds-bitstream-formats',
|
||||||
templateUrl: './bitstream-formats.component.html'
|
templateUrl: './bitstream-formats.component.html',
|
||||||
})
|
})
|
||||||
export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
@@ -35,7 +49,7 @@ export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
|||||||
pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'rbp',
|
id: 'rbp',
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
pageSizeOptions: [20, 40, 60, 80, 100]
|
pageSizeOptions: [20, 40, 60, 80, 100],
|
||||||
});
|
});
|
||||||
|
|
||||||
constructor(private notificationsService: NotificationsService,
|
constructor(private notificationsService: NotificationsService,
|
||||||
@@ -64,7 +78,7 @@ export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
|||||||
map((response: RemoteData<NoContent>) => response.hasSucceeded),
|
map((response: RemoteData<NoContent>) => response.hasSucceeded),
|
||||||
)),
|
)),
|
||||||
// wait for all responses to come in and return them as a single array
|
// wait for all responses to come in and return them as a single array
|
||||||
toArray()
|
toArray(),
|
||||||
).subscribe((results: boolean[]) => {
|
).subscribe((results: boolean[]) => {
|
||||||
// Count the number of succeeded and failed deletions
|
// Count the number of succeeded and failed deletions
|
||||||
const successResponses = results.filter((result: boolean) => result);
|
const successResponses = results.filter((result: boolean) => result);
|
||||||
@@ -101,7 +115,7 @@ export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
|||||||
return this.bitstreamFormatService.getSelectedBitstreamFormats().pipe(
|
return this.bitstreamFormatService.getSelectedBitstreamFormats().pipe(
|
||||||
map((bitstreamFormats: BitstreamFormat[]) => {
|
map((bitstreamFormats: BitstreamFormat[]) => {
|
||||||
return bitstreamFormats.find((selectedFormat) => selectedFormat.id === bitstreamFormat.id) != null;
|
return bitstreamFormats.find((selectedFormat) => selectedFormat.id === bitstreamFormat.id) != null;
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +141,7 @@ export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
const messages = observableCombineLatest(
|
const messages = observableCombineLatest(
|
||||||
this.translateService.get(`${prefix}.${suffix}.head`),
|
this.translateService.get(`${prefix}.${suffix}.head`),
|
||||||
this.translateService.get(`${prefix}.${suffix}.amount`, {amount: amount})
|
this.translateService.get(`${prefix}.${suffix}.amount`, { amount: amount }),
|
||||||
);
|
);
|
||||||
messages.subscribe(([head, content]) => {
|
messages.subscribe(([head, content]) => {
|
||||||
|
|
||||||
@@ -144,7 +158,7 @@ export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
|||||||
this.bitstreamFormats = this.paginationService.getFindListOptions(this.pageConfig.id, this.pageConfig).pipe(
|
this.bitstreamFormats = this.paginationService.getFindListOptions(this.pageConfig.id, this.pageConfig).pipe(
|
||||||
switchMap((findListOptions: FindListOptions) => {
|
switchMap((findListOptions: FindListOptions) => {
|
||||||
return this.bitstreamFormatService.findAll(findListOptions);
|
return this.bitstreamFormatService.findAll(findListOptions);
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { BitstreamFormatsComponent } from './bitstream-formats.component';
|
|
||||||
import { SharedModule } from '../../../shared/shared.module';
|
|
||||||
import { FormatFormComponent } from './format-form/format-form.component';
|
|
||||||
import { EditBitstreamFormatComponent } from './edit-bitstream-format/edit-bitstream-format.component';
|
|
||||||
import { BitstreamFormatsRoutingModule } from './bitstream-formats-routing.module';
|
|
||||||
import { AddBitstreamFormatComponent } from './add-bitstream-format/add-bitstream-format.component';
|
|
||||||
import { FormModule } from '../../../shared/form/form.module';
|
import { FormModule } from '../../../shared/form/form.module';
|
||||||
|
import { SharedModule } from '../../../shared/shared.module';
|
||||||
|
import { AddBitstreamFormatComponent } from './add-bitstream-format/add-bitstream-format.component';
|
||||||
|
import { BitstreamFormatsComponent } from './bitstream-formats.component';
|
||||||
|
import { BitstreamFormatsRoutingModule } from './bitstream-formats-routing.module';
|
||||||
|
import { EditBitstreamFormatComponent } from './edit-bitstream-format/edit-bitstream-format.component';
|
||||||
|
import { FormatFormComponent } from './format-form/format-form.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -15,14 +16,14 @@ import { FormModule } from '../../../shared/form/form.module';
|
|||||||
SharedModule,
|
SharedModule,
|
||||||
RouterModule,
|
RouterModule,
|
||||||
BitstreamFormatsRoutingModule,
|
BitstreamFormatsRoutingModule,
|
||||||
FormModule
|
FormModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
BitstreamFormatsComponent,
|
BitstreamFormatsComponent,
|
||||||
EditBitstreamFormatComponent,
|
EditBitstreamFormatComponent,
|
||||||
AddBitstreamFormatComponent,
|
AddBitstreamFormatComponent,
|
||||||
FormatFormComponent
|
FormatFormComponent,
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
export class BitstreamFormatsModule {
|
export class BitstreamFormatsModule {
|
||||||
|
|
||||||
|
@@ -1,9 +1,14 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
|
import {
|
||||||
|
ActivatedRouteSnapshot,
|
||||||
|
Resolve,
|
||||||
|
RouterStateSnapshot,
|
||||||
|
} from '@angular/router';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
||||||
import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service';
|
|
||||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,7 +29,7 @@ export class BitstreamFormatsResolver implements Resolve<RemoteData<BitstreamFor
|
|||||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<BitstreamFormat>> {
|
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<BitstreamFormat>> {
|
||||||
return this.bitstreamFormatDataService.findById(route.params.id)
|
return this.bitstreamFormatDataService.findById(route.params.id)
|
||||||
.pipe(
|
.pipe(
|
||||||
getFirstCompletedRemoteData()
|
getFirstCompletedRemoteData(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,24 +1,32 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
import {
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
ComponentFixture,
|
||||||
|
TestBed,
|
||||||
|
waitForAsync,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
ActivatedRoute,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
|
|
||||||
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level';
|
|
||||||
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
||||||
|
import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
|
||||||
import { RouterStub } from '../../../../shared/testing/router.stub';
|
|
||||||
import { EditBitstreamFormatComponent } from './edit-bitstream-format.component';
|
|
||||||
import {
|
import {
|
||||||
createFailedRemoteDataObject$,
|
createFailedRemoteDataObject$,
|
||||||
createSuccessfulRemoteDataObject,
|
createSuccessfulRemoteDataObject,
|
||||||
createSuccessfulRemoteDataObject$
|
createSuccessfulRemoteDataObject$,
|
||||||
} from '../../../../shared/remote-data.utils';
|
} from '../../../../shared/remote-data.utils';
|
||||||
|
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
||||||
|
import { RouterStub } from '../../../../shared/testing/router.stub';
|
||||||
|
import { EditBitstreamFormatComponent } from './edit-bitstream-format.component';
|
||||||
|
|
||||||
describe('EditBitstreamFormatComponent', () => {
|
describe('EditBitstreamFormatComponent', () => {
|
||||||
let comp: EditBitstreamFormatComponent;
|
let comp: EditBitstreamFormatComponent;
|
||||||
@@ -36,8 +44,8 @@ describe('EditBitstreamFormatComponent', () => {
|
|||||||
|
|
||||||
const routeStub = {
|
const routeStub = {
|
||||||
data: observableOf({
|
data: observableOf({
|
||||||
bitstreamFormat: createSuccessfulRemoteDataObject(bitstreamFormat)
|
bitstreamFormat: createSuccessfulRemoteDataObject(bitstreamFormat),
|
||||||
})
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
let router;
|
let router;
|
||||||
@@ -48,7 +56,7 @@ describe('EditBitstreamFormatComponent', () => {
|
|||||||
router = new RouterStub();
|
router = new RouterStub();
|
||||||
notificationService = new NotificationsServiceStub();
|
notificationService = new NotificationsServiceStub();
|
||||||
bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', {
|
bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', {
|
||||||
updateBitstreamFormat: createSuccessfulRemoteDataObject$({})
|
updateBitstreamFormat: createSuccessfulRemoteDataObject$({}),
|
||||||
});
|
});
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -60,7 +68,7 @@ describe('EditBitstreamFormatComponent', () => {
|
|||||||
{ provide: NotificationsService, useValue: notificationService },
|
{ provide: NotificationsService, useValue: notificationService },
|
||||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
||||||
],
|
],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -99,7 +107,7 @@ describe('EditBitstreamFormatComponent', () => {
|
|||||||
router = new RouterStub();
|
router = new RouterStub();
|
||||||
notificationService = new NotificationsServiceStub();
|
notificationService = new NotificationsServiceStub();
|
||||||
bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', {
|
bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', {
|
||||||
updateBitstreamFormat: createFailedRemoteDataObject$('Error', 500)
|
updateBitstreamFormat: createFailedRemoteDataObject$('Error', 500),
|
||||||
});
|
});
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -111,7 +119,7 @@ describe('EditBitstreamFormatComponent', () => {
|
|||||||
{ provide: NotificationsService, useValue: notificationService },
|
{ provide: NotificationsService, useValue: notificationService },
|
||||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
||||||
],
|
],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
beforeEach(initBeforeEach);
|
beforeEach(initBeforeEach);
|
||||||
|
@@ -1,14 +1,21 @@
|
|||||||
import { map } from 'rxjs/operators';
|
import {
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
Component,
|
||||||
|
OnInit,
|
||||||
|
} from '@angular/core';
|
||||||
|
import {
|
||||||
|
ActivatedRoute,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
||||||
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
|
||||||
import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths';
|
|
||||||
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
||||||
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
|
import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders the edit page of a bitstream format.
|
* This component renders the edit page of a bitstream format.
|
||||||
@@ -36,7 +43,7 @@ export class EditBitstreamFormatComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.bitstreamFormatRD$ = this.route.data.pipe(
|
this.bitstreamFormatRD$ = this.route.data.pipe(
|
||||||
map((data) => data.bitstreamFormat as RemoteData<BitstreamFormat>)
|
map((data) => data.bitstreamFormat as RemoteData<BitstreamFormat>),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +64,7 @@ export class EditBitstreamFormatComponent implements OnInit {
|
|||||||
this.notificationService.error('admin.registries.bitstream-formats.edit.failure.head',
|
this.notificationService.error('admin.registries.bitstream-formats.edit.failure.head',
|
||||||
'admin.registries.bitstream-formats.create.edit.content');
|
'admin.registries.bitstream-formats.create.edit.content');
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,17 +1,29 @@
|
|||||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import {
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
ComponentFixture,
|
||||||
import { RouterStub } from '../../../../shared/testing/router.stub';
|
TestBed,
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
waitForAsync,
|
||||||
|
} from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
} from '@angular/forms';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { FormatFormComponent } from './format-form.component';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import {
|
||||||
|
DynamicCheckboxModel,
|
||||||
|
DynamicFormArrayModel,
|
||||||
|
DynamicInputModel,
|
||||||
|
} from '@ng-dynamic-forms/core';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
||||||
import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level';
|
import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level';
|
||||||
import { DynamicCheckboxModel, DynamicFormArrayModel, DynamicInputModel } from '@ng-dynamic-forms/core';
|
|
||||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
||||||
import { isEmpty } from '../../../../shared/empty.util';
|
import { isEmpty } from '../../../../shared/empty.util';
|
||||||
|
import { RouterStub } from '../../../../shared/testing/router.stub';
|
||||||
|
import { FormatFormComponent } from './format-form.component';
|
||||||
|
|
||||||
describe('FormatFormComponent', () => {
|
describe('FormatFormComponent', () => {
|
||||||
let comp: FormatFormComponent;
|
let comp: FormatFormComponent;
|
||||||
@@ -45,7 +57,7 @@ describe('FormatFormComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: Router, useValue: router },
|
{ provide: Router, useValue: router },
|
||||||
],
|
],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user