Skip to content

Commit 6dee25d

Browse files
author
Andrea Barbasso
committed
[CST-2709] fix lint
1 parent 62c5d45 commit 6dee25d

7 files changed

Lines changed: 84 additions & 77 deletions

src/app/app.menus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { buildMenuStructure } from './shared/menu/menu.structure';
99
import { MenuID } from './shared/menu/menu-id.model';
1010
import { MenuRoute } from './shared/menu/menu-route.model';
1111
import { AccessControlMenuProvider } from './shared/menu/providers/access-control.menu';
12+
import { AdminCommunityListMenuProvider } from './shared/menu/providers/admin-community-list.menu';
1213
import { AdminSearchMenuProvider } from './shared/menu/providers/admin-search.menu';
1314
import { CoarNotifyMenuProvider } from './shared/menu/providers/coar-notify.menu';
1415
import { SubscribeMenuProvider } from './shared/menu/providers/comcol-subscribe.menu';
@@ -35,7 +36,6 @@ import { SystemWideAlertMenuProvider } from './shared/menu/providers/system-wide
3536
import { UserAgreementMenuProvider } from './shared/menu/providers/user-agreement.menu';
3637
import { WithdrawnReinstateItemMenuProvider } from './shared/menu/providers/withdrawn-reinstate-item.menu';
3738
import { WorkflowMenuProvider } from './shared/menu/providers/workflow.menu';
38-
import { AdminCommunityListMenuProvider } from './shared/menu/providers/admin-community-list.menu';
3939

4040
/**
4141
* Represents and builds the menu structure for the three available menus (public navbar, admin sidebar and the dso edit

src/app/shared/menu/providers/admin-community-list.menu.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
*/
88

99
import { TestBed } from '@angular/core/testing';
10+
import { of } from 'rxjs';
1011

11-
import { MenuItemType } from '../menu-item-type.model';
12-
import { PartialMenuSection } from '../menu-provider.model';
13-
import { AdminCommunityListMenuProvider } from './admin-community-list.menu';
1412
import { APP_CONFIG } from '../../../../config/app-config.interface';
1513
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
16-
import { of } from 'rxjs';
1714
import { AuthorizationDataServiceStub } from '../../testing/authorization-service.stub';
15+
import { MenuItemType } from '../menu-item-type.model';
16+
import { PartialMenuSection } from '../menu-provider.model';
17+
import { AdminCommunityListMenuProvider } from './admin-community-list.menu';
1818

1919
describe('AdminCommunityListMenuProvider', () => {
2020
const expectedSections: PartialMenuSection[] = [
@@ -41,7 +41,7 @@ describe('AdminCommunityListMenuProvider', () => {
4141
providers: [
4242
AdminCommunityListMenuProvider,
4343
{ provide: APP_CONFIG, useValue: { layout: { navbar: { showCommunityCollection: false } } } },
44-
{ provide: AuthorizationDataService, useValue: authorizationServiceStub }, ],
44+
{ provide: AuthorizationDataService, useValue: authorizationServiceStub } ],
4545
});
4646
provider = TestBed.inject(AdminCommunityListMenuProvider);
4747
});

src/app/shared/menu/providers/admin-community-list.menu.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,24 @@
66
* http://www.dspace.org/license/
77
*/
88

9-
import { inject, Injectable } from '@angular/core';
9+
import {
10+
inject,
11+
Injectable,
12+
} from '@angular/core';
1013
import {
1114
map,
1215
Observable,
1316
of,
1417
} from 'rxjs';
1518

19+
import { APP_CONFIG } from '../../../../config/app-config.interface';
20+
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
21+
import { FeatureID } from '../../../core/data/feature-authorization/feature-id';
1622
import { MenuItemType } from '../menu-item-type.model';
1723
import {
1824
AbstractMenuProvider,
1925
PartialMenuSection,
2026
} from '../menu-provider.model';
21-
import { APP_CONFIG } from '../../../../config/app-config.interface';
22-
import { FeatureID } from '../../../core/data/feature-authorization/feature-id';
23-
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
2427

2528
/**
2629
* Menu provider to create the "Communities & Collections" menu section in the admin navbar

src/app/shared/menu/providers/community-list.menu.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
import { TestBed } from '@angular/core/testing';
1010

11+
import { APP_CONFIG } from '../../../../config/app-config.interface';
1112
import { MenuItemType } from '../menu-item-type.model';
1213
import { PartialMenuSection } from '../menu-provider.model';
1314
import { CommunityListMenuProvider } from './community-list.menu';
14-
import { APP_CONFIG } from '../../../../config/app-config.interface';
1515

1616
describe('CommunityListMenuProvider', () => {
1717
const expectedSections: PartialMenuSection[] = [

src/app/shared/menu/providers/community-list.menu.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,21 @@
66
* http://www.dspace.org/license/
77
*/
88

9-
import { inject, Injectable } from '@angular/core';
9+
import {
10+
inject,
11+
Injectable,
12+
} from '@angular/core';
1013
import {
1114
Observable,
1215
of,
1316
} from 'rxjs';
1417

18+
import { APP_CONFIG } from '../../../../config/app-config.interface';
1519
import { MenuItemType } from '../menu-item-type.model';
1620
import {
1721
AbstractMenuProvider,
1822
PartialMenuSection,
1923
} from '../menu-provider.model';
20-
import { APP_CONFIG } from '../../../../config/app-config.interface';
2124

2225
/**
2326
* Menu provider to create the "Communities & Collections" menu section in the public navbar

src/app/shared/menu/providers/statistics.menu.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { TestBed } from '@angular/core/testing';
2+
import { ActivatedRoute } from '@angular/router';
23
import { TranslateModule } from '@ngx-translate/core';
34
import { of } from 'rxjs';
45

56
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
6-
import { StatisticsMenuProvider } from './statistics.menu';
7-
import { ActivatedRoute } from '@angular/router';
87
import { ActivatedRouteStub } from '../../testing/active-router.stub';
8+
import { StatisticsMenuProvider } from './statistics.menu';
99

1010
describe('StatisticsMenuProvider', () => {
1111
let provider: StatisticsMenuProvider;

src/app/shared/menu/providers/statistics.menu.ts

Lines changed: 63 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,23 @@
77
*/
88

99
import { Injectable } from '@angular/core';
10+
import { ActivatedRoute } from '@angular/router';
1011
import {
1112
combineLatest,
1213
map,
1314
Observable,
1415
} from 'rxjs';
16+
import {
17+
switchMap,
18+
take,
19+
} from 'rxjs/operators';
1520

16-
import { getDSORoute } from '../../../app-routing-paths';
1721
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
1822
import { FeatureID } from '../../../core/data/feature-authorization/feature-id';
1923
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
20-
import { hasValue } from '../../empty.util';
2124
import { MenuItemType } from '../menu-item-type.model';
2225
import { PartialMenuSection } from '../menu-provider.model';
2326
import { DSpaceObjectPageMenuProvider } from './helper-providers/dso.menu';
24-
import { switchMap, take } from 'rxjs/operators';
25-
import { ActivatedRoute } from '@angular/router';
2627

2728
/**
2829
* Menu provider to create the "Statistics" menu section in the public navbar. The menu depends on the page it is on.
@@ -35,7 +36,7 @@ export class StatisticsMenuProvider extends DSpaceObjectPageMenuProvider {
3536

3637
constructor(
3738
protected authorizationService: AuthorizationDataService,
38-
protected route: ActivatedRoute
39+
protected route: ActivatedRoute,
3940
) {
4041
super();
4142
}
@@ -109,67 +110,67 @@ export class StatisticsMenuProvider extends DSpaceObjectPageMenuProvider {
109110
canViewWorkflow: this.getAuthorizedWorkflowStatistics(),
110111
}).pipe(
111112
take(1),
112-
map(({canViewUsage, canViewLogin, canViewWorkflow}) => {
113-
const menuList = [];
114-
if (canViewUsage || canViewLogin || canViewWorkflow) {
115-
if (canViewUsage) {
116-
menuList.push({
117-
id: 'statistics_site',
118-
parentID: 'statistics',
119-
active: false,
120-
visible: true,
121-
model: {
122-
type: MenuItemType.LINK,
123-
text: 'menu.section.statistics.site',
124-
link: '/statistics',
125-
},
126-
});
127-
}
113+
map(({ canViewUsage, canViewLogin, canViewWorkflow }) => {
114+
const menuList = [];
115+
if (canViewUsage || canViewLogin || canViewWorkflow) {
116+
if (canViewUsage) {
117+
menuList.push({
118+
id: 'statistics_site',
119+
parentID: 'statistics',
120+
active: false,
121+
visible: true,
122+
model: {
123+
type: MenuItemType.LINK,
124+
text: 'menu.section.statistics.site',
125+
link: '/statistics',
126+
},
127+
});
128+
}
128129

129-
if (canViewLogin) {
130-
menuList.push({
131-
id: 'statistics_login',
132-
parentID: 'statistics',
133-
active: false,
134-
visible: true,
135-
model: {
136-
type: MenuItemType.LINK,
137-
text: 'menu.section.statistics.login',
138-
link: '/statistics/login',
139-
},
140-
});
141-
}
130+
if (canViewLogin) {
131+
menuList.push({
132+
id: 'statistics_login',
133+
parentID: 'statistics',
134+
active: false,
135+
visible: true,
136+
model: {
137+
type: MenuItemType.LINK,
138+
text: 'menu.section.statistics.login',
139+
link: '/statistics/login',
140+
},
141+
});
142+
}
142143

143-
if (canViewWorkflow) {
144-
menuList.push({
145-
id: 'statistics_workflow',
146-
parentID: 'statistics',
147-
active: false,
148-
visible: true,
149-
model: {
150-
type: MenuItemType.LINK,
151-
text: 'menu.section.statistics.workflow',
152-
link: '/statistics/workflow',
153-
},
154-
});
155-
}
144+
if (canViewWorkflow) {
145+
menuList.push({
146+
id: 'statistics_workflow',
147+
parentID: 'statistics',
148+
active: false,
149+
visible: true,
150+
model: {
151+
type: MenuItemType.LINK,
152+
text: 'menu.section.statistics.workflow',
153+
link: '/statistics/workflow',
154+
},
155+
});
156+
}
156157

157-
// the parent menu should be added after the children
158-
menuList.push(
159-
{
160-
id: 'statistics',
161-
active: false,
162-
visible: true,
163-
index: 1,
164-
model: {
165-
type: MenuItemType.TEXT,
166-
text: 'menu.section.statistics',
158+
// the parent menu should be added after the children
159+
menuList.push(
160+
{
161+
id: 'statistics',
162+
active: false,
163+
visible: true,
164+
index: 1,
165+
model: {
166+
type: MenuItemType.TEXT,
167+
text: 'menu.section.statistics',
168+
},
167169
},
168-
},
169-
);
170-
}
171-
return menuList;
172-
}));
170+
);
171+
}
172+
return menuList;
173+
}));
173174
}
174175

175176
protected isApplicable(dso: DSpaceObject): boolean {

0 commit comments

Comments
 (0)