Copilot commented on code in PR #34330: URL: https://github.com/apache/superset/pull/34330#discussion_r2237947453
########## superset-frontend/packages/superset-ui-chart-controls/src/types.ts: ########## @@ -458,6 +458,10 @@ export enum Comparator { BetweenOrEqual = '≤ x ≤', BetweenOrLeftEqual = '≤ x <', BetweenOrRightEqual = '< x ≤', + BeginsWith = 'begins with', + EndsWith = 'ends with', + Containg = 'containing', Review Comment: There is a spelling error in the enum name. 'Containg' should be 'Containing'. ```suggestion Containing = 'containing', ``` ########## superset-frontend/packages/superset-ui-chart-controls/src/utils/getColorFormatters.ts: ########## @@ -168,6 +188,38 @@ export const getColorFunction = ( ? { cutoffValue: targetValueLeft!, extremeValue: targetValueRight! } : false; break; + case Comparator.BeginsWith: + comparatorFunction = (value: string) => + typeof value === 'string' && + value?.startsWith(targetValue as unknown as string) + ? { cutoffValue: targetValue!, extremeValue: targetValue! } + : false; + break; + case Comparator.EndsWith: + comparatorFunction = (value: string) => + typeof value === 'string' && + value?.endsWith(targetValue as unknown as string) + ? { cutoffValue: targetValue!, extremeValue: targetValue! } + : false; + break; + case Comparator.Containg: Review Comment: There is a spelling error in the case statement. 'Containg' should be 'Containing' to match the corrected enum name. ```suggestion case Comparator.Containing: ``` ########## superset-frontend/src/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.tsx: ########## @@ -70,6 +81,15 @@ const operatorOptions = [ { value: Comparator.BetweenOrRightEqual, label: '< x ≤' }, ]; +const stringOperatorOptions = [ + { value: Comparator.None, label: t('None') }, + { value: Comparator.Equal, label: '=' }, + { value: Comparator.BeginsWith, label: t('begins with') }, + { value: Comparator.EndsWith, label: t('ends with') }, + { value: Comparator.Containg, label: t('containing') }, Review Comment: There is a spelling error in the comparator reference. 'Containg' should be 'Containing' to match the corrected enum name. ```suggestion { value: Comparator.Containing, label: t('containing') }, ``` ########## superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx: ########## @@ -705,11 +705,12 @@ const config: ControlPanelConfig = { (colname: string, index: number) => coltypes[index] === GenericDataType.Numeric, ) - .map((colname: string) => ({ + .map((colname: string, index: number) => ({ value: colname, label: Array.isArray(verboseMap) ? colname : (verboseMap[colname] ?? colname), + dataType: coltypes[index], Review Comment: The index used for dataType is from the filtered array, but should correspond to the original array position. This will result in incorrect dataType mapping since the filter changes the indices. ########## superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/controlPanel.ts: ########## @@ -104,12 +104,13 @@ export default { (_: string, index: number) => coltypes[index] === GenericDataType.Numeric, ) - .map((colname: string | number) => ({ + .map((colname: string | number, index: number) => ({ value: colname, label: (Array.isArray(verboseMap) ? verboseMap[colname as number] : verboseMap[colname as string]) ?? colname, + dataType: coltypes[index], Review Comment: The index used for dataType is from the filtered array, but should correspond to the original array position. This will result in incorrect dataType mapping since the filter changes the indices. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org