Skip to content

Commit

Permalink
Display associated resource name on storage pools objects (#9449)
Browse files Browse the repository at this point in the history
  • Loading branch information
nvazquez authored Sep 5, 2024
1 parent 7e085d5 commit 36d37f7
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -86,6 +98,18 @@ public void setVolumeId(String volumeId) {
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;
}
Expand Down Expand Up @@ -117,4 +141,16 @@ public String getVolumeId() {
public Date getLastUpdated() {
return lastUpdated;
}

public String getTemplateName() {
return templateName;
}

public String getSnapshotName() {
return snapshotName;
}

public String getVolumeName() {
return volumeName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,20 @@ ListResponse<DataStoreObjectResponse> getResponse(DataStore dataStore, ListDataS
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);
}
Expand Down
8 changes: 4 additions & 4 deletions ui/src/views/infra/StorageBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 36d37f7

Please sign in to comment.