Skip to content

Commit 2d74706

Browse files
frano-mMillenniumFalconMechanic
authored andcommitted
Add facet to select secondary analysis workflow type. Third Pass. Resolves #548. (#896)
1 parent 9d5646b commit 2d74706

File tree

8 files changed

+122
-2538
lines changed

8 files changed

+122
-2538
lines changed

spa/src/app/files/hca-table-files/file-row-mapper.mock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ export const FILE_NULL_VALUES =
697697
"format": null,
698698
"name": null,
699699
"sha256": null,
700-
"size": null,
700+
"size": 148,
701701
"uuid": null,
702702
"version": null,
703703
"url": null

spa/src/app/files/hca-table-files/hca-table-files.component.spec.ts

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ describe("HCATableFilesComponent", () => {
5252

5353
const testStore = jasmine.createSpyObj("Store", ["pipe", "dispatch"]);
5454

55-
const ROW_INDEX_0 = 0;
56-
const ROW_INDEX_1 = 1;
57-
const ROW_INDEX_2 = 2;
58-
const ROW_INDEX_3 = 3;
55+
const INDEX_TABLE_ROW_SINGLE_VALUES = 0;
56+
const INDEX_TABLE_ROW_MULTIPLE_VALUES_SINGLE_OBJECT = 1;
57+
const INDEX_TABLE_ROW_EMPTY_ARRAY_VALUES = 3;
58+
const INDEX_TABLE_ROW_NULL_VALUES = 4;
5959

60-
const PROTOCOL_ARRAY_INDEX_0 = 0;
60+
const INDEX_PROTOCOL_OBJECT_0 = 0;
6161

62-
const WORKFLOW_COLUMN = "workflow";
62+
const COLUMN_NAME_WORKFLOW = "workflow";
6363

64-
const HCA_CONTENT_UNSPECIFIED_DASH_COMPONENT = "hca-content-unspecified-dash";
65-
const HCA_CONTENT_ELLIPSIS_COMPONENT = "hca-content-ellipsis";
64+
const COMPONENT_NAME_HCA_CONTENT_UNSPECIFIED_DASH = "hca-content-unspecified-dash";
65+
const COMPONENT_NAME_HCA_CONTENT_ELLIPSIS = "hca-content-ellipsis";
6666

6767
beforeEach(async(() => {
6868

@@ -253,7 +253,7 @@ describe("HCATableFilesComponent", () => {
253253

254254
fixture.detectChanges();
255255

256-
const columnHeaderDE = findHeader(WORKFLOW_COLUMN);
256+
const columnHeaderDE = findHeader(COLUMN_NAME_WORKFLOW);
257257

258258
// Confirm column "Analysis Protocol" is displayed
259259
expect(columnHeaderDE.nativeElement.innerText).toEqual("Analysis Protocol");
@@ -276,8 +276,8 @@ describe("HCATableFilesComponent", () => {
276276

277277
fixture.detectChanges();
278278

279-
// Confirm first row in column "Analysis Protocol" displays component
280-
expect(findColumnCellComponent(ROW_INDEX_0, WORKFLOW_COLUMN, HCA_CONTENT_UNSPECIFIED_DASH_COMPONENT)).not.toBe(null);
279+
// Confirm row with empty array values in column "Analysis Protocol" displays component
280+
expect(findColumnCellComponent(INDEX_TABLE_ROW_EMPTY_ARRAY_VALUES, COLUMN_NAME_WORKFLOW, COMPONENT_NAME_HCA_CONTENT_UNSPECIFIED_DASH)).not.toBe(null);
281281
});
282282

283283
/**
@@ -297,8 +297,8 @@ describe("HCATableFilesComponent", () => {
297297

298298
fixture.detectChanges();
299299

300-
// Confirm second row in column "Analysis Protocol" displays component
301-
expect(findColumnCellComponent(ROW_INDEX_1, WORKFLOW_COLUMN, HCA_CONTENT_UNSPECIFIED_DASH_COMPONENT)).not.toBe(null);
300+
// Confirm row with null values in column "Analysis Protocol" displays component
301+
expect(findColumnCellComponent(INDEX_TABLE_ROW_NULL_VALUES, COLUMN_NAME_WORKFLOW, COMPONENT_NAME_HCA_CONTENT_UNSPECIFIED_DASH)).not.toBe(null);
302302
});
303303

304304
/**
@@ -318,8 +318,8 @@ describe("HCATableFilesComponent", () => {
318318

319319
fixture.detectChanges();
320320

321-
// Confirm first row in column "Analysis Protocol" does not display component
322-
expect(findColumnCellComponent(ROW_INDEX_0, WORKFLOW_COLUMN, HCA_CONTENT_ELLIPSIS_COMPONENT)).toBe(null);
321+
// Confirm row with empty values in column "Analysis Protocol" does not display component
322+
expect(findColumnCellComponent(INDEX_TABLE_ROW_EMPTY_ARRAY_VALUES, COLUMN_NAME_WORKFLOW, COMPONENT_NAME_HCA_CONTENT_ELLIPSIS)).toBe(null);
323323
});
324324

325325
/**
@@ -339,8 +339,8 @@ describe("HCATableFilesComponent", () => {
339339

340340
fixture.detectChanges();
341341

342-
// Confirm second row in column "Analysis Protocol" does not display component
343-
expect(findColumnCellComponent(ROW_INDEX_1, WORKFLOW_COLUMN, HCA_CONTENT_ELLIPSIS_COMPONENT)).toBe(null);
342+
// Confirm row with null values in column "Analysis Protocol" does not display component
343+
expect(findColumnCellComponent(INDEX_TABLE_ROW_NULL_VALUES, COLUMN_NAME_WORKFLOW, COMPONENT_NAME_HCA_CONTENT_ELLIPSIS)).toBe(null);
344344
});
345345

346346
/**
@@ -360,10 +360,10 @@ describe("HCATableFilesComponent", () => {
360360

361361
fixture.detectChanges();
362362

363-
const columnRowDE = findColumnCells(WORKFLOW_COLUMN)[ROW_INDEX_2];
363+
const columnRowDE = findColumnCells(COLUMN_NAME_WORKFLOW)[INDEX_TABLE_ROW_SINGLE_VALUES];
364364

365-
// Confirm third row in column "Analysis Protocol" displays a single value
366-
expect(columnRowDE.nativeElement.innerText).toEqual(FILES_TABLE_MODEL.data[ROW_INDEX_2].protocols[PROTOCOL_ARRAY_INDEX_0].workflow.join(", "));
365+
// Confirm row with single values in column "Analysis Protocol" displays a single value
366+
expect(columnRowDE.nativeElement.innerText).toEqual(FILES_TABLE_MODEL.data[INDEX_TABLE_ROW_SINGLE_VALUES].protocols[INDEX_PROTOCOL_OBJECT_0].workflow.join(", "));
367367
});
368368

369369
/**
@@ -383,10 +383,10 @@ describe("HCATableFilesComponent", () => {
383383

384384
fixture.detectChanges();
385385

386-
const columnRowDE = findColumnCells(WORKFLOW_COLUMN)[ROW_INDEX_3];
386+
const columnRowDE = findColumnCells(COLUMN_NAME_WORKFLOW)[INDEX_TABLE_ROW_MULTIPLE_VALUES_SINGLE_OBJECT];
387387

388-
// Confirm fourth row in column "Analysis Protocol" displays multiple string value
389-
expect(columnRowDE.nativeElement.innerText).toEqual(FILES_TABLE_MODEL.data[ROW_INDEX_3].protocols[PROTOCOL_ARRAY_INDEX_0].workflow.join(", "));
388+
// Confirm row with multiple string values in column "Analysis Protocol" displays multiple string value
389+
expect(columnRowDE.nativeElement.innerText).toEqual(FILES_TABLE_MODEL.data[INDEX_TABLE_ROW_MULTIPLE_VALUES_SINGLE_OBJECT].protocols[INDEX_PROTOCOL_OBJECT_0].workflow.join(", "));
390390
});
391391

392392
/**
@@ -406,8 +406,8 @@ describe("HCATableFilesComponent", () => {
406406

407407
fixture.detectChanges();
408408

409-
// Confirm third row in column "Analysis Protocol" does not display component
410-
expect(findColumnCellComponent(ROW_INDEX_2, WORKFLOW_COLUMN, HCA_CONTENT_UNSPECIFIED_DASH_COMPONENT)).toBe(null);
409+
// Confirm row with single values in column "Analysis Protocol" does not display component
410+
expect(findColumnCellComponent(INDEX_TABLE_ROW_SINGLE_VALUES, COLUMN_NAME_WORKFLOW, COMPONENT_NAME_HCA_CONTENT_UNSPECIFIED_DASH)).toBe(null);
411411
});
412412

413413
/**
@@ -435,6 +435,10 @@ describe("HCATableFilesComponent", () => {
435435

436436
const columnRowDE = findColumnCells(columnName)[rowIndex];
437437

438+
if ( !columnRowDE ) {
439+
return null;
440+
}
441+
438442
return columnRowDE.nativeElement.querySelector(componentName);
439443
}
440444

spa/src/app/files/hca-table-files/hca-table-files.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class HCATableFilesComponent implements OnInit, AfterViewInit {
102102
*/
103103
public getFileDownloadClass(tableData: string): { [className: string]: boolean } {
104104

105-
if ( tableData.indexOf(" ") == -1 ) {
105+
if ( tableData && tableData.indexOf(" ") == -1 ) {
106106
return {
107107
"file-download": true,
108108
truncate: true

0 commit comments

Comments
 (0)