Skip to content
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

fix: adapt APISIX plugin disabled #2717

Merged
merged 2 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions web/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module.exports = {
'import/order': 'off',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'no-underscore-dangle': 'off',
},
settings: {
'import/resolver': {
Expand Down
6 changes: 4 additions & 2 deletions web/src/components/Plugin/PluginDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const PluginDetail: React.FC<Props> = ({

useEffect(() => {
form.setFieldsValue({
disable: isEnabled ? true : initialData[name] && !initialData[name].disable,
disable: isEnabled ? true : initialData[name] && !initialData[name]._meta.disable,
scope: 'global',
});
if (PLUGIN_UI_LIST.includes(name)) {
Expand Down Expand Up @@ -415,7 +415,9 @@ const PluginDetail: React.FC<Props> = ({
name="disable"
>
<Switch
defaultChecked={isEnabled ? true : initialData[name] && !initialData[name].disable}
defaultChecked={
isEnabled ? true : initialData[name] && !initialData[name]._meta.disable
}
disabled={readonly || isEnabled}
/>
</Form.Item>
Expand Down
10 changes: 5 additions & 5 deletions web/src/components/Plugin/PluginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const PluginPage: React.FC<Props> = ({

useEffect(() => {
const openPluginList = pluginList.filter(
(item) => initialData[item.name] && !initialData[item.name].disable,
(item) => initialData[item.name] && !initialData[item.name]._meta.disable,
);
setPlugins(initialData);
setEnablePluginsList(openPluginList);
Expand Down Expand Up @@ -244,16 +244,16 @@ const PluginPage: React.FC<Props> = ({
actions={[
<Button
type={
initialData[item.name] && !initialData[item.name].disable
initialData[item.name] && !initialData[item.name]._meta.disable
? 'primary'
: 'default'
}
danger={initialData[item.name] && !initialData[item.name].disable}
danger={initialData[item.name] && !initialData[item.name]._meta.disable}
onClick={() => {
setName(item.name);
}}
>
{initialData[item.name] && !initialData[item.name].disable
{initialData[item.name] && !initialData[item.name]._meta.disable
? formatMessage({ id: 'component.plugin.disable' })
: formatMessage({ id: 'component.plugin.enable' })}
</Button>,
Expand Down Expand Up @@ -315,7 +315,7 @@ const PluginPage: React.FC<Props> = ({
onChange={({ monacoData, formData, shouldDelete }) => {
let newPlugins = {
...initialData,
[name]: { ...monacoData, disable: !formData.disable },
[name]: { ...monacoData, _meta: { disable: !formData.disable } },
};
let handleType = 'edit';
if (shouldDelete === true) {
Expand Down