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
2 changes: 1 addition & 1 deletion spa/src/app/_ngrx/app.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ export const AppReducers = {
...fileReducer.reducer,
config: configReducer.reducer,
http: httpReducer.reducer,
...systemReducer.reducer,
system: systemReducer.reducer,
terra: terraReducer.reducer
};
27 changes: 16 additions & 11 deletions spa/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<announcement *ngIf="isMaintenanceModeWarningVisible((config$ | async)?.deployment)" class="data-re-ingestion">
<p class="fontsize-s">Warning: in maintenance mode for data re-ingestion</p>
</announcement>
<header>
<hca-toolbar (menuOpen)="onMenuOpen($event)"></hca-toolbar>
</header>
<release-banner *ngIf="showRelease()"></release-banner>
<ng-container *ngIf="systemStatus$ | async as systemStatus">
<announcement *ngIf="!systemStatus.health.ok" class="status" >
<ng-container *ngIf="state$ | async as state">
<announcement *ngIf="isMaintenanceModeWarningVisible()" class="data-re-ingestion">
<p class="fontsize-s">Warning: in maintenance mode for data re-ingestion</p>
</announcement>
<header>
<hca-toolbar (menuOpen)="onMenuOpen($event)"></hca-toolbar>
</header>
<release-banner *ngIf="showRelease()"></release-banner>
<announcement *ngIf="!state.systemStatus.ok" class="status">
<mat-icon>warning</mat-icon>
<p class="fontsize-s">One or more of the systems composing the HCA DCP is currently unavailable. Please try again later, or monitor the full system status <a href="/system-status">here</a>.</p>
<p class="fontsize-s">One or more of the systems composing the HCA DCP is currently unavailable.
<ng-container *ngIf="isStatusPageFeatureEnabled()">Please try again later, or monitor the full system status
<a href="/system-status">here</a>.
</ng-container>
</p>
</announcement>
<announcement *ngIf="systemStatus.health.ok && systemStatus.index.indexing" class="status">
<announcement *ngIf="state.systemStatus.ok && state.systemStatus.indexing" class="status">
<p class="fontsize-s">Data indexing in progress. Search results may be incomplete.</p>
</announcement>
</ng-container>
Expand All @@ -20,3 +24,4 @@
<data-policy-footer></data-policy-footer>
</sticky-footer>
<hca-footer></hca-footer>

13 changes: 13 additions & 0 deletions spa/src/app/app.component.state.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Human Cell Atlas
* https://www.humancellatlas.org/
*
* State backing top level app component.
*/
import { SystemStatus } from "./system/_ngrx/system-status.model";

// App dependencies
export interface AppComponentState {

systemStatus: SystemStatus;
}
62 changes: 30 additions & 32 deletions spa/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@ import { combineLatest, Observable, Subscription, Subject } from "rxjs";
import { filter, map, takeUntil } from "rxjs/operators";

// App dependencies
import { Config } from "./config/config.model";
import { selectConfigConfig } from "./config/_ngrx/config.selectors";
import { AppComponentState } from "./app.component.state";
import { ConfigService } from "./config/config.service";
import { SearchTermUrlService } from "./files/search/url/search-term-url.service";
import { SetViewStateAction } from "./files/_ngrx/facet/set-view-state.action";
import { ClearReleaseReferrerAction } from "./files/_ngrx/release/clear-release-referrer.action";
import { FetchProjectEditsRequestAction } from "./files/_ngrx/project-edits/fetch-project-edits-request.action";
import { ReleaseService } from "./files/shared/release.service";
import { EntityName } from "./files/shared/entity-name.model";
import { FetchReleasesRequestAction } from "./files/_ngrx/release/fetch-releases-request.action";
import { AppState } from "./_ngrx/app.state";
import { DeviceDetectorService } from "ngx-device-detector";
import { HealthRequestAction } from "./system/_ngrx/health/health-request.action";
import { selectHealth, selectIndex } from "./system/_ngrx/system.selectors";
import { IndexRequestAction } from "./system/_ngrx/index/index-request.action";
import { SystemState } from "./system.state";
import { AppState } from "./_ngrx/app.state";
import { selectSystemStatus } from "./system/_ngrx/system.selectors";
import { SystemStatusRequestAction } from "./system/_ngrx/system-status-request.action";

@Component({
selector: "app-root",
Expand All @@ -39,14 +37,14 @@ import { SystemState } from "./system.state";
export class AppComponent implements OnInit, OnDestroy {

// Template/public variables
public systemStatus$: Observable<SystemState>;
public config$: Observable<Config>;
public state$: Observable<AppComponentState>;

// Locals
private ngDestroy$ = new Subject();
private routerEventsSubscription: Subscription;

/**
* @param {ConfigService} configService
* @param {DeviceDetectorService} deviceService
* @param {ReleaseService} releaseService
* @param {SearchTermUrlService} searchUrlService
Expand All @@ -56,7 +54,8 @@ export class AppComponent implements OnInit, OnDestroy {
* @param {Router} router
* @param {Renderer2} renderer
*/
constructor(private deviceService: DeviceDetectorService,
constructor(private configService: ConfigService,
private deviceService: DeviceDetectorService,
private releaseService: ReleaseService,
private searchUrlService: SearchTermUrlService,
private store: Store<AppState>,
Expand All @@ -81,13 +80,11 @@ export class AppComponent implements OnInit, OnDestroy {
/**
* Returns true if the maintenance mode warning is visible.
*
* @param {string} environmentName
* @returns {boolean}
*/
public isMaintenanceModeWarningVisible(environmentName: string): boolean {
public isMaintenanceModeWarningVisible(): boolean {

// Maintenance mode warning is currently disabled. To re-enable, uncomment line below.
// return environmentName === "prod";
// Maintenance mode warning is currently disabled.
return false;
}

Expand Down Expand Up @@ -123,6 +120,16 @@ export class AppComponent implements OnInit, OnDestroy {
return !( this.router.url.includes("/releases/") || this.router.url.includes("/projects/") );
}

/**
* Returns true if this isn't a v2.0 environment (DCP-wide system status is only available in pre v2.0 environments).
*
* @returns {boolean}
*/
public isStatusPageFeatureEnabled(): boolean {

return !this.configService.isV2();
}

/**
* Load project edits data from local JSON files.
*/
Expand Down Expand Up @@ -175,23 +182,19 @@ export class AppComponent implements OnInit, OnDestroy {
}

/**
* Fetch current status of system, and current status of index, and display information banners, if necessary.
* Fetch current status of system, and current status of index, and display information banners, if necessary. Also
* check for changes in config.
*/
private systemCheck() {

this.store.dispatch(new HealthRequestAction());
const health$ = this.store.pipe(select(selectHealth));

this.store.dispatch(new IndexRequestAction());
const index$ = this.store.pipe(select(selectIndex));
private initState() {

this.systemStatus$ = combineLatest(health$, index$).pipe(
this.store.dispatch(new SystemStatusRequestAction());
this.state$ = this.store.pipe(
select(selectSystemStatus),
takeUntil(this.ngDestroy$),
map(([health, index]) => {
map((systemStatus) => {

return {
health,
index
systemStatus
}
})
);
Expand Down Expand Up @@ -250,15 +253,10 @@ export class AppComponent implements OnInit, OnDestroy {
public ngOnInit() {

this.setAppStateFromURL();
this.systemCheck();
this.initState();
this.loadReleaseData();
this.loadProjectEditsData();
this.initReleaseReferrerListener();

this.config$ = this.store.pipe(
select(selectConfigConfig),
takeUntil(this.ngDestroy$)
);
}
}

7 changes: 6 additions & 1 deletion spa/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { AppComponent } from "./app.component";
import { AppRoutes } from "./app.routes";
import { ConfigModule } from "./config/config.module";
import { ConfigService } from "./config/config.service";
import { environment } from "../environments/environment";
import { FilesModule } from "./files/files.module";
import { ReleaseBannerComponent } from "./files/releases/release-banner/release-banner.component";
import { HCAEncodeHttpParamsInterceptor } from "./http/hca-encode-http-params.interceptor";
Expand All @@ -42,6 +43,7 @@ import { LocalStorageService } from "./storage/local-storage.service";
import { ErrorComponent } from "./system/error/error.component";
import { NotFoundComponent } from "./system/not-found/not-found.component";
import { SystemService } from "./system/shared/system.service";
import { SystemService20 } from "./system/shared/system.2.0.service";

@NgModule({
bootstrap: [AppComponent],
Expand Down Expand Up @@ -87,7 +89,10 @@ import { SystemService } from "./system/shared/system.service";
],
providers: [
LocalStorageService,
SystemService,
{
provide: "SYSTEM_SERVICE",
useClass: environment.version === "2.0" ? SystemService20 : SystemService
},
// Bootstrap config from API end point, must return function from useFactory method, when function is invoked,
// must return promise to ensure Angular "pauses" until config is resolved from API end point.
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ describe("HCAGetDataDownloadsComponent", () => {
/**
* Confirm "Create Concatenated Expression Matrix" is displayed.
*/
it(`displays "Create Concatenated Expression Matrix"`, () => {
it(`hides "Create Concatenated Expression Matrix" in pre v2.0 environment`, () => {

// Confirm "Create Concatenated Expression Matrix" is displayed
expect(isPanelHeaderDisplayed("Create Concatenated Expression Matrix")).toEqual(true);
expect(isPanelHeaderDisplayed("Create Concatenated Expression Matrix")).toEqual(false);
});

/**
Expand Down
16 changes: 0 additions & 16 deletions spa/src/app/system.state.ts

This file was deleted.

15 changes: 0 additions & 15 deletions spa/src/app/system/_ngrx/health/health-failure.action.ts

This file was deleted.

15 changes: 0 additions & 15 deletions spa/src/app/system/_ngrx/health/health-request.action.ts

This file was deleted.

15 changes: 0 additions & 15 deletions spa/src/app/system/_ngrx/health/health-success.action.ts

This file was deleted.

31 changes: 0 additions & 31 deletions spa/src/app/system/_ngrx/health/health.reducer.ts

This file was deleted.

48 changes: 0 additions & 48 deletions spa/src/app/system/_ngrx/health/health.state.ts

This file was deleted.

15 changes: 0 additions & 15 deletions spa/src/app/system/_ngrx/index/index-failure.action.ts

This file was deleted.

Loading