Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@
},
"private": false,
"dependencies": {
"@angular/animations": "9.1.0",
"@angular/common": "9.1.0",
"@angular/compiler": "9.1.0",
"@angular/core": "9.1.0",
"@angular/forms": "9.1.0",
"@angular/localize": "^9.1.0",
"@angular/platform-browser": "9.1.0",
"@angular/platform-browser-dynamic": "9.1.0",
"@angular/platform-server": "9.1.0",
"@angular/router": "9.1.0",
"@angular/animations": "9.1.1",
"@angular/common": "9.1.1",
"@angular/compiler": "9.1.1",
"@angular/core": "9.1.1",
"@angular/forms": "9.1.1",
"@angular/localize": "9.1.1",
"@angular/platform-browser": "9.1.1",
"@angular/platform-browser-dynamic": "9.1.1",
"@angular/platform-server": "9.1.1",
"@angular/router": "9.1.1",
"@ng-bootstrap/ng-bootstrap": "6.0.2",
"@ngrx/effects": "9.0.0",
"@ngrx/entity": "9.0.0",
"@ngrx/router-store": "9.0.0",
"@ngrx/store": "9.0.0",
"@ngrx/effects": "9.1.0",
"@ngrx/entity": "9.1.0",
"@ngrx/router-store": "9.1.0",
"@ngrx/store": "9.1.0",
"@nguniversal/express-engine": "9.1.0",
"@ngx-translate/core": "12.1.2",
"@ngx-translate/http-loader": "4.0.0",
Expand All @@ -52,6 +52,7 @@
"font-awesome": "4.7.0",
"ie11-custom-properties": "3.0.6",
"net": "1.0.2",
"ng5-slider": "1.2.4",
"rxjs": "6.5.5",
"scholars-embed-utilities": "0.2.0",
"sockjs-client": "1.4.0",
Expand All @@ -63,9 +64,9 @@
"devDependencies": {
"@angular-devkit/build-angular": "0.901.0",
"@angular/cli": "9.1.0",
"@angular/compiler-cli": "9.1.0",
"@angular/language-service": "9.1.0",
"@ngrx/store-devtools": "9.0.0",
"@angular/compiler-cli": "9.1.1",
"@angular/language-service": "9.1.1",
"@ngrx/store-devtools": "9.1.0",
"@nguniversal/builders": "9.1.0",
"@types/compression": "1.7.0",
"@types/express": "4.17.4",
Expand Down
2 changes: 1 addition & 1 deletion src/app/+admin/admin.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</div>

<div class="container mt-2">
<span class="h2 text-primary">{{ 'SHARED.SIDEBAR.ADMINISTRATION.TITLE' | translate }}</span>
<span class="h2 text-primary">{{ 'ADMIN.TITLE' | translate }}</span>
<ul role="tablist" class="list-unstyled mt-3 nav" [ngClass]="{ 'nav-tabs nav-fill': showTabs(windowDimensions | async), 'nav-pills flex-column': !showTabs(windowDimensions | async) }">
<li class="nav-item" *ngFor="let tab of tabs">
<a class="nav-link" [routerLink]="tab.route" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">{{ tab.translateKey | translate }}</a>
Expand Down
10 changes: 5 additions & 5 deletions src/app/+admin/admin.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ export class AdminComponent implements OnInit {
this.tabs = [
{
route: ['/admin/DirectoryViews'],
translateKey: 'SHARED.SIDEBAR.ADMINISTRATION.DIRECTORY_VIEWS',
translateKey: 'ADMIN.DIRECTORY_VIEWS.TITLE',
},
{
route: ['/admin/DiscoveryViews'],
translateKey: 'SHARED.SIDEBAR.ADMINISTRATION.DISCOVERY_VIEWS',
translateKey: 'ADMIN.DISCOVERY_VIEWS.TITLE',
},
{
route: ['/admin/DisplayViews'],
translateKey: 'SHARED.SIDEBAR.ADMINISTRATION.DISPLAY_VIEWS',
translateKey: 'ADMIN.DISPLAY_VIEWS.TITLE',
},
{
route: ['/admin/Themes'],
translateKey: 'SHARED.SIDEBAR.ADMINISTRATION.THEMES',
translateKey: 'ADMIN.THEMES.TITLE',
},
{
route: ['/admin/Users'],
translateKey: 'SHARED.SIDEBAR.ADMINISTRATION.USERS',
translateKey: 'ADMIN.USERS.TITLE',
},
];
}
Expand Down
5 changes: 2 additions & 3 deletions src/app/+admin/directory-views/directory-views.component.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<scholars-pagination *ngIf="directoryViews | async; let directoryViews" [page]="page">
<span class="h3 text-primary">{{ 'ADMIN.DIRECTORY_VIEWS.TITLE' | translate }}</span>
<scholars-pagination [page]="page">
<table class="table table-striped table-hover">
<thead>
<tr>
<th scope="col">{{ 'ADMIN.DIRECTORY_VIEWS.NAME' | translate }}</th>
<th scope="col">{{ 'ADMIN.DIRECTORY_VIEWS.LAYOUT' | translate }}</th>
</tr>
</thead>
<tbody>
<tbody *ngIf="directoryViews | async; let directoryViews">
<tr *ngFor="let directoryView of directoryViews">
<td scope="row">{{directoryView.name}}</td>
<td scope="row">{{directoryView.layout}}</td>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<scholars-pagination [page]="page">
<span class="h3 text-primary">{{ 'ADMIN.DISCOVERY_VIEWS.TITLE' | translate }}</span>
<table class="table table-striped table-hover">
<thead>
<tr>
Expand Down
1 change: 0 additions & 1 deletion src/app/+admin/display-views/display-views.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<scholars-pagination [page]="page">
<span class="h3 text-primary">{{ 'ADMIN.DISPLAY_VIEWS.TITLE' | translate }}</span>
<table class="table table-striped table-hover">
<thead>
<tr>
Expand Down
1 change: 0 additions & 1 deletion src/app/+admin/themes/themes.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<scholars-pagination [page]="page">
<span class="h3 text-primary">{{ 'ADMIN.THEMES.TITLE' | translate }}</span>
<table class="table table-striped table-hover">
<thead>
<tr>
Expand Down
3 changes: 1 addition & 2 deletions src/app/+admin/users/users.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<scholars-pagination [page]="page">
<span class="h3 text-primary">{{ 'ADMIN.USERS.TITLE' | translate }}</span>
<table class="table table-striped table-hover">
<thead>
<tr>
Expand All @@ -18,7 +17,7 @@
<td scope="row">{{getRoleValue(user.role)}}</td>
<td scope="row">{{user.active}}</td>
<td scope="row">{{user.enabled}}</td>
<td scope="row" class="text-center" (click)="openUserEditDialog(user)"><i class="fa fa-edit"></i></td>
<td scope="row" (click)="openUserEditDialog(user)"><i class="fa fa-edit"></i></td>
</tr>
</tbody>
</table>
Expand Down
7 changes: 6 additions & 1 deletion src/app/+directory/directory.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ export class DirectoryComponent implements OnDestroy, OnInit {

private subscriptions: Subscription[];

constructor(@Inject('APP_CONFIG') private appConfig: AppConfig, private store: Store<AppState>, private router: Router, private route: ActivatedRoute) {
constructor(
@Inject('APP_CONFIG') private appConfig: AppConfig,
private store: Store<AppState>,
private router: Router,
private route: ActivatedRoute
) {
this.subscriptions = [];
}

Expand Down
8 changes: 7 additions & 1 deletion src/app/+discovery/discovery.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { addExportToQueryParams, getQueryParams, applyFiltersToQueryParams, show
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DiscoveryComponent implements OnDestroy, OnInit {

public windowDimensions: Observable<WindowDimensions>;

public url: Observable<string>;
Expand All @@ -53,7 +54,12 @@ export class DiscoveryComponent implements OnDestroy, OnInit {

private subscriptions: Subscription[];

constructor(@Inject('APP_CONFIG') private appConfig: AppConfig, private store: Store<AppState>, private router: Router, private route: ActivatedRoute) {
constructor(
@Inject('APP_CONFIG') private appConfig: AppConfig,
private store: Store<AppState>,
private router: Router,
private route: ActivatedRoute
) {
this.subscriptions = [];
}

Expand Down
50 changes: 24 additions & 26 deletions src/app/core/guard/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ import * as fromRouter from '../store/router/router.actions';

@Injectable()
export class AuthGuard implements CanActivate {
constructor(@Inject(PLATFORM_ID) private platformId: string, private alert: AlertService, private dialog: DialogService, private store: Store<AppState>) {}

constructor(
@Inject(PLATFORM_ID) private platformId: string,
private alert: AlertService,
private dialog: DialogService,
private store: Store<AppState>
) { }

public canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
const roles = route.data.roles;
Expand All @@ -36,26 +42,20 @@ export class AuthGuard implements CanActivate {
}

private isAuthorized(url: string, roles: Role[]): Observable<boolean> {
return this.isAuthenticated(url).pipe(
switchMap((authenticated: boolean) =>
authenticated
? this.store.pipe(
select(selectUser),
filter((user: User) => user !== undefined),
map((user: User) => {
const authorized = user ? roles.indexOf(Role[user.role]) >= 0 : false;
if (!authorized) {
this.store.dispatch(new fromRouter.Go({ path: ['/'] }));
if (isPlatformBrowser(this.platformId)) {
this.store.dispatch(this.alert.unsubscribeFailureAlert());
}
}
return authorized;
})
)
: scheduled([false], asap)
)
);
return this.isAuthenticated(url).pipe(switchMap((authenticated: boolean) => authenticated ?
this.store.pipe(
select(selectUser),
filter((user: User) => user !== undefined),
map((user: User) => {
const authorized = user ? roles.indexOf(Role[user.role]) >= 0 : false;
if (!authorized) {
this.store.dispatch(new fromRouter.Go({ path: ['/'] }));
if (isPlatformBrowser(this.platformId)) {
this.store.dispatch(this.alert.unsubscribeFailureAlert());
}
}
return authorized;
})) : scheduled([false], asap)));
}

private isAuthenticated(url: string): Observable<boolean> {
Expand All @@ -65,11 +65,9 @@ export class AuthGuard implements CanActivate {
if (!authenticated) {
this.store.dispatch(new fromRouter.Go({ path: ['/'] }));
if (isPlatformBrowser(this.platformId)) {
this.store.dispatch(
new fromAuth.SetLoginRedirectAction({
navigation: { path: [url] },
})
);
this.store.dispatch(new fromAuth.SetLoginRedirectAction({
navigation: { path: [url] },
}));
this.store.dispatch(this.dialog.loginDialog());
this.store.dispatch(this.alert.forbiddenAlert());
}
Expand Down
6 changes: 4 additions & 2 deletions src/app/core/model/sidebar/sidebar-item.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Observable } from 'rxjs';

import { Params } from '@angular/router';
import { Action } from '@ngrx/store';
import { Observable } from 'rxjs';

export enum SidebarItemType {
FACET = 'FACET',
RANGE_SLIDER = 'RANGE_SLIDER',
ACTION = 'ACTION',
INFO = 'INFO',
}
Expand All @@ -18,5 +18,7 @@ export interface SidebarItem {
action?: Action;
selected?: boolean;
parenthetical?: number;
rangeOptions?: any;
rangeValues?: any;
classes?: string;
}
9 changes: 6 additions & 3 deletions src/app/core/model/view/collection-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,23 @@ export enum OpKey {
EXPRESSION = 'EXPRESSION',
FUZZY = 'FUZZY',
NOT_EQUALS = 'NOT_EQUALS',
STARTS_WITH = 'STARTS_WITH',
STARTS_WITH = 'STARTS_WITH'
}

export enum Layout {
LIST = 'LIST',
GRID = 'GRID',
GRID = 'GRID'
}

export enum FacetType {
STRING = 'STRING',
DATE_YEAR = 'DATE_YEAR',
RANGE_SLIDER = 'RANGE_SLIDER'
}

export enum FacetSort {
COUNT = 'COUNT',
INDEX = 'INDEX',
INDEX = 'INDEX'
}

export interface Sort {
Expand All @@ -48,6 +49,8 @@ export interface Facet {
readonly direction: Direction;
readonly collapsed: boolean;
readonly hidden: boolean;
readonly rangeMin?: number;
readonly rangeMax?: number;
}

export interface Filter {
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/store/auth/auth.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import * as fromSdr from '../sdr/sdr.actions';

@Injectable()
export class AuthEffects {
constructor(private actions: Actions, private store: Store<AppState>, private alert: AlertService, private authService: AuthService, private dialog: DialogService) {}
constructor(private actions: Actions, private store: Store<AppState>, private alert: AlertService, private authService: AuthService, private dialog: DialogService) { }

@Effect() reconnect = this.actions.pipe(
ofType(fromAuth.AuthActionTypes.LOGIN_SUCCESS, fromAuth.AuthActionTypes.LOGOUT_SUCCESS),
Expand Down
1 change: 0 additions & 1 deletion src/app/core/store/router/router.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { AppState } from '../';
import { selectLoginRedirect } from '../auth';

import * as fromAuth from '../auth/auth.actions';
import * as fromDialog from '../dialog/dialog.actions';
import * as fromRouter from './router.actions';

@Injectable()
Expand Down
Loading