Skip to content

Commit

Permalink
Merge pull request #392 from TAMULib/sprint-7-staging
Browse files Browse the repository at this point in the history
Sprint 7 Staging
  • Loading branch information
Dbreck-TAMU authored Sep 12, 2024
2 parents b410d64 + 43a7431 commit 16d87be
Show file tree
Hide file tree
Showing 113 changed files with 440 additions and 899 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified .yarn/install-state.gz
Binary file not shown.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"@nguniversal/express-engine": "16.2.0",
"@ngx-translate/core": "15.0.0",
"@ngx-translate/http-loader": "8.0.0",
"@stomp/stompjs": "7.0.0",
"bootstrap": "~4.6.2",
"d3": "7.8.5",
"express": "4.18.2",
Expand Down
2 changes: 0 additions & 2 deletions server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const BASE_HREF = process.env.BASE_HREF || '/';

const BROKER_URL = process.env.BROKER_URL || 'ws://localhost:9000';
const SERVICE_URL = process.env.SERVICE_URL || 'http://localhost:9000';
const SSR_SERVICE_URL = process.env.SSR_SERVICE_URL || 'http://127.0.0.1:9000';

const UI_URL = process.env.UI_URL || 'http://localhost:4200';
const EMBED_URL = process.env.EMBED_URL || 'http://localhost:4201';
Expand All @@ -37,7 +36,6 @@ const COLLECT_SEARCH_STATS = process.env.COLLECT_SEARCH_STATS === 'true';
const serverAppConfig = (appConfig: AppConfig): AppConfig => {
return {
...appConfig,
serviceUrl: SSR_SERVICE_URL
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { TranslateModule } from '@ngx-translate/core';

import { testAppConfig } from '../../../test.config';
import { getRequest } from '../../app.browser.module';
import { APP_CONFIG } from '../../app.config';
import { Layout } from '../../core/model/view';
import { ContainerType } from '../../core/model/view/data-and-analytics-view';
import { Side } from '../../core/model/view/display-view';
Expand Down Expand Up @@ -39,6 +40,7 @@ describe('ProfileSummariesExportComponent', () => {
],
providers: [
{ provide: REQUEST, useFactory: getRequest },
{ provide: APP_CONFIG, useValue: testAppConfig },
RestService
]
}).compileComponents();
Expand Down
12 changes: 6 additions & 6 deletions src/app/+directory/directory.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class DirectoryComponent implements OnDestroy, OnInit {
}

public isActive(directoryView: DirectoryView, params: Params, option: string): boolean {
const queryParams: Params = Object.assign({}, params);
const queryParams: Params = { ...params };
if (hasFilter(queryParams.filters, directoryView.index.field)) {
return queryParams[`${directoryView.index.field}.filter`] === option;
}
Expand Down Expand Up @@ -114,7 +114,7 @@ export class DirectoryComponent implements OnDestroy, OnInit {
}

public getDirectoryExportUrl(params: Params, directoryView: DirectoryView): string {
const queryParams: Params = Object.assign({}, params);
const queryParams: Params = { ...params };
queryParams.facets = null;
queryParams.collection = null;
addExportToQueryParams(queryParams, directoryView);
Expand All @@ -124,13 +124,13 @@ export class DirectoryComponent implements OnDestroy, OnInit {
}

public getDirectoryQueryParamsRemovingFilter(params: Params, filterToRemove: Filter): Params {
const queryParams: Params = Object.assign({}, params);
const queryParams: Params = { ...params };
removeFilterFromQueryParams(queryParams, filterToRemove);
return queryParams;
}

public getDirectoryQueryParamsResetting(params: Params, directoryView: DirectoryView): Params {
const queryParams: Params = Object.assign({}, params);
const queryParams: Params = { ...params };
if (hasFilter(queryParams.filters, directoryView.index.field)) {
const filters = queryParams.filters.split(',')
.map((field) => field.trim())
Expand All @@ -147,13 +147,13 @@ export class DirectoryComponent implements OnDestroy, OnInit {
}

public getDirectoryQueryParamsClearingFilters(params: Params, discoveryView: DiscoveryView): Params {
const queryParams: Params = Object.assign({}, params);
const queryParams: Params = { ...params };
resetFiltersInQueryParams(queryParams, discoveryView);
return queryParams;
}

public getDirectoryQueryParamsWithOption(params: Params, directoryView: DirectoryView, option: string): Params {
const queryParams: Params = Object.assign({}, params);
const queryParams: Params = { ...params };
queryParams.page = 1;
if (option) {
queryParams[`${directoryView.index.field}.filter`] = option;
Expand Down
6 changes: 3 additions & 3 deletions src/app/+discovery/discovery.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class DiscoveryComponent implements OnDestroy, OnInit {
}

public getDiscoveryExportUrl(params: Params, discoveryView: DiscoveryView): string {
const queryParams: Params = Object.assign({}, params);
const queryParams: Params = { ...params };
queryParams.facets = null;
queryParams.collection = null;
addExportToQueryParams(queryParams, discoveryView);
Expand All @@ -128,13 +128,13 @@ export class DiscoveryComponent implements OnDestroy, OnInit {
}

public getDiscoveryQueryParamsRemovingFilter(params: Params, filterToRemove: Filter): Params {
const queryParams: Params = Object.assign({}, params);
const queryParams: Params = { ...params };
removeFilterFromQueryParams(queryParams, filterToRemove);
return queryParams;
}

public getDiscoveryQueryParamsClearingFilters(params: Params, discoveryView: DiscoveryView): Params {
const queryParams: Params = Object.assign({}, params);
const queryParams: Params = { ...params };
resetFiltersInQueryParams(queryParams, discoveryView);
return queryParams;
}
Expand Down
5 changes: 4 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export class AppComponent implements OnInit {

private isPlatformBrowser: boolean;

constructor(@Inject(PLATFORM_ID) platformId: string, private store: Store<AppState>) {
constructor(
@Inject(PLATFORM_ID) platformId: string,
private store: Store<AppState>
) {
initializeTemplateHelpers(environment.formalize);
this.isPlatformBrowser = isPlatformBrowser(platformId);
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class I18nTranslateState {
}

export const I18N_TRANSLATE_STATE = makeStateKey<I18nTranslateState>('I18N_TRANSLATE_STATE');
export const STORE_TRANSLATE_STATE = makeStateKey<string>('STORE_TRANSLATE_STATE');

const getBaseHref = (document: Document, appConfig: AppConfig): string => {
const baseTag = document.querySelector('head > base');
Expand All @@ -47,10 +48,10 @@ const createWithCredentialsInterceptor = (): HttpInterceptor => {
],
imports: [
BrowserModule,
TransferHttpCacheModule,
BrowserAnimationsModule,
AppRoutingModule,
HttpClientModule,
TransferHttpCacheModule,
TranslateModule.forRoot(),
CoreModule.forRoot(),
NgbModule,
Expand Down
19 changes: 16 additions & 3 deletions src/app/app.server.module.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { APP_BASE_HREF, DOCUMENT } from '@angular/common';
import { NgModule, TransferState } from '@angular/core';
import { APP_BOOTSTRAP_LISTENER, NgModule, TransferState } from '@angular/core';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { ServerModule } from '@angular/platform-server';
import { MissingTranslationHandler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { readFileSync } from 'fs';
import { Observable, of } from 'rxjs';
import { Observable, of, take } from 'rxjs';

import { Store } from '@ngrx/store';
import { AppComponent } from './app.component';
import { AppModule, I18N_TRANSLATE_STATE, I18nTranslateState } from './app.module';
import { AppModule, I18N_TRANSLATE_STATE, I18nTranslateState, STORE_TRANSLATE_STATE } from './app.module';
import { ComputedStyleLoader } from './core/computed-style-loader';
import { CustomMissingTranslationHandler } from './core/handler/custom-missing-translation.handler';

Expand Down Expand Up @@ -72,6 +73,18 @@ const createUniversalStyleLoader = (document: Document, baseHref: string): Compu
useFactory: createUniversalStyleLoader,
deps: [DOCUMENT, APP_BASE_HREF],
},
{
provide: APP_BOOTSTRAP_LISTENER,
useFactory: (store: Store, transferState: TransferState) => {
return () => {
store.pipe(take(1)).subscribe(state => {
transferState.set<string>(STORE_TRANSLATE_STATE, JSON.stringify(state));
});
};
},
deps: [Store, TransferState],
multi: true,
}
],
})
export class AppServerModule { }
2 changes: 0 additions & 2 deletions src/app/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { DialogService } from './service/dialog.service';
import { MetadataService } from './service/metadata.service';
import { RestService } from './service/rest.service';
import { StatsService } from './service/stats.service';
import { StompService } from './service/stomp.service';
import { ThemeService } from './service/theme.service';

const MODULES = [
Expand All @@ -27,7 +26,6 @@ const PROVIDERS = [
MetadataService,
RestService,
StatsService,
StompService,
ThemeService,
ThemeRepo,
UserRepo
Expand Down
17 changes: 6 additions & 11 deletions src/app/core/guard/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export class AuthGuard {
public canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
const roles = route.data.roles;
return this.requiresAuthorization(roles).pipe(
switchMap((authorize: boolean) => {
return authorize ? this.isAuthorized(state.url, roles) : this.isAuthenticated(state.url);
})
switchMap((authorize: boolean) => authorize
? this.isAuthorized(state.url, roles)
: this.isAuthenticated(state.url))
);
}

Expand All @@ -48,10 +48,7 @@ export class AuthGuard {
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());
}
this.store.dispatch(new fromRouter.Link({ url: '/' }));
}
return authorized;
})) : scheduled([false], asapScheduler)));
Expand All @@ -62,11 +59,9 @@ export class AuthGuard {
select(selectIsAuthenticated),
map((authenticated: boolean) => {
if (!authenticated) {
this.store.dispatch(new fromRouter.Go({ path: ['/'] }));
this.store.dispatch(new fromRouter.Link({ url: '/' }));
this.store.dispatch(new fromAuth.SetLoginRedirectAction({ url }));
if (isPlatformBrowser(this.platformId)) {
this.store.dispatch(new fromAuth.SetLoginRedirectAction({
navigation: { path: [url] },
}));
this.store.dispatch(this.dialog.loginDialog());
this.store.dispatch(this.alert.forbiddenAlert());
}
Expand Down
Loading

0 comments on commit 16d87be

Please sign in to comment.