Welcome to mirror list, hosted at ThFree Co, Russian Federation.

utils.js « job_details « ci « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4d06c241b4f3a76593bcd1f41ca2c93247ba0b6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
export const compactJobLog = (jobLog) => {
  const compactedLog = [];

  jobLog.forEach((obj) => {
    // push header section line
    if (obj.line && obj.isHeader) {
      compactedLog.push(obj.line);
    }

    // push lines within section header
    if (obj.lines?.length > 0) {
      compactedLog.push(...obj.lines);
    }

    // push lines from plain log
    if (!obj.lines && obj.content.length > 0) {
      compactedLog.push(obj);
    }
  });

  return compactedLog;
};

export const filterAnnotations = (annotations, type) => {
  return [...annotations]
    .sort((a, b) => a.name.localeCompare(b.name))
    .flatMap((annotationList) => annotationList.data)
    .flatMap((annotation) => annotation[type] ?? []);
};