-
Notifications
You must be signed in to change notification settings - Fork 543
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
feat: support show all enable plugin list tab #2585
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a9bd4eb
resolving some conflicts
22fc396
fix test case
cb04768
fix create-consumer test case
Morakes 158ecb3
fix test case
6964c14
fix test case
1f25dca
fix test case
3c87d96
fix test case
5ac8d68
optimize render list
5ee1637
fix test case
553b0fc
fix test case
2877db8
move variable
ffb7468
merge some duplicate code
1d1c056
merge some duplicate code
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ const PluginPage: React.FC<Props> = ({ | |
const { formatMessage } = useIntl(); | ||
const [form] = Form.useForm(); | ||
const [pluginList, setPluginList] = useState<PluginComponent.Meta[]>([]); | ||
const [enablePluginsList, setEnablePluginsList] = useState<PluginComponent.Meta[]>([]); | ||
const [pluginTemplateList, setPluginTemplateList] = useState<PluginTemplateModule.ResEntity[]>( | ||
[], | ||
); | ||
|
@@ -96,23 +97,32 @@ 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( | ||
(item) => initialData[item.name] && !initialData[item.name].disable, | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you help us improve this section, please? Like you've done here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I will improve it |
||
|
||
const openPluginType = openPluginList.map((item) => item.type); | ||
const newOpenPluginType = openPluginType.filter((elem, index, self) => { | ||
return index === self.indexOf(elem); | ||
}); | ||
|
||
const [showEnablePlugin, setShowEnablePlugin] = useState<boolean>(true); | ||
const [showEnablePlugin, setShowEnablePlugin] = useState<boolean>(false); | ||
guoqqqi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const tabsList = [ | ||
{ | ||
title: formatMessage({ id: 'component.plugin.enable' }), | ||
key: 'enablePlugins', | ||
title: formatMessage({ id: 'component.plugin.all' }), | ||
key: 'allPlugins', | ||
}, | ||
{ | ||
title: formatMessage({ id: 'component.plugin.disable' }), | ||
key: 'allPlugins', | ||
title: formatMessage({ id: 'component.plugin.enable' }), | ||
key: 'enablePlugins', | ||
}, | ||
]; | ||
|
||
|
@@ -228,19 +238,10 @@ const PluginPage: React.FC<Props> = ({ | |
id={`plugin-category-${typeItem}`} | ||
> | ||
{orderBy( | ||
pluginList.filter( | ||
(showEnablePlugin ? enablePluginsList : pluginList).filter( | ||
readonly | ||
? (item) => item.type === typeItem && !item.hidden && initialData[item.name] | ||
: (item) => | ||
showEnablePlugin | ||
? item.type === typeItem && | ||
!item.hidden && | ||
(!initialData[item.name] || | ||
(initialData[item.name] && initialData[item.name].disable)) | ||
: item.type === typeItem && | ||
!item.hidden && | ||
initialData[item.name] && | ||
!initialData[item.name].disable, | ||
: (item) => item.type === typeItem && !item.hidden, | ||
), | ||
'name', | ||
'asc', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
enablePluginsList can be obtained from the
pluginList
after calculation, no need to define a new state.