Adopt @simpleworkjs/frontend's messages/modal/validate modules
Replaces the vendored app.util.actionMessage/actionConfirm/alert (the latter added ad hoc to fix "app.util.alert is not a function") with the published @simpleworkjs/frontend package: app.messages.action/confirm, app.modal.open, and app.validate.js (which also replaces the identical vendored val.js). Gains real HTML-escaping on message content and a toast fallback when there's no inline .actionMessage target, neither of which the vendored code had. app.api/app.auth/app.pubsub/app.socket in app-base.js are untouched — they're app-specific (dual-mode callback/promise API, auth-token header injection) and not something the generic frontend package's app.js provides, so it isn't loaded here. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
function renderUsers(){
|
||||
app.user.list(function(error, data){
|
||||
if(error){
|
||||
app.util.actionMessage(data.message, $('#tab-people'), 'danger');
|
||||
app.messages.action(data.message, $('#tab-people'), 'danger');
|
||||
return;
|
||||
}
|
||||
$.scope.userRow.empty();
|
||||
@@ -128,7 +128,7 @@
|
||||
async function revokeInvite(tokenId, btn) {
|
||||
$thisRow = $(btn).closest('tr');
|
||||
$thisRow.addClass('table-warning');
|
||||
let confirmation = await app.util.actionConfirm('Revoke selected invite token?', $thisRow, 'warning');
|
||||
let confirmation = await app.messages.confirm('Revoke selected invite token?', $thisRow, 'warning');
|
||||
if(!confirmation){
|
||||
$thisRow.removeClass('table-warning');
|
||||
return;
|
||||
@@ -153,12 +153,12 @@
|
||||
async function deleteUser(uid, btn){
|
||||
const $row = $(btn).closest('tr');
|
||||
$row.addClass('table-warning');
|
||||
const confirmed = await app.util.actionConfirm(`Delete user "${uid}"?`, $row, 'warning');
|
||||
const confirmed = await app.messages.confirm(`Delete user "${uid}"?`, $row, 'warning');
|
||||
$row.removeClass('table-warning');
|
||||
if (!confirmed) return;
|
||||
app.api.delete('user/' + uid, function(error, data){
|
||||
if (error) {
|
||||
app.util.actionMessage(data.message || 'Failed to delete user', $row, 'danger');
|
||||
app.messages.action(data.message || 'Failed to delete user', $row, 'danger');
|
||||
return;
|
||||
}
|
||||
renderUsers();
|
||||
|
||||
Reference in New Issue
Block a user