fix: Set status tooltip to error message on failed actions

When saving, updating and rechecking an storage fails (which is
different to the soft-fail when the action itself succeeds but the
status check does not) further details are provided in the error message
of the response, which is now set as the tooltip.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2024-07-29 12:15:50 +02:00 committed by skjnldsv
parent 9eeb3cf423
commit ac1c8c4237

View file

@ -1234,8 +1234,9 @@ MountConfigListView.prototype = _.extend({
success: function () {
$tr.remove();
},
error: function () {
self.updateStatus($tr, StorageConfig.Status.ERROR);
error: function (result) {
const statusMessage = (result && result.responseJSON) ? result.responseJSON.message : undefined;
self.updateStatus($tr, StorageConfig.Status.ERROR, statusMessage);
}
});
}
@ -1270,11 +1271,12 @@ MountConfigListView.prototype = _.extend({
}
}
},
error: function() {
error: function(result) {
if (concurrentTimer === undefined
|| $tr.data('save-timer') === concurrentTimer
) {
self.updateStatus($tr, StorageConfig.Status.ERROR);
const statusMessage = (result && result.responseJSON) ? result.responseJSON.message : undefined;
self.updateStatus($tr, StorageConfig.Status.ERROR, statusMessage);
}
}
});
@ -1298,8 +1300,9 @@ MountConfigListView.prototype = _.extend({
success: function(result) {
self.updateStatus($tr, result.status, result.statusMessage);
},
error: function() {
self.updateStatus($tr, StorageConfig.Status.ERROR);
error: function(result) {
const statusMessage = (result && result.responseJSON) ? result.responseJSON.message : undefined;
self.updateStatus($tr, StorageConfig.Status.ERROR, statusMessage);
}
});
},