- 
                Notifications
    
You must be signed in to change notification settings  - Fork 4.5k
 
[Dashboards] - Min Max range on secondary axis bar charts #15118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from 14 commits
      Commits
    
    
            Show all changes
          
          
            29 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      9882c6b
              
                done
              
              
                ehconitin bff3f99
              
                range should be only for numeric values, like omit null values
              
              
                ehconitin 808832c
              
                improve input
              
              
                ehconitin 4a5db13
              
                validate range max min and make groupby resolver service changes more…
              
              
                ehconitin ddb770b
              
                grep
              
              
                ehconitin a9c02d6
              
                update snapshot
              
              
                ehconitin 5031066
              
                fix
              
              
                ehconitin 27f2475
              
                fix
              
              
                ehconitin 871e2ea
              
                improve
              
              
                ehconitin 549b184
              
                nit
              
              
                ehconitin 58ab7f0
              
                macros adjust
              
              
                ehconitin a62ce9b
              
                figma
              
              
                ehconitin 3f46f4a
              
                Merge remote-tracking branch 'upstream/main' into min-max-range-clean
              
              
                ehconitin 138d3e7
              
                improve
              
              
                ehconitin f94c950
              
                new plan
              
              
                ehconitin eca043b
              
                continuew
              
              
                ehconitin 0983d71
              
                Merge remote-tracking branch 'upstream/main' into min-max-range-clean
              
              
                ehconitin dbe0da7
              
                fix
              
              
                ehconitin 9512d6d
              
                improve
              
              
                ehconitin 7d9df2c
              
                match figma
              
              
                ehconitin adf8d1c
              
                Merge remote-tracking branch 'upstream/main' into min-max-range-clean
              
              
                ehconitin e36a07f
              
                Merge remote-tracking branch 'upstream/main' into min-max-range-clean
              
              
                ehconitin 5d8295c
              
                refact
              
              
                ehconitin eaf6f06
              
                Merge remote-tracking branch 'upstream/main' into min-max-range-clean
              
              
                ehconitin 40fe7fc
              
                Merge branch 'main' into min-max-range
              
              
                charlesBochet 828d689
              
                Merge branch 'main' into min-max-range
              
              
                charlesBochet 9bc5100
              
                Fixes
              
              
                charlesBochet d707db7
              
                Merge branch 'main' into min-max-range
              
              
                charlesBochet bffe841
              
                Fixes
              
              
                charlesBochet File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
          Some comments aren't visible on the classic Files Changed page.
        
There are no files selected for viewing
        
          
          
            80 changes: 80 additions & 0 deletions
          
          80 
        
  packages/twenty-front/src/modules/command-menu/components/CommandMenuItemNumberInput.tsx
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| import { TextInput } from '@/ui/input/components/TextInput'; | ||
| import { useState } from 'react'; | ||
| import { Key } from 'ts-key-enum'; | ||
| import { isDefined } from 'twenty-shared/utils'; | ||
| import { | ||
| canBeCastAsNumberOrNull, | ||
| castAsNumberOrNull, | ||
| } from '~/utils/cast-as-number-or-null'; | ||
| 
     | 
||
| type CommandMenuItemNumberInputProps = { | ||
| value: string; | ||
| onChange: (value: number | null) => void; | ||
| onValidate?: (value: number | null) => boolean; | ||
| placeholder?: string; | ||
| }; | ||
| 
     | 
||
| export const CommandMenuItemNumberInput = ({ | ||
| value, | ||
| onChange, | ||
| onValidate, | ||
| placeholder, | ||
| }: CommandMenuItemNumberInputProps) => { | ||
| const [draftValue, setDraftValue] = useState(value); | ||
| const [hasError, setHasError] = useState(false); | ||
| 
     | 
||
| const handleChange = (text: string) => { | ||
| setDraftValue(text); | ||
| if (hasError) { | ||
| setHasError(false); | ||
| } | ||
| }; | ||
| 
     | 
||
| const handleCommit = () => { | ||
| if (!canBeCastAsNumberOrNull(draftValue)) { | ||
| setHasError(true); | ||
| setDraftValue(value); | ||
| return; | ||
| } | ||
| 
     | 
||
| const numericValue = castAsNumberOrNull(draftValue); | ||
| 
     | 
||
| if (isDefined(onValidate)) { | ||
| const isInvalid = onValidate(numericValue); | ||
| if (isInvalid) { | ||
| setHasError(true); | ||
| return; | ||
| } | ||
| } | ||
| 
     | 
||
| onChange(numericValue); | ||
| setHasError(false); | ||
| }; | ||
| 
     | 
||
| const handleBlur = () => { | ||
| handleCommit(); | ||
| }; | ||
| 
     | 
||
| const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => { | ||
| if (event.key === Key.Enter || event.key === Key.Escape) { | ||
| event.stopPropagation(); | ||
| handleCommit(); | ||
| } else { | ||
| event.stopPropagation(); | ||
| } | ||
| }; | ||
| 
     | 
||
| return ( | ||
| <TextInput | ||
| type="number" | ||
| value={draftValue} | ||
| sizeVariant="sm" | ||
| onChange={handleChange} | ||
| onBlur={handleBlur} | ||
| onKeyDown={handleKeyDown} | ||
| placeholder={placeholder} | ||
| error={hasError ? ' ' : undefined} | ||
| noErrorHelper | ||
| /> | ||
| ); | ||
| }; | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            12 changes: 12 additions & 0 deletions
          
          12 
        
  ...ty-front/src/modules/command-menu/pages/page-layout/constants/settings/RangeMaxSetting.ts
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; | ||
| import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; | ||
| import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; | ||
| import { IconMathMax } from 'twenty-ui/display'; | ||
| 
     | 
||
| export const RANGE_MAX_SETTING: ChartSettingsItem = { | ||
| isBoolean: false, | ||
| Icon: IconMathMax, | ||
| label: CHART_CONFIGURATION_SETTING_LABELS.MAX_RANGE, | ||
                
      
                  ehconitin marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| id: CHART_CONFIGURATION_SETTING_IDS.MAX_RANGE, | ||
| isInput: true, | ||
| }; | ||
        
          
          
            12 changes: 12 additions & 0 deletions
          
          12 
        
  ...ty-front/src/modules/command-menu/pages/page-layout/constants/settings/RangeMinSetting.ts
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; | ||
| import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; | ||
| import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; | ||
| import { IconMathMin } from 'twenty-ui/display'; | ||
| 
     | 
||
| export const RANGE_MIN_SETTING: ChartSettingsItem = { | ||
| isBoolean: false, | ||
| Icon: IconMathMin, | ||
| label: CHART_CONFIGURATION_SETTING_LABELS.MIN_RANGE, | ||
| id: CHART_CONFIGURATION_SETTING_IDS.MIN_RANGE, | ||
| isInput: true, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.