api: Display last updated time for VM (#4685)

Add a field in api response and ui to display last updated time
This commit is contained in:
Rakesh 2021-08-09 10:47:53 +02:00 committed by GitHub
parent 2f8d557f58
commit 949cf71491
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 0 deletions

View File

@ -82,6 +82,10 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
@Param(description = "the date when this virtual machine was created")
private Date created;
@SerializedName("lastupdated")
@Param(description="the date when this virtual machine was updated last time", since="4.16.0")
private Date lastUpdated;
@SerializedName(ApiConstants.STATE)
@Param(description = "the state of the virtual machine")
private String state;
@ -911,4 +915,12 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
public String getPoolType() { return poolType; }
public void setPoolType(String poolType) { this.poolType = poolType; }
public void setLastUpdated(Date lastUpdated) {
this.lastUpdated = lastUpdated;
}
public Date getLastUpdated() {
return lastUpdated;
}
}

View File

@ -422,6 +422,7 @@ SELECT
`vm_instance`.`limit_cpu_use` AS `limit_cpu_use`,
`vm_instance`.`created` AS `created`,
`vm_instance`.`state` AS `state`,
`vm_instance`.`update_time` AS `update_time`,
`vm_instance`.`removed` AS `removed`,
`vm_instance`.`ha_enabled` AS `ha_enabled`,
`vm_instance`.`hypervisor_type` AS `hypervisor_type`,

View File

@ -202,6 +202,7 @@ public class MetricsServiceImpl extends ComponentLifecycleBase implements Metric
metricsResponse.setDiskRead(vmResponse.getDiskKbsRead());
metricsResponse.setDiskWrite(vmResponse.getDiskKbsWrite());
metricsResponse.setDiskIopsTotal(vmResponse.getDiskIORead(), vmResponse.getDiskIOWrite());
metricsResponse.setLastUpdated(vmResponse.getLastUpdated());
metricsResponses.add(metricsResponse);
}
return metricsResponses;

View File

@ -138,6 +138,7 @@ public class UserVmJoinDaoImpl extends GenericDaoBaseWithTagInformation<UserVmJo
userVmResponse.setDomainName(userVm.getDomainName());
userVmResponse.setCreated(userVm.getCreated());
userVmResponse.setLastUpdated(userVm.getLastUpdated());
userVmResponse.setDisplayVm(userVm.isDisplayVm());
if (userVm.getState() != null) {

View File

@ -108,6 +108,9 @@ public class UserVmJoinVO extends BaseViewWithTagInformationVO implements Contro
@Column(name = GenericDao.REMOVED_COLUMN)
private Date removed;
@Column(name="update_time")
private Date lastUpdated;
@Column(name = "instance_name", updatable = true, nullable = false)
private String instanceName;
@ -491,6 +494,10 @@ public class UserVmJoinVO extends BaseViewWithTagInformationVO implements Contro
return removed;
}
public Date getLastUpdated() {
return lastUpdated;
}
public String getInstanceName() {
return instanceName;
}

View File

@ -554,6 +554,12 @@
<a-icon type="calendar" />{{ $toLocaleDate(resource.created) }}
</div>
</div>
<div class="resource-detail-item" v-if="resource.lastupdated">
<div class="resource-detail-item__label">{{ $t('label.last.updated') }}</div>
<div class="resource-detail-item__details">
<a-icon type="calendar" />{{ $toLocaleDate(resource.lastupdated) }}
</div>
</div>
</div>
<div class="account-center-tags" v-if="$route.meta.related">