SkyeYoung commented on code in PR #2585:
URL: https://github.com/apache/apisix-dashboard/pull/2585#discussion_r947423606


##########
web/src/components/Plugin/PluginPage.tsx:
##########
@@ -96,6 +98,14 @@ const PluginPage: React.FC<Props> = ({
       form.setFieldsValue({ plugin_config_id });
     });
   }, []);
+
+  useEffect(() => {
+    const openList = pluginList.filter(
+      (item) => initialData[item.name] && !initialData[item.name].disable,
+    );
+    setEnablePluginsList(openList);
+  }, [initialData]);
+
   const openPluginList = pluginList.filter(

Review Comment:
   Can you help us improve this section, please? Like you've done here? 
   
   
https://github.com/Morakes/apisix-dashboard/blob/2877db87a5c3d8af1e187f012c406bd38f27f24a/web/src/components/Plugin/PluginPage.tsx#L102-L107
 



##########
web/src/components/Plugin/PluginPage.tsx:
##########
@@ -104,6 +114,34 @@ const PluginPage: React.FC<Props> = ({
     return index === self.indexOf(elem);
   });
 
+  const tabsList = [
+    {
+      title: formatMessage({ id: 'component.plugin.all' }),
+      key: 'allPlugins',
+    },
+    {
+      title: formatMessage({ id: 'component.plugin.enable' }),
+      key: 'enablePlugins',
+    },
+  ];
+
+  const SwitchTab = () => (
+    <Tabs
+      defaultActiveKey={showEnablePlugin ? 'enablePlugins' : 'allPlugins'}
+      onChange={(val: string) => {
+        if (val === 'enablePlugins') {
+          setShowEnablePlugin(true);
+        } else {
+          setShowEnablePlugin(false);
+        }

Review Comment:
   ```suggestion
           setShowEnablePlugin(val === 'enablePlugins');
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to