Skip to content

Commit

Permalink
Class View Search Case Fix (#2498)
Browse files Browse the repository at this point in the history
* search case fix

* auto lint fixes
  • Loading branch information
Advitya17 authored Jan 23, 2024
1 parent 4cd7c79 commit 01cb9d5
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion libs/core-ui/src/lib/util/getFeatureOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function getFeatureOptions(
return {
data: {
categoricalOptions: options,
fullLabel: meta.label.toLowerCase()
fullLabel: meta.label.toLocaleLowerCase()
},
key,
text: meta.abbridgedLabel
Expand Down
8 changes: 4 additions & 4 deletions libs/fairness/src/lib/Controls/Insights.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ export class Insights extends React.Component<IInsightsProps> {
// description of model with best performance
const insights3 = localization.formatString(
localization.Fairness.ModelComparison.insightsText3,
this.props.selectedMetric.title.toLowerCase(),
this.props.selectedMetric.title.toLocaleLowerCase(),
this.props.selectedMetric.isMinimization
? formattedMinPerformance
: formattedMaxPerformance,
this.props.selectedFairnessMetric.title.toLowerCase(),
this.props.selectedFairnessMetric.title.toLocaleLowerCase(),
FormatMetrics.formatNumbers(
this.props.fairnessArray[
this.props.selectedMetric.isMinimization
Expand All @@ -101,12 +101,12 @@ export class Insights extends React.Component<IInsightsProps> {
// description of model with best fairness metric value
const insights4 = localization.formatString(
localization.Fairness.ModelComparison.insightsText4,
this.props.selectedMetric.title.toLowerCase(),
this.props.selectedMetric.title.toLocaleLowerCase(),
FormatMetrics.formatNumbers(
this.props.performanceArray[minFairnessValueIndex],
this.props.selectedPerformanceKey
),
this.props.selectedFairnessMetric.title.toLowerCase(),
this.props.selectedFairnessMetric.title.toLocaleLowerCase(),
formattedMinFairnessValue
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class CohortToolBar extends React.Component<
public componentDidMount(): void {
const cohortNames: string[] = [];
this.props.cohorts.forEach((cohort: ErrorCohort) => {
cohortNames.push(cohort.cohort.name.toLowerCase());
cohortNames.push(cohort.cohort.name.toLocaleLowerCase());
});
const selectionCount: number = this.props.selectedIndices.length;
this.setState({ cohortNames, selectionCount });
Expand All @@ -72,7 +72,7 @@ export class CohortToolBar extends React.Component<
if (prevProps.cohorts !== this.props.cohorts) {
const cohortNames: string[] = [];
this.props.cohorts.forEach((cohort: ErrorCohort) => {
cohortNames.push(cohort.cohort.name.toLowerCase());
cohortNames.push(cohort.cohort.name.toLocaleLowerCase());
});
this.setState({ cohortNames });
}
Expand Down Expand Up @@ -180,7 +180,9 @@ export class CohortToolBar extends React.Component<
this.setState({
errorMessage: localization.InterpretVision.Cohort.errorNumSelected
});
} else if (this.state.cohortNames.includes(cohortName.toLowerCase())) {
} else if (
this.state.cohortNames.includes(cohortName.toLocaleLowerCase())
) {
this.setState({
errorMessage: localization.InterpretVision.Cohort.errorCohortName
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class ImageList extends React.Component<
}

private getFilteredItems(): IVisionListItem[] {
const searchValue = this.props.searchValue.toLowerCase();
const searchValue = this.props.searchValue.toLocaleLowerCase();
let filteredItems: IVisionListItem[] = this.props.items;
if (searchValue.length > 0) {
filteredItems = getFilteredDataFromSearch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class TableList extends React.Component<
this.props.searchValue !== prevProps.searchValue
) {
const filteredItems: IVisionListItem[] = this.getFilteredItems();
const searchVal = this.props.searchValue.toLowerCase();
const searchVal = this.props.searchValue.toLocaleLowerCase();
const groups: IGroup[] =
searchVal.length === 0
? this.getGroups()
Expand Down Expand Up @@ -118,7 +118,7 @@ export class TableList extends React.Component<

items = items.concat(this.props.successInstances);
items = items.concat(this.props.errorInstances);
const searchValue = this.props.searchValue.toLowerCase();
const searchValue = this.props.searchValue.toLocaleLowerCase();
if (searchValue.length === 0) {
return items;
}
Expand Down Expand Up @@ -155,7 +155,7 @@ export class TableList extends React.Component<
filteredItems: IVisionListItem[],
groups: IGroup[]
): IGroup[] {
const searchValue = this.props.searchValue.toLowerCase();
const searchValue = this.props.searchValue.toLocaleLowerCase();
if (searchValue.length === 0) {
return groups;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export function includesSearchVal(
searchVal: string
): boolean {
if (Array.isArray(labels)) {
return labels.some((label) => label.toLowerCase().includes(searchVal));
return labels.some((label) =>
label.toLocaleLowerCase().includes(searchVal.toLocaleLowerCase())
);
}
return labels.toLowerCase().includes(searchVal);
return labels.toLocaleLowerCase().includes(searchVal.toLocaleLowerCase());
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ export class CohortStatsHeatmap extends React.Component<
localization.ModelAssessment.ModelOverview
.tableMetricTooltip,
// make metric name lower case in sentence
this.series.xAxis.categories[this.point.x].toLowerCase(),
this.series.xAxis.categories[
this.point.x
].toLocaleLowerCase(),
cohortNameBold,
pointValue === null
? localization.ModelAssessment.ModelOverview.nA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class FairnessMetricTable extends React.Component<
: localization.ModelAssessment.ModelOverview
.tableRatioTooltip,
// make metric name lower case in sentence
this.series.xAxis.categories[point.x].toLowerCase(),
this.series.xAxis.categories[point.x].toLocaleLowerCase(),
pointValue,
min,
`<b>${point.minCohort}</b>`,
Expand Down

0 comments on commit 01cb9d5

Please sign in to comment.