Skip to content

Commit

Permalink
Merge pull request #136 from sonroyaalmerol/ui-task-custom
Browse files Browse the repository at this point in the history
fix last plus error not showing in UI
  • Loading branch information
sonroyaalmerol authored Feb 7, 2025
2 parents 0577f7c + 641f720 commit 567acdf
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/proxy/views/d2d_backup/panels/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Ext.define("PBS.config.DiskBackupJobView", {
{
header: gettext("Status"),
dataIndex: "last-run-state",
renderer: PBS.Utils.render_task_status,
renderer: PBSPlus.Utils.render_task_status,
flex: 1,
},
{
Expand Down
45 changes: 45 additions & 0 deletions internal/proxy/views/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Ext.define('PBSPlus.Utils', {
singleton: true,
render_task_status: function(value, metadata, record, rowIndex, colIndex, store) {
var lastPlusError = record.data['last-plus-error'] || store.getById('last-plus-error')?.data.value
if (lastPlusError) {
return `<i class="fa fa-times critical"></i> ${lastPlusError}`;
}

if (
!record.data['last-run-upid'] &&
!store.getById('last-run-upid')?.data.value &&
!record.data.upid &&
!store.getById('upid')?.data.value
) {
return '-';
}

if (!record.data['last-run-endtime'] && !store.getById('last-run-endtime')?.data.value) {
metadata.tdCls = 'x-grid-row-loading';
return '';
}

let parsed = Proxmox.Utils.parse_task_status(value);
let text = value;
let icon = '';
switch (parsed) {
case 'unknown':
icon = 'question faded';
text = Proxmox.Utils.unknownText;
break;
case 'error':
icon = 'times critical';
text = Proxmox.Utils.errorText + ': ' + value;
break;
case 'warning':
icon = 'exclamation warning';
break;
case 'ok':
icon = 'check good';
text = gettext("OK");
}

return `<i class="fa fa-${icon}"></i> ${text}`;
},
});
3 changes: 1 addition & 2 deletions internal/store/database/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ func (database *Database) GetJob(id string) (*types.Job, error) {
}

if job.LastRunPlusError != "" {
plusError := "Error: " + job.LastRunPlusError
job.LastRunState = &plusError
job.LastRunState = &job.LastRunPlusError
lastRunPlusTime := int64(job.LastRunPlusTime)
job.LastRunEndtime = &lastRunPlusTime
job.LastRunUpid = ""
Expand Down

0 comments on commit 567acdf

Please sign in to comment.