Skip to content

Conversation

@tiansfather
Copy link
Contributor

@tiansfather tiansfather commented Dec 30, 2024

{PR title}

Summary of the changes (Less than 80 chars)

比如DynamicColumnObject不继承DynamicObject,只是实现了IDynamicObject接口,故在方法中需要调整判断方式

Description

fixes #{bug number} (in this specific format)

Regression?

  • Yes
  • No

[If yes, specify the version the behavior has regressed from]

[是否影响老版本]

Risk

  • High
  • Medium
  • Low

[Justify the selection above]

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Bug Fixes:

  • Fix issue where DynamicColumnObject did not inherit DynamicObject but implemented the IDynamicObject interface.

Should support IDynamicObject in IEditorItem CanWrite method since DynamicColumnObject doesn't inherit from DynamicObject
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 30, 2024

Reviewer's Guide by Sourcery

This PR updates the CanWrite method to support IDynamicObject in IEditorItem.

Class diagram showing the updated type relationship for DynamicObject support

classDiagram
    class DynamicObject {
    }
    class IDynamicObject {
      <<interface>>
    }
    class DynamicColumnObject {
    }
    DynamicObject ..|> IDynamicObject
    DynamicColumnObject ..|> IDynamicObject
    note for IDynamicObject "New interface check replaces DynamicObject inheritance check"
    note for DynamicColumnObject "Example class implementing IDynamicObject"
Loading

File-Level Changes

Change Details Files
Updated the CanWrite method to check if the provided model type is assignable from the IDynamicObject interface.
  • Changed the condition in the CanWrite method to use typeof(IDynamicObject).IsAssignableFrom(modelType) instead of checking for DynamicObject or its subclasses.
  • This change allows the CanWrite method to correctly handle types that implement the IDynamicObject interface, even if they don't inherit from the DynamicObject class.
src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto
Copy link

bb-auto bot commented Dec 30, 2024

Thanks for your PR, @tiansfather. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@bb-auto bb-auto bot requested a review from ArgoZhang December 30, 2024 05:49
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @tiansfather - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please complete the PR template fully, including regression status, risk assessment, and verification details. This helps reviewers better understand the context and impact of the change.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Dec 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (3d6591e) to head (ed319b8).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #4998   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          630       630           
  Lines        28105     28105           
  Branches      4030      4030           
=========================================
  Hits         28105     28105           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ArgoZhang
Copy link
Member

@tiansfather 感谢大佬提交 PR, 请补充 Issue 写明示例,我需要了解代码运行逻辑,方便以后维护

@tiansfather
Copy link
Contributor Author

tiansfather commented Dec 31, 2024

本来是希望DynamicColumnObject动态对象可以不需要EditTemplate直接通过设置ComponentType支持单表维护,如下代码
image

不过就算按上面的修改了,后面调用Utility.CreateComponentByFieldType还是会有问题,除非在这个方法里也判断model是不是IDynamicObject
image

最简单的就是设置EditTemplate就ok了,大佬有什么建议吗

@ArgoZhang
Copy link
Member

@tiansfather 动态类型根据实现不同。这里是很难实现 ValueChagned 回调的。所以你看源码应该能看到很多地方都是排除了动态类型。包括缓存哪里都时不支持的

@tiansfather
Copy link
Contributor Author

恩,那没事,这个pr先撤回

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