Display associated resource name on storage pools objects (#9449)

This commit is contained in:
Nicolas Vazquez 2024-09-05 01:09:07 -03:00 committed by GitHub
parent 7e085d5e1d
commit 36d37f70a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 50 additions and 8 deletions

View File

@ -41,6 +41,10 @@ public class DataStoreObjectResponse extends BaseResponse {
@Param(description = "Template ID associated with the data store object.")
private String templateId;
@SerializedName(ApiConstants.TEMPLATE_NAME)
@Param(description = "Template Name associated with the data store object.")
private String templateName;
@SerializedName(ApiConstants.FORMAT)
@Param(description = "Format of template associated with the data store object.")
private String format;
@ -49,10 +53,18 @@ public class DataStoreObjectResponse extends BaseResponse {
@Param(description = "Snapshot ID associated with the data store object.")
private String snapshotId;
@SerializedName("snapshotname")
@Param(description = "Snapshot Name associated with the data store object.")
private String snapshotName;
@SerializedName(ApiConstants.VOLUME_ID)
@Param(description = "Volume ID associated with the data store object.")
private String volumeId;
@SerializedName(ApiConstants.VOLUME_NAME)
@Param(description = "Volume Name associated with the data store object.")
private String volumeName;
@SerializedName(ApiConstants.LAST_UPDATED)
@Param(description = "Last modified date of the file/directory.")
private Date lastUpdated;
@ -86,6 +98,18 @@ public class DataStoreObjectResponse extends BaseResponse {
this.volumeId = volumeId;
}
public void setTemplateName(String templateName) {
this.templateName = templateName;
}
public void setSnapshotName(String snapshotName) {
this.snapshotName = snapshotName;
}
public void setVolumeName(String volumeName) {
this.volumeName = volumeName;
}
public String getName() {
return name;
}
@ -117,4 +141,16 @@ public class DataStoreObjectResponse extends BaseResponse {
public Date getLastUpdated() {
return lastUpdated;
}
public String getTemplateName() {
return templateName;
}
public String getSnapshotName() {
return snapshotName;
}
public String getVolumeName() {
return volumeName;
}
}

View File

@ -233,14 +233,20 @@ public class StorageBrowserImpl extends MutualExclusiveIdsManagerBase implements
new Date(answer.getLastModified().get(i)));
String filePath = paths.get(i);
if (pathTemplateMap.get(filePath) != null) {
response.setTemplateId(pathTemplateMap.get(filePath).getUuid());
response.setFormat(pathTemplateMap.get(filePath).getFormat().toString());
VMTemplateVO vmTemplateVO = pathTemplateMap.get(filePath);
response.setTemplateId(vmTemplateVO.getUuid());
response.setFormat(vmTemplateVO.getFormat().toString());
response.setTemplateName(vmTemplateVO.getName());
}
if (pathSnapshotMap.get(filePath) != null) {
response.setSnapshotId(pathSnapshotMap.get(filePath).getUuid());
SnapshotVO snapshotVO = pathSnapshotMap.get(filePath);
response.setSnapshotId(snapshotVO.getUuid());
response.setSnapshotName(snapshotVO.getName());
}
if (pathVolumeMap.get(filePath) != null) {
response.setVolumeId(pathVolumeMap.get(filePath).getUuid());
VolumeVO volumeVO = pathVolumeMap.get(filePath);
response.setVolumeId(volumeVO.getUuid());
response.setVolumeName(volumeVO.getName());
}
responses.add(response);
}

View File

@ -127,20 +127,20 @@
<template v-if="column.key == 'associatedResource'">
<template v-if="record.snapshotid">
<router-link :to="{ path: '/snapshot/' + record.snapshotid }" target='_blank' >
{{ $t('label.snapshot') }}
{{ record.snapshotname }}
</router-link>
</template>
<template v-else-if="record.volumeid">
<router-link :to="{ path: '/volume/' + record.volumeid }" target='_blank' >
{{ $t('label.volume') }}
{{ record.volumename }}
</router-link>
</template>
<template v-else-if="record.templateid">
<router-link v-if="record.format === 'ISO'" :to="{ path: '/iso/' + record.templateid }" target='_blank' >
{{ $t('label.iso') }}
{{ record.templatename }}
</router-link>
<router-link v-else :to="{ path: '/template/' + record.templateid }" target='_blank'>
{{ $t('label.templatename') }}
{{ record.templatename }}
</router-link>
</template>
<template v-else>