• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CBIIT / crdc-datahub-ui / 18789341118

24 Oct 2025 06:57PM UTC coverage: 78.178% (+15.5%) from 62.703%
18789341118

push

github

web-flow
Merge pull request #888 from CBIIT/3.4.0

3.4.0 Release

4977 of 5488 branches covered (90.69%)

Branch coverage included in aggregate %.

8210 of 9264 new or added lines in 257 files covered. (88.62%)

6307 existing lines in 120 files now uncovered.

30203 of 39512 relevant lines covered (76.44%)

213.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.62
/src/classes/Excel/Instructions/InstructionsSection.ts
1
/* eslint-disable class-methods-use-this */
2
import type ExcelJS from "exceljs";
3

4
import { SectionBase, SectionCtxBase } from "../SectionBase";
1✔
5

6
import { COLUMNS, InstructionsKeys } from "./Columns";
1✔
7
import { CONTENT, LAYOUT } from "./Content";
1✔
8

9
// eslint-disable-next-line @typescript-eslint/ban-types
10
export type InstructionsDeps = {};
11

12
export class InstructionsSection extends SectionBase<InstructionsKeys, InstructionsDeps> {
1✔
13
  static SHEET_NAME = LAYOUT.sheetName;
1✔
14

15
  constructor(deps: InstructionsDeps = {}) {
1✔
16
    super({
1✔
17
      id: "Instructions",
1✔
18
      sheetName: InstructionsSection.SHEET_NAME,
1✔
19
      columns: COLUMNS,
1✔
20
      headerColor: "#FFFFFF",
1✔
21
      deps,
1✔
22
    });
1✔
23
  }
1✔
24

25
  protected create(ctx: SectionCtxBase): ExcelJS.Worksheet {
1✔
26
    const existing = ctx.workbook.worksheets.find(
1✔
27
      (ws) => ws.name === InstructionsSection.SHEET_NAME
1✔
28
    );
1✔
29
    if (existing) {
1!
NEW
30
      ctx.workbook.removeWorksheet(existing.id);
×
NEW
31
    }
×
32

33
    const ws = ctx.workbook.addWorksheet(InstructionsSection.SHEET_NAME, {
1✔
34
      views: [{ showGridLines: false }],
1✔
35
      pageSetup: { fitToPage: true, fitToWidth: 1, fitToHeight: 0, orientation: "portrait" },
1✔
36
    });
1✔
37

38
    ws.columns = [...COLUMNS];
1✔
39

40
    const r1 = ws.getRow(1);
1✔
41
    r1.hidden = true;
1✔
42
    r1.height = 4;
1✔
43

44
    const lastColumn = ws.getColumn("M");
1✔
45
    lastColumn.width = COLUMNS[0].width;
1✔
46

47
    return ws;
1✔
48
  }
1✔
49

50
  protected write(_ctx: SectionCtxBase, ws: ExcelJS.Worksheet): ExcelJS.Row[] {
1✔
51
    this.createTitle(_ctx, ws);
1✔
52
    this.createSpacing(_ctx, ws, LAYOUT.rows.spacing1, 40);
1✔
53
    this.createIntroSection(_ctx, ws);
1✔
54
    this.createGetStartedSection(_ctx, ws);
1✔
55
    this.createDependentCellsSection(_ctx, ws);
1✔
56
    this.createFAQSection(_ctx, ws);
1✔
57

58
    return [ws.getRow(LAYOUT.rows.title)];
1✔
59
  }
1✔
60

61
  private createTitle = (_ctx: SectionCtxBase, ws: ExcelJS.Worksheet) => {
1✔
62
    ws.mergeCells(`B${LAYOUT.rows.title}:M${LAYOUT.rows.title}`);
1✔
63
    const marginCell = ws.getCell(`A${LAYOUT.rows.title}`);
1✔
64
    const title = ws.getCell(`B${LAYOUT.rows.title}`);
1✔
65
    title.value = CONTENT.title;
1✔
66
    title.font = { bold: true, size: 26, color: { argb: "FFFFFFFF" } };
1✔
67
    title.alignment = { horizontal: "left", vertical: "middle" };
1✔
68
    title.fill = { type: "pattern", pattern: "solid", fgColor: { argb: "000000" } };
1✔
69
    marginCell.fill = { type: "pattern", pattern: "solid", fgColor: { argb: "000000" } };
1✔
70
    ws.getRow(LAYOUT.rows.title).height = 60;
1✔
71
  };
1✔
72

73
  private createSectionHeader = (
1✔
74
    _ctx: SectionCtxBase,
4✔
75
    ws: ExcelJS.Worksheet,
4✔
76
    row: number,
4✔
77
    text: string
4✔
78
  ) => {
4✔
79
    ws.mergeCells(`B${row}:L${row}`);
4✔
80
    const headerCell = ws.getCell(`B${row}`);
4✔
81
    headerCell.value = text;
4✔
82
    headerCell.font = { bold: true, size: 20, color: { argb: "FFFFFFFF" } };
4✔
83
    headerCell.alignment = { horizontal: "left", vertical: "middle", indent: 1 };
4✔
84
    headerCell.fill = { type: "pattern", pattern: "solid", fgColor: { argb: "627EB6" } };
4✔
85
    ws.getRow(row).height = 40;
4✔
86
  };
4✔
87

88
  private createIntroSection = (_ctx: SectionCtxBase, ws: ExcelJS.Worksheet) => {
1✔
89
    this.createSectionHeader(_ctx, ws, LAYOUT.rows.intro, CONTENT.sections.intro.title);
1✔
90

91
    const row = LAYOUT.rows.intro + 1;
1✔
92
    ws.mergeCells(`B${row}:L${row}`);
1✔
93
    const introCell = ws.getCell(`B${row}`);
1✔
94
    introCell.value = CONTENT.sections.intro.description;
1✔
95
    introCell.font = { size: 14, color: { argb: "000000" } };
1✔
96
    introCell.alignment = { horizontal: "left", vertical: "top", wrapText: true };
1✔
97
    ws.getRow(row).height = 60;
1✔
98
  };
1✔
99

100
  private createGetStartedSection = (_ctx: SectionCtxBase, ws: ExcelJS.Worksheet) => {
1✔
101
    this.createSectionHeader(_ctx, ws, LAYOUT.rows.getStarted, CONTENT.sections.getStarted.title);
1✔
102

103
    const row = LAYOUT.rows.getStarted + 1;
1✔
104
    ws.mergeCells(`B${row}:L${row}`);
1✔
105
    const introCell = ws.getCell(`B${row}`);
1✔
106
    introCell.value = CONTENT.sections.getStarted.description;
1✔
107
    introCell.font = { size: 14, color: { argb: "000000" } };
1✔
108
    introCell.alignment = { horizontal: "left", vertical: "top", wrapText: true };
1✔
109
    ws.getRow(row).height = 60;
1✔
110

111
    this.createGetStartedTable(_ctx, ws, row + 1);
1✔
112
  };
1✔
113

114
  private createDependentCellsSection = (_ctx: SectionCtxBase, ws: ExcelJS.Worksheet) => {
1✔
115
    this.createSectionHeader(
1✔
116
      _ctx,
1✔
117
      ws,
1✔
118
      LAYOUT.rows.dependentCells,
1✔
119
      CONTENT.sections.dependentCells.title
1✔
120
    );
1✔
121

122
    const [firstDescription, secondDescription, thirdDescription] =
1✔
123
      CONTENT.sections.dependentCells.descriptions;
1✔
124

125
    const row = LAYOUT.rows.dependentCells + 2;
1✔
126
    ws.mergeCells(`D${row}:L${row}`);
1✔
127
    const blockedCell = ws.getCell(`C${row}`);
1✔
128
    const textCell = ws.getCell(`D${row}`);
1✔
129
    textCell.value = firstDescription;
1✔
130
    textCell.font = { size: 14, color: { argb: "000000" } };
1✔
131
    textCell.alignment = { horizontal: "left", vertical: "top", wrapText: true, indent: 1 };
1✔
132
    blockedCell.fill = { type: "pattern", pattern: "solid", fgColor: { argb: "000000" } };
1✔
133

134
    ws.mergeCells(`D${row + 1}:L${row + 1}`);
1✔
135
    const textCell2 = ws.getCell(`D${row + 1}`);
1✔
136
    textCell2.value = secondDescription;
1✔
137
    textCell2.font = { size: 14, color: { argb: "000000" } };
1✔
138
    textCell2.alignment = { horizontal: "left", vertical: "top", wrapText: true, indent: 2 };
1✔
139

140
    ws.mergeCells(`D${row + 2}:L${row + 2}`);
1✔
141
    const textCell3 = ws.getCell(`D${row + 2}`);
1✔
142
    textCell3.value = thirdDescription;
1✔
143
    textCell3.font = { size: 14, color: { argb: "000000" } };
1✔
144
    textCell3.alignment = { horizontal: "left", vertical: "top", wrapText: true, indent: 2 };
1✔
145
  };
1✔
146

147
  private createFAQSection = (_ctx: SectionCtxBase, ws: ExcelJS.Worksheet) => {
1✔
148
    this.createSectionHeader(_ctx, ws, LAYOUT.rows.faq, CONTENT.sections.faq.title);
1✔
149

150
    const row = LAYOUT.rows.faq + 2;
1✔
151
    CONTENT.sections.faq.questions.forEach((q, i) => {
1✔
152
      this.createQuestion(ws, q.question, q.answer, row + i * 3, { rowHeight: q.rowHeight || 60 });
4!
153
    });
1✔
154
  };
1✔
155

156
  private createQuestion = (
1✔
157
    ws: ExcelJS.Worksheet,
4✔
158
    question: string,
4✔
159
    answer: string,
4✔
160
    startRow: number,
4✔
161
    opts?: { rowHeight?: number }
4✔
162
  ) => {
4✔
163
    ws.mergeCells(`B${startRow}:L${startRow}`);
4✔
164
    ws.mergeCells(`B${startRow + 1}:L${startRow + 1}`);
4✔
165
    const questionCell = ws.getCell(`B${startRow}`);
4✔
166
    const answerCell = ws.getCell(`B${startRow + 1}`);
4✔
167
    questionCell.value = question;
4✔
168
    questionCell.font = { size: 16, color: { argb: "000000" }, bold: true };
4✔
169
    questionCell.alignment = { horizontal: "left", vertical: "top", wrapText: true };
4✔
170

171
    answerCell.value = answer;
4✔
172
    answerCell.font = { size: 14, color: { argb: "000000" } };
4✔
173
    answerCell.alignment = { horizontal: "left", vertical: "top", wrapText: true, indent: 2 };
4✔
174
    ws.getRow(startRow + 1).height = opts?.rowHeight || 60;
4!
175
  };
4✔
176

177
  private createGetStartedTable = (
1✔
178
    _ctx: SectionCtxBase,
1✔
179
    ws: ExcelJS.Worksheet,
1✔
180
    startRow: number
1✔
181
  ) => {
1✔
182
    const rows = CONTENT.sections.getStarted.table.types.map((type, i) => [
1✔
183
      type,
3✔
184
      CONTENT.sections.getStarted.table.descriptions[i],
3✔
185
    ]);
1✔
186

187
    const cols = 2;
1✔
188

189
    rows.forEach((row, rowIndex) => {
1✔
190
      ws.mergeCells(`C${startRow + rowIndex}:D${startRow + rowIndex}`);
3✔
191
      ws.mergeCells(`E${startRow + rowIndex}:L${startRow + rowIndex}`);
3✔
192
      ws.getRow(startRow + rowIndex).height = 60;
3✔
193

194
      Array.from({ length: cols }).forEach((_, colIndex) => {
3✔
195
        const letter = colIndex === 0 ? "C" : "E";
6✔
196
        const cell = ws.getCell(`${letter}${startRow + rowIndex}`);
6✔
197
        cell.value = row[colIndex];
6✔
198
        cell.font = { size: 14, color: { argb: "000000" } };
6✔
199
        cell.alignment = { horizontal: "left", vertical: "middle", wrapText: true };
6✔
200

201
        const isLastRow = rowIndex === rows.length - 1;
6✔
202
        const isLastCol = colIndex === cols - 1;
6✔
203

204
        cell.border = {
6✔
205
          ...(isLastRow ? {} : { bottom: { style: "thin", color: { argb: "FFDDDDDD" } } }),
6✔
206
          ...(isLastCol ? {} : { right: { style: "thin", color: { argb: "FFDDDDDD" } } }),
6✔
207
        };
6✔
208
      });
3✔
209
    });
1✔
210
  };
1✔
211

212
  private createSpacing = (
1✔
213
    _ctx: SectionCtxBase,
1✔
214
    ws: ExcelJS.Worksheet,
1✔
215
    row: number,
1✔
216
    height: number
1✔
217
  ) => {
1✔
218
    const targetRow = ws.getRow(row);
1✔
219
    targetRow.height = height;
1✔
220
  };
1✔
221

222
  // eslint-disable-next-line @typescript-eslint/no-empty-function
223
  protected async applyValidation(_ctx: SectionCtxBase, _ws: ExcelJS.Worksheet): Promise<void> {}
1✔
224
}
1✔
225

226
export { COLUMNS as InstructionsColumns };
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc