Skip to content

fix: resolve some interaction issues#1102

Merged
hexqi merged 9 commits intoopentiny:refactor/developfrom
SonyLeo:fix/interactionRepair
Feb 14, 2025
Merged

fix: resolve some interaction issues#1102
hexqi merged 9 commits intoopentiny:refactor/developfrom
SonyLeo:fix/interactionRepair

Conversation

@SonyLeo
Copy link
Copy Markdown
Contributor

@SonyLeo SonyLeo commented Feb 10, 2025

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

What is the current behavior?

1、【国际化资源】首次删除单个词条时,删除按钮置灰无法删除
2、【资源管理】检验资源 CDN 链接失败时,提示信息中:工具类名称 和 CDN 链接不匹配,且 链接显示为 undefined.
3、【物料】分组增加区块时,关键字检索不匹配
4、【数据源】设置数据源类型时、数据源类型样式异常。查看已保存数据源时,数据源类型不切换
5、【页面】历史备份预览界面时,页面名称不显示、页面一直显示 页面加载中 ...

Issue Number: N/A

What is the new behavior?

1、【国际化资源】删除按钮正常显示,可以删除单个词条
2、【资源管理】检验资源 CDN 链接失败时,提示信息的工具类名称 和 CDN 链接匹配,链接正常显示
3、【物料】分组增加区块时,关键字搜索可以根据 区块名称 或 区块 ID 正常检索
4、【数据源】数据源类型样式正常。查看已保存数据源时,数据源类型正常切换

image

5、【页面】历史备份预览界面时,正常预览页面

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Improved data source selection with a simplified, reactive radio button interface.
    • Enhanced filtering in available blocks by including a Chinese name criterion.
    • Revamped page preview history to display additional contextual details.
    • Updated placeholder text in the search component for clearer user guidance.
  • Bug Fixes

    • Updated selection count logic in tables for a more accurate display.
  • Refactor

    • Upgraded background processing of utility imports with asynchronous error handling for smoother notifications.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 10, 2025

Walkthrough

This pull request introduces several modifications across multiple modules. The npm utility import process has been enhanced with a preliminary validation step and improved error handling. Vue components have been updated: one now uses a simplified tiny-radio component with added reactivity, another modifies its method for counting selected rows, and a page preview function has been enriched with additional contextual information. Additionally, a new query parameter has been incorporated into the available blocks API call in the materials module.

Changes

File(s) Change Summary
packages/canvas/render/src/application-function/utils.ts Restructured npm utility import handling to filter valid utilities; updated error handling to reference valid utilities; changed promise resolution from Promise.allSettled to Promise.all.
packages/plugins/datasource/src/DataSourceType.vue Simplified radio button rendering using a tiny-radio component; added a watch function for modelValue to update dataSourceType.
packages/plugins/i18n/src/Main.vue Updated computed property to count selected rows using getAllSelection() instead of getSelectRecords().
packages/plugins/materials/src/meta/block/src/http.js Added a new query parameter (name_cn_contains) to fetchAvailableBlocks function and updated its signature.
packages/plugins/page/src/PageHistory.vue Enhanced previewHistory function to include additional properties (pageInfo and ancestors) in the payload sent to previewPage.
packages/plugins/materials/src/meta/block/src/BlockGroupPanel.vue Changed placeholder text in tiny-search component from "请输入关键词" to "请输入名称或ID搜索".

Suggested reviewers

  • hexqi
  • chilingling

Poem

In the code garden, I happily hop,
Async streams and promises never stop.
Vue whispers secrets with every new watch,
Errors handled gently, no bug can botch.
I nibble on updates with a joyful cheer,
A rabbit's delight in each line so clear!
🐇💻 Hop into a future bright and dear!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 73dc5b7 and 0ab227b.

📒 Files selected for processing (1)
  • packages/plugins/materials/src/meta/block/src/BlockGroupPanel.vue (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/plugins/materials/src/meta/block/src/BlockGroupPanel.vue
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions Bot added bug Something isn't working refactor-main labels Feb 10, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
packages/plugins/i18n/src/Main.vue (1)

274-274: Consider updating batchDelete to use getAllSelection for consistency.

The batchDelete function still uses getSelectRecords() while the selection count uses getAllSelection(). This inconsistency could lead to mismatches between the number of items shown as selected and the number of items actually deleted.

Apply this change for consistency:

-      const i18nData = i18nTable.value.getSelectRecords()
+      const i18nData = i18nTable.value.getAllSelection()
🧹 Nitpick comments (2)
packages/canvas/render/src/application-function/utils.ts (2)

57-67: Consider handling invalid or missing CDN links more robustly.
While the filter ensures that only items with a "cdnLink" are processed, you may want to validate the link format or handle potential edge cases (e.g., an empty string). This can help avoid silent failures and facilitate better user feedback.


68-83: Ensure all rejected imports are consistently handled or retried if needed.
This block gracefully handles rejected imports by notifying the user. However, keep in mind that some rejections might be transient or caused by temporary network issues. Depending on your requirements, you may want to give the user an option to retry loading the utilities or provide additional support instructions.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 789e06a and 3fd2381.

📒 Files selected for processing (5)
  • packages/canvas/render/src/application-function/utils.ts (1 hunks)
  • packages/plugins/datasource/src/DataSourceType.vue (2 hunks)
  • packages/plugins/i18n/src/Main.vue (1 hunks)
  • packages/plugins/materials/src/meta/block/src/http.js (1 hunks)
  • packages/plugins/page/src/PageHistory.vue (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (5)
packages/plugins/page/src/PageHistory.vue (1)

61-65: Great inclusion of contextual data for page previews.
Passing the platform ID, page name, and item as ancestors ensures a richer preview. Consider validating that "item.name" is defined to avoid potential undefined references in scenarios where the backup item might lack a name property.

packages/plugins/datasource/src/DataSourceType.vue (2)

6-12: Good simplification of the radio button rendering.
Using a single with v-for reduces duplication and improves readability. The dynamic :key, :text, and :label bindings correctly leverage the "item" object.


55-60: Sync child state with parent prop changes.
This watcher ensures that updates to "modelValue" flow down to "dataSourceType." Combine it with appropriate validation or defensive checks if "modelValue" can be undefined or hold unexpected values.

packages/plugins/materials/src/meta/block/src/http.js (1)

124-124: LGTM! This change fixes the keyword search functionality.

The addition of name_cn_contains parameter enables searching blocks by their Chinese names, resolving the issue with keyword searches in material grouping.

packages/plugins/i18n/src/Main.vue (1)

192-192: LGTM! This change fixes the delete button functionality.

Switching from getSelectRecords() to getAllSelection() correctly tracks selected rows, enabling proper deletion of single entries in internationalization resources.

Let's verify that the delete button is properly enabled/disabled based on selections:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check for other usages of getSelectRecords to ensure consistent selection handling

# Search for other instances of getSelectRecords
rg "getSelectRecords" -A 5

Length of output: 1922


LGTM! The change correctly fixes the delete button behavior in the i18n module.

  • The computed property now uses getAllSelection(), ensuring the delete button is enabled/disabled based on the actual count of selected rows.
  • The remaining instances of getSelectRecords in Main.vue and other files appear in contexts unrelated to the deletion functionality and do not affect the fix.

Comment thread packages/canvas/render/src/application-function/utils.ts Outdated
Comment thread packages/plugins/materials/src/meta/block/src/http.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants