opentiny / tiny-engine

TinyEngine is a low-code engine based on which you can build or develop low-code platforms in different domains/TinyEngine是一个低代码引擎,基于这个引擎可以构建或者开发出不同领域的低代码平台
https://opentiny.design/tiny-engine
MIT License
1.98k stars 305 forks source link

Refactoring useHttp to httpService #886

Closed yy-wow closed 3 weeks ago

yy-wow commented 4 weeks ago

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

Background and solution

What is the current behavior?

Issue Number: N/A

What is the new behavior?

支持用户自定义http请求配置

  1. 增加MetaService:HttpService
  2. 将 useHttp() 改为 getMetaApi(HttpService)

    Does this PR introduce a breaking change?

Other information

Summary by CodeRabbit

Release Notes

coderabbitai[bot] commented 4 weeks ago

Walkthrough

The pull request introduces significant updates across multiple files, primarily focusing on replacing the useHttp function with getMetaApi(META_SERVICE.Http) for handling HTTP requests. This change affects how application IDs are retrieved and modifies various components to improve error handling and user interactions. New dependencies are added, and existing ones are removed, reflecting a shift in the underlying architecture. The overall structure of the components remains intact, but the modifications enhance the functionality and maintainability of the codebase.

Changes

File Path Change Summary
designer-demo/package.json Added dependencies: @opentiny/tiny-engine-utils and @vueuse/core.
designer-demo/registry.js Updated metas array to include HttpService instead of GenerateCodeService.
designer-demo/src/composable/http/Login.vue Introduced a new login popup component with methods for opening and closing the login interface.
designer-demo/src/composable/http/index.js Implemented an HTTP service with enhanced error handling and login management.
designer-demo/src/composable/index.js Exported HttpService from the http module.
packages/canvas/DesignCanvas/src/DesignCanvas.vue Updated HTTP request handling to use getMetaApi.
packages/common/composable/defaultGlobalService.js Replaced useHttp with getMetaApi in multiple functions.
packages/common/composable/http/index.js Defined a new HTTP service with interceptors and configuration options.
packages/common/composable/index.js Added export for HttpService.
packages/common/js/http.js Updated HTTP requests to use getMetaApi.
packages/common/js/vscodeGenerateFile.js Updated multiple functions to utilize getMetaApi for HTTP requests.
packages/configurator/src/collection-configurator/CollectionConfigurator.vue Updated data fetching logic to use getMetaApi.
packages/configurator/src/variable-configurator/VariableConfigurator.vue Updated HTTP request logic to use getMetaApi.
packages/design-core/index.js Added HttpService to exports.
packages/design-core/src/preview/src/preview/http.js Updated multiple functions to use getMetaApi.
packages/design-core/src/preview/src/previewApp.vue Updated HTTP requests to utilize getMetaApi.
packages/plugins/block/src/js/http.js Refactored HTTP request handling to use getMetaApi.
packages/plugins/bridge/src/http.js Updated HTTP requests to utilize getMetaApi.
packages/plugins/datasource/src/js/http.js Refactored HTTP request handling to use getMetaApi.
packages/plugins/i18n/src/Main.vue Updated application ID retrieval method.
packages/plugins/materials/src/composable/useMaterial.js Updated HTTP requests to use getMetaApi.
packages/plugins/materials/src/composable/useResource.js Updated HTTP requests to use getMetaApi.
packages/plugins/page/src/http.js Updated HTTP requests to use getMetaApi.
packages/plugins/robot/src/Main.vue Updated HTTP requests to use getMetaApi.
packages/plugins/robot/src/js/robotSetting.js Updated HTTP requests to use getMetaApi.
packages/register/src/constants.js Added Http: 'engine.service.http' to META_SERVICE.
packages/register/src/service.js Added setOptions method to apis object.
packages/toolbars/generate-code/src/Main.vue Updated HTTP requests to use getMetaApi.
packages/toolbars/generate-code/src/http.js Updated multiple functions to use getMetaApi.
packages/toolbars/lock/src/http.js Updated HTTP requests to use getMetaApi.
packages/toolbars/logo/src/Main.vue Updated HTTP requests to use getMetaApi.
packages/toolbars/logout/src/js/http.js Updated logout request to use getMetaApi.
packages/common/package.json Removed @opentiny/tiny-engine-http, added axios and axios-mock-adapter.
packages/engine-cli/template/designer/registry.js Updated metas array to include HttpService.
packages/engine-cli/template/designer/src/composable/http/index.js Introduced configuration and interceptors for HttpService.
packages/http/src/axios.js Removed entire module.
packages/http/vite.config.js Removed Vite configuration for the HTTP package.
packages/http/src/config.js Removed configuration function for HTTP requests.
packages/http/src/index.js Removed HTTP request handling module.
packages/http/package.json Removed package configuration for @opentiny/tiny-engine-http.
packages/plugins/block/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/plugins/bridge/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/plugins/datasource/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/plugins/help/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/plugins/i18n/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/plugins/materials/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/plugins/page/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/plugins/robot/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/plugins/schema/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/plugins/state/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/plugins/tutorial/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/settings/styles/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/toolbars/breadcrumb/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/toolbars/generate-code/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/toolbars/lock/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/toolbars/logo/package.json Removed dependency on @opentiny/tiny-engine-http.
packages/plugins/block/src/js/blockSetting.jsx Updated application ID retrieval method.
packages/plugins/bridge/src/js/resource.js Updated application ID retrieval method.
packages/plugins/datasource/src/DataSourceForm.vue Updated application ID retrieval method.
packages/plugins/materials/src/meta/block/src/BlockGroup.vue Updated application ID retrieval method.
packages/plugins/materials/src/meta/block/src/BlockGroupPanel.vue Updated application ID retrieval method.
packages/plugins/materials/src/meta/block/src/BlockList.vue Updated application ID retrieval method.
packages/plugins/materials/src/meta/block/src/BlockPanel.vue Updated application ID retrieval method.
packages/plugins/page/src/PageTree.vue Updated application ID retrieval method.
packages/plugins/bridge/src/BridgeSetting.vue Updated application ID retrieval method and enhanced validation logic.
packages/plugins/datasource/src/DataSourceGlobalDataHandler.vue No changes to exported entities.
packages/plugins/datasource/src/DataSourceList.vue Updated application ID retrieval method.
packages/plugins/materials/src/meta/block/src/BlockDetail.vue Updated application ID retrieval method.
packages/plugins/page/src/PageFolderSetting.vue Updated application ID retrieval method and enhanced deletion logic.
packages/plugins/page/src/PageSetting.vue Updated application ID retrieval method and added confirmation dialog for deletion.

Possibly related PRs

Suggested labels

ospp-2024

Suggested reviewers

🐰 In the code where I hop and play,
New dependencies come out to stay.
With HttpService now in sight,
Fetching data feels just right!
Errors handled, logic clear,
A brighter future, oh so near! 🐇


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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , 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 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.