-
Notifications
You must be signed in to change notification settings - Fork 130
feat(AddOrEdit): support export and import a storage #351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 adds export and import functionality for storage configurations in the AddOrEdit page, making it easier to migrate, clone storage configurations, and report bugs. The implementation includes three main changes: UI buttons with modal dialogs for import/export, support for reactive values in form components, and English translations for the new features.
Key Changes
- Added Export and Import buttons with modal dialogs that allow users to copy/paste JSON configuration
- Modified the Item component to support both direct values and reactive Accessor functions, fixing an issue where the driver selection component didn't support reactive value changes
- Import automatically strips server-managed fields (id, disabled, modified, status) to prevent import failures
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/pages/manage/storages/AddOrEdit.tsx | Added export/import buttons with ModalInput dialogs, restructured button layout into HStack, and implemented JSON serialization logic for storage configurations |
| src/pages/manage/storages/Item.tsx | Enhanced type definitions to accept both direct values and Accessor functions, added getVal helper function, and changed Switch component from defaultChecked to checked for proper reactivity |
| src/lang/en/storages.json | Added English translations for export, import buttons and modal titles |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
abee9a1 to
5ecfc18
Compare
Description / 描述
增加存储配置导入导出功能
Motivation and Context / 背景
方便迁移、克隆存储以及BUG反馈
Close: OpenListTeam/OpenList#1909
How Has This Been Tested? / 测试
导入自动删除
id、disabled、modified、status字段,避免导入失败修复了驱动选择的 Item 组件不支持响应式更改值的问题
让用户自行复制粘贴 textarea 里面的 JSON,避免部分浏览器不支持操作剪贴板
Checklist / 检查清单
我已阅读 CONTRIBUTING 文档。
go fmtor prettier.我已使用
go fmt或 prettier 格式化提交的代码。我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
我已相应更新了相关仓库(若适用)。