Skip to content

Commit

Permalink
fix #1838
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuancelin committed Feb 29, 2024
1 parent ce130d1 commit fa43933
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
32 changes: 30 additions & 2 deletions otoroshi/javascript/src/pages/WasmPluginsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,34 @@ export class WasmPluginsPage extends Component {
},
};

wasmSourcePathAlert = (create) => {
window.newAlert(<>
<p>It seems you have forgotten the <span className="badge bg-warning">path</span> value of your wasm source.</p>
<p>Please add one if you want to {create ? 'create' : 'save'} this wasm plugin :)</p>
</>, 'Validation error')
}

createItem = (item) => {
console.log(item, item.path)
if (!item.config.source.path) {
this.wasmSourcePathAlert(true);
} else if (item.config.source.path && !item.config.source.path.trim()) {
this.wasmSourcePathAlert(true);
} else {
return BackOfficeServices.createWasmPlugin(item);
}
}

updateItem = (item) => {
if (!item.config.source.path) {
this.wasmSourcePathAlert();
} else if (item.config.source.path && !item.config.source.path.trim()) {
this.wasmSourcePathAlert();
} else {
return BackOfficeServices.updateWasmPlugin(item);
}
}

render() {
return (
<div>
Expand All @@ -546,9 +574,9 @@ export class WasmPluginsPage extends Component {
//fields: ['id', 'name', 'description'],
})
}
updateItem={BackOfficeServices.updateWasmPlugin}
updateItem={this.updateItem}
deleteItem={BackOfficeServices.deleteWasmPlugin}
createItem={BackOfficeServices.createWasmPlugin}
createItem={this.createItem}
showActions={true}
showLink={false}
rowNavigation={true}
Expand Down
5 changes: 0 additions & 5 deletions otoroshi/package.json

This file was deleted.

0 comments on commit fa43933

Please sign in to comment.