Skip to content

Commit 667d70e

Browse files
Shyam NamboodiripadShyam Namboodiripad
authored andcommitted
Merged PR 49004: [9.4] [cherry-pick] Only display tags from the latest execution
Avoid displaying tags that are only present on previous runs since clicking on them filters out all the tests in the view. Tags from older runs also mess up the global tags display (since tags that are global to the latest execution are not considered global anymore unless they are all also present on older runs). Also includes fixes for some minor issues I noticed: * Avoid displaying the pointer (hand) cursor when hovering over controls that are not interactive (such as the global tags list and the section that displays historical trends for non-leaf nodes). * Make styling for some buttons more consistent.
1 parent 5cec925 commit 667d70e

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/components/App.tsx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
import { useState } from 'react';
5-
import { Settings28Regular, FilterDismissRegular, Dismiss20Regular, ArrowDownloadRegular } from '@fluentui/react-icons';
5+
import { Settings28Regular, FilterDismissRegular, DismissRegular, ArrowDownloadRegular } from '@fluentui/react-icons';
66
import { Button, Drawer, DrawerBody, DrawerHeader, DrawerHeaderTitle, Switch, Tooltip } from '@fluentui/react-components';
77
import { makeStyles } from '@fluentui/react-components';
88
import './App.css';
@@ -40,17 +40,6 @@ const useStyles = makeStyles({
4040
position: 'absolute',
4141
top: '1.5rem',
4242
right: '1rem',
43-
cursor: 'pointer',
44-
fontSize: '2rem',
45-
width: '28px',
46-
height: '28px',
47-
borderRadius: '6px',
48-
display: 'flex',
49-
alignItems: 'center',
50-
justifyContent: 'center',
51-
'&:hover': {
52-
backgroundColor: tokens.colorNeutralBackground4,
53-
},
5443
},
5544
switchLabel: { fontSize: '1rem', paddingTop: '1rem' },
5645
drawerBody: { paddingTop: '1rem' },
@@ -61,7 +50,7 @@ function App() {
6150
const { dataset, scoreSummary, selectedTags, clearFilters } = useReportContext();
6251
const [isSettingsOpen, setIsSettingsOpen] = useState(false);
6352
const { renderMarkdown, setRenderMarkdown } = useReportContext();
64-
const { globalTags, filterableTags } = categorizeAndSortTags(dataset);
53+
const { globalTags, filterableTags } = categorizeAndSortTags(dataset, scoreSummary.primaryResult.executionName);
6554

6655
const toggleSettings = () => setIsSettingsOpen(!isSettingsOpen);
6756
const closeSettings = () => setIsSettingsOpen(false);
@@ -122,7 +111,7 @@ function App() {
122111
<Drawer open={isSettingsOpen} onOpenChange={toggleSettings} position="end">
123112
<DrawerHeader>
124113
<DrawerHeaderTitle>Settings</DrawerHeaderTitle>
125-
<span className={classes.closeButton} onClick={closeSettings}><Dismiss20Regular /></span>
114+
<Button className={classes.closeButton} icon={<DismissRegular />} appearance="subtle" onClick={closeSettings} />
126115
</DrawerHeader>
127116
<DrawerBody className={classes.drawerBody}>
128117
<Switch

src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/components/ScoreNodeHistory.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const ScoreNodeHistory = () => {
9696
const historyData = calculateScoreNodeHistoryData(scoreSummary, summaryNode);
9797

9898
return (<div className={classes.section}>
99-
<div className={classes.sectionHeader}>
99+
<div className={classes.dismissableSectionHeader}>
100100
<Button icon={<DismissRegular />} appearance="subtle" onClick={() => selectScenarioLevel(selectedScenarioLevel)} />
101101
<h3 className={classes.sectionHeaderText}>Pass/Fail Trends for {summaryNode.name}</h3>
102102
</div>

src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/components/Styles.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export const useStyles = makeStyles({
4848
right: '0',
4949
maxWidth: '80rem',
5050
},
51+
dismissableSectionHeader: {
52+
display: 'flex',
53+
alignItems: 'center',
54+
},
5155
sectionHeader: {
5256
display: 'flex',
5357
alignItems: 'center',

src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/components/TagsDisplay.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ const useStyles = makeStyles({
4646
cursor: 'default',
4747
':hover': {
4848
backgroundColor: tokens.colorBrandBackground2,
49-
boxShadow: 'none'
49+
boxShadow: 'none',
50+
cursor: 'default'
5051
},
5152
'&.selected': {
5253
backgroundColor: tokens.colorBrandBackground2
@@ -56,14 +57,15 @@ const useStyles = makeStyles({
5657

5758
export type TagInfo = { tag: string; count: number };
5859

59-
export function categorizeAndSortTags(dataset: Dataset): {
60+
export function categorizeAndSortTags(dataset: Dataset, primaryExecutionName: string): {
6061
globalTags: TagInfo[];
6162
filterableTags: TagInfo[];
6263
} {
6364
const tagCounts = new Map<string, number>();
64-
const totalResults = dataset.scenarioRunResults.length;
65+
const primaryResults = dataset.scenarioRunResults.filter(result => result.executionName === primaryExecutionName);
66+
const totalResults = primaryResults.length;
6567

66-
dataset.scenarioRunResults.forEach(result => {
68+
primaryResults.forEach(result => {
6769
if (result.tags) {
6870
result.tags.forEach(tag => {
6971
const currentCount = tagCounts.get(tag) || 0;

0 commit comments

Comments
 (0)