Skip to content

Commit

Permalink
fix: Add "View Logs" button to Manage Bot Run Dialog (#1152)
Browse files Browse the repository at this point in the history
* Add "View Logs" button to Manage Bot Run Dialog

* Remove superfluous aria-label
  • Loading branch information
stalgiag committed Jul 16, 2024
1 parent 78fab77 commit 6379fd0
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
27 changes: 27 additions & 0 deletions client/components/ManageBotRunDialog/ViewLogsButton/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Button } from 'react-bootstrap';

const ViewLogsButton = ({ externalLogsUrl }) => {
const onClick = () => {
window.open(externalLogsUrl, '_blank');
};

return (
<Button
disabled={!externalLogsUrl}
aria-disabled={!externalLogsUrl}
onClick={onClick}
role="link"
variant="secondary"
>
View Log
</Button>
);
};

ViewLogsButton.propTypes = {
externalLogsUrl: PropTypes.string
};

export default ViewLogsButton;
17 changes: 16 additions & 1 deletion client/components/ManageBotRunDialog/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import './ManageBotRunDialog.css';
import MarkBotRunFinishedButton from './MarkBotRunFinishedButton';
import RetryCanceledCollectionsButton from './RetryCanceledCollectionsButton';
import StopRunningCollectionButton from './StopRunningCollectionButton';
import ViewLogsButton from './ViewLogsButton';

const ManageBotRunDialog = ({
testPlanReportId,
Expand Down Expand Up @@ -78,6 +79,13 @@ const ManageBotRunDialog = ({
onChange
}
},
{
component: ViewLogsButton,
props: {
externalLogsUrl:
collectionJobQuery?.collectionJobByTestPlanRunId?.externalLogsUrl
}
},
{
component: StopRunningCollectionButton,
props: {
Expand Down Expand Up @@ -107,7 +115,14 @@ const ManageBotRunDialog = ({
}
}
];
}, [testPlanReportId, testPlanRun, possibleReassignees, onChange]);
}, [
testPlanReportId,
testPlanRun,
possibleReassignees,
onChange,
collectionJobQuery
]);

const deleteConfirmationContent = (
<>
<p>
Expand Down
1 change: 1 addition & 0 deletions client/components/ManageBotRunDialog/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const COLLECTION_JOB_ID_BY_TEST_PLAN_RUN_ID_QUERY = gql`
collectionJobByTestPlanRunId(testPlanRunId: $testPlanRunId) {
id
status
externalLogsUrl
}
}
`;
Expand Down

0 comments on commit 6379fd0

Please sign in to comment.