You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/06/11 08:15:26 UTC
[incubator-apisix-dashboard] 02/03: feat: refactor plugin initial
This is an automated email from the ASF dual-hosted git repository.
juzhiyuan pushed a commit to branch feat-plugins
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git
commit 8ffe2f4539b0bcf6ad0224e1ffd11b8c77ef1a5f
Author: juzhiyuan <jj...@gmail.com>
AuthorDate: Thu Jun 11 16:05:01 2020 +0800
feat: refactor plugin initial
---
src/pages/Routes/Create.tsx | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/src/pages/Routes/Create.tsx b/src/pages/Routes/Create.tsx
index d27bcad..8d4e5cb 100644
--- a/src/pages/Routes/Create.tsx
+++ b/src/pages/Routes/Create.tsx
@@ -64,21 +64,20 @@ const Create: React.FC = (props) => {
fetchPluginList().then((data: string[]) => {
const names = data.filter((name) => !PLUGIN_BLOCK_LIST.includes(name));
- let enabledList: PluginForm.PluginProps[] = names.map((name) => ({
- name,
- ...PLUGIN_MAPPER_SOURCE[name],
- }));
- let disabledList: PluginForm.PluginProps[] = [];
- // TODO: 国际化
- const enabledPluginNames = Object.keys(step3Data.plugins);
- if (enabledPluginNames.length) {
- disabledList = enabledList.filter((item) => !enabledPluginNames.includes(item.name));
- enabledList = enabledList.filter((item) => enabledPluginNames.includes(item.name));
- }
+
+ const enabledNames = Object.keys(step3Data.plugins);
+ const disabledNames = names.filter((name) => !enabledNames.includes(name));
+
setStep3Data({
- ...step3Data,
- _disabledPluginList: disabledList,
- _enabledPluginList: enabledList,
+ plugins: step3Data.plugins,
+ _disabledPluginList: disabledNames.map((name) => ({
+ name,
+ ...PLUGIN_MAPPER_SOURCE[name],
+ })),
+ _enabledPluginList: enabledNames.map((name) => ({
+ name,
+ ...PLUGIN_MAPPER_SOURCE[name],
+ })),
});
});
}, []);