- 
                Notifications
    You must be signed in to change notification settings 
- Fork 23
feat(ui/dashboard): flags discard change #2119
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
base: main
Are you sure you want to change the base?
Conversation
fb1ad41    to
    8cf02cd      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a comprehensive "discard changes" feature for the feature flag details targeting system. It adds functionality to track and revert unsaved changes in different sections of the targeting configuration.
- Adds a discard changes modal with support for multiple change types (prerequisites, individual rules, custom rules, default rules)
- Implements change tracking and comparison utilities for detecting modifications in targeting configurations
- Adds undo buttons throughout the targeting interface to trigger discard operations
Reviewed Changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description | 
|---|---|
| ui/dashboard/src/utils/style.ts | Adds capitalize utility function for string formatting | 
| ui/dashboard/src/utils/data-type.ts | Updates isEmpty function to support generic array types | 
| ui/dashboard/src/pages/feature-flag-details/targeting/utils.ts | Adds extensive discard changes logic and utility functions | 
| ui/dashboard/src/pages/feature-flag-details/targeting/types.ts | Defines types for discard changes functionality | 
| ui/dashboard/src/pages/feature-flag-details/targeting/segment-rule/rule.tsx | Adds null safety for feature rules and clauses | 
| ui/dashboard/src/pages/feature-flag-details/targeting/segment-rule/index.tsx | Replaces remove button with undo button for discard changes | 
| ui/dashboard/src/pages/feature-flag-details/targeting/prerequisite-rule/index.tsx | Adds undo button for prerequisite rule discard changes | 
| ui/dashboard/src/pages/feature-flag-details/targeting/prerequisite-rule/condition.tsx | Adds validation and auto-selection for prerequisite variations | 
| ui/dashboard/src/pages/feature-flag-details/targeting/individual-rule/index.tsx | Adds undo button for individual rule discard changes | 
| ui/dashboard/src/pages/feature-flag-details/targeting/index.tsx | Integrates discard changes functionality into main targeting component | 
| ui/dashboard/src/pages/feature-flag-details/targeting/default-rule/index.tsx | Adds undo button for default rule discard changes | 
| ui/dashboard/src/pages/feature-flag-details/elements/discard-changes-modal/index.tsx | Implements the discard changes modal component | 
| ui/dashboard/src/components/date-time-picker/custom-datepicker.css | Fixes z-index for datepicker triangle | 
| ui/dashboard/src/@types/feature.ts | Adds type field to FeatureRuleClause | 
| ui/dashboard/src/@locales/ja/form.json | Adds Japanese translations for discard changes | 
| ui/dashboard/src/@locales/ja/common.json | Adds Japanese translations for common discard actions | 
| ui/dashboard/src/@locales/en/form.json | Adds English translations for discard changes | 
| ui/dashboard/src/@locales/en/common.json | Adds English translations for common discard actions | 
| ui/dashboard/src/@icons/index.tsx | Exports new warning and arrow icons | 
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| import { capitalize } from 'lodash'; | ||
| import { cn } from 'utils/style'; | 
    
      
    
      Copilot
AI
    
    
    
      Sep 22, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import uses lodash's capitalize function, but the project has a custom capitalize function in utils/style.ts. The imports should be consistent - either use the custom function or ensure the lodash version is intended.
| import { capitalize } from 'lodash'; | |
| import { cn } from 'utils/style'; | |
| import { capitalize, cn } from 'utils/style'; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed b461ec6
| "custom-rule-audience-not-include-desc": "<p>この配分に含まれていない <b>{{percent}}%</b> には <b>{{variation}}</b> が提供されます</p>", | ||
| "custom-rule-audience-include-desc": "<p>この配分に含まれている <b>{{percent}}%</b> には提供されます</p>", | ||
| "custom-rule-default-strategy-discard-desc": "デフォルトルールに設定", | ||
| "custom-rule-default-audience-discard-desc": "デフォルトオーディエンスに設定します" | 
    
      
    
      Copilot
AI
    
    
    
      Sep 22, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing trailing comma after the translation value. This should end with a comma to maintain consistent JSON formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed b461ec6
7985caa    to
    b461ec6      
    Compare
  
    | "name-search-placeholder": "名前を検索...", | ||
| "discard-form:discard-rule.discard-unsaved-changes": "未保存の変更を破棄しますか?", | ||
| "prerequisite-discard-desc": "前提フラグ <b>{{flagName}}</b>(バリエーション付き)を{{action}}", | ||
| "individual-discard-desc": "{{action}} ユーザーに対して <variantElement /> に <b>{{flagName}}</b> を設定", | ||
| "custom-rule-discard-desc": "{{action}} 条件を", | ||
| "custom-rule-clause-value-discard-desc": "{{action}} 条件から値 <b>{{value}}</b> を", | ||
| "custom-rule-strategy-discard-desc": "{{action}} ルールのバリエーションを", | ||
| "custom-rule-strategy-add-new-discard-desc": "ルール {{clauseLabel}} を追加して配信", | ||
| "custom-rule-reorder-discard-desc": "ルールを並べ替える", | ||
| "custom-rule-audience-discard-desc": "{{action}} オーディエンスのトラフィック配分を", | ||
| "custom-rule-audience-not-include-desc": "<p>この配分に含まれていない <b>{{percent}}%</b> には <b>{{variation}}</b> が提供されます</p>", | ||
| "custom-rule-audience-include-desc": "<p>この配分に含まれている <b>{{percent}}%</b> には提供されます</p>", | ||
| "custom-rule-default-strategy-discard-desc": "デフォルトルールに設定", | ||
| "custom-rule-default-audience-discard-desc": "デフォルトオーディエンスに設定します" | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "name-search-placeholder": "名前を検索...", | |
| "discard-form:discard-rule.discard-unsaved-changes": "未保存の変更を破棄しますか?", | |
| "prerequisite-discard-desc": "前提フラグ <b>{{flagName}}</b>(バリエーション付き)を{{action}}", | |
| "individual-discard-desc": "{{action}} ユーザーに対して <variantElement /> に <b>{{flagName}}</b> を設定", | |
| "custom-rule-discard-desc": "{{action}} 条件を", | |
| "custom-rule-clause-value-discard-desc": "{{action}} 条件から値 <b>{{value}}</b> を", | |
| "custom-rule-strategy-discard-desc": "{{action}} ルールのバリエーションを", | |
| "custom-rule-strategy-add-new-discard-desc": "ルール {{clauseLabel}} を追加して配信", | |
| "custom-rule-reorder-discard-desc": "ルールを並べ替える", | |
| "custom-rule-audience-discard-desc": "{{action}} オーディエンスのトラフィック配分を", | |
| "custom-rule-audience-not-include-desc": "<p>この配分に含まれていない <b>{{percent}}%</b> には <b>{{variation}}</b> が提供されます</p>", | |
| "custom-rule-audience-include-desc": "<p>この配分に含まれている <b>{{percent}}%</b> には提供されます</p>", | |
| "custom-rule-default-strategy-discard-desc": "デフォルトルールに設定", | |
| "custom-rule-default-audience-discard-desc": "デフォルトオーディエンスに設定します" | |
| "name-search-placeholder": "名前で検索...", | |
| "discard-unsaved-changes": "未保存の変更を破棄しますか?", | |
| "prerequisite-discard-desc": "前提フラグ <b>{{flagName}}</b>(バリエーション付き)を{{action}}します", | |
| "individual-discard-desc": "ユーザーに対して <b>{{flagName}}</b> を <variantElement /> に{{action}}します", | |
| "custom-rule-discard-desc": "条件を{{action}}します", | |
| "custom-rule-clause-value-discard-desc": "条件から値 <b>{{value}}</b> を{{action}}します", | |
| "custom-rule-strategy-discard-desc": "ルールのバリエーションを{{action}}します", | |
| "custom-rule-strategy-add-new-discard-desc": "ルール {{clauseLabel}} を追加して配信します", | |
| "custom-rule-reorder-discard-desc": "ルールを並べ替えます", | |
| "custom-rule-audience-discard-desc": "オーディエンスのトラフィック配分を{{action}}します", | |
| "custom-rule-audience-not-include-desc": "この配分に含まれていない <b>{{percent}}%</b> には <b>{{variation}}</b> が提供されます", | |
| "custom-rule-audience-include-desc": "この配分に含まれている <b>{{percent}}%</b> には提供されます", | |
| "custom-rule-default-strategy-discard-desc": "デフォルトルールに設定します", | |
| "custom-rule-default-audience-discard-desc": "デフォルトオーディエンスに設定します" | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 767f972
| "old-console": "旧コンソール", | ||
| "discard": "変更を破棄", | ||
| "edit-rule": "<p>ルール編集</p>", | ||
| "add-rule": "ルールを追加" | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "old-console": "旧コンソール", | |
| "discard": "変更を破棄", | |
| "edit-rule": "<p>ルール編集</p>", | |
| "add-rule": "ルールを追加" | |
| "old-console": "旧コンソール", | |
| "discard": "変更を破棄", | |
| "edit-rule": "ルールを編集", | |
| "add-rule": "ルールを追加" | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 767f972
| @steveninhle, please fix the conflicts. | 
b461ec6    to
    767f972      
    Compare
  
    
No description provided.