-
-
-
-
+ {state.currentResource?.resourceType === RESOURCE_TYPES.GIT ? (
+ <>
+
+ >
+ ) : (
+ <>
+
+
+
+
+ >
+ )}
{state.occurrenceDetails && (
diff --git a/pages/api/utils/occurrence-utils.js b/pages/api/utils/occurrence-utils.js
index 96c93554..bbc7286f 100644
--- a/pages/api/utils/occurrence-utils.js
+++ b/pages/api/utils/occurrence-utils.js
@@ -128,6 +128,7 @@ const matchAndMapVulnerabilities = (occurrences) => {
if (!endScan) {
return {
+ uri: startScan.resource.uri,
name: startScan.name,
started: startScan.createTime,
completed: null,
@@ -139,6 +140,7 @@ const matchAndMapVulnerabilities = (occurrences) => {
}
return {
+ uri: startScan.resource.uri,
name: startScan.name,
started: startScan.createTime,
completed: endScan.createTime,
@@ -202,6 +204,7 @@ const mapBuilds = (occurrences, resourceUri) => {
return relatedBuildOccurrences.map((occ) => {
return {
+ uri: occ.resource.uri,
name: occ.name,
started: occ.build.provenance.startTime,
completed: occ.build.provenance.endTime,
@@ -217,6 +220,7 @@ const mapBuilds = (occurrences, resourceUri) => {
const mapDeployments = (occurrences) => {
return occurrences.map((occ) => {
return {
+ uri: occ.resource.uri,
name: occ.name,
deploymentStart: occ.deployment.deployment.deployTime,
deploymentEnd: occ.deployment.deployment.undeployTime,
diff --git a/styles/modules/OccurrenceDetails.module.scss b/styles/modules/OccurrenceDetails.module.scss
index 42cc731a..a6ab8905 100644
--- a/styles/modules/OccurrenceDetails.module.scss
+++ b/styles/modules/OccurrenceDetails.module.scss
@@ -103,6 +103,10 @@ $SIDE_SPACING: 1rem;
width: 97%;
margin: 0 0 0.25rem auto;
}
+
+ > p {
+ overflow-wrap: break-word;
+ }
}
.cardTitle {
diff --git a/styles/modules/Occurrences.module.scss b/styles/modules/Occurrences.module.scss
index 5ddf0803..dbed9060 100644
--- a/styles/modules/Occurrences.module.scss
+++ b/styles/modules/Occurrences.module.scss
@@ -83,6 +83,23 @@ $INDENTATION: 1rem;
}
}
+.occurrenceSection {
+ margin: 1rem auto;
+}
+
+.occurrenceSectionHeader {
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+ padding: 0.5rem;
+ font-size: 1.25rem;
+
+ > a {
+ display: block;
+ @include ellipsis(calc(100% - 1rem));
+ }
+}
+
.active {
border-bottom-width: 0;
border-left-width: 8px;
@@ -138,7 +155,7 @@ $INDENTATION: 1rem;
justify-content: flex-start;
margin-left: 1rem;
font-weight: 600;
- font-size: 1.5rem;
+ font-size: 1.25rem;
> p {
margin-left: 0.25rem;
@@ -155,6 +172,19 @@ $INDENTATION: 1rem;
color: $DT_SUB_TEXT;
}
+ .occurrenceSectionHeader {
+ color: $DT_MAIN_TEXT;
+ border-top-color: $ACCENT;
+ background-color: $DT_BACKGROUND_DARK;
+ svg {
+ color: $ACCENT;
+
+ &:hover {
+ color: $DT_HOVER_GREEN;
+ }
+ }
+ }
+
.previewContainer {
background-color: $DT_BACKGROUND_MEDIUM;
color: $DT_MAIN_TEXT;
@@ -182,6 +212,18 @@ $INDENTATION: 1rem;
color: $LT_SUB_TEXT;
}
+ .occurrenceSectionHeader {
+ color: $LT_MAIN_TEXT;
+ border-top-color: $ACCENT;
+ svg {
+ color: $ACCENT;
+
+ &:hover {
+ color: $LT_HOVER_GREEN;
+ }
+ }
+ }
+
.previewContainer {
background-color: $LT_BACKGROUND_LIGHT;
color: $LT_MAIN_TEXT;
diff --git a/styles/modules/Typography.module.scss b/styles/modules/Typography.module.scss
index 821ce295..5226128d 100644
--- a/styles/modules/Typography.module.scss
+++ b/styles/modules/Typography.module.scss
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+@import "styles/mixins";
@import "styles/constants";
.externalLink {
@@ -34,6 +35,7 @@
display: flex;
flex-direction: row;
width: fit-content;
+ @include ellipsis(100%);
}
.verticalLabelWithValueContainer {
diff --git a/test/components/occurrences/BuildOccurrenceSection.spec.js b/test/components/occurrences/BuildOccurrenceSection.spec.js
index 01716d81..ae702188 100644
--- a/test/components/occurrences/BuildOccurrenceSection.spec.js
+++ b/test/components/occurrences/BuildOccurrenceSection.spec.js
@@ -18,32 +18,20 @@ import React from "react";
import { render, screen } from "test/testing-utils/renderer";
import BuildOccurrenceSection from "components/occurrences/BuildOccurrenceSection";
import { createMockMappedBuildOccurrence } from "test/testing-utils/mocks";
-import { getResourceDetails, RESOURCE_TYPES } from "utils/resource-utils";
describe("BuildOccurrenceSection", () => {
- let occurrences, rerender;
+ let occurrences;
it("should return null if there are no relevant occurrences", () => {
occurrences = [];
- render(
-
- );
+ render();
expect(screen.queryByText(/build/i)).not.toBeInTheDocument();
});
describe("build occurrences exist", () => {
beforeEach(() => {
occurrences = chance.n(createMockMappedBuildOccurrence, chance.d4());
- const utils = render(
-
- );
- rerender = utils.rerender;
+ render();
});
it("should render the section title", () => {
@@ -80,29 +68,5 @@ describe("BuildOccurrenceSection", () => {
);
});
});
-
- it("should render the produced artifact if the build occurrence is representing a git resource", () => {
- rerender(
-
- );
-
- occurrences.forEach((occurrence, index) => {
- const renderedTimestamp = screen.queryAllByText(/^completed at/i);
- expect(renderedTimestamp).toHaveLength(occurrences.length);
- expect(renderedTimestamp[index]).toBeInTheDocument();
-
- const artifactVersions = occurrence.artifacts.map((artifact) => {
- const { resourceVersion } = getResourceDetails(artifact.id);
- return resourceVersion;
- });
-
- expect(
- screen.getByText(artifactVersions[0].substring(0, 12))
- ).toBeInTheDocument();
- });
- });
});
});