Skip to content

Conversation

@steveninhle
Copy link
Collaborator

No description provided.

@steveninhle steveninhle changed the title feat: flags discard change feat(ui/dashboard): flags discard change Sep 10, 2025
@steveninhle steveninhle force-pushed the feat-flags-discard-change branch 2 times, most recently from fb1ad41 to 8cf02cd Compare September 16, 2025 06:53
@steveninhle steveninhle marked this pull request as ready for review September 16, 2025 08:07
@cre8ivejp cre8ivejp requested a review from Copilot September 22, 2025 02:27
Copy link

Copilot AI left a 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.

Comment on lines 4 to 5
import { capitalize } from 'lodash';
import { cn } from 'utils/style';
Copy link

Copilot AI Sep 22, 2025

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.

Suggested change
import { capitalize } from 'lodash';
import { cn } from 'utils/style';
import { capitalize, cn } from 'utils/style';

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

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": "デフォルトオーディエンスに設定します"
Copy link

Copilot AI Sep 22, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed b461ec6

@steveninhle steveninhle force-pushed the feat-flags-discard-change branch from 7985caa to b461ec6 Compare September 22, 2025 03:57
Comment on lines 357 to 370
"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": "デフォルトオーディエンスに設定します"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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": "デフォルトオーディエンスに設定します"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 767f972

Comment on lines 294 to 297
"old-console": "旧コンソール",
"discard": "変更を破棄",
"edit-rule": "<p>ルール編集</p>",
"add-rule": "ルールを追加"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"old-console": "旧コンソール",
"discard": "変更を破棄",
"edit-rule": "<p>ルール編集</p>",
"add-rule": "ルールを追加"
"old-console": "旧コンソール",
"discard": "変更を破棄",
"edit-rule": "ルールを編集",
"add-rule": "ルールを追加"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 767f972

@cre8ivejp
Copy link
Member

@steveninhle, please fix the conflicts.

@steveninhle steveninhle force-pushed the feat-flags-discard-change branch from b461ec6 to 767f972 Compare October 21, 2025 09:55
@steveninhle steveninhle requested a review from t-kikuc as a code owner October 21, 2025 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants