mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
Display message when action is not allowed
This commit is contained in:
parent
366a2d57c3
commit
c7f834e547
@ -237,7 +237,11 @@ function constructDeleteForm(fields, options) {
|
|||||||
* - hidden: Set to true to hide the field
|
* - hidden: Set to true to hide the field
|
||||||
* - icon: font-awesome icon to display before the field
|
* - icon: font-awesome icon to display before the field
|
||||||
* - prefix: Custom HTML prefix to display before the field
|
* - prefix: Custom HTML prefix to display before the field
|
||||||
* - onSuccess: callback function
|
* - preventClose: Set to true to prevent form from closing on success
|
||||||
|
* - onSuccess: callback function when form action is successful
|
||||||
|
* - follow: If a 'url' is provided by the API on success, redirect to it
|
||||||
|
* - redirect: A URL to redirect to after form success
|
||||||
|
* - reload: Set to true to reload the current page after form success
|
||||||
* - confirm: Set to true to require a "confirm" button
|
* - confirm: Set to true to require a "confirm" button
|
||||||
* - confirmText: Text for confirm button (default = "Confirm")
|
* - confirmText: Text for confirm button (default = "Confirm")
|
||||||
*
|
*
|
||||||
@ -266,8 +270,11 @@ function constructForm(url, options) {
|
|||||||
constructCreateForm(OPTIONS.actions.POST, options);
|
constructCreateForm(OPTIONS.actions.POST, options);
|
||||||
} else {
|
} else {
|
||||||
// User does not have permission to POST to the endpoint
|
// User does not have permission to POST to the endpoint
|
||||||
console.log('cannot POST');
|
showAlertDialog(
|
||||||
// TODO
|
'{% trans "Action Prohibited" %}',
|
||||||
|
'{% trans "Create operation not allowed" %}'
|
||||||
|
);
|
||||||
|
console.log(`'POST action unavailable at ${url}`);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'PUT':
|
case 'PUT':
|
||||||
@ -276,8 +283,11 @@ function constructForm(url, options) {
|
|||||||
constructChangeForm(OPTIONS.actions.PUT, options);
|
constructChangeForm(OPTIONS.actions.PUT, options);
|
||||||
} else {
|
} else {
|
||||||
// User does not have permission to PUT/PATCH to the endpoint
|
// User does not have permission to PUT/PATCH to the endpoint
|
||||||
// TODO
|
showAlertDialog(
|
||||||
console.log('cannot edit');
|
'{% trans "Action Prohibited" %}',
|
||||||
|
'{% trans "Update operation not allowed" %}'
|
||||||
|
);
|
||||||
|
console.log(`${options.method} action unavailable at ${url}`);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'DELETE':
|
case 'DELETE':
|
||||||
@ -285,17 +295,23 @@ function constructForm(url, options) {
|
|||||||
constructDeleteForm(OPTIONS.actions.DELETE, options);
|
constructDeleteForm(OPTIONS.actions.DELETE, options);
|
||||||
} else {
|
} else {
|
||||||
// User does not have permission to DELETE to the endpoint
|
// User does not have permission to DELETE to the endpoint
|
||||||
// TODO
|
showAlertDialog(
|
||||||
console.log('cannot delete');
|
'{% trans "Action Prohibited" %}',
|
||||||
|
'{% trans "Delete operation not allowed" %}'
|
||||||
|
);
|
||||||
|
console.log(`DELETE action unavailable at ${url}`);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'GET':
|
case 'GET':
|
||||||
if (canView(OPTIONS)) {
|
if (canView(OPTIONS)) {
|
||||||
console.log('view');
|
// TODO?
|
||||||
} else {
|
} else {
|
||||||
// User does not have permission to GET to the endpoint
|
// User does not have permission to GET to the endpoint
|
||||||
// TODO
|
showAlertDialog(
|
||||||
console.log('cannot view');
|
'{% trans "Action Prohibited" %}',
|
||||||
|
'{% trans "View operation not allowed" %}'
|
||||||
|
);
|
||||||
|
console.log(`GET action unavailable at ${url}`);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user