Skip to content

Commit a7b4969

Browse files
committed
Add Download Complete status for template
1 parent 21828b3 commit a7b4969

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

server/src/main/java/com/cloud/api/query/dao/TemplateJoinDaoImpl.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ private enum TemplateStatus {
168168
INSTALLING_ISO("Installing ISO"),
169169
BYPASSED_SECONDARY_STORAGE("Bypassed Secondary Storage"),
170170
PROCESSING("Processing"),
171-
DOWNLOADING("%d%% Downloaded");
171+
DOWNLOADING("%d%% Downloaded"),
172+
DOWNLOAD_COMPLETE("Download Complete");
172173

173174
private final String status;
174175
TemplateStatus(String status) {
@@ -187,16 +188,13 @@ private String getTemplateStatus(TemplateJoinVO template) {
187188
if (template == null) {
188189
return null;
189190
}
190-
191+
boolean isIso = Storage.ImageFormat.ISO == template.getFormat();
191192
TemplateStatus templateStatus;
192193
if (template.getDownloadState() == Status.DOWNLOADED) {
193-
templateStatus = TemplateStatus.SUCCESSFULLY_INSTALLED;
194+
templateStatus = isIso ? TemplateStatus.SUCCESSFULLY_INSTALLED : TemplateStatus.DOWNLOAD_COMPLETE;
194195
} else if (template.getDownloadState() == Status.DOWNLOAD_IN_PROGRESS) {
195196
if (template.getDownloadPercent() == 100) {
196-
templateStatus = TemplateStatus.INSTALLING_TEMPLATE;
197-
if (Storage.ImageFormat.ISO == template.getFormat()) {
198-
templateStatus = TemplateStatus.INSTALLING_ISO;
199-
}
197+
templateStatus = isIso ? TemplateStatus.INSTALLING_ISO : TemplateStatus.INSTALLING_TEMPLATE;
200198
} else {
201199
return TemplateStatus.DOWNLOADING.format(template.getDownloadPercent());
202200
}

0 commit comments

Comments
 (0)