Skip to content

Commit

Permalink
feat(xo-server,xo-web): show link to the SR for the garbage collector…
Browse files Browse the repository at this point in the history
… (coalesce) task (#7189)

See #5379 (comment)
  • Loading branch information
fbeauchamp committed Nov 29, 2023
1 parent 61e1f83 commit b856c1a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [VM/Disks] Display task information when importing VDIs (PR [#7197](https://github.com/vatesfr/xen-orchestra/pull/7197))
- [REST API] Support VM import using the XVA format
- [Task] Show the related SR on the Garbage Collector Task ( vdi coalescing) (PR [#7189](https://github.com/vatesfr/xen-orchestra/pull/7189))

### Bug fixes

Expand Down
6 changes: 5 additions & 1 deletion packages/xo-server/src/xapi-object-to-xo.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,10 @@ const TRANSFORMS = {
// -----------------------------------------------------------------

task(obj) {
let applies_to
if (obj.other_config.applies_to) {
applies_to = obj.$xapi.getObject(obj.other_config.applies_to, undefined).uuid
}
return {
allowedOperations: obj.allowed_operations,
created: toTimestamp(obj.created),
Expand All @@ -708,7 +712,7 @@ const TRANSFORMS = {
result: obj.result,
status: obj.status,
xapiRef: obj.$ref,

applies_to,
$host: link(obj, 'resident_on'),
}
},
Expand Down
13 changes: 10 additions & 3 deletions packages/xo-web/src/xo-app/tasks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,22 @@ const FILTERS = {

@connectStore(() => ({
host: createGetObject((_, props) => props.item.$host),
appliesTo: createGetObject((_, props) => props.item.applies_to),
}))
export class TaskItem extends Component {
render() {
const { host, item: task } = this.props

const { appliesTo, host, item: task } = this.props
// garbage collection task has an uuid in the desc
const showDesc = task.name_description && task.name_label !== 'Garbage Collection'
return (
<div>
{task.name_label} ({task.name_description && `${task.name_description} `}
{task.name_label} ({showDesc && `${task.name_description} `}
on {host ? <Link to={`/hosts/${host.id}`}>{host.name_label}</Link> : `unknown host − ${task.$host}`})
{appliesTo !== undefined && (
<span>
, applies to <Link to={`/srs/${appliesTo.id}`}>{appliesTo.name_label}</Link>
</span>
)}
{task.disappeared === undefined && ` ${Math.round(task.progress * 100)}%`}
</div>
)
Expand Down

0 comments on commit b856c1a

Please sign in to comment.