Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
dd41e16
Improve global settings in the UI to be more intuitive/logical
sureshanaparti Dec 21, 2021
cbda03d
config and ui changes
sureshanaparti Mar 28, 2022
25a5de1
config depot fixes
sureshanaparti Mar 29, 2022
7337bbf
ui alignment and test changes
sureshanaparti Mar 29, 2022
e5fc891
Fix typo on XML definition
nvazquez Mar 31, 2022
719d8f8
Add component annotation to mock class
nvazquez Mar 31, 2022
9cc6f61
Updated config group / subgroup dao component mocks, and added compon…
sureshanaparti Apr 1, 2022
8b69a7b
ui improvements / refactoring
sureshanaparti Apr 5, 2022
7957819
Review comments, and code improvements
sureshanaparti Apr 11, 2022
7911f5c
review changes
sureshanaparti Apr 13, 2022
b34a636
config group improvements
sureshanaparti Apr 22, 2022
4c374fd
review changes, rebase / conflicts fixes
sureshanaparti May 9, 2022
4239084
Fix upgrade path
davidjumani Dec 20, 2022
31b4463
Refactor ui to externalize fetching of data
davidjumani Dec 20, 2022
48d831f
Fix incorrect categorizing
davidjumani Dec 21, 2022
b6f1130
Fix ui issues
davidjumani Dec 21, 2022
24113a7
Refactor ui
davidjumani Dec 21, 2022
51896a8
Rename vue files
davidjumani Dec 22, 2022
33ebe69
Adding possible values for list styled gs
davidjumani Jan 3, 2023
4ee3199
Further changes
davidjumani Jan 5, 2023
f0e9fbf
Merge branch 'main' of github.com:apache/cloudstack into global-setti…
davidjumani Jan 5, 2023
c5ad181
ui fixes
davidjumani Jan 5, 2023
ab91fac
Updating since in api param
davidjumani Jan 5, 2023
ee42179
UI enhancements
davidjumani Jan 5, 2023
9e7c3d8
Apply suggestions from code review
davidjumani Jan 6, 2023
38da4ac
Addressing sonarcloud issues
davidjumani Jan 6, 2023
75861e8
Apply suggestions from code review
davidjumani Jan 6, 2023
b0a57a7
Use idempotent add column in db upgrade
davidjumani Jan 9, 2023
b7ba8c8
Merge branch 'main' of github.com:apache/cloudstack into global-setti…
davidjumani Jan 12, 2023
21012c6
Merge branch 'main' into global-settings-intuitive-ui
DaanHoogland Jan 13, 2023
7217aba
Cosmetic changes
davidjumani Jan 18, 2023
2afcf71
Merge branch 'main' into global-settings-intuitive-ui
DaanHoogland Jan 20, 2023
00e8809
Merge branch 'main' of github.com:apache/cloudstack into global-setti…
davidjumani Jan 23, 2023
519ab0e
Change network.router.EnableServiceMonitoring to Boolean
davidjumani Jan 30, 2023
7d0a9bb
Cosmetic changes
davidjumani Jan 30, 2023
e92b64c
Fix incompatible types
davidjumani Jan 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions api/src/main/java/com/cloud/server/ManagementService.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import com.cloud.user.UserData;
import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
import org.apache.cloudstack.api.command.admin.config.ListCfgGroupsByCmd;
import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
import org.apache.cloudstack.api.command.admin.config.UpdateHypervisorCapabilitiesCmd;
import org.apache.cloudstack.api.command.admin.guest.AddGuestOsCmd;
Expand Down Expand Up @@ -63,6 +64,7 @@
import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
import org.apache.cloudstack.config.Configuration;
import org.apache.cloudstack.config.ConfigurationGroup;

import com.cloud.alert.Alert;
import com.cloud.capacity.Capacity;
Expand Down Expand Up @@ -102,6 +104,13 @@ public interface ManagementService {
*/
Pair<List<? extends Configuration>, Integer> searchForConfigurations(ListCfgsByCmd c);

/**
* returns the the configuration groups
*
* @return list of configuration groups
*/
Pair<List<? extends ConfigurationGroup>, Integer> listConfigurationGroups(ListCfgGroupsByCmd cmd);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this would not suffice?

Suggested change
Pair<List<? extends ConfigurationGroup>, Integer> listConfigurationGroups(ListCfgGroupsByCmd cmd);
Pair<List<ConfigurationGroup>, Integer> listConfigurationGroups(ListCfgGroupsByCmd cmd);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for consistency across the function definitions in interface


/**
* Searches for Clusters by the specified search criteria
*
Expand Down
5 changes: 5 additions & 0 deletions api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public class ApiConstants {
public static final String MAX_IOPS = "maxiops";
public static final String HYPERVISOR_SNAPSHOT_RESERVE = "hypervisorsnapshotreserve";
public static final String DATADISK_OFFERING_LIST = "datadiskofferinglist";
public static final String DEFAULT_VALUE = "defaultvalue";
public static final String DESCRIPTION = "description";
public static final String DESTINATION = "destination";
public static final String DESTINATION_ZONE_ID = "destzoneid";
Expand Down Expand Up @@ -187,6 +188,7 @@ public class ApiConstants {
public static final String GATEWAY = "gateway";
public static final String IP6_GATEWAY = "ip6gateway";
public static final String GROUP = "group";
public static final String SUBGROUP = "subgroup";
public static final String GROUP_ID = "groupid";
public static final String GSLB_LB_METHOD = "gslblbmethod";
public static final String GSLB_SERVICE_DOMAIN_NAME = "gslbdomainname";
Expand Down Expand Up @@ -296,6 +298,7 @@ public class ApiConstants {
public static final String IS_DEFAULT_USE = "defaultuse";
public static final String OLD_FORMAT = "oldformat";
public static final String OP = "op";
public static final String OPTIONS = "options";
public static final String OS_CATEGORY_ID = "oscategoryid";
public static final String OS_CATEGORY_NAME = "oscategoryname";
public static final String OS_ID = "osid";
Expand All @@ -307,6 +310,7 @@ public class ApiConstants {
public static final String OUTPUT = "output";
public static final String PROPERTIES = "properties";
public static final String PARAMS = "params";
public static final String PARENT = "parent";
public static final String PARENT_ID = "parentid";
public static final String PARENT_DOMAIN_ID = "parentdomainid";
public static final String PARENT_TEMPLATE_ID = "parenttemplateid";
Expand All @@ -328,6 +332,7 @@ public class ApiConstants {
public static final String POSITION = "position";
public static final String POST_URL = "postURL";
public static final String POWER_STATE = "powerstate";
public static final String PRECEDENCE = "precedence";
public static final String PRIVATE_INTERFACE = "privateinterface";
public static final String PRIVATE_IP = "privateip";
public static final String PRIVATE_PORT = "privateport";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.apache.cloudstack.api.response.CapacityResponse;
import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.ConditionResponse;
import org.apache.cloudstack.api.response.ConfigurationGroupResponse;
import org.apache.cloudstack.api.response.ConfigurationResponse;
import org.apache.cloudstack.api.response.CounterResponse;
import org.apache.cloudstack.api.response.CreateCmdResponse;
Expand Down Expand Up @@ -133,6 +134,7 @@
import org.apache.cloudstack.backup.BackupOffering;
import org.apache.cloudstack.backup.BackupSchedule;
import org.apache.cloudstack.config.Configuration;
import org.apache.cloudstack.config.ConfigurationGroup;
import org.apache.cloudstack.direct.download.DirectDownloadCertificate;
import org.apache.cloudstack.direct.download.DirectDownloadCertificateHostMap;
import org.apache.cloudstack.direct.download.DirectDownloadManager;
Expand Down Expand Up @@ -244,6 +246,8 @@ public interface ResponseGenerator {

ConfigurationResponse createConfigurationResponse(Configuration cfg);

ConfigurationGroupResponse createConfigurationGroupResponse(ConfigurationGroup cfgGroup);

SnapshotResponse createSnapshotResponse(Snapshot snapshot);

SnapshotPolicyResponse createSnapshotPolicyResponse(SnapshotPolicy policy);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.config;

import java.util.ArrayList;
import java.util.List;

import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ConfigurationGroupResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.config.ConfigurationGroup;
import org.apache.log4j.Logger;

import com.cloud.utils.Pair;

@APICommand(name = ListCfgGroupsByCmd.APINAME, description = "Lists all configuration groups (primarily used for UI).", responseObject = ConfigurationGroupResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.18.0")
public class ListCfgGroupsByCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListCfgGroupsByCmd.class.getName());

public static final String APINAME = "listConfigurationGroups";

// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////

@Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "lists configuration group by group name")
private String groupName;

// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////

public String getGroupName() {
return groupName;
}

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////

@Override
public String getCommandName() {
return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
}

@Override
public void execute() {
Pair<List<? extends ConfigurationGroup>, Integer> result = _mgr.listConfigurationGroups(this);
ListResponse<ConfigurationGroupResponse> response = new ListResponse<>();
List<ConfigurationGroupResponse> configGroupResponses = new ArrayList<>();
for (ConfigurationGroup cfgGroup : result.first()) {
ConfigurationGroupResponse cfgGroupResponse = _responseGenerator.createConfigurationGroupResponse(cfgGroup);
configGroupResponses.add(cfgGroupResponse);
}

response.setResponses(configGroupResponses, result.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;

import org.apache.cloudstack.api.APICommand;
Expand All @@ -35,7 +38,9 @@
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.config.Configuration;

import com.cloud.exception.InvalidParameterValueException;
import com.cloud.utils.Pair;
import com.cloud.utils.exception.CloudRuntimeException;

@APICommand(name = "listConfigurations", description = "Lists all configurations.", responseObject = ConfigurationResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
Expand Down Expand Up @@ -89,6 +94,15 @@ public class ListCfgsByCmd extends BaseListCmd {
description = "the ID of the Image Store to update the parameter value for corresponding image store")
private Long imageStoreId;

@Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "lists configuration by group name (primarily used for UI)", since = "4.18.0")
private String groupName;

@Parameter(name = ApiConstants.SUBGROUP, type = CommandType.STRING, description = "lists configuration by subgroup name (primarily used for UI)", since = "4.18.0")
private String subGroupName;

@Parameter(name = ApiConstants.PARENT, type = CommandType.STRING, description = "lists configuration by parent name (primarily used for UI)", since = "4.18.0")
private String parentName;

// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
Expand Down Expand Up @@ -125,6 +139,26 @@ public Long getImageStoreId() {
return imageStoreId;
}

public String getGroupName() {
return groupName;
}

public String getSubGroupName() {
return subGroupName;
}

public String getParentName() {
return parentName;
}

@Override
public Integer getPageSize() {
if (StringUtils.isNotEmpty(getGroupName())) {
return Integer.valueOf(s_pageSizeUnlimited.intValue());
}
return super.getPageSize();
}

@Override
public Long getPageSizeVal() {
Long defaultPageSize = 500L;
Expand All @@ -143,37 +177,74 @@ public Long getPageSizeVal() {
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////

private void setScope(ConfigurationResponse cfgResponse) {
if (!matchesConfigurationGroup(cfgResponse)) {
return;
}
cfgResponse.setObjectName("configuration");
if (getZoneId() != null) {
cfgResponse.setScope("zone");
}
if (getClusterId() != null) {
cfgResponse.setScope("cluster");
}
if (getStoragepoolId() != null) {
cfgResponse.setScope("storagepool");
}
if (getAccountId() != null) {
cfgResponse.setScope("account");
}
if (getDomainId() != null) {
cfgResponse.setScope("domain");
}
if (getImageStoreId() != null){
cfgResponse.setScope("imagestore");
}
}

@Override
public void execute() {
Pair<List<? extends Configuration>, Integer> result = _mgr.searchForConfigurations(this);
ListResponse<ConfigurationResponse> response = new ListResponse<ConfigurationResponse>();
List<ConfigurationResponse> configResponses = new ArrayList<ConfigurationResponse>();
for (Configuration cfg : result.first()) {
ConfigurationResponse cfgResponse = _responseGenerator.createConfigurationResponse(cfg);
cfgResponse.setObjectName("configuration");
if (getZoneId() != null) {
cfgResponse.setScope("zone");
}
if (getClusterId() != null) {
cfgResponse.setScope("cluster");
validateParameters();
try {
Pair<List<? extends Configuration>, Integer> result = _mgr.searchForConfigurations(this);
ListResponse<ConfigurationResponse> response = new ListResponse<>();
List<ConfigurationResponse> configResponses = new ArrayList<>();
for (Configuration cfg : result.first()) {
ConfigurationResponse cfgResponse = _responseGenerator.createConfigurationResponse(cfg);
setScope(cfgResponse);
configResponses.add(cfgResponse);
}
if (getStoragepoolId() != null) {
cfgResponse.setScope("storagepool");
}
if (getAccountId() != null) {
cfgResponse.setScope("account");

if (StringUtils.isNotEmpty(getGroupName())) {
response.setResponses(configResponses, configResponses.size());
} else {
response.setResponses(configResponses, result.second());
}
if (getDomainId() != null) {
cfgResponse.setScope("domain");
response.setResponseName(getCommandName());
setResponseObject(response);
} catch (InvalidParameterValueException e) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage());
} catch (CloudRuntimeException e) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
}
}

private void validateParameters() {
if (StringUtils.isNotEmpty(getSubGroupName()) && StringUtils.isEmpty(getGroupName())) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Configuration group name must be specified with the subgroup name");
}
}

private boolean matchesConfigurationGroup(ConfigurationResponse cfgResponse) {
if (StringUtils.isNotEmpty(getGroupName())) {
if (!(getGroupName().equalsIgnoreCase(cfgResponse.getGroup()))) {
return false;
}
if (getImageStoreId() != null){
cfgResponse.setScope("imagestore");
if (StringUtils.isNotEmpty(getSubGroupName()) &&
!getSubGroupName().equalsIgnoreCase(cfgResponse.getSubGroup())) {
return false;
}
configResponses.add(cfgResponse);
}

response.setResponses(configResponses, result.second());
response.setResponseName(getCommandName());
setResponseObject(response);
return true;
}
}
Loading