Skip to content

Commit

Permalink
feat: removing Join to explore Red Hat TPA section if the source is t…
Browse files Browse the repository at this point in the history
…rustification (#340)

Signed-off-by: Olga Lavtar <[email protected]>
  • Loading branch information
olavtar authored Apr 25, 2024
1 parent 04a1e0e commit c432c3c
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public Map<String, Object> setVariables(
@Body Object report,
@ExchangeProperty(Constants.ANONYMOUS_ID_PROPERTY) String anonymousId,
@ExchangeProperty(Constants.RHDA_TOKEN_HEADER) String userId,
@ExchangeProperty(Constants.RHDA_SOURCE_HEADER) String rhdaSource,
@ExchangeProperty(Constants.PROVIDER_PRIVATE_DATA_PROPERTY) List<String> providerPrivateData)
throws JsonMappingException, JsonProcessingException, IOException {

Expand All @@ -87,6 +88,7 @@ public Map<String, Object> setVariables(
params.put("snykSignup", snykSignup);
params.put("cveIssueTemplate", cveIssuePathRegex);
params.put("imageMapping", getImageMapping());
params.put("rhdaSource", rhdaSource);
if (!disabled && writeKey.isPresent()) {
params.put("userId", userId);
params.put("anonymousId", anonymousId);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/freemarker/templates/generated/main.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ui/src/api/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface AppData {
userId?: string | null;
anonymousId?: string | null;
writeKey?: string | null;
rhdaSource?: string | null;
}

export interface ReportMap {
Expand Down
8 changes: 6 additions & 2 deletions ui/src/components/SummaryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {useAppContext} from "../App";

export const SummaryCard = ({report, isReportMap, purl}: { report: Report, isReportMap?: boolean, purl?: string }) => {
const appContext = useAppContext();
const gridItemMd = appContext.rhdaSource !== 'trustification' ? 6 : undefined;

return (
<Grid hasGutter>
<Title headingLevel="h3" size={TitleSizes['2xl']} style={{paddingLeft: '15px'}}>
Expand Down Expand Up @@ -79,7 +81,7 @@ export const SummaryCard = ({report, isReportMap, purl}: { report: Report, isRep
<Divider/>
</Card>
</GridItem>
<GridItem md={6}>
<GridItem md={gridItemMd}>
<Card isFlat>
<DescriptionListGroup>
<CardTitle component="h4">
Expand Down Expand Up @@ -137,7 +139,8 @@ export const SummaryCard = ({report, isReportMap, purl}: { report: Report, isRep
</DescriptionListGroup>
</Card>&nbsp;
</GridItem>
<GridItem md={6}>
{appContext.rhdaSource !== 'trustification' && (
<GridItem md={6}>
<Card isFlat>
<DescriptionListGroup>
<CardTitle component="h4">
Expand Down Expand Up @@ -166,6 +169,7 @@ export const SummaryCard = ({report, isReportMap, purl}: { report: Report, isRep
</DescriptionListGroup>
</Card>&nbsp;
</GridItem>
)}
</Grid>
);
};
3 changes: 2 additions & 1 deletion ui/src/mocks/reportDocker.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -954,5 +954,6 @@ export const dockerReport: AppData = {
"]",
userId: 'testUser333',
anonymousId: null,
writeKey: ''
writeKey: '',
rhdaSource: 'trustification'
};
3 changes: 2 additions & 1 deletion ui/src/mocks/reportMixed.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7236,5 +7236,6 @@ export const reportMixed: AppData = {
"]",
userId: 'testUser003',
anonymousId: null,
writeKey: ''
writeKey: '',
rhdaSource: 'vscode'
};
4 changes: 4 additions & 0 deletions ui/src/mocks/reportWithError.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@ export const errorReport: AppData = {
" \"catalogUrl\": \"https://catalog.redhat.com/software/containers/ubi9/ubi-minimal/615bd9b4075b022acc111bf5?architecture=amd64&image=65a828e3cda4984705d45d26\"\n" +
" }\n" +
"]",
userId: 'testUser003',
anonymousId: null,
writeKey: '',
rhdaSource: 'vscode'
};
4 changes: 4 additions & 0 deletions ui/src/mocks/reportWithForbidden.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@ export const forbiddenReport: AppData = {
" \"catalogUrl\": \"https://catalog.redhat.com/software/containers/ubi9/ubi-minimal/615bd9b4075b022acc111bf5?architecture=amd64&image=65a828e3cda4984705d45d26\"\n" +
" }\n" +
"]",
userId: 'testUser003',
anonymousId: null,
writeKey: '',
rhdaSource: 'vscode'
};
4 changes: 4 additions & 0 deletions ui/src/mocks/reportWithToken.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,4 +449,8 @@ export const withTokenReport: AppData = {
" \"catalogUrl\": \"https://catalog.redhat.com/software/containers/ubi9/ubi-minimal/615bd9b4075b022acc111bf5?architecture=amd64&image=65a828e3cda4984705d45d26\"\n" +
" }\n" +
"]",
userId: 'testUser003',
anonymousId: null,
writeKey: '',
rhdaSource: 'vscode'
};
4 changes: 4 additions & 0 deletions ui/src/mocks/reportWithUnauthenticated.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,8 @@ export const unauthenticatedReport: AppData = {
" \"catalogUrl\": \"https://catalog.redhat.com/software/containers/ubi9/ubi-minimal/615bd9b4075b022acc111bf5?architecture=amd64&image=65a828e3cda4984705d45d26\"\n" +
" }\n" +
"]",
userId: 'testUser003',
anonymousId: null,
writeKey: '',
rhdaSource: 'vscode'
};
4 changes: 4 additions & 0 deletions ui/src/mocks/reportWithUnauthorized.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@ export const unauthorizedReport: AppData = {
" \"catalogUrl\": \"https://catalog.redhat.com/software/containers/ubi9/ubi-minimal/615bd9b4075b022acc111bf5?architecture=amd64&image=65a828e3cda4984705d45d26\"\n" +
" }\n" +
"]",
userId: 'testUser003',
anonymousId: null,
writeKey: '',
rhdaSource: 'vscode'
};
4 changes: 4 additions & 0 deletions ui/src/mocks/reportWithoutToken.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,4 +397,8 @@ export const withoutTokenReport: AppData = {
" \"catalogUrl\": \"https://catalog.redhat.com/software/containers/ubi9/ubi-minimal/615bd9b4075b022acc111bf5?architecture=amd64&image=65a828e3cda4984705d45d26\"\n" +
" }\n" +
"]",
userId: 'testUser003',
anonymousId: null,
writeKey: '',
rhdaSource: 'vscode'
};

0 comments on commit c432c3c

Please sign in to comment.