Skip to content

Commit 7819360

Browse files
Add "No issues" panel when diagnostics does not find any issues with a workflow (#959)
* Move diagnostics layout components around to support error/info panels * Add info panel that shows up if Workflow Diagnostics returns no issues
1 parent 6cfecb0 commit 7819360

File tree

7 files changed

+58
-36
lines changed

7 files changed

+58
-36
lines changed

src/assets/circle-check.svg

Lines changed: 12 additions & 0 deletions
Loading
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
1-
import { styled as createStyled } from 'baseui';
1+
import { styled as createStyled, withStyle } from 'baseui';
22
import { type Theme } from 'baseui/theme';
33

4+
import PageSection from '@/components/page-section/page-section';
5+
46
export const styled = {
57
ButtonsContainer: createStyled('div', ({ $theme }: { $theme: Theme }) => ({
68
display: 'flex',
79
justifyContent: 'space-between',
810
gap: $theme.sizing.scale300,
911
})),
12+
PageSection: withStyle(PageSection, ({ $theme }: { $theme: Theme }) => ({
13+
display: 'flex',
14+
flexDirection: 'column',
15+
gap: $theme.sizing.scale800,
16+
})),
17+
NoIssuesContainer: createStyled('div', ({ $theme }: { $theme: Theme }) => ({
18+
flex: 1,
19+
display: 'flex',
20+
flexDirection: 'column',
21+
alignItems: 'center',
22+
justifyContent: 'center',
23+
gap: $theme.sizing.scale600,
24+
padding: `${$theme.sizing.scale900} ${$theme.sizing.scale600}`,
25+
})),
26+
NoIssuesText: createStyled('div', ({ $theme }: { $theme: Theme }) => ({
27+
...$theme.typography.HeadingXSmall,
28+
})),
1029
};

src/views/workflow-diagnostics/workflow-diagnostics-content/workflow-diagnostics-content.tsx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
import React, { useMemo, useState } from 'react';
44

5+
import Image from 'next/image';
6+
7+
import circleCheck from '@/assets/circle-check.svg';
8+
import PanelSection from '@/components/panel-section/panel-section';
9+
510
import WorkflowDiagnosticsJson from '../workflow-diagnostics-json/workflow-diagnostics-json';
611
import WorkflowDiagnosticsList from '../workflow-diagnostics-list/workflow-diagnostics-list';
712
import WorkflowDiagnosticsViewToggle from '../workflow-diagnostics-view-toggle/workflow-diagnostics-view-toggle';
@@ -19,7 +24,7 @@ export default function WorkflowDiagnosticsContent({
1924
}: Props) {
2025
const [activeView, setActiveView] = useState<DiagnosticsViewMode>('list');
2126

22-
const issuesGroupsWithEntries: Array<string> = useMemo(
27+
const nonEmptyIssueGroups: Array<string> = useMemo(
2328
() =>
2429
Object.entries(diagnosticsResult.DiagnosticsResult)
2530
.map(([name, issuesGroup]) => {
@@ -31,13 +36,21 @@ export default function WorkflowDiagnosticsContent({
3136
[diagnosticsResult.DiagnosticsResult]
3237
);
3338

34-
if (issuesGroupsWithEntries.length === 0) {
35-
// TODO: Add a No Issues Found panel
36-
return <div>No issues found with this workflow</div>;
39+
if (nonEmptyIssueGroups.length === 0) {
40+
return (
41+
<PanelSection>
42+
<styled.NoIssuesContainer>
43+
<Image width={64} height={64} alt="No issues" src={circleCheck} />
44+
<styled.NoIssuesText>
45+
No issues found with this workflow
46+
</styled.NoIssuesText>
47+
</styled.NoIssuesContainer>
48+
</PanelSection>
49+
);
3750
}
3851

3952
return (
40-
<>
53+
<styled.PageSection>
4154
<styled.ButtonsContainer>
4255
<WorkflowDiagnosticsViewToggle
4356
listEnabled
@@ -61,6 +74,6 @@ export default function WorkflowDiagnosticsContent({
6174
diagnosticsResult={diagnosticsResult}
6275
/>
6376
)}
64-
</>
77+
</styled.PageSection>
6578
);
6679
}

src/views/workflow-diagnostics/workflow-diagnostics-fallback/workflow-diagnostics-fallback.styles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ import { styled as contentStyledComponents } from '../workflow-diagnostics-conte
22

33
export const styled = {
44
ButtonsContainer: contentStyledComponents.ButtonsContainer,
5+
PageSection: contentStyledComponents.PageSection,
56
};

src/views/workflow-diagnostics/workflow-diagnostics-fallback/workflow-diagnostics-fallback.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function WorkflowDiagnosticsFallback({
1010
diagnosticsResult,
1111
}: Props) {
1212
return (
13-
<>
13+
<styled.PageSection>
1414
<styled.ButtonsContainer>
1515
<WorkflowDiagnosticsViewToggle listEnabled={false} />
1616
</styled.ButtonsContainer>
@@ -19,6 +19,6 @@ export default function WorkflowDiagnosticsFallback({
1919
runId={runId}
2020
diagnosticsResult={diagnosticsResult}
2121
/>
22-
</>
22+
</styled.PageSection>
2323
);
2424
}

src/views/workflow-diagnostics/workflow-diagnostics.styles.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/views/workflow-diagnostics/workflow-diagnostics.tsx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import workflowDiagnosticsDisabledErrorPanelConfig from './config/workflow-diagn
1313
import useDiagnoseWorkflow from './hooks/use-diagnose-workflow/use-diagnose-workflow';
1414
import WorkflowDiagnosticsContent from './workflow-diagnostics-content/workflow-diagnostics-content';
1515
import WorkflowDiagnosticsFallback from './workflow-diagnostics-fallback/workflow-diagnostics-fallback';
16-
import { styled } from './workflow-diagnostics.styles';
1716

1817
export default function WorkflowDiagnostics({
1918
params,
@@ -41,19 +40,9 @@ export default function WorkflowDiagnostics({
4140
throw error;
4241
}
4342

44-
return (
45-
<styled.PageSection>
46-
{data.parsingError ? (
47-
<WorkflowDiagnosticsFallback
48-
{...params}
49-
diagnosticsResult={data.result}
50-
/>
51-
) : (
52-
<WorkflowDiagnosticsContent
53-
{...params}
54-
diagnosticsResult={data.result}
55-
/>
56-
)}
57-
</styled.PageSection>
43+
return data.parsingError ? (
44+
<WorkflowDiagnosticsFallback {...params} diagnosticsResult={data.result} />
45+
) : (
46+
<WorkflowDiagnosticsContent {...params} diagnosticsResult={data.result} />
5847
);
5948
}

0 commit comments

Comments
 (0)