Skip to content

Commit 881ef75

Browse files
committed
Don't render 0 if a result is falsy
1 parent 1d2a22a commit 881ef75

File tree

1 file changed

+36
-32
lines changed

1 file changed

+36
-32
lines changed

extensions/ql-vscode/src/view/variant-analysis/VariantAnalysisOutcomePanels.tsx

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,20 @@ export const VariantAnalysisOutcomePanels = ({
182182
</Badge>
183183
</TabHeader>
184184
)}
185-
{notFoundRepos?.repositoryCount && (
186-
<TabHeader>
187-
No access
188-
<Badge>{formatDecimal(notFoundRepos.repositoryCount)}</Badge>
189-
</TabHeader>
190-
)}
191-
{noCodeqlDbRepos?.repositoryCount && (
192-
<TabHeader>
193-
No database
194-
<Badge>{formatDecimal(noCodeqlDbRepos.repositoryCount)}</Badge>
195-
</TabHeader>
196-
)}
185+
{notFoundRepos?.repositoryCount !== undefined &&
186+
notFoundRepos?.repositoryCount > 0 && (
187+
<TabHeader>
188+
No access
189+
<Badge>{formatDecimal(notFoundRepos.repositoryCount)}</Badge>
190+
</TabHeader>
191+
)}
192+
{noCodeqlDbRepos?.repositoryCount !== undefined &&
193+
noCodeqlDbRepos?.repositoryCount > 0 && (
194+
<TabHeader>
195+
No database
196+
<Badge>{formatDecimal(noCodeqlDbRepos.repositoryCount)}</Badge>
197+
</TabHeader>
198+
)}
197199
{scannedReposCount > 0 && (
198200
<TabPanel>
199201
<VariantAnalysisAnalyzedRepos
@@ -207,26 +209,28 @@ export const VariantAnalysisOutcomePanels = ({
207209
/>
208210
</TabPanel>
209211
)}
210-
{notFoundRepos?.repositoryCount && (
211-
<TabPanel>
212-
<VariantAnalysisSkippedRepositoriesTab
213-
alertTitle="No access"
214-
alertMessage="The following repositories can't be analyzed because they don’t exist or you don’t have access."
215-
skippedRepositoryGroup={notFoundRepos}
216-
filterSortState={filterSortState}
217-
/>
218-
</TabPanel>
219-
)}
220-
{noCodeqlDbRepos?.repositoryCount && (
221-
<TabPanel>
222-
<VariantAnalysisSkippedRepositoriesTab
223-
alertTitle="No CodeQL database"
224-
alertMessage="The following repositories can't be analyzed because they don't currently have a CodeQL database available for the selected language."
225-
skippedRepositoryGroup={noCodeqlDbRepos}
226-
filterSortState={filterSortState}
227-
/>
228-
</TabPanel>
229-
)}
212+
{notFoundRepos?.repositoryCount !== undefined &&
213+
notFoundRepos?.repositoryCount > 0 && (
214+
<TabPanel>
215+
<VariantAnalysisSkippedRepositoriesTab
216+
alertTitle="No access"
217+
alertMessage="The following repositories can't be analyzed because they don’t exist or you don’t have access."
218+
skippedRepositoryGroup={notFoundRepos}
219+
filterSortState={filterSortState}
220+
/>
221+
</TabPanel>
222+
)}
223+
{noCodeqlDbRepos?.repositoryCount !== undefined &&
224+
noCodeqlDbRepos?.repositoryCount > 0 && (
225+
<TabPanel>
226+
<VariantAnalysisSkippedRepositoriesTab
227+
alertTitle="No CodeQL database"
228+
alertMessage="The following repositories can't be analyzed because they don't currently have a CodeQL database available for the selected language."
229+
skippedRepositoryGroup={noCodeqlDbRepos}
230+
filterSortState={filterSortState}
231+
/>
232+
</TabPanel>
233+
)}
230234
</Tabs>
231235
</>
232236
);

0 commit comments

Comments
 (0)