feat: plugins can also be enabled when the plugin dependency version is inconsistent (#5225)

This commit is contained in:
chenos 2024-09-07 17:02:25 +08:00 committed by GitHub
parent 954b6bdf62
commit 4365c3ea4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 4 deletions

View File

@ -838,5 +838,7 @@
"Open in new window": "Open in new window",
"Sorry, the page you visited does not exist.": "Sorry, the page you visited does not exist.",
"is none of": "is none of",
"is any of": "is any of"
"is any of": "is any of",
"Plugin dependency version mismatch": "Plugin dependency version mismatch",
"The current dependency version of the plugin does not match the version of the application and may not work properly. Are you sure you want to continue enabling the plugin?": "The current dependency version of the plugin does not match the version of the application and may not work properly. Are you sure you want to continue enabling the plugin?"
}

View File

@ -972,5 +972,7 @@
"Sorry, the page you visited does not exist.": "抱歉,你访问的页面不存在。",
"Set Template Engine": "设置模板引擎",
"Skip getting the total number of table records during paging to speed up loading. It is recommended to enable this option for data tables with a large amount of data": "在分页时跳过获取表记录总数,以加快加载速度,建议对有大量数据的数据表开启此选项",
"The current user only has the UI configuration permission, but don't have view permission for collection \"{{name}}\"": "当前用户只有 UI 配置权限,但没有数据表 \"{{name}}\" 查看权限。"
"The current user only has the UI configuration permission, but don't have view permission for collection \"{{name}}\"": "当前用户只有 UI 配置权限,但没有数据表 \"{{name}}\" 查看权限。",
"Plugin dependency version mismatch": "插件依赖版本不一致",
"The current dependency version of the plugin does not match the version of the application and may not work properly. Are you sure you want to continue enabling the plugin?": "当前插件的依赖版本与应用的版本不一致,可能无法正常工作。您确定要继续激活插件吗?"
}

View File

@ -7,7 +7,7 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import { App, Card, Divider, Popconfirm, Space, Switch, Typography, message } from 'antd';
import { App, Card, Divider, Popconfirm, Space, Switch, Typography } from 'antd';
import classnames from 'classnames';
import React, { FC, useState } from 'react';
import { useTranslation } from 'react-i18next';
@ -157,7 +157,20 @@ function PluginInfo(props: IPluginInfo) {
onChange={async (checked, e) => {
e.stopPropagation();
if (!isCompatible && checked) {
message.error(t("Dependencies check failed, can't enable."));
modal.confirm({
title: t('Plugin dependency version mismatch'),
content: t(
'The current dependency version of the plugin does not match the version of the application and may not work properly. Are you sure you want to continue enabling the plugin?',
),
onOk: async () => {
await api.request({
url: `pm:enable`,
params: {
filterByTk: name,
},
});
},
});
return;
}
if (!checked) {