Skip to content

Commit 36d37f7

Browse files
authored
Display associated resource name on storage pools objects (apache#9449)
1 parent 7e085d5 commit 36d37f7

3 files changed

Lines changed: 50 additions & 8 deletions

File tree

api/src/main/java/org/apache/cloudstack/storage/browser/DataStoreObjectResponse.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ public class DataStoreObjectResponse extends BaseResponse {
4141
@Param(description = "Template ID associated with the data store object.")
4242
private String templateId;
4343

44+
@SerializedName(ApiConstants.TEMPLATE_NAME)
45+
@Param(description = "Template Name associated with the data store object.")
46+
private String templateName;
47+
4448
@SerializedName(ApiConstants.FORMAT)
4549
@Param(description = "Format of template associated with the data store object.")
4650
private String format;
@@ -49,10 +53,18 @@ public class DataStoreObjectResponse extends BaseResponse {
4953
@Param(description = "Snapshot ID associated with the data store object.")
5054
private String snapshotId;
5155

56+
@SerializedName("snapshotname")
57+
@Param(description = "Snapshot Name associated with the data store object.")
58+
private String snapshotName;
59+
5260
@SerializedName(ApiConstants.VOLUME_ID)
5361
@Param(description = "Volume ID associated with the data store object.")
5462
private String volumeId;
5563

64+
@SerializedName(ApiConstants.VOLUME_NAME)
65+
@Param(description = "Volume Name associated with the data store object.")
66+
private String volumeName;
67+
5668
@SerializedName(ApiConstants.LAST_UPDATED)
5769
@Param(description = "Last modified date of the file/directory.")
5870
private Date lastUpdated;
@@ -86,6 +98,18 @@ public void setVolumeId(String volumeId) {
8698
this.volumeId = volumeId;
8799
}
88100

101+
public void setTemplateName(String templateName) {
102+
this.templateName = templateName;
103+
}
104+
105+
public void setSnapshotName(String snapshotName) {
106+
this.snapshotName = snapshotName;
107+
}
108+
109+
public void setVolumeName(String volumeName) {
110+
this.volumeName = volumeName;
111+
}
112+
89113
public String getName() {
90114
return name;
91115
}
@@ -117,4 +141,16 @@ public String getVolumeId() {
117141
public Date getLastUpdated() {
118142
return lastUpdated;
119143
}
144+
145+
public String getTemplateName() {
146+
return templateName;
147+
}
148+
149+
public String getSnapshotName() {
150+
return snapshotName;
151+
}
152+
153+
public String getVolumeName() {
154+
return volumeName;
155+
}
120156
}

server/src/main/java/org/apache/cloudstack/storage/browser/StorageBrowserImpl.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,20 @@ ListResponse<DataStoreObjectResponse> getResponse(DataStore dataStore, ListDataS
233233
new Date(answer.getLastModified().get(i)));
234234
String filePath = paths.get(i);
235235
if (pathTemplateMap.get(filePath) != null) {
236-
response.setTemplateId(pathTemplateMap.get(filePath).getUuid());
237-
response.setFormat(pathTemplateMap.get(filePath).getFormat().toString());
236+
VMTemplateVO vmTemplateVO = pathTemplateMap.get(filePath);
237+
response.setTemplateId(vmTemplateVO.getUuid());
238+
response.setFormat(vmTemplateVO.getFormat().toString());
239+
response.setTemplateName(vmTemplateVO.getName());
238240
}
239241
if (pathSnapshotMap.get(filePath) != null) {
240-
response.setSnapshotId(pathSnapshotMap.get(filePath).getUuid());
242+
SnapshotVO snapshotVO = pathSnapshotMap.get(filePath);
243+
response.setSnapshotId(snapshotVO.getUuid());
244+
response.setSnapshotName(snapshotVO.getName());
241245
}
242246
if (pathVolumeMap.get(filePath) != null) {
243-
response.setVolumeId(pathVolumeMap.get(filePath).getUuid());
247+
VolumeVO volumeVO = pathVolumeMap.get(filePath);
248+
response.setVolumeId(volumeVO.getUuid());
249+
response.setVolumeName(volumeVO.getName());
244250
}
245251
responses.add(response);
246252
}

ui/src/views/infra/StorageBrowser.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,20 +127,20 @@
127127
<template v-if="column.key == 'associatedResource'">
128128
<template v-if="record.snapshotid">
129129
<router-link :to="{ path: '/snapshot/' + record.snapshotid }" target='_blank' >
130-
{{ $t('label.snapshot') }}
130+
{{ record.snapshotname }}
131131
</router-link>
132132
</template>
133133
<template v-else-if="record.volumeid">
134134
<router-link :to="{ path: '/volume/' + record.volumeid }" target='_blank' >
135-
{{ $t('label.volume') }}
135+
{{ record.volumename }}
136136
</router-link>
137137
</template>
138138
<template v-else-if="record.templateid">
139139
<router-link v-if="record.format === 'ISO'" :to="{ path: '/iso/' + record.templateid }" target='_blank' >
140-
{{ $t('label.iso') }}
140+
{{ record.templatename }}
141141
</router-link>
142142
<router-link v-else :to="{ path: '/template/' + record.templateid }" target='_blank'>
143-
{{ $t('label.templatename') }}
143+
{{ record.templatename }}
144144
</router-link>
145145
</template>
146146
<template v-else>

0 commit comments

Comments
 (0)