Skip to content

Commit

Permalink
fix(plugin): Inject the disable property into every plugin's jsonsche…
Browse files Browse the repository at this point in the history
…ma, the same as manager-api. (apache#1031)

uses the correct Proxy host

fix apache#1027
fix apache#1028
  • Loading branch information
juzhiyuan authored and starsz committed Dec 14, 2020
1 parent 9c1141d commit 80631e9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion web/config/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};

Expand Down
17 changes: 15 additions & 2 deletions web/src/components/Plugin/PluginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 80631e9

Please sign in to comment.