This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git
The following commit(s) were added to refs/heads/master by this push: new 93b9c68 fix(plugin): Inject the disable property into every plugin's jsonschema, the same as manager-api. (#1031) 93b9c68 is described below commit 93b9c6820d361380b0c370a3946a350dbac10f2f Author: 琚致远 <juzhiy...@apache.org> AuthorDate: Sat Dec 12 13:01:36 2020 +0800 fix(plugin): Inject the disable property into every plugin's jsonschema, the same as manager-api. (#1031) uses the correct Proxy host fix #1027 fix #1028 --- web/config/proxy.ts | 2 +- web/src/components/Plugin/PluginPage.tsx | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/web/config/proxy.ts b/web/config/proxy.ts index 6f2e82f..fda3747 100644 --- a/web/config/proxy.ts +++ b/web/config/proxy.ts @@ -15,7 +15,7 @@ * limitations under the License. */ const serveUrlMap = { - dev: 'http://40.73.92.163:8080', + dev: 'http://139.217.190.60', test: 'http://localhost:9000', }; diff --git a/web/src/components/Plugin/PluginPage.tsx b/web/src/components/Plugin/PluginPage.tsx index 6296e74..4224af2 100644 --- a/web/src/components/Plugin/PluginPage.tsx +++ b/web/src/components/Plugin/PluginPage.tsx @@ -58,10 +58,20 @@ const PluginPage: React.FC<Props> = ({ const validateData = (pluginName: string, value: PluginComponent.Data) => { fetchSchema(pluginName, schemaType).then((schema) => { + // NOTE: The frontend will inject the disable property into schema just like the manager-api does + if (!schema.properties) { + // eslint-disable-next-line + schema.properties = {} + } + // eslint-disable-next-line + ;(schema.properties as any).disable = { + type: "boolean" + } + const { valid, errors } = validate(value, schema); if (valid) { setName(NEVER_EXIST_PLUGIN_FLAG); - onChange({ ...initialData, [pluginName]: { ...value, disable: false } }); + onChange({ ...initialData, [pluginName]: value }); return; } errors?.forEach((item) => { @@ -146,7 +156,10 @@ const PluginPage: React.FC<Props> = ({ disabled={readonly} onChange={(isChecked) => { if (isChecked) { - validateData(item.name, initialData[item.name]); + validateData(item.name, { + ...initialData[item.name], + disable: false + }); } else { onChange({ ...initialData,