Skip to content

Commit

Permalink
OSCI-6572
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Stepanov <astepano@redhat.com>
  • Loading branch information
Andrei-Stepanov committed Mar 25, 2024
1 parent 567362c commit 502e6c9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/components/PageDetails/DetailsDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ export function DetailsDrawer(props: DetailsDrawerProps) {
</Text>
</TextContent>
);
const noteWidget = !_.isEmpty(selectedTest?.note) && (
<Alert isInline title="Note from CI system" variant="info">
{selectedTest?.note}
</Alert>
);
const shouldShowError =
selectedTest?.status === 'error' ||
(!_.isNil(selectedTest?.waiver) && selectedTest?.error);
Expand Down Expand Up @@ -304,6 +309,7 @@ export function DetailsDrawer(props: DetailsDrawerProps) {
</DrawerHead>
<DrawerPanelBody className="pf-v5-u-pb-sm">
{descriptionWidget}
{noteWidget}
{contactWidget}
{errorAlert}
{failedAlert}
Expand Down
11 changes: 10 additions & 1 deletion src/components/PageDetails/artifactTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ import {
isAChildBuildMsg,
getBrokerSchemaMsgBody,
} from '../../types';
import { getMessageError, isResultWaivable } from '../../utils/utils';
import {
getMessageError,
getMsgTestNote,
isResultWaivable,
} from '../../utils/utils';
import { mkStagesAndStates } from '../../utils/stages_states';

function transformUmbStatus(stateName: StateName): TestStatus {
Expand Down Expand Up @@ -242,6 +246,7 @@ function transformTest(
): CiTest {
const docsUrl = getDocsUrl(aChild);
let error: MSG_V_1.MsgErrorType | undefined;
let note: string | undefined;
let logsUrl: string | undefined;
let messageId: string | undefined;
const name = getTestcaseName(aChild);
Expand All @@ -263,13 +268,16 @@ function transformTest(
waiver = aChild.waiver;
} else if (isAChildTestMsg(aChild)) {
const testMsg = getTestMsgBody(aChild);
note = getMsgTestNote(testMsg);
error = getMessageError(testMsg);
logsUrl = testMsg.run.log;
messageId = getMsgId(aChild);
runDetailsUrl = testMsg.run.url;
} else if (isAChildGreenwaveAndTestMsg(aChild)) {
const msgBody = getTestMsgBody(aChild.ms);
const msgId = getMsgId(aChild.ms);
const testMsg = getTestMsgBody(aChild.ms);
note = getMsgTestNote(testMsg);
logsUrl = msgBody.run.log;
runDetailsUrl = msgBody.run.url;
error = getMessageError(msgBody);
Expand Down Expand Up @@ -306,6 +314,7 @@ function transformTest(

return {
name: name || 'unknown',
note,
error,
status,
waiver,
Expand Down
2 changes: 2 additions & 0 deletions src/components/PageDetails/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export interface CiContact {

export interface CiTest {
name: string;
/* https://pagure.io/fedora-ci/messages/blob/master/f/schemas/test-common.yaml#_71 */
note?: string;
error?: MSG_V_1.MsgErrorType;
status: TestStatus;
waiver?: GreenwaveWaiveType;
Expand Down
12 changes: 11 additions & 1 deletion src/utils/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of ciboard
* Copyright (c) 2021, 2022, 2023 Andrei Stepanov <astepano@redhat.com>
* Copyright (c) 2021, 2022, 2023, 2024 Andrei Stepanov <astepano@redhat.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -158,6 +158,16 @@ export const getMessageError = (brokerMsgBody: BrokerSchemaMsgBody) => {
}
};

export const getMsgTestNote = (brokerMsgBody: BrokerSchemaMsgBody) => {
let note: string | undefined;
if (MSG_V_0_1.isMsg(brokerMsgBody)) {
note = brokerMsgBody.note;
} else if (MSG_V_1.isMsg(brokerMsgBody)) {
note = brokerMsgBody.test.note;
}
return note;
};

export interface IconProps {
className: string;
icon: React.ComponentClass<SVGIconProps, any>;
Expand Down

0 comments on commit 502e6c9

Please sign in to comment.