Skip to content

Commit

Permalink
Add default value for image comaprtment
Browse files Browse the repository at this point in the history
  • Loading branch information
rwx42 committed Oct 10, 2018
1 parent 82148f5 commit 779827e
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,10 @@ public ListBoxModel doFillImageCompartmentIdItems(
@QueryParameter @RelativePath("..") String apikey,
@QueryParameter @RelativePath("..") String passphrase,
@QueryParameter @RelativePath("..") String regionId,
@QueryParameter @RelativePath("..") String maxAsyncThreads)
throws IOException, ServletException {
@QueryParameter @RelativePath("..") String maxAsyncThreads,
@QueryParameter String compartmentId) throws IOException, ServletException {
ListBoxModel model = new ListBoxModel();
model.add("<Select image compartmentId>", "");
model.add("Default", compartmentId);

if (anyRequiredFieldEmpty(userId, fingerprint, tenantId, apikey, regionId)) {
return model;
Expand All @@ -487,8 +487,8 @@ public ListBoxModel doFillImageCompartmentIdItems(

try{
List<Compartment> compartmentIds = client.getCompartmentsList(tenantId);
for (Compartment compartmentId : compartmentIds) {
model.add(compartmentId.getName(), compartmentId.getId());
for (Compartment compartment : compartmentIds) {
model.add(compartment.getName(), compartment.getId());
}
}catch (Exception e) {
LOGGER.log(Level.WARNING, "Failed to get compartment list", e);
Expand All @@ -512,6 +512,9 @@ public ListBoxModel doFillImageIdItems(
if (anyRequiredFieldEmpty(userId, fingerprint, tenantId, apikey, regionId, compartmentId)) {
return model;
}
if (anyRequiredFieldEmpty(imageCompartmentId)) {
imageCompartmentId = compartmentId;
}

BaremetalCloudClient client = getClient(fingerprint, apikey, passphrase, tenantId, userId, regionId, maxAsyncThreads);

Expand Down

0 comments on commit 779827e

Please sign in to comment.