Skip to content

Commit

Permalink
feat: trial warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Nov 6, 2023
1 parent 7bb73dd commit 7e5b718
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/components/Deployments/StyledDeployments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ export const StyledDeployments = styled.div`
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
}
.warning {
width: 15px;
}
.status {
@media ${bp.xs_smallOnly} {
margin-left: 20px;
Expand Down
3 changes: 3 additions & 0 deletions src/components/Deployments/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ const Deployments: FC<DeploymentsProps> = ({ deployments, environmentSlug, proje
{!['complete', 'cancelled', 'failed'].includes(deployment.status) && deployment.buildStep && (
<HoverTag text={deployment.buildStep} maxWidth="160px" tooltipPosition="top" />
)}
{['deployCompletedWithWarnings'].includes(deployment.buildStep) && deployment.buildStep && (
<img className='warning' src='/static/images/logs2microsoftteams/warning.png'></img>
)}
</div>
<div className="duration">{getDeploymentDuration(deployment)} </div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/components/LogViewer/LogAccordion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
import { StyledLogAccordion } from '../StyledLogViewer';

const LogAccordion = forwardRef(
({ children, onToggle, header, className = '', defaultValue = false, metadata = '' }, ref) => {
({ children, onToggle, header, className = '', defaultValue = false, metadata = ['', false] }, ref) => {
const logsTopRef = useRef(null);
const logsEndRef = useRef(null);
const [visibility, setVisibility] = useState(defaultValue);
Expand All @@ -30,14 +30,14 @@ const LogAccordion = forwardRef(
return (
<StyledLogAccordion className={className}>
<div
className={`accordion-heading`}
className={metadata[1] == true ? `accordion-heading accordion-heading-warning` : `accordion-heading`}
onClick={e => {
setVisibility(!visibility);
if (onToggle) onToggle(!visibility);
}}
>
<div key="1" className={'log-header' + (visibility ? ' visible' : '')}>
{header} {metadata.length > 0 ? '(' + metadata + ')' : ''}
<div key="1" className={'log-header' + (metadata[1] == true ? ' log-warning-state' : '') + (visibility ? ' visible' : '')}>
{metadata[1] == true ? (<img className='warning' src='/static/images/logs2microsoftteams/warning.png'></img>): ''}{header} {metadata[0].length > 0 ? '(' + metadata[0] + ')' : ''}
</div>
</div>
<div ref={logsTopRef} />
Expand Down
20 changes: 20 additions & 0 deletions src/components/LogViewer/StyledLogViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,24 @@ export const StyledLogAccordion = styled.div`
}
}
}
&.data-row {
.accordion-heading {
.log-warning-state {
::before {
color: #000000;
background-color: #ffbe00;
}
}
}
}
&.data-row {
.accordion-heading-warning {
color: #000000;
background-color: #c59c26;
.warning {
width: 14px;
margin-right: 10px;
}
}
}
`;
10 changes: 7 additions & 3 deletions src/components/LogViewer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const logPreprocessorProcessParse = (tokens, sectionMetadata) => {
case 'section-opener':
let metadataForSection = sectionMetadata.get(tokens[i].details.trim());
if (metadataForSection == undefined) {
metadataForSection = '';
metadataForSection = ['', false]
}

let node = {
Expand Down Expand Up @@ -167,11 +167,15 @@ const logPreprocessorExtractSectionEndDetails = logs => {
let stepName = tokens[i].trim();
i++;
let stepDetails = tokens[i].trim();

if (stepName != '' && stepDetails != '') {
let durationArray = stepDetails.match(durationRegexp);
let hasWarnings = false
if (stepDetails.match(/.* WithWarnings$/)) {
hasWarnings = true
}
let payload = [`Duration: ${durationArray[1]}`, hasWarnings]
if (durationArray.length == 2) {
ret.set(stepName, `Duration: ${durationArray[1]}`);
ret.set(stepName, payload);
}
}
}
Expand Down

0 comments on commit 7e5b718

Please sign in to comment.