Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(xo-web): Hide creation date if not available #3959

Merged
merged 4 commits into from Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.unreleased.md
Expand Up @@ -4,7 +4,8 @@

### Bug fixes

[Host] Fix multipathing status for XenServer < 7.5 [#3956](https://github.com/vatesfr/xen-orchestra/issues/3956) (PR [#3961](https://github.com/vatesfr/xen-orchestra/pull/3961))
- [Host] Fix multipathing status for XenServer < 7.5 [#3956](https://github.com/vatesfr/xen-orchestra/issues/3956) (PR [#3961](https://github.com/vatesfr/xen-orchestra/pull/3961))
- [Home/VM] Show creation date of the VM on if it available [#3953](https://github.com/vatesfr/xen-orchestra/issues/3953) (PR [#3959](https://github.com/vatesfr/xen-orchestra/pull/3959))

### Released packages

Expand Down
7 changes: 2 additions & 5 deletions packages/xo-server/src/xapi-object-to-xo.js
Expand Up @@ -54,12 +54,9 @@ function toTimestamp(date) {
return timestamp
}

const ms = parseDateTime(date)
if (!ms) {
return null
}
const ms = parseDateTime(date)?.getTime()

return Math.round(ms.getTime() / 1000)
julien-f marked this conversation as resolved.
Show resolved Hide resolved
return ms === undefined || ms === 0 ? null : Math.round(ms / 1000)
pdonias marked this conversation as resolved.
Show resolved Hide resolved
}

// ===================================================================
Expand Down
26 changes: 14 additions & 12 deletions packages/xo-web/src/xo-app/vm/tab-general.js
Expand Up @@ -116,18 +116,20 @@ export default connectStore(() => {
<br />
<Row className='text-xs-center'>
<Col mediumSize={3}>
<div className='text-xs-center'>
{_('created', {
date: (
<FormattedDate
day='2-digit'
month='long'
value={vm.installTime * 1000}
year='numeric'
/>
),
})}
</div>
{vm.installTime !== null && (
<div className='text-xs-center'>
{_('created', {
date: (
<FormattedDate
day='2-digit'
month='long'
value={vm.installTime * 1000}
year='numeric'
/>
),
})}
</div>
)}
{vm.power_state === 'Running' ? (
<div>
<p className='text-xs-center'>
Expand Down