Skip to content

Commit 22b804a

Browse files
MillenniumFalconMechanicNoopDog
authored andcommitted
Fixed referrer. Completed file download roundtrip. Added file type descriptions - first pass.
1 parent 788ae17 commit 22b804a

15 files changed

+112
-45
lines changed

spa/src/app/app.component.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Component, OnDestroy, OnInit, Renderer2 } from "@angular/core";
1111
import { ActivatedRoute, NavigationEnd, Params, Router } from "@angular/router";
1212
import { select, Store } from "@ngrx/store";
1313
import { combineLatest, Observable, Subscription, Subject } from "rxjs";
14-
import { map, takeUntil } from "rxjs/operators";
14+
import { filter, map, takeUntil } from "rxjs/operators";
1515

1616
// App dependencies
1717
import { Config } from "./config/config.model";
@@ -28,6 +28,7 @@ import { HealthRequestAction } from "./system/_ngrx/health/health-request.action
2828
import { selectHealth, selectIndex } from "./system/_ngrx/system.selectors";
2929
import { IndexRequestAction } from "./system/_ngrx/index/index-request.action";
3030
import { SystemState } from "./system.state";
31+
import { ClearReleaseReferrerAction } from "./files/_ngrx/release/clear-release-referrer.action";
3132

3233
@Component({
3334
selector: "app-root",
@@ -132,6 +133,22 @@ export class AppComponent implements OnInit, OnDestroy {
132133
this.store.dispatch(new FetchReleasesRequestAction());
133134
}
134135

136+
/**
137+
* Clear release referrer if the user is no longer in the context of viewing release information. This is used
138+
* by the project detail to determine where the back button should navigate to; either the release page if the
139+
* referrer flag is set, otherwise the project tab.
140+
*/
141+
private initReleaseReferrerListener(): void {
142+
143+
this.router.events.pipe(
144+
filter(evt => evt instanceof NavigationEnd),
145+
filter(evt => (evt as NavigationEnd).url.indexOf("releases") === -1),
146+
takeUntil(this.ngDestroy$)
147+
).subscribe(() => {
148+
this.store.dispatch(new ClearReleaseReferrerAction());
149+
});
150+
}
151+
135152
/**
136153
* Determine the current selected tab.
137154
*
@@ -268,6 +285,7 @@ export class AppComponent implements OnInit, OnDestroy {
268285
this.setAppStateFromURL();
269286
this.systemCheck();
270287
this.loadReleaseData();
288+
this.initReleaseReferrerListener();
271289

272290
this.config$ = this.store.pipe(
273291
select(selectConfigConfig),

spa/src/app/files/_ngrx/release/clear-release-referrer.action.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
* Human Cell Atlas
33
* https://www.humancellatlas.org/
44
*
5-
* Action triggered when release list page referrer indicator should be cleared.
5+
* Action triggered when release list page referrer indicator should be cleared. The release list page referrer is used
6+
* by the project detail page to determine where the back button should navigate to; the release page if the release
7+
* referrer is set, otherwise the project detail tab.
68
*/
79

810
// Core dependencies

spa/src/app/files/project-detail/project-detail.component.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { filter, map, take } from "rxjs/operators";
1616

1717
// App dependencies
1818
import { selectSelectedProject } from "../_ngrx/file.selectors";
19-
import { ClearReleaseReferrerAction } from "../_ngrx/release/clear-release-referrer.action";
2019
import {
2120
selectReleaseByProjectId,
2221
selectReleaseReferrer
@@ -138,9 +137,7 @@ export class ProjectDetailComponent {
138137
* indicating this project detail component should return the release page (if necessary).
139138
*/
140139
public ngOnDestroy() {
141-
142140
this.store.dispatch(new ClearSelectedProjectAction());
143-
this.store.dispatch(new ClearReleaseReferrerAction());
144141
}
145142

146143
/**

spa/src/app/files/releases/2020-march/2020-03-release.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{
1818
"type": "ANNOTATED_CLUSTERS",
1919
"extension": "loom",
20-
"url": "2020-Mar-Atlas-Adult-Retina-10x.annotated_v1.loom"
20+
"url": "2020-Mar-Atlas-Adult-Retina-10x_annotated_v1.loom"
2121
},
2222
{
2323
"type": "DIFFERENTIAL_EXPRESSION",
@@ -67,7 +67,7 @@
6767
{
6868
"type": "ANNOTATED_CLUSTERS",
6969
"extension": "loom",
70-
"url": "2020-Mar-InterOrganoid-Adult-Brain-10x.annotated_v1.loom"
70+
"url": "2020-Mar-InterOrganoid-Adult-Brain-10x_annotated_v1.loom"
7171
},
7272
{
7373
"type": "DIFFERENTIAL_EXPRESSION",
@@ -117,7 +117,7 @@
117117
{
118118
"type": "ANNOTATED_CLUSTERS",
119119
"extension": "loom",
120-
"url": "2020-Mar-Diff-Fetal-Neuron-SS2.annotated_v1.loom"
120+
"url": "2020-Mar-Diff-Fetal-Neuron-SS2_annotated_v1.loom"
121121
},
122122
{
123123
"type": "DIFFERENTIAL_EXPRESSION",
@@ -167,7 +167,7 @@
167167
{
168168
"type": "ANNOTATED_CLUSTERS",
169169
"extension": "loom",
170-
"url": "2020-Mar-SpatioTemporal-Fetal-Kidney-10x.annotated_v1.loom"
170+
"url": "2020-Mar-SpatioTemporal-Fetal-Kidney-10x_annotated_v1.loom"
171171
},
172172
{
173173
"type": "DIFFERENTIAL_EXPRESSION",
@@ -211,7 +211,7 @@
211211
{
212212
"type": "ANNOTATED_CLUSTERS",
213213
"extension": "loom",
214-
"url": "2020-Mar-SpatioTemporal-Adult-Kidney-10x.annotated_v1.loom"
214+
"url": "2020-Mar-SpatioTemporal-Adult-Kidney-10x_annotated_v1.loom"
215215
},
216216
{
217217
"type": "DIFFERENTIAL_EXPRESSION",
@@ -261,7 +261,7 @@
261261
{
262262
"type": "ANNOTATED_CLUSTERS",
263263
"extension": "loom",
264-
"url": "2020-Mar-IBD-Adult-Colon-10.annotated_v1.loom"
264+
"url": "2020-Mar-IBD-Adult-Colon-10_annotated_v1.loom"
265265
},
266266
{
267267
"type": "DIFFERENTIAL_EXPRESSION",
@@ -311,7 +311,7 @@
311311
{
312312
"type": "ANNOTATED_CLUSTERS",
313313
"extension": "loom",
314-
"url": "2020-Mar-Reprogram-Embryo-Dendritic-10x.annotated_v1.loom"
314+
"url": "2020-Mar-Reprogram-Embryo-Dendritic-10x_annotated_v1.loom"
315315
},
316316
{
317317
"type": "DIFFERENTIAL_EXPRESSION",
@@ -361,7 +361,7 @@
361361
{
362362
"type": "ANNOTATED_CLUSTERS",
363363
"extension": "loom",
364-
"url": "2020-Mar-Landscape-Adult-Liver-10x.annotated_v1.loom"
364+
"url": "2020-Mar-Landscape-Adult-Liver-10x_annotated_v1.loom"
365365
},
366366
{
367367
"type": "DIFFERENTIAL_EXPRESSION",
@@ -411,7 +411,7 @@
411411
{
412412
"type": "ANNOTATED_CLUSTERS",
413413
"extension": "loom",
414-
"url": "2020-Mar-Profiling-Adult-BoneMarrow-10x.annotated_v1.loom"
414+
"url": "2020-Mar-Profiling-Adult-BoneMarrow-10x_annotated_v1.loom"
415415
},
416416
{
417417
"type": "DIFFERENTIAL_EXPRESSION",
@@ -461,7 +461,7 @@
461461
{
462462
"type": "ANNOTATED_CLUSTERS",
463463
"extension": "loom",
464-
"url": "2020-Mar-Somatic-Adult-Pancreas-SS2.annotated_v1.loom"
464+
"url": "2020-Mar-Somatic-Adult-Pancreas-SS2_annotated_v1.loom"
465465
},
466466
{
467467
"type": "DIFFERENTIAL_EXPRESSION",
@@ -511,7 +511,7 @@
511511
{
512512
"type": "ANNOTATED_CLUSTERS",
513513
"extension": "loom",
514-
"url": "2020-Mar-Sensitivity-Adult-Spleen-10x.annotated_v1.loom"
514+
"url": "2020-Mar-Sensitivity-Adult-Spleen-10x_annotated_v1.loom"
515515
},
516516
{
517517
"type": "DIFFERENTIAL_EXPRESSION",
@@ -555,7 +555,7 @@
555555
{
556556
"type": "ANNOTATED_CLUSTERS",
557557
"extension": "loom",
558-
"url": "2020-Mar-Sensitivity-Adult-Esophagus-10x.annotated_v1.loom"
558+
"url": "2020-Mar-Sensitivity-Adult-Esophagus-10x_annotated_v1.loom"
559559
},
560560
{
561561
"type": "DIFFERENTIAL_EXPRESSION",
@@ -599,7 +599,7 @@
599599
{
600600
"type": "ANNOTATED_CLUSTERS",
601601
"extension": "loom",
602-
"url": "2020-Mar-Sensitivity-Adult-Lung-10x.annotated_v1.loom"
602+
"url": "2020-Mar-Sensitivity-Adult-Lung-10x_annotated_v1.loom"
603603
},
604604
{
605605
"type": "DIFFERENTIAL_EXPRESSION",
@@ -649,7 +649,7 @@
649649
{
650650
"type": "ANNOTATED_CLUSTERS",
651651
"extension": "loom",
652-
"url": "2020-Mar-Census-Adult-Blood-10x.annotated_v1.loom"
652+
"url": "2020-Mar-Census-Adult-Blood-10x_annotated_v1.loom"
653653
},
654654
{
655655
"type": "DIFFERENTIAL_EXPRESSION",
@@ -693,7 +693,7 @@
693693
{
694694
"type": "ANNOTATED_CLUSTERS",
695695
"extension": "loom",
696-
"url": "2020-Mar-Census-Adult-Immune-10x.annotated_v1.loom"
696+
"url": "2020-Mar-Census-Adult-Immune-10x_annotated_v1.loom"
697697
},
698698
{
699699
"type": "DIFFERENTIAL_EXPRESSION",
@@ -743,7 +743,7 @@
743743
{
744744
"type": "ANNOTATED_CLUSTERS",
745745
"extension": "loom",
746-
"url": "2020-Mar-FetalMaternal-Adult-Blood-10x.annotated_v1.loom"
746+
"url": "2020-Mar-FetalMaternal-Adult-Blood-10x_annotated_v1.loom"
747747
},
748748
{
749749
"type": "DIFFERENTIAL_EXPRESSION",
@@ -787,7 +787,7 @@
787787
{
788788
"type": "ANNOTATED_CLUSTERS",
789789
"extension": "loom",
790-
"url": "2020-Mar-FetalMaternal-Adult-Blood-SS2.annotated_v1.loom"
790+
"url": "2020-Mar-FetalMaternal-Adult-Blood-SS2_annotated_v1.loom"
791791
},
792792
{
793793
"type": "DIFFERENTIAL_EXPRESSION",
@@ -831,7 +831,7 @@
831831
{
832832
"type": "ANNOTATED_CLUSTERS",
833833
"extension": "loom",
834-
"url": "2020-Mar-FetalMaternal-Fetal-Placenta-10x.annotated_v1.loom"
834+
"url": "2020-Mar-FetalMaternal-Fetal-Placenta-10x_annotated_v1.loom"
835835
},
836836
{
837837
"type": "DIFFERENTIAL_EXPRESSION",
@@ -875,7 +875,7 @@
875875
{
876876
"type": "ANNOTATED_CLUSTERS",
877877
"extension": "loom",
878-
"url": "2020-Mar-FetalMaternal-Adult-Decidua-10x.annotated_v1.loom"
878+
"url": "2020-Mar-FetalMaternal-Adult-Decidua-10x_annotated_v1.loom"
879879
},
880880
{
881881
"type": "DIFFERENTIAL_EXPRESSION",
@@ -919,7 +919,7 @@
919919
{
920920
"type": "ANNOTATED_CLUSTERS",
921921
"extension": "loom",
922-
"url": "2020-Mar-FetalMaternal-Adult-Decidua-SS2.annotated_v1.loom"
922+
"url": "2020-Mar-FetalMaternal-Adult-Decidua-SS2_annotated_v1.loom"
923923
},
924924
{
925925
"type": "DIFFERENTIAL_EXPRESSION",
@@ -969,7 +969,7 @@
969969
{
970970
"type": "ANNOTATED_CLUSTERS",
971971
"extension": "loom",
972-
"url": "2020-Mar-Tcell-Adult-LymphNode-10x.annotated_v1.loom"
972+
"url": "2020-Mar-Tcell-Adult-LymphNode-10x_annotated_v1.loom"
973973
},
974974
{
975975
"type": "DIFFERENTIAL_EXPRESSION",
@@ -1013,7 +1013,7 @@
10131013
{
10141014
"type": "ANNOTATED_CLUSTERS",
10151015
"extension": "loom",
1016-
"url": "2020-Mar-Tcell-Adult-BoneMarrow-10x.annotated_v1.loom"
1016+
"url": "2020-Mar-Tcell-Adult-BoneMarrow-10x_annotated_v1.loom"
10171017
},
10181018
{
10191019
"type": "DIFFERENTIAL_EXPRESSION",
@@ -1057,7 +1057,7 @@
10571057
{
10581058
"type": "ANNOTATED_CLUSTERS",
10591059
"extension": "loom",
1060-
"url": "2020-Mar-Tcell-Adult-Lung-10x.annotated_v1.loom"
1060+
"url": "2020-Mar-Tcell-Adult-Lung-10x_annotated_v1.loom"
10611061
},
10621062
{
10631063
"type": "DIFFERENTIAL_EXPRESSION",
@@ -1101,7 +1101,7 @@
11011101
{
11021102
"type": "ANNOTATED_CLUSTERS",
11031103
"extension": "loom",
1104-
"url": "2020-Mar-Tcell-Adult-Blood-10x.annotated_v1.loom"
1104+
"url": "2020-Mar-Tcell-Adult-Blood-10x_annotated_v1.loom"
11051105
},
11061106
{
11071107
"type": "DIFFERENTIAL_EXPRESSION",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<ng-container *ngFor="let releaseFile of releaseFiles">
22
<div>
33
<div class="download-progress-indicator icon16">
4-
<a [href]="releaseFile.url" class="download-not-started icon16"></a>
4+
<a [href]="getReleaseFileUrl(releaseFile.url)" class="download-not-started icon16"></a>
55
</div>
66
<span class="fontsize-s">{{releaseFile.extension}}</span>
7-
<copy-to-clipboard [copyToClipboardLink]="releaseFile.url"></copy-to-clipboard>
7+
<copy-to-clipboard [copyToClipboardLink]="getReleaseFileUrl(releaseFile.url)"></copy-to-clipboard>
88
</div>
99
</ng-container>

spa/src/app/files/releases/release-file-download/release-file-download.component.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import { Component, Input } from "@angular/core";
1010

1111
// App dependencies
12+
import { ConfigService } from "../../../config/config.service";
1213
import { ReleaseFilesView } from "../release-files-view.model";
1314

1415
@Component({
@@ -20,4 +21,19 @@ export class ReleaseFileDownloadComponent {
2021

2122
// Inputs
2223
@Input() releaseFiles: ReleaseFilesView[];
24+
25+
/**
26+
* @param {ConfigService} configService
27+
*/
28+
constructor(private configService: ConfigService) {}
29+
30+
/**
31+
* Returns the full release file URL.
32+
*
33+
* @param {string} url
34+
*/
35+
public getReleaseFileUrl(url: string): string {
36+
37+
return `${this.configService.getProjectMetaURL()}/release-files/releases/2020-mar/${url}`;
38+
}
2339
}

spa/src/app/files/releases/release-file-type.model.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
*/
77

88
export enum ReleaseFileType {
9-
ANNOTATED_CLUSTERS = "Annotated Clusters",
10-
DIFFERENTIAL_EXPRESSION = "Differential Expression",
11-
FILTER = "Filter",
9+
ANNOTATED_CLUSTERS = "ANNOTATED_CLUSTERS",
10+
DIFFERENTIAL_EXPRESSION = "DIFFERENTIAL_EXPRESSION",
11+
FILTER = "FILTER",
1212
CSV = "CSV",
13-
PIPELINE_INPUT = "Pipeline Input"
13+
PIPELINE_INPUT = "PIPELINE_INPUT"
1414
}

spa/src/app/files/releases/release-file.model.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
* Model of a downloadable data file of a study, included in a project.
66
*/
77

8+
// App dependencies
9+
import { ReleaseFileType } from "./release-file-type.model";
10+
811
export interface ReleaseFile {
912

1013
extension: string;
11-
type: string;
14+
type: ReleaseFileType;
1215
url: string;
1316
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h5>{{releaseFileTitle}}</h5>
1+
<h5>{{getReleaseFileTitleDisplay(releaseFileTitle)}}</h5>
22
<p class="fontsize-xs">{{releaseFileParagraph}}
33
<learn-more></learn-more></p>
44
<release-file-download [releaseFiles]="releaseFiles"></release-file-download>

spa/src/app/files/releases/release-file/release-file.component.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Component, Input } from "@angular/core";
1010

1111
// App dependencies
1212
import { ReleaseFilesView } from "../release-files-view.model";
13+
import { ReleaseFileType } from "../release-file-type.model";
1314

1415
@Component({
1516
selector: "release-file",
@@ -22,4 +23,15 @@ export class ReleaseFileComponent {
2223
@Input() releaseFiles: ReleaseFilesView[];
2324
@Input() releaseFileParagraph: string;
2425
@Input() releaseFileTitle: string;
26+
27+
/**
28+
* Return the display view for the specifed file type.
29+
*
30+
* @param {ReleaseFileType} fileType
31+
* @returns {string}
32+
*/
33+
public getReleaseFileTitleDisplay(fileType: ReleaseFileType): string {
34+
35+
return ReleaseFileType[fileType].replace("_", " ");
36+
}
2537
}

0 commit comments

Comments
 (0)