Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coar Notify Integration - Administer/Log #2751

Merged
merged 120 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
e1cda4f
prepare dashboard config
FrancescoMolinaro Dec 21, 2023
7445591
add route, renaming
FrancescoMolinaro Dec 21, 2023
604fb4f
add components, refactor sidebar section, add config
FrancescoMolinaro Dec 22, 2023
5d8ba54
add new component, add mock, refactor
FrancescoMolinaro Dec 22, 2023
e39e034
update config and integrate rest
FrancescoMolinaro Dec 28, 2023
fec6550
finalize config and mapping
FrancescoMolinaro Dec 29, 2023
01a4157
fix lint, fix aggregate count, add translations
FrancescoMolinaro Dec 29, 2023
a43cb35
fix lint
FrancescoMolinaro Dec 29, 2023
6a41dce
fix tests
FrancescoMolinaro Dec 29, 2023
055cc50
reduce inner space
FrancescoMolinaro Dec 29, 2023
cd4b6a4
refactor, align config with rest
FrancescoMolinaro Dec 29, 2023
664dd85
fix lint
FrancescoMolinaro Dec 29, 2023
7d3dbc3
add validation message
FrancescoMolinaro Jan 2, 2024
3616e66
refactor fn name
FrancescoMolinaro Jan 2, 2024
c4b8eab
add base config
FrancescoMolinaro Jan 2, 2024
457c3b3
refactor, decouple pagination and configuration
FrancescoMolinaro Jan 3, 2024
d72f522
add header translations
FrancescoMolinaro Jan 3, 2024
9617329
add new dependencies for facets filters isolation
FrancescoMolinaro Jan 4, 2024
9386536
fix lint
FrancescoMolinaro Jan 4, 2024
de8c0c9
add tabulatable loader and related configuration
FrancescoMolinaro Jan 4, 2024
b8e353d
add tabulatable loader missing files
FrancescoMolinaro Jan 4, 2024
566c8b3
remove log
FrancescoMolinaro Jan 4, 2024
c434c06
refactor, fix lint
FrancescoMolinaro Jan 4, 2024
6254efa
add modal, refine table,refactor, fix lint
FrancescoMolinaro Jan 5, 2024
4292c01
clean up
FrancescoMolinaro Jan 5, 2024
e9159ce
fix lint
FrancescoMolinaro Jan 5, 2024
af3bfee
fix test dependencies
FrancescoMolinaro Jan 5, 2024
7185c55
fix test dependencies, move components in two tabs
FrancescoMolinaro Jan 5, 2024
4d30bc7
separate results, config routes, add data mapping, add service
FrancescoMolinaro Jan 8, 2024
c57ad8e
refactor, add detail mapping, add missing translation, optimize modal
FrancescoMolinaro Jan 8, 2024
c20d798
clean up, fix tests, add missing translations
FrancescoMolinaro Jan 8, 2024
937abc0
clean up
FrancescoMolinaro Jan 8, 2024
7ce0bd0
remove unused method
FrancescoMolinaro Jan 8, 2024
7289118
clean up
FrancescoMolinaro Jan 9, 2024
e04c3e6
add check on device width for columns rendering
FrancescoMolinaro Jan 9, 2024
f9474d4
remove mobile adaption, adapt reprocess
FrancescoMolinaro Jan 9, 2024
b6245d3
improve responsivness
FrancescoMolinaro Jan 9, 2024
7719626
add link, rename tabs, small refactor
FrancescoMolinaro Jan 9, 2024
eb8a820
rename tab metrics
FrancescoMolinaro Jan 9, 2024
9332a33
add tests
FrancescoMolinaro Jan 10, 2024
34ceced
refactor test, change type in table
FrancescoMolinaro Jan 11, 2024
441170d
refactor, add date formatting
FrancescoMolinaro Jan 11, 2024
a370b14
fix lint
FrancescoMolinaro Jan 11, 2024
75fb527
refactor translations mapping
FrancescoMolinaro Jan 11, 2024
6079e58
add missing translations handler
FrancescoMolinaro Jan 11, 2024
5202757
update translations
FrancescoMolinaro Jan 11, 2024
7640dac
update translations
FrancescoMolinaro Jan 11, 2024
a6da490
Merged in CST-10642-notify-logs (pull request #1183)
FrancescoMolinaro Jan 11, 2024
f6557fe
Merged in CST-13091-missing-validation-message (pull request #1173)
FrancescoMolinaro Jan 11, 2024
70aeed6
Merged in CST-12766-UI-adaption (pull request #1151)
FrancescoMolinaro Jan 11, 2024
a03b7e4
Merge branch 'coar-notify-7' into coar-notify-7-part-two
steph-ieffam Jan 12, 2024
1693d49
fix SSR issue for notify dashboard
FrancescoMolinaro Jan 12, 2024
dbf4233
fix missing label in modal, add search-labels, fix reprocess message
FrancescoMolinaro Jan 12, 2024
46eaa58
[CST-13053] added missing breadcrumbs for new filter
steph-ieffam Jan 12, 2024
df0cdc3
Merge remote-tracking branch 'origin/coar-notify-7-part-two' into coa…
steph-ieffam Jan 12, 2024
61a05df
add navigation with new config, add custom filter
FrancescoMolinaro Jan 12, 2024
93777b9
fix lint
FrancescoMolinaro Jan 12, 2024
f4c2b0b
implement items clickable, fix minor issues, add filters
FrancescoMolinaro Jan 15, 2024
8e11047
Merge branch 'coar-notify-7-part-two' into CST-13262-clickable-notify…
FrancescoMolinaro Jan 15, 2024
ec9797a
add message detail and translations
FrancescoMolinaro Jan 15, 2024
6a1871b
rename param
FrancescoMolinaro Jan 15, 2024
b34c2ec
Merged in CST-13262-clickable-notify-boxes (pull request #1214)
FrancescoMolinaro Jan 15, 2024
1fdd152
fix tests
FrancescoMolinaro Jan 15, 2024
ba8345c
Merge branch 'coar-notify-7-part-two' into CST-13053-logs-detail-message
FrancescoMolinaro Jan 15, 2024
57861a1
fix tests, small refactor, add translations
FrancescoMolinaro Jan 15, 2024
8726fcc
Merged in CST-13053-logs-detail-message (pull request #1217)
FrancescoMolinaro Jan 15, 2024
a183b0a
add content fallback and truncate text
FrancescoMolinaro Jan 15, 2024
8941119
Merge branch 'coar-notify-7' into coar-notify-7-part-two
FrancescoMolinaro Jan 15, 2024
67d8230
fix merge conflicts
FrancescoMolinaro Jan 15, 2024
9db4d9d
fix lint
FrancescoMolinaro Jan 15, 2024
02a289e
Merge branch 'coar-notify-7-part-two' into CST-13289-notify-ui-improv…
FrancescoMolinaro Jan 16, 2024
91706bf
minor UI improvements, adapt notifications menu section, change trans…
FrancescoMolinaro Jan 16, 2024
fc4b954
CST-10644 administrative search facets
frabacche Jan 17, 2024
aa825af
Merge branch 'coar-notify-7-part-two' of bitbucket.org:4Science/dspac…
frabacche Jan 17, 2024
6069eae
Merged in CST-13289-notify-ui-improvements (pull request #1222)
FrancescoMolinaro Jan 17, 2024
9e9b4ca
Merge branch 'coar-notify-7' into coar-notify-7-part-two
steph-ieffam Jan 17, 2024
1a65b56
configure menu section, reprocess button condition
FrancescoMolinaro Jan 17, 2024
b870d53
add dashboard description
FrancescoMolinaro Jan 17, 2024
f6851fa
finalize UI improvements
FrancescoMolinaro Jan 17, 2024
a1ad620
[CST-13316] added missing labels and fixed typo
steph-ieffam Jan 18, 2024
abfdaa0
Merge remote-tracking branch 'origin/CST-13316-improvments-part-two' …
steph-ieffam Jan 18, 2024
f83d75f
Merge branch 'coar-notify-7' into coar-notify-7-part-two
FrancescoMolinaro Jan 18, 2024
c2f44c3
resolve conflict on missing IpV4Validator
FrancescoMolinaro Jan 18, 2024
532e529
resolve conflict on missing IpV4Validator
FrancescoMolinaro Jan 18, 2024
5dcd52d
fix tests
FrancescoMolinaro Jan 18, 2024
1600bd5
add tests
FrancescoMolinaro Jan 19, 2024
d497689
add role to not semantic tag with aria-label (span)
FrancescoMolinaro Jan 19, 2024
b77aa2d
add tests
FrancescoMolinaro Jan 20, 2024
e4eb8b5
add tests
FrancescoMolinaro Jan 20, 2024
0caacd9
small clean up
FrancescoMolinaro Jan 25, 2024
9056e98
fix issue with breadcrumb
FrancescoMolinaro Jan 26, 2024
a27e55e
Merged in CST-13383-breadcrumb-bug (pull request #1277)
FrancescoMolinaro Jan 26, 2024
9b04507
CST-13397 - fine tune UI
FrancescoMolinaro Jan 26, 2024
4ff0c79
Merged in CST-13397-ui-fine-tuning-part-2 (pull request #1282)
FrancescoMolinaro Jan 26, 2024
8d49fe6
Merge remote-tracking branch 'origin/coar-notify-7' into coar-notify-…
steph-ieffam Jan 26, 2024
2f943bb
fix ssr issue
FrancescoMolinaro Jan 26, 2024
7b42d41
Merged in CST-13397-fix-ssr-issue (pull request #1285)
FrancescoMolinaro Jan 29, 2024
47e6bc8
[CST-13444] configured label for date facet for LDN Message Entity
steph-ieffam Jan 30, 2024
c2a2992
CST-13526 update status mapping
FrancescoMolinaro Feb 5, 2024
020103f
Merge branch 'coar-notify-7-part-two' into CST-13526-untrusted-ip-map…
FrancescoMolinaro Feb 5, 2024
47c3d3c
CST-13526 update filter label
FrancescoMolinaro Feb 5, 2024
824cdfa
Merged in CST-13526-untrusted-ip-mapping (pull request #1312)
FrancescoMolinaro Feb 14, 2024
eab0791
Merge branch 'coar-notify-7' into coar-notify-7-part-two
FrancescoMolinaro Feb 29, 2024
0a3f884
Resolve conflicts after merge of part 1
FrancescoMolinaro Feb 29, 2024
4fcb660
fix lint, fix tests
FrancescoMolinaro Feb 29, 2024
1f463f7
Merge branch 'main' into coar-notify-7-part-two
FrancescoMolinaro Mar 1, 2024
b94167a
resolve issue #2842
FrancescoMolinaro Mar 1, 2024
c00134f
coar-notify-7 item submission coar section send patch remove on blank…
frabacche Mar 1, 2024
0e4b220
Merge pull request #77 from 4Science/coar-notify-7-part-two-submissio…
frabacche Mar 1, 2024
4fdade8
ldn message: move enqueueretry from get to post
frabacche Mar 4, 2024
c27e758
Add components descriptions, fix bug on navigation, align labels, add…
FrancescoMolinaro Mar 4, 2024
f925273
fix menu resolver condition for LDN
FrancescoMolinaro Mar 4, 2024
38ac31e
add route guard
FrancescoMolinaro Mar 4, 2024
23cb4ca
Add components descriptions, fix bug on navigation, align labels, add…
FrancescoMolinaro Mar 4, 2024
a79c403
fix menu resolver condition for LDN
FrancescoMolinaro Mar 4, 2024
c03ab07
add route guard
FrancescoMolinaro Mar 4, 2024
fd1483d
restyle header
FrancescoMolinaro Mar 4, 2024
1fd16a2
Merge remote-tracking branch 'origin/coar-notify-7-part-two' into coa…
FrancescoMolinaro Mar 4, 2024
add1257
Merge pull request #78 from 4Science/coar-notify-7-part-two-refactor-…
frabacche Mar 4, 2024
0f7965e
Merge remote-tracking branch 'github/main' into coar-notify-7-part-two
frabacche Mar 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 59 additions & 1 deletion config/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,67 @@ comcolSelectionSort:


# Search settings
search:
search:
# Settings to enable/disable or configure advanced search filters.
advancedFilters:
enabled: false
# List of filters to enable in "Advanced Search" dropdown
filter: [ 'title', 'author', 'subject', 'entityType' ]


# Notify metrics
# Configuration for Notify Admin Dashboard for metrics visualization
notifyMetrics:
# Configuration for received messages
- title: 'admin-notify-dashboard.received-ldn'
boxes:
- color: '#B8DAFF'
title: 'admin-notify-dashboard.NOTIFY.incoming.accepted'
config: 'NOTIFY.incoming.accepted'
description: 'admin-notify-dashboard.NOTIFY.incoming.accepted.description'
- color: '#D4EDDA'
title: 'admin-notify-dashboard.NOTIFY.incoming.processed'
config: 'NOTIFY.incoming.processed'
description: 'admin-notify-dashboard.NOTIFY.incoming.processed.description'
- color: '#FDBBC7'
title: 'admin-notify-dashboard.NOTIFY.incoming.failure'
config: 'NOTIFY.incoming.failure'
description: 'admin-notify-dashboard.NOTIFY.incoming.failure.description'
- color: '#FDBBC7'
title: 'admin-notify-dashboard.NOTIFY.incoming.untrusted'
config: 'NOTIFY.incoming.untrusted'
description: 'admin-notify-dashboard.NOTIFY.incoming.untrusted.description'
- color: '#43515F'
title: 'admin-notify-dashboard.NOTIFY.incoming.involvedItems'
textColor: '#fff'
config: 'NOTIFY.incoming.involvedItems'
description: 'admin-notify-dashboard.NOTIFY.incoming.involvedItems.description'
# Configuration for outgoing messages
- title: 'admin-notify-dashboard.generated-ldn'
boxes:
- color: '#B8DAFF'
title: 'admin-notify-dashboard.NOTIFY.outgoing.queued'
config: 'NOTIFY.outgoing.queued'
description: 'admin-notify-dashboard.NOTIFY.outgoing.queued.description'
- color: '#FDEEBB'
title: 'admin-notify-dashboard.NOTIFY.outgoing.queued_for_retry'
config: 'NOTIFY.outgoing.queued_for_retry'
description: 'admin-notify-dashboard.NOTIFY.outgoing.queued_for_retry.description'
- color: '#FDBBC7'
title: 'admin-notify-dashboard.NOTIFY.outgoing.failure'
config: 'NOTIFY.outgoing.failure'
description: 'admin-notify-dashboard.NOTIFY.outgoing.failure.description'
- color: '#43515F'
title: 'admin-notify-dashboard.NOTIFY.outgoing.involvedItems'
textColor: '#fff'
config: 'NOTIFY.outgoing.involvedItems'
description: 'admin-notify-dashboard.NOTIFY.outgoing.involvedItems.description'
- color: '#D4EDDA'
title: 'admin-notify-dashboard.NOTIFY.outgoing.delivered'
config: 'NOTIFY.outgoing.delivered'
description: 'admin-notify-dashboard.NOTIFY.outgoing.delivered.description'





Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ <h1 class="flex-grow-1">{{ isNewService ? ('ldn-create-service.title' | translat
id="ldnUrl"
name="ldnUrl"
type="text">
<div *ngIf="formModel.get('ldnUrl').invalid && formModel.get('ldnUrl').touched" class="error-text">
{{ 'ldn-new-service.form.error.ldnurl' | translate }}
<div *ngIf="formModel.get('ldnUrl').invalid && formModel.get('ldnUrl').touched" >
<div *ngIf="formModel.get('ldnUrl').errors['required']" class="error-text">
{{ 'ldn-new-service.form.error.ldnurl' | translate }}
</div>
<div *ngIf="formModel.get('ldnUrl').errors['ldnUrlAlreadyAssociated']" class="error-text">
{{ 'ldn-new-service.form.error.ldnurl.ldnUrlAlreadyAssociated' | translate }}
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
TemplateRef,
ViewChild
} from '@angular/core';
import {FormArray, FormBuilder, FormGroup, Validators} from '@angular/forms';
import {
FormArray,
FormBuilder,
FormGroup,
Validators
} from '@angular/forms';
import {LDN_SERVICE} from '../ldn-services-model/ldn-service.resource-type';
import {ActivatedRoute, Router} from '@angular/router';
import {LdnServicesService} from '../ldn-services-data/ldn-services-data.service';
Expand Down Expand Up @@ -167,6 +172,9 @@
this.closeModal();
this.sendBack();
} else {
if (!this.formModel.errors) {
this.setLdnUrlError();

Check warning on line 176 in src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts#L176

Added line #L176 was not covered by tests
}
this.notificationService.error(this.translateService.get('ldn-service-notification.created.failure.title'),
this.translateService.get('ldn-service-notification.created.failure.body'));
this.closeModal();
Expand Down Expand Up @@ -405,6 +413,9 @@
this.notificationService.success(this.translateService.get('admin.registries.services-formats.modify.success.head'),
this.translateService.get('admin.registries.services-formats.modify.success.content'));
} else {
if (!this.formModel.errors) {
this.setLdnUrlError();

Check warning on line 417 in src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts#L417

Added line #L417 was not covered by tests
}
this.notificationService.error(this.translateService.get('admin.registries.services-formats.modify.failure.head'),
this.translateService.get('admin.registries.services-formats.modify.failure.content'));
this.closeModal();
Expand Down Expand Up @@ -554,4 +565,14 @@
automatic: '',
});
}


/**
* set ldnUrl error in case of unprocessable entity and provided value
*/
private setLdnUrlError(): void {
const control = this.formModel.controls.ldnUrl;

Check warning on line 574 in src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts#L574

Added line #L574 was not covered by tests
const controlErrors = control.errors || {};
control.setErrors({...controlErrors, ldnUrlAlreadyAssociated: true });

Check warning on line 576 in src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts#L576

Added line #L576 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ describe('LdnServicesService test', () => {

rdbService = jasmine.createSpyObj('rdbService', {
buildSingle: createSuccessfulRemoteDataObject$({}, 500),
buildFromRequestUUID: createSuccessfulRemoteDataObject$({}, 500),
buildList: cold('a', { a: remoteDataMocks.Success })
});

Expand Down Expand Up @@ -111,6 +112,20 @@ describe('LdnServicesService test', () => {
done();
});
});

it('should invoke service', (done) => {
const constraints = [{void: true}];
const files = [new File([],'fileName')];
spyOn(service as any, 'getInvocationFormData');
spyOn(service, 'getBrowseEndpoint').and.returnValue(observableOf('testEndpoint'));
service.invoke('serviceName', 'serviceId', constraints, files).subscribe(result => {
expect((service as any).getInvocationFormData).toHaveBeenCalledWith(constraints, files);
expect(service.getBrowseEndpoint).toHaveBeenCalled();
expect(result).toBeInstanceOf(RemoteData);
done();
});

});
});

});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';
import {ChangeDetectorRef, EventEmitter} from '@angular/core';
import { ChangeDetectorRef, EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core';
import {NotificationsService} from '../../../shared/notifications/notifications.service';
import {NotificationsServiceStub} from '../../../shared/testing/notifications-service.stub';
import {TranslateModule, TranslateService} from '@ngx-translate/core';
Expand All @@ -21,8 +21,6 @@ describe('LdnServicesOverviewComponent', () => {
let ldnServicesService;
let paginationService;
let modalService: NgbModal;
let notificationsService: NotificationsService;
let translateService: TranslateService;

const translateServiceStub = {
get: () => of('translated-text'),
Expand All @@ -33,7 +31,11 @@ describe('LdnServicesOverviewComponent', () => {

beforeEach(async () => {
paginationService = new PaginationServiceStub();
ldnServicesService = jasmine.createSpyObj('LdnServicesService', ['findAll', 'delete', 'patch']);
ldnServicesService = jasmine.createSpyObj('ldnServicesService', {
'findAll': createSuccessfulRemoteDataObject$({}),
'delete': createSuccessfulRemoteDataObject$({}),
'patch': createSuccessfulRemoteDataObject$({}),
});
await TestBed.configureTestingModule({
imports: [TranslateModule.forRoot()],
declarations: [LdnServicesOverviewComponent],
Expand All @@ -50,9 +52,10 @@ describe('LdnServicesOverviewComponent', () => {
}
},
{provide: ChangeDetectorRef, useValue: {}},
{provide: NotificationsService, useValue: NotificationsServiceStub},
{provide: NotificationsService, useValue: new NotificationsServiceStub()},
{provide: TranslateService, useValue: translateServiceStub},
]
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
});

Expand All @@ -62,8 +65,6 @@ describe('LdnServicesOverviewComponent', () => {
ldnServicesService = TestBed.inject(LdnServicesService);
paginationService = TestBed.inject(PaginationService);
modalService = TestBed.inject(NgbModal);
notificationsService = TestBed.inject(NotificationsService);
translateService = TestBed.inject(TranslateService);
component.modalRef = jasmine.createSpyObj({close: null});
component.isProcessingSub = jasmine.createSpyObj({unsubscribe: null});
component.ldnServicesRD$ = of({} as RemoteData<PaginatedList<LdnService>>);
Expand Down Expand Up @@ -141,4 +142,22 @@ describe('LdnServicesOverviewComponent', () => {
expect(deleteSpy).toHaveBeenCalledWith(serviceId);
}));
});

describe('selectServiceToDelete', () => {
it('should set service to delete', fakeAsync(() => {
spyOn(component, 'openDeleteModal');
const serviceId = 123;
component.selectServiceToDelete(serviceId);
expect(component.selectedServiceId).toEqual(serviceId);
expect(component.openDeleteModal).toHaveBeenCalled();
}));
});

describe('toggleStatus', () => {
it('should toggle status', (() => {
component.toggleStatus({enabled: false}, ldnServicesService);
expect(ldnServicesService.patch).toHaveBeenCalled();
}));
});

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
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';

@NgModule({
imports: [
RouterModule.forChild([
{
canActivate: [SiteAdministratorGuard, NotifyInfoGuard],
path: '',
resolve: {
breadcrumb: I18nBreadcrumbResolver,
},
component: AdminNotifyDashboardComponent,
pathMatch: 'full',
data: {
title: 'admin.notify.dashboard.page.title',
breadcrumbKey: 'admin.notify.dashboard',
},
},
{
path: 'inbound',
resolve: {
breadcrumb: I18nBreadcrumbResolver,
},
component: AdminNotifyIncomingComponent,
canActivate: [SiteAdministratorGuard, NotifyInfoGuard],
data: {
title: 'admin.notify.dashboard.page.title',
breadcrumbKey: 'admin.notify.dashboard',
},
},
{
path: 'outbound',
resolve: {
breadcrumb: I18nBreadcrumbResolver,
},
component: AdminNotifyOutgoingComponent,
canActivate: [SiteAdministratorGuard, NotifyInfoGuard],
data: {
title: 'admin.notify.dashboard.page.title',
breadcrumbKey: 'admin.notify.dashboard',
},
}
])
],
})
/**
* Routing module for the Notifications section of the admin sidebar
*/
export class AdminNotifyDashboardRoutingModule {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<div class="container">
<div class="row">
<div class="col-12">
<h1 class="border-bottom pb-2">{{'admin-notify-dashboard.title'| translate}}</h1>
<div class="my-4">{{'admin-notify-dashboard.description' | translate}}</div>
<div>
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active">{{'admin-notify-dashboard.metrics' | translate}}</a>
</li>
<li class="nav-item">
<a class="nav-link" [routerLink]="'inbound'" [queryParams]="{view: 'table'}">{{'admin.notify.dashboard.inbound-logs' | translate}}</a>
</li>
<li class="nav-item">
<a class="nav-link" [routerLink]="'outbound'" [queryParams]="{view: 'table'}">{{'admin.notify.dashboard.outbound-logs' | translate}}</a>
</ul>
<div class="mt-2">
<ds-admin-notify-metrics *ngIf="(notifyMetricsRows$ | async)?.length" [boxesConfig]="notifyMetricsRows$ | async"></ds-admin-notify-metrics>
</div>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
import { TranslateModule } from '@ngx-translate/core';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import { SearchService } from '../../core/shared/search/search.service';
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
import { buildPaginatedList } from '../../core/data/paginated-list.model';
import { AdminNotifySearchResult } from './models/admin-notify-message-search-result.model';
import { AdminNotifyMessage } from './models/admin-notify-message.model';

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

let item1;
let item2;
let item3;
let searchResult1;
let searchResult2;
let searchResult3;
let results;

const mockBoxes = [
{ title: 'admin-notify-dashboard.received-ldn', boxes: [ undefined, undefined, undefined, undefined, undefined ] },
{ title: 'admin-notify-dashboard.generated-ldn', boxes: [ undefined, undefined, undefined, undefined, undefined ] }
];

beforeEach(async () => {
item1 = Object.assign(new AdminNotifyMessage(), { uuid: 'e1c51c69-896d-42dc-8221-1d5f2ad5516e' });
item2 = Object.assign(new AdminNotifyMessage(), { uuid: 'c8279647-1acc-41ae-b036-951d5f65649b' });
item3 = Object.assign(new AdminNotifyMessage(), { uuid: 'c3bcbff5-ec0c-4831-8e4c-94b9c933ccac' });
searchResult1 = Object.assign(new AdminNotifySearchResult(), { indexableObject: item1 });
searchResult2 = Object.assign(new AdminNotifySearchResult(), { indexableObject: item2 });
searchResult3 = Object.assign(new AdminNotifySearchResult(), { indexableObject: item3 });
results = buildPaginatedList(undefined, [searchResult1, searchResult2, searchResult3]);

await TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), NgbNavModule],
declarations: [ AdminNotifyDashboardComponent ],
providers: [{ provide: SearchService, useValue: { search: () => createSuccessfulRemoteDataObject$(results)}}]
})
.compileComponents();

fixture = TestBed.createComponent(AdminNotifyDashboardComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', (done) => {
component.notifyMetricsRows$.subscribe(boxes => {
expect(boxes).toEqual(mockBoxes);
done();
});
expect(component).toBeTruthy();
});
});
Loading
Loading