fix the logical judgment for configuration addition, deletion, and modification.#5432
Conversation
WalkthroughA new boolean field Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Frontend (AngularJS)
participant Backend (NamespaceService)
participant ItemBO
User->>Frontend (AngularJS): View configuration items
Frontend (AngularJS)->>Backend (NamespaceService): Request item list
Backend (NamespaceService)->>ItemBO: Create ItemBO for each item
Backend (NamespaceService)->>ItemBO: Set isNewlyAdded based on releaseItems
Backend (NamespaceService)-->>Frontend (AngularJS): Return item list with isNewlyAdded flag
Frontend (AngularJS)->>User: Display items with "New Added", "Modified", or "Deleted" labels based on flags
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 4
🔭 Outside diff range comments (1)
apollo-portal/src/main/resources/static/views/component/release-modal.html (1)
94-103: Ensure all status labels use the new isNewlyAdded flagThe branch‐tab template still uses the old
config.isModified && !config.oldValuelogic instead of the newconfig.isNewlyAddedflag. To keep UI behavior consistent, please update the label spans in:• apollo-portal/src/main/resources/static/views/component/namespace-panel-branch-tab.html
Replace the existing status spans with:
<span class="label label-success" ng-if="config.isNewlyAdded" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Branch.Body.NewAddedTips' | translate}}"> {{'Component.Namespace.Branch.Body.Added' | translate}} </span> <span class="label label-info" ng-if="config.isModified && !config.isNewlyAdded && !config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Branch.Body.ModifiedTips' | translate}}"> {{'Component.Namespace.Branch.Body.Modified' | translate}} </span> <span class="label label-danger" ng-if="config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Branch.Body.DeletedTips' | translate}}"> {{'Component.Namespace.Branch.Body.Deleted' | translate}} </span>After updating, please scan other HTML templates for any remaining
config.isModified && !config.oldValuepatterns and apply the same change.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
CHANGES.md(1 hunks)apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/bo/ItemBO.java(2 hunks)apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceService.java(1 hunks)apollo-portal/src/main/resources/static/views/component/namespace-panel-master-tab.html(3 hunks)apollo-portal/src/main/resources/static/views/component/release-modal.html(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build (8)
🔇 Additional comments (7)
CHANGES.md (1)
20-20: Changelog entry looks good.The entry accurately documents the fix for configuration change logic and references the correct PR.
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceService.java (1)
425-425: Excellent logic improvement for identifying newly added items.The new approach using
!releaseItems.containsKey(key)is more reliable than inferring fromoldValuepresence. This explicitly tracks whether an item is newly added versus modified, addressing the core issue described in the PR.apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/bo/ItemBO.java (2)
25-25: New field correctly added.The
isNewlyAddedfield is properly positioned with other boolean flags and follows Java naming conventions.
69-75: Getter and setter methods properly implemented.The methods follow standard Java bean conventions with correct naming and implementation for the boolean field.
apollo-portal/src/main/resources/static/views/component/release-modal.html (2)
94-96: Improved condition for "New Added" label.Using the explicit
config.isNewlyAddedflag is much clearer and more reliable than the previous implicit logic based onoldValuepresence.
98-100: Enhanced condition for "Modified" label with proper exclusion.The updated condition
config.isModified && !config.isNewlyAdded && !config.isDeletedcreates clear mutual exclusion between "New Added" and "Modified" labels, preventing incorrect labeling issues.apollo-portal/src/main/resources/static/views/component/namespace-panel-master-tab.html (1)
355-357: Good refinement of “Modified” conditionSwitching to
!config.isNewlyAddedinstead of the oldconfig.oldValuecheck removes a brittle heuristic and aligns with the dedicated flag introduced on the backend.
Looks correct. Verify thatisNewlyAddedis always accompanied byisModifiedto keep existing “No Publish” banner logic intact.
What's the purpose of this PR
您好,我在使用apollo的过程中,发现了一个问题,对于未发布的配置,增删改的判断有一些问题,做了下修复
Which issue(s) this PR fixes:
Fixes #
Brief changelog
一、复现步骤
1、原始数据如下:
2、修改第二条数据,value设为1; 删除第三条数据
可以看到第二条和第三条数据的标识出现了错误,发布页面也有同样的问题
二、问题修复
1、对配置的增删改判断逻辑做下了修改,效果如下:
Summary by CodeRabbit
Bug Fixes
New Features