juzhiyuan commented on a change in pull request #512:
URL: https://github.com/apache/apisix-dashboard/pull/512#discussion_r494302019
##########
File path: src/pages/Consumer/Create.tsx
##########
@@ -68,8 +68,18 @@ const Page: React.FC = (props) => {
setStep(nextStep);
});
} else if (nextStep === 3) {
- const isValid = Object.keys(plugins).some((name) =>
name.includes('auth'));
- if (!isValid) {
+ const authPluginNames = [
+ 'openid-connect',
+ 'basic-auth',
+ 'jwt-auth',
+ 'key-auth',
+ 'authz-keycloak',
+ ];
+ const currentAuthPlugin = Object.keys(plugins).filter((plugin) =>
+ authPluginNames.includes(plugin),
+ );
+ const currentAuthPluginLen = currentAuthPlugin.length;
+ if (currentAuthPluginLen > 1 || currentAuthPluginLen === 0) {
Review comment:
Maybe there have some mistakes here? I think this message will only
popup when there has no 1 auth plugin :D
##########
File path: src/pages/Consumer/Create.tsx
##########
@@ -68,8 +68,18 @@ const Page: React.FC = (props) => {
setStep(nextStep);
});
} else if (nextStep === 3) {
- const isValid = Object.keys(plugins).some((name) =>
name.includes('auth'));
- if (!isValid) {
+ const authPluginNames = [
Review comment:
oh my mistake, you could import an plugin array from
https://github.com/api7/dashboard-components/blob/master/packages/plugin/src/data.tsx#L4
##########
File path: src/pages/Consumer/Create.tsx
##########
@@ -68,8 +68,18 @@ const Page: React.FC = (props) => {
setStep(nextStep);
});
} else if (nextStep === 3) {
- const isValid = Object.keys(plugins).some((name) =>
name.includes('auth'));
- if (!isValid) {
+ const authPluginNames = [
Review comment:
```js
import {PLUGIN_MAPPER_SOURCE} from '@api7-dashboard/plugin;
```
https://github.com/api7/dashboard-components/blob/master/packages/plugin/src/data.tsx#L37
##########
File path: src/pages/Consumer/Create.tsx
##########
@@ -68,8 +68,18 @@ const Page: React.FC = (props) => {
setStep(nextStep);
});
} else if (nextStep === 3) {
- const isValid = Object.keys(plugins).some((name) =>
name.includes('auth'));
- if (!isValid) {
+ const authPluginNames = [
+ 'openid-connect',
+ 'basic-auth',
+ 'jwt-auth',
+ 'key-auth',
+ 'authz-keycloak',
+ ];
+ const currentAuthPlugin = Object.keys(plugins).filter((plugin) =>
+ authPluginNames.includes(plugin),
+ );
+ const currentAuthPluginLen = currentAuthPlugin.length;
+ if (currentAuthPluginLen > 1 || currentAuthPluginLen === 0) {
Review comment:
let's invite @membphis @moonming to check this condition :D
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]