Merge remote-tracking branch 'apache/4.19'

This commit is contained in:
Abhishek Kumar 2024-04-04 17:54:42 +05:30
commit 55b28d645f
46 changed files with 721 additions and 78 deletions

View File

@ -91,6 +91,10 @@ public interface AlertService {
return null;
}
public static Set<AlertType> getAlertTypes() {
return defaultAlertTypes;
}
@Override
public String toString() {
return String.valueOf(this.getType());

View File

@ -20,6 +20,7 @@ package org.apache.cloudstack.api.command.admin.acl.project;
import org.apache.cloudstack.acl.ProjectRole;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
@ -70,4 +71,13 @@ public class CreateProjectRoleCmd extends ProjectRoleCmd {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public Long getApiResourceId() {
return getProjectId();
}
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Project;
}
}

View File

@ -22,6 +22,7 @@ import org.apache.cloudstack.acl.ProjectRolePermission;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.Parameter;
@ -96,4 +97,14 @@ public class CreateProjectRolePermissionCmd extends BaseRolePermissionCmd {
response.setObjectName("projectrolepermission");
setResponseObject(response);
}
@Override
public Long getApiResourceId() {
return getProjectId();
}
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Project;
}
}

View File

@ -21,6 +21,7 @@ import org.apache.cloudstack.acl.ProjectRole;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
@ -79,4 +80,14 @@ public class DeleteProjectRoleCmd extends BaseCmd {
public long getEntityOwnerId() {
return CallContext.current().getCallingAccountId();
}
@Override
public Long getApiResourceId() {
return getProjectId();
}
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Project;
}
}

View File

@ -21,6 +21,7 @@ import org.apache.cloudstack.acl.ProjectRolePermission;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
@ -80,4 +81,14 @@ public class DeleteProjectRolePermissionCmd extends BaseCmd {
public long getEntityOwnerId() {
return CallContext.current().getCallingAccountId();
}
@Override
public Long getApiResourceId() {
return getProjectId();
}
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Project;
}
}

View File

@ -21,6 +21,7 @@ import org.apache.cloudstack.acl.ProjectRole;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
@ -76,4 +77,14 @@ public class UpdateProjectRoleCmd extends ProjectRoleCmd {
public long getEntityOwnerId() {
return 0;
}
@Override
public Long getApiResourceId() {
return getProjectId();
}
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Project;
}
}

View File

@ -26,6 +26,7 @@ import org.apache.cloudstack.acl.ProjectRolePermission;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
@ -154,4 +155,14 @@ public class UpdateProjectRolePermissionCmd extends BaseCmd {
public long getEntityOwnerId() {
return CallContext.current().getCallingAccountId();
}
@Override
public Long getApiResourceId() {
return getProjectId();
}
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Project;
}
}

View File

@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.offering;
import java.util.ArrayList;
import java.util.List;
import com.cloud.offering.DiskOffering.State;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
@ -27,6 +28,7 @@ import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DiskOfferingResponse;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.StringUtils;
import com.cloud.dc.DataCenter;
@ -121,6 +123,9 @@ public class UpdateDiskOfferingCmd extends BaseCmd {
@Parameter(name = ApiConstants.CACHE_MODE, type = CommandType.STRING, description = "the cache mode to use for this disk offering", since = "4.15")
private String cacheMode;
@Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "state of the disk offering")
private String diskOfferingState;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -260,6 +265,13 @@ public class UpdateDiskOfferingCmd extends BaseCmd {
public Long getIopsWriteRateMaxLength() {
return iopsWriteRateMaxLength;
}
public State getState() {
State state = EnumUtils.getEnumIgnoreCase(State.class, diskOfferingState);
if (StringUtils.isNotBlank(diskOfferingState) && state == null) {
throw new InvalidParameterValueException("Invalid state value: " + diskOfferingState);
}
return state;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////

View File

@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.offering;
import java.util.ArrayList;
import java.util.List;
import com.cloud.offering.ServiceOffering.State;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
@ -27,6 +28,7 @@ import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.StringUtils;
import com.cloud.dc.DataCenter;
@ -82,6 +84,11 @@ public class UpdateServiceOfferingCmd extends BaseCmd {
since = "4.16")
private String hostTags;
@Parameter(name = ApiConstants.STATE,
type = CommandType.STRING,
description = "state of the service offering")
private String serviceOfferingState;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -170,6 +177,14 @@ public class UpdateServiceOfferingCmd extends BaseCmd {
return hostTags;
}
public State getState() {
State state = EnumUtils.getEnumIgnoreCase(State.class, serviceOfferingState);
if (StringUtils.isNotBlank(serviceOfferingState) && state == null) {
throw new InvalidParameterValueException("Invalid state value: " + serviceOfferingState);
}
return state;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -26,6 +26,7 @@ import com.cloud.host.Host;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
@ -102,4 +103,14 @@ public class ChangeOutOfBandManagementPasswordCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "change out-of-band management password for host: " + getHostId();
}
@Override
public Long getApiResourceId() {
return getHostId();
}
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Host;
}
}

View File

@ -26,6 +26,7 @@ import com.google.common.collect.ImmutableMap;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
@ -112,4 +113,14 @@ public class ConfigureOutOfBandManagementCmd extends BaseCmd {
builder.put(option, value);
}
}
@Override
public Long getApiResourceId() {
return getHostId();
}
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Host;
}
}

View File

@ -27,6 +27,7 @@ import com.cloud.org.Cluster;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
@ -94,4 +95,14 @@ public class DisableOutOfBandManagementForClusterCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "disable out-of-band management password for cluster: " + getClusterId();
}
@Override
public Long getApiResourceId() {
return getClusterId();
}
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Cluster;
}
}

View File

@ -27,6 +27,7 @@ import com.cloud.host.Host;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
@ -95,4 +96,14 @@ public class DisableOutOfBandManagementForHostCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "disable out-of-band management password for host: " + getHostId();
}
@Override
public Long getApiResourceId() {
return getHostId();
}
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Host;
}
}

View File

@ -27,6 +27,7 @@ import com.cloud.exception.ResourceUnavailableException;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
@ -94,4 +95,14 @@ public class DisableOutOfBandManagementForZoneCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "disable out-of-band management password for zone: " + getZoneId();
}
@Override
public Long getApiResourceId() {
return getZoneId();
}
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Zone;
}
}

View File

@ -27,6 +27,7 @@ import com.cloud.org.Cluster;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
@ -94,4 +95,14 @@ public class EnableOutOfBandManagementForClusterCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "enable out-of-band management password for cluster: " + getClusterId();
}
@Override
public Long getApiResourceId() {
return getClusterId();
}
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Cluster;
}
}

View File

@ -27,6 +27,7 @@ import com.cloud.host.Host;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
@ -95,4 +96,14 @@ public class EnableOutOfBandManagementForHostCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "enable out-of-band management password for host: " + getHostId();
}
@Override
public Long getApiResourceId() {
return getHostId();
}
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Host;
}
}

View File

@ -27,6 +27,7 @@ import com.cloud.exception.ResourceUnavailableException;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
@ -94,4 +95,14 @@ public class EnableOutOfBandManagementForZoneCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "enable out-of-band management password for zone: " + getZoneId();
}
@Override
public Long getApiResourceId() {
return getZoneId();
}
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Zone;
}
}

View File

@ -114,4 +114,9 @@ public class IssueOutOfBandManagementPowerActionCmd extends BaseAsyncCmd {
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Host;
}
@Override
public Long getApiResourceId() {
return getHostId();
}
}

View File

@ -0,0 +1,54 @@
// 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.resource;
import com.cloud.user.Account;
import org.apache.cloudstack.alert.AlertService;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.response.AlertResponse;
import org.apache.cloudstack.api.response.AlertTypeResponse;
import org.apache.cloudstack.api.response.ListResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@APICommand(name = "listAlertTypes", description = "Lists all alerts types", responseObject = AlertResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListAlertTypesCmd extends BaseCmd {
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute() {
Set<AlertService.AlertType> result = AlertService.AlertType.getAlertTypes();
ListResponse<AlertTypeResponse> response = new ListResponse<>();
List<AlertTypeResponse> typeResponseList = new ArrayList<>();
for (AlertService.AlertType alertType : result) {
AlertTypeResponse alertResponse = new AlertTypeResponse(alertType.getType(), alertType.getName());
alertResponse.setObjectName("alerttype");
typeResponseList.add(alertResponse);
}
response.setResponses(typeResponseList, result.size());
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}

View File

@ -16,6 +16,8 @@
// under the License.
package org.apache.cloudstack.api.command.user.offering;
import static com.cloud.offering.DiskOffering.State.Active;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
@ -26,6 +28,10 @@ import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.StringUtils;
import com.cloud.offering.DiskOffering.State;
@APICommand(name = "listDiskOfferings", description = "Lists all available disk offerings.", responseObject = DiskOfferingResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
@ -64,6 +70,11 @@ public class ListDiskOfferingsCmd extends BaseListProjectAndAccountResourcesCmd
since = "4.19")
private String storageType;
@Parameter(name = ApiConstants.STATE, type = CommandType.STRING,
description = "Filter by state of the disk offering. Defaults to 'Active'. If set to 'all' shows both Active & Inactive offerings.",
since = "4.19")
private String diskOfferingState;
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
type = CommandType.UUID,
entityType = UserVmResponse.class,
@ -99,6 +110,17 @@ public class ListDiskOfferingsCmd extends BaseListProjectAndAccountResourcesCmd
return storageType;
}
public State getState() {
if (StringUtils.isBlank(diskOfferingState)) {
return Active;
}
State state = EnumUtils.getEnumIgnoreCase(State.class, diskOfferingState);
if (!diskOfferingState.equalsIgnoreCase("all") && state == null) {
throw new IllegalArgumentException("Invalid state value: " + diskOfferingState);
}
return state;
}
public Long getVirtualMachineId() {
return virtualMachineId;
}

View File

@ -16,6 +16,8 @@
// under the License.
package org.apache.cloudstack.api.command.user.offering;
import static com.cloud.offering.ServiceOffering.State.Active;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
@ -25,6 +27,10 @@ import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.StringUtils;
import com.cloud.offering.ServiceOffering.State;
@APICommand(name = "listServiceOfferings", description = "Lists all available service offerings.", responseObject = ServiceOfferingResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
@ -92,6 +98,11 @@ public class ListServiceOfferingsCmd extends BaseListProjectAndAccountResourcesC
since = "4.19")
private String storageType;
@Parameter(name = ApiConstants.STATE, type = CommandType.STRING,
description = "Filter by state of the service offering. Defaults to 'Active'. If set to 'all' shows both Active & Inactive offerings.",
since = "4.19")
private String serviceOfferingState;
@Parameter(name = ApiConstants.TEMPLATE_ID,
type = CommandType.UUID,
entityType = TemplateResponse.class,
@ -99,7 +110,6 @@ public class ListServiceOfferingsCmd extends BaseListProjectAndAccountResourcesC
since = "4.20.0")
private Long templateId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -146,6 +156,17 @@ public class ListServiceOfferingsCmd extends BaseListProjectAndAccountResourcesC
return storageType;
}
public State getState() {
if (StringUtils.isBlank(serviceOfferingState)) {
return Active;
}
State state = EnumUtils.getEnumIgnoreCase(State.class, serviceOfferingState);
if (!serviceOfferingState.equalsIgnoreCase("all") && state == null) {
throw new IllegalArgumentException("Invalid state value: " + serviceOfferingState);
}
return state;
}
public Long getTemplateId() {
return templateId;
}

View File

@ -136,4 +136,10 @@ public class CreateVMSnapshotCmd extends BaseAsyncCreateCmd {
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.VmSnapshot;
}
@Override
public Long getApiResourceId() {
return getEntityId();
}
}

View File

@ -0,0 +1,55 @@
// 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.response;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
public class AlertTypeResponse extends BaseResponse {
@SerializedName("alerttypeid")
@Param(description = "alert type")
private short alertType;
@SerializedName(ApiConstants.NAME)
@Param(description = "description of alert type")
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public short getUsageType() {
return alertType;
}
public void setUsageType(short alertType) {
this.alertType = alertType;
}
public AlertTypeResponse(short alertType, String name) {
this.alertType = alertType;
this.name = name;
setObjectName("alerttype");
}
}

View File

@ -53,6 +53,10 @@ public class DiskOfferingResponse extends BaseResponseWithAnnotations {
@Param(description = "the name of the disk offering")
private String name;
@SerializedName(ApiConstants.STATE)
@Param(description = "state of the disk offering")
private String state;
@SerializedName(ApiConstants.DISPLAY_TEXT)
@Param(description = "an alternate display text of the disk offering.")
private String displayText;
@ -230,6 +234,14 @@ public class DiskOfferingResponse extends BaseResponseWithAnnotations {
this.name = name;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getDisplayText() {
return displayText;
}

View File

@ -37,6 +37,10 @@ public class ServiceOfferingResponse extends BaseResponseWithAnnotations {
@Param(description = "the name of the service offering")
private String name;
@SerializedName("state")
@Param(description = "state of the service offering")
private String state;
@SerializedName("displaytext")
@Param(description = "an alternate display text of the service offering.")
private String displayText;
@ -249,6 +253,14 @@ public class ServiceOfferingResponse extends BaseResponseWithAnnotations {
this.name = name;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public Boolean getIsSystem() {
return isSystem;
}

View File

@ -76,7 +76,5 @@ FROM
LEFT JOIN
`cloud`.`disk_offering_details` AS `vsphere_storage_policy` ON `vsphere_storage_policy`.`offering_id` = `disk_offering`.`id`
AND `vsphere_storage_policy`.`name` = 'storagepolicy'
WHERE
`disk_offering`.`state`='Active'
GROUP BY
`disk_offering`.`id`;

View File

@ -24,6 +24,7 @@ SELECT
`service_offering`.`id` AS `id`,
`service_offering`.`uuid` AS `uuid`,
`service_offering`.`name` AS `name`,
`service_offering`.`state` AS `state`,
`service_offering`.`display_text` AS `display_text`,
`disk_offering`.`provisioning_type` AS `provisioning_type`,
`service_offering`.`created` AS `created`,
@ -84,7 +85,7 @@ SELECT
FROM
`cloud`.`service_offering`
INNER JOIN
`cloud`.`disk_offering` ON service_offering.disk_offering_id = disk_offering.id AND `disk_offering`.`state`='Active'
`cloud`.`disk_offering` ON service_offering.disk_offering_id = disk_offering.id
LEFT JOIN
`cloud`.`service_offering_details` AS `domain_details` ON `domain_details`.`service_offering_id` = `service_offering`.`id` AND `domain_details`.`name`='domainid'
LEFT JOIN
@ -108,7 +109,5 @@ FROM
LEFT JOIN
`cloud`.`service_offering_details` AS `vsphere_storage_policy` ON `vsphere_storage_policy`.`service_offering_id` = `service_offering`.`id`
AND `vsphere_storage_policy`.`name` = 'storagepolicy'
WHERE
`service_offering`.`state`='Active'
GROUP BY
`service_offering`.`id`;

View File

@ -16,6 +16,8 @@
// under the License.
package com.cloud.api.query;
import static com.cloud.vm.VmDetailConstants.SSH_PUBLIC_KEY;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
@ -34,37 +36,6 @@ import java.util.stream.Stream;
import javax.inject.Inject;
import com.cloud.storage.StoragePool;
import com.cloud.storage.StoragePoolHostVO;
import com.cloud.event.EventVO;
import com.cloud.event.dao.EventDao;
import com.cloud.host.HostVO;
import com.cloud.offering.ServiceOffering;
import com.cloud.service.ServiceOfferingDetailsVO;
import com.cloud.storage.VMTemplateStoragePoolVO;
import com.cloud.storage.dao.StoragePoolHostDao;
import com.cloud.storage.dao.VMTemplatePoolDao;
import com.cloud.host.Host;
import com.cloud.host.dao.HostDao;
import com.cloud.network.as.AutoScaleVmGroupVmMapVO;
import com.cloud.network.as.dao.AutoScaleVmGroupDao;
import com.cloud.network.as.dao.AutoScaleVmGroupVmMapDao;
import com.cloud.network.dao.NetworkDao;
import com.cloud.network.dao.NetworkVO;
import com.cloud.network.dao.PublicIpQuarantineDao;
import com.cloud.network.PublicIpQuarantine;
import com.cloud.network.vo.PublicIpQuarantineVO;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.user.AccountVO;
import com.cloud.user.SSHKeyPairVO;
import com.cloud.user.dao.SSHKeyPairDao;
import com.cloud.vm.InstanceGroupVMMapVO;
import com.cloud.vm.NicVO;
import com.cloud.vm.UserVmDetailVO;
import com.cloud.vm.dao.InstanceGroupVMMapDao;
import com.cloud.vm.dao.NicDao;
import com.cloud.vm.dao.UserVmDetailsDao;
import com.cloud.storage.VolumeVO;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import org.apache.cloudstack.acl.SecurityChecker;
@ -105,6 +76,7 @@ import org.apache.cloudstack.api.command.user.account.ListAccountsCmd;
import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd;
import org.apache.cloudstack.api.command.user.address.ListQuarantinedIpsCmd;
import org.apache.cloudstack.api.command.user.affinitygroup.ListAffinityGroupsCmd;
import org.apache.cloudstack.api.command.user.bucket.ListBucketsCmd;
import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
import org.apache.cloudstack.api.command.user.job.ListAsyncJobsCmd;
@ -126,6 +98,7 @@ import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd;
import org.apache.cloudstack.api.command.user.zone.ListZonesCmd;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.AsyncJobResponse;
import org.apache.cloudstack.api.response.BucketResponse;
import org.apache.cloudstack.api.response.DetailOptionsResponse;
import org.apache.cloudstack.api.response.DiskOfferingResponse;
import org.apache.cloudstack.api.response.DomainResponse;
@ -248,22 +221,36 @@ import com.cloud.dc.dao.DedicatedResourceDao;
import com.cloud.domain.Domain;
import com.cloud.domain.DomainVO;
import com.cloud.domain.dao.DomainDao;
import com.cloud.event.EventVO;
import com.cloud.event.dao.EventDao;
import com.cloud.event.dao.EventJoinDao;
import com.cloud.exception.CloudAuthenticationException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.ha.HighAvailabilityManager;
import com.cloud.host.Host;
import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDao;
import com.cloud.hypervisor.Hypervisor;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.PublicIpQuarantine;
import com.cloud.network.RouterHealthCheckResult;
import com.cloud.network.VNF;
import com.cloud.network.VpcVirtualNetworkApplianceService;
import com.cloud.network.as.AutoScaleVmGroupVmMapVO;
import com.cloud.network.as.dao.AutoScaleVmGroupDao;
import com.cloud.network.as.dao.AutoScaleVmGroupVmMapDao;
import com.cloud.network.dao.NetworkDao;
import com.cloud.network.dao.NetworkVO;
import com.cloud.network.dao.PublicIpQuarantineDao;
import com.cloud.network.dao.RouterHealthCheckResultDao;
import com.cloud.network.dao.RouterHealthCheckResultVO;
import com.cloud.network.router.VirtualNetworkApplianceManager;
import com.cloud.network.security.SecurityGroupVMMapVO;
import com.cloud.network.security.dao.SecurityGroupVMMapDao;
import com.cloud.network.vo.PublicIpQuarantineVO;
import com.cloud.offering.DiskOffering;
import com.cloud.offering.ServiceOffering;
import com.cloud.org.Grouping;
import com.cloud.projects.Project;
import com.cloud.projects.Project.ListProjectResourcesCriteria;
@ -279,6 +266,7 @@ import com.cloud.server.ResourceManagerUtil;
import com.cloud.server.ResourceMetaDataService;
import com.cloud.server.ResourceTag;
import com.cloud.server.ResourceTag.ResourceObjectType;
import com.cloud.service.ServiceOfferingDetailsVO;
import com.cloud.service.ServiceOfferingVO;
import com.cloud.service.dao.ServiceOfferingDao;
import com.cloud.service.dao.ServiceOfferingDetailsDao;
@ -292,24 +280,34 @@ import com.cloud.storage.Storage;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Storage.TemplateType;
import com.cloud.storage.StorageManager;
import com.cloud.storage.StoragePool;
import com.cloud.storage.StoragePoolHostVO;
import com.cloud.storage.StoragePoolStatus;
import com.cloud.storage.StoragePoolTagVO;
import com.cloud.storage.VMTemplateStoragePoolVO;
import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.Volume;
import com.cloud.storage.VolumeApiServiceImpl;
import com.cloud.storage.VolumeVO;
import com.cloud.storage.dao.BucketDao;
import com.cloud.storage.dao.DiskOfferingDao;
import com.cloud.storage.dao.StoragePoolHostDao;
import com.cloud.storage.dao.StoragePoolTagsDao;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.storage.dao.VMTemplatePoolDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.tags.ResourceTagVO;
import com.cloud.tags.dao.ResourceTagDao;
import com.cloud.template.VirtualMachineTemplate.State;
import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
import com.cloud.user.Account;
import com.cloud.user.AccountManager;
import com.cloud.user.AccountVO;
import com.cloud.user.DomainManager;
import com.cloud.user.SSHKeyPairVO;
import com.cloud.user.User;
import com.cloud.user.dao.AccountDao;
import com.cloud.user.dao.SSHKeyPairDao;
import com.cloud.user.dao.UserDao;
import com.cloud.utils.DateUtil;
import com.cloud.utils.NumbersUtil;
@ -325,18 +323,20 @@ import com.cloud.utils.db.SearchCriteria.Func;
import com.cloud.utils.db.SearchCriteria.Op;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.DomainRouterVO;
import com.cloud.vm.InstanceGroupVMMapVO;
import com.cloud.vm.NicVO;
import com.cloud.vm.UserVmDetailVO;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineManager;
import com.cloud.vm.VmDetailConstants;
import com.cloud.vm.dao.DomainRouterDao;
import com.cloud.vm.dao.InstanceGroupVMMapDao;
import com.cloud.vm.dao.NicDao;
import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.dao.UserVmDetailsDao;
import com.cloud.vm.dao.VMInstanceDao;
import org.apache.cloudstack.api.command.user.bucket.ListBucketsCmd;
import org.apache.cloudstack.api.response.BucketResponse;
import static com.cloud.vm.VmDetailConstants.SSH_PUBLIC_KEY;
@Component
public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements QueryService, Configurable {
@ -3333,6 +3333,7 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
Long storagePoolId = cmd.getStoragePoolId();
Boolean encrypt = cmd.getEncrypt();
String storageType = cmd.getStorageType();
DiskOffering.State state = cmd.getState();
final Long vmId = cmd.getVirtualMachineId();
Filter searchFilter = new Filter(DiskOfferingVO.class, "sortKey", SortKeyAscending.value(), cmd.getStartIndex(), cmd.getPageSizeVal());
@ -3341,7 +3342,10 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
diskOfferingSearch.select(null, Func.DISTINCT, diskOfferingSearch.entity().getId()); // select distinct
diskOfferingSearch.and("computeOnly", diskOfferingSearch.entity().isComputeOnly(), Op.EQ);
diskOfferingSearch.and("activeState", diskOfferingSearch.entity().getState(), Op.EQ);
if (state != null) {
diskOfferingSearch.and("state", diskOfferingSearch.entity().getState(), Op.EQ);
}
// Keeping this logic consistent with domain specific zones
// if a domainId is provided, we just return the disk offering
@ -3454,7 +3458,10 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
SearchCriteria<DiskOfferingVO> sc = diskOfferingSearch.create();
sc.setParameters("computeOnly", false);
sc.setParameters("activeState", DiskOffering.State.Active);
if (state != null) {
sc.setParameters("state", state);
}
if (keyword != null) {
sc.setParameters("keywordDisplayText", "%" + keyword + "%");
@ -3625,6 +3632,7 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
Integer cpuSpeed = cmd.getCpuSpeed();
Boolean encryptRoot = cmd.getEncryptRoot();
String storageType = cmd.getStorageType();
ServiceOffering.State state = cmd.getState();
final Long templateId = cmd.getTemplateId();
final Account owner = accountMgr.finalizeOwner(caller, accountName, domainId, projectId);
@ -3660,7 +3668,10 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
SearchBuilder<ServiceOfferingVO> serviceOfferingSearch = _srvOfferingDao.createSearchBuilder();
serviceOfferingSearch.select(null, Func.DISTINCT, serviceOfferingSearch.entity().getId()); // select distinct
serviceOfferingSearch.and("activeState", serviceOfferingSearch.entity().getState(), Op.EQ);
if (state != null) {
serviceOfferingSearch.and("state", serviceOfferingSearch.entity().getState(), Op.EQ);
}
if (vmId != null) {
currentVmOffering = _srvOfferingDao.findByIdIncludingRemoved(vmInstance.getId(), vmInstance.getServiceOfferingId());
@ -3939,7 +3950,9 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
}
SearchCriteria<ServiceOfferingVO> sc = serviceOfferingSearch.create();
sc.setParameters("activeState", ServiceOffering.State.Active);
if (state != null) {
sc.setParameters("state", state);
}
if (vmId != null) {
if (!currentVmOffering.isDynamic()) {

View File

@ -103,6 +103,7 @@ public class DiskOfferingJoinDaoImpl extends GenericDaoBase<DiskOfferingJoinVO,
DiskOfferingResponse diskOfferingResponse = new DiskOfferingResponse();
diskOfferingResponse.setId(offering.getUuid());
diskOfferingResponse.setName(offering.getName());
diskOfferingResponse.setState(offering.getState().toString());
diskOfferingResponse.setDisplayText(offering.getDisplayText());
diskOfferingResponse.setProvisioningType(offering.getProvisioningType().toString());
diskOfferingResponse.setCreated(offering.getCreated());

View File

@ -114,6 +114,7 @@ public class ServiceOfferingJoinDaoImpl extends GenericDaoBase<ServiceOfferingJo
ServiceOfferingResponse offeringResponse = new ServiceOfferingResponse();
offeringResponse.setId(offering.getUuid());
offeringResponse.setName(offering.getName());
offeringResponse.setState(offering.getState().toString());
offeringResponse.setIsSystemOffering(offering.isSystemUse());
offeringResponse.setDefaultUse(offering.isDefaultUse());
offeringResponse.setSystemVmType(offering.getSystemVmType());

View File

@ -20,9 +20,12 @@ import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;
import com.cloud.offering.ServiceOffering.State;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
@ -43,6 +46,10 @@ public class ServiceOfferingJoinVO extends BaseViewVO implements InternalIdentit
@Column(name = "name")
private String name;
@Column(name = "state")
@Enumerated(value = EnumType.STRING)
private State state;
@Column(name = "display_text")
private String displayText;
@ -231,6 +238,10 @@ public class ServiceOfferingJoinVO extends BaseViewVO implements InternalIdentit
return name;
}
public State getState() {
return state;
}
public String getDisplayText() {
return displayText;
}

View File

@ -3467,6 +3467,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
final List<Long> zoneIds = cmd.getZoneIds();
String storageTags = cmd.getStorageTags();
String hostTags = cmd.getHostTags();
ServiceOffering.State state = cmd.getState();
if (userId == null) {
userId = Long.valueOf(User.UID_SYSTEM);
@ -3551,7 +3552,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
throw new InvalidParameterValueException(String.format("Unable to update service offering: %s by id user: %s because it is not root-admin or domain-admin", offeringHandle.getUuid(), user.getUuid()));
}
final boolean updateNeeded = name != null || displayText != null || sortKey != null || storageTags != null || hostTags != null;
final boolean updateNeeded = name != null || displayText != null || sortKey != null || storageTags != null || hostTags != null || state != null;
final boolean detailsUpdateNeeded = !filteredDomainIds.equals(existingDomainIds) || !filteredZoneIds.equals(existingZoneIds);
if (!updateNeeded && !detailsUpdateNeeded) {
return _serviceOfferingDao.findById(id);
@ -3571,8 +3572,17 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
offering.setSortKey(sortKey);
}
if (state != null) {
offering.setState(state);
}
DiskOfferingVO diskOffering = _diskOfferingDao.findById(offeringHandle.getDiskOfferingId());
updateOfferingTagsIfIsNotNull(storageTags, diskOffering);
if (diskOffering.isComputeOnly() && state != null) {
diskOffering.setState(state == ServiceOffering.State.Active ? DiskOffering.State.Active : DiskOffering.State.Inactive);
}
_diskOfferingDao.update(diskOffering.getId(), diskOffering);
updateServiceOfferingHostTagsIfNotNull(hostTags, offering);
@ -3927,6 +3937,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
Long iopsWriteRateMax = cmd.getIopsWriteRateMax();
Long iopsWriteRateMaxLength = cmd.getIopsWriteRateMaxLength();
String cacheMode = cmd.getCacheMode();
DiskOffering.State state = cmd.getState();
// Check if diskOffering exists
final DiskOffering diskOfferingHandle = _entityMgr.findById(DiskOffering.class, diskOfferingId);
@ -3980,7 +3991,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
throw new InvalidParameterValueException(String.format("Unable to update disk offering: %s by id user: %s because it is not root-admin or domain-admin", diskOfferingHandle.getUuid(), user.getUuid()));
}
boolean updateNeeded = shouldUpdateDiskOffering(name, displayText, sortKey, displayDiskOffering, tags, cacheMode) ||
boolean updateNeeded = shouldUpdateDiskOffering(name, displayText, sortKey, displayDiskOffering, tags, cacheMode, state) ||
shouldUpdateIopsRateParameters(iopsReadRate, iopsReadRateMax, iopsReadRateMaxLength, iopsWriteRate, iopsWriteRateMax, iopsWriteRateMaxLength) ||
shouldUpdateBytesRateParameters(bytesReadRate, bytesReadRateMax, bytesReadRateMaxLength, bytesWriteRate, bytesWriteRateMax, bytesWriteRateMaxLength);
@ -4008,6 +4019,10 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
diskOffering.setCacheMode(DiskOffering.DiskCacheMode.valueOf(cacheMode.toUpperCase()));
}
if (state != null) {
diskOffering.setState(state);
}
if (updateNeeded && !_diskOfferingDao.update(diskOfferingId, diskOffering)) {
return null;
}
@ -4228,8 +4243,8 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
* Check if it needs to update any parameter when updateDiskoffering is called
* Verify if name or displayText are not blank, tags is not null, sortkey and displayDiskOffering is not null
*/
protected boolean shouldUpdateDiskOffering(String name, String displayText, Integer sortKey, Boolean displayDiskOffering, String tags, String cacheMode) {
return !StringUtils.isAllBlank(name, displayText, cacheMode) || tags != null || sortKey != null || displayDiskOffering != null;
protected boolean shouldUpdateDiskOffering(String name, String displayText, Integer sortKey, Boolean displayDiskOffering, String tags, String cacheMode, DiskOffering.State state) {
return !StringUtils.isAllBlank(name, displayText, cacheMode) || tags != null || sortKey != null || displayDiskOffering != null || state != null;
}
protected boolean shouldUpdateBytesRateParameters(Long bytesReadRate, Long bytesReadRateMax, Long bytesReadRateMaxLength, Long bytesWriteRate, Long bytesWriteRateMax, Long bytesWriteRateMaxLength) {

View File

@ -185,6 +185,7 @@ import org.apache.cloudstack.api.command.admin.region.UpdateRegionCmd;
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.CleanVMReservationsCmd;
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.ListAlertTypesCmd;
import org.apache.cloudstack.api.command.admin.resource.ListAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.ListCapacityCmd;
import org.apache.cloudstack.api.command.admin.resource.StartRollingMaintenanceCmd;
@ -3557,6 +3558,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
cmdList.add(RemoveRegionCmd.class);
cmdList.add(UpdateRegionCmd.class);
cmdList.add(ListAlertsCmd.class);
cmdList.add(ListAlertTypesCmd.class);
cmdList.add(ListCapacityCmd.class);
cmdList.add(UpdatePodManagementNetworkIpRangeCmd.class);
cmdList.add(UploadCustomCertificateCmd.class);

View File

@ -56,6 +56,7 @@ import com.cloud.network.dao.IPAddressVO;
import com.cloud.network.dao.Ipv6GuestPrefixSubnetNetworkMapDao;
import com.cloud.network.dao.PhysicalNetworkDao;
import com.cloud.network.dao.PhysicalNetworkVO;
import com.cloud.offering.DiskOffering;
import com.cloud.projects.ProjectManager;
import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.StoragePoolTagVO;
@ -1078,17 +1079,18 @@ public class ConfigurationManagerTest {
@Test
public void shouldUpdateDiskOfferingTests(){
Assert.assertTrue(configurationMgr.shouldUpdateDiskOffering(Mockito.anyString(), Mockito.anyString(), Mockito.anyInt(), Mockito.anyBoolean(), Mockito.anyString(), Mockito.anyString()));
Assert.assertTrue(configurationMgr.shouldUpdateDiskOffering(Mockito.anyString(), nullable(String.class), nullable(Integer.class), nullable(Boolean.class), nullable(String.class), nullable(String.class)));
Assert.assertTrue(configurationMgr.shouldUpdateDiskOffering(nullable(String.class), Mockito.anyString(), nullable(Integer.class), nullable(Boolean.class), nullable(String.class), nullable(String.class)));
Assert.assertTrue(configurationMgr.shouldUpdateDiskOffering(nullable(String.class), nullable(String.class), Mockito.anyInt(), nullable(Boolean.class), nullable(String.class), nullable(String.class)));
Assert.assertTrue(configurationMgr.shouldUpdateDiskOffering(nullable(String.class), nullable(String.class), nullable(int.class), Mockito.anyBoolean(), nullable(String.class), nullable(String.class)));
Assert.assertTrue(configurationMgr.shouldUpdateDiskOffering(nullable(String.class), nullable(String.class), nullable(int.class), nullable(Boolean.class), Mockito.anyString(), Mockito.anyString()));
Assert.assertTrue(configurationMgr.shouldUpdateDiskOffering(Mockito.anyString(), Mockito.anyString(), Mockito.anyInt(), Mockito.anyBoolean(), Mockito.anyString(), Mockito.anyString(), Mockito.any(DiskOffering.State.class)));
Assert.assertTrue(configurationMgr.shouldUpdateDiskOffering(Mockito.anyString(), nullable(String.class), nullable(Integer.class), nullable(Boolean.class), nullable(String.class), nullable(String.class), nullable(DiskOffering.State.class)));
Assert.assertTrue(configurationMgr.shouldUpdateDiskOffering(nullable(String.class), nullable(String.class), nullable(Integer.class), nullable(Boolean.class), nullable(String.class), nullable(String.class), Mockito.any(DiskOffering.State.class)));
Assert.assertTrue(configurationMgr.shouldUpdateDiskOffering(nullable(String.class), Mockito.anyString(), nullable(Integer.class), nullable(Boolean.class), nullable(String.class), nullable(String.class), nullable(DiskOffering.State.class)));
Assert.assertTrue(configurationMgr.shouldUpdateDiskOffering(nullable(String.class), nullable(String.class), Mockito.anyInt(), nullable(Boolean.class), nullable(String.class), nullable(String.class), nullable(DiskOffering.State.class)));
Assert.assertTrue(configurationMgr.shouldUpdateDiskOffering(nullable(String.class), nullable(String.class), nullable(int.class), Mockito.anyBoolean(), nullable(String.class), nullable(String.class), nullable(DiskOffering.State.class)));
Assert.assertTrue(configurationMgr.shouldUpdateDiskOffering(nullable(String.class), nullable(String.class), nullable(int.class), nullable(Boolean.class), Mockito.anyString(), Mockito.anyString(), nullable(DiskOffering.State.class)));
}
@Test
public void shouldUpdateDiskOfferingTestFalse(){
Assert.assertFalse(configurationMgr.shouldUpdateDiskOffering(null, null, null, null, null, null));
Assert.assertFalse(configurationMgr.shouldUpdateDiskOffering(null, null, null, null, null, null, null));
}
@Test

View File

@ -71,7 +71,6 @@
"label.action.delete.account": "Delete Account",
"label.action.delete.backup.offering": "Delete backup offering",
"label.action.delete.cluster": "Delete cluster",
"label.action.delete.disk.offering": "Delete disk offering",
"label.action.delete.domain": "Delete domain",
"label.action.delete.egress.firewall": "Delete egress firewall rule",
"label.action.delete.firewall": "Delete firewall rule",
@ -91,9 +90,7 @@
"label.action.delete.primary.storage": "Delete primary storage",
"label.action.delete.secondary.storage": "Delete secondary storage",
"label.action.delete.security.group": "Delete security group",
"label.action.delete.service.offering": "Delete service offering",
"label.action.delete.snapshot": "Delete Snapshot",
"label.action.delete.system.service.offering": "Delete system service offering",
"label.action.delete.template": "Delete Template",
"label.action.delete.tungsten.router.table": "Remove Tungsten Fabric route table from Network",
"label.action.delete.user": "Delete User",
@ -106,9 +103,12 @@
"label.action.detach.iso": "Detach ISO",
"label.action.disable.account": "Disable Account",
"label.action.disable.cluster": "Disable cluster",
"label.action.disable.disk.offering": "Disable disk offering",
"label.action.disable.physical.network": "Disable physical Network",
"label.action.disable.pod": "Disable pod",
"label.action.disable.static.nat": "Disable static NAT",
"label.action.disable.service.offering": "Disable service offering",
"label.action.disable.system.service.offering": "Disable system service offering",
"label.action.disable.user": "Disable User",
"label.action.disable.zone": "Disable zone",
"label.action.download.iso": "Download ISO",
@ -124,9 +124,12 @@
"label.action.verify.two.factor.authentication": "Verified Two factor authentication",
"label.action.enable.account": "Enable Account",
"label.action.enable.cluster": "Enable cluster",
"label.action.enable.disk.offering": "Enable disk offering",
"label.action.enable.maintenance.mode": "Enable maintenance mode",
"label.action.enable.physical.network": "Enable physical Network",
"label.action.enable.pod": "Enable pod",
"label.action.enable.service.offering": "Enable service offering",
"label.action.enable.system.service.offering": "Enable system service offering",
"label.action.enable.static.nat": "Enable static NAT",
"label.action.enable.user": "Enable User",
"label.action.enable.zone": "Enable zone",
@ -1024,6 +1027,7 @@
"label.import.instance": "Import Instance",
"label.import.offering": "Import offering",
"label.import.role": "Import role",
"label.inactive": "Inactive",
"label.in.progress": "in progress",
"label.in.progress.for": "in progress for",
"label.info": "Info",
@ -2419,7 +2423,6 @@
"message.action.delete.autoscale.vmgroup": "Please confirm that you want to delete this autoscale Instance group.",
"message.action.delete.backup.offering": "Please confirm that you want to delete this backup offering?",
"message.action.delete.cluster": "Please confirm that you want to delete this cluster.",
"message.action.delete.disk.offering": "Please confirm that you want to delete this disk offering.",
"message.action.delete.domain": "Please confirm that you want to delete this domain.",
"message.action.delete.external.firewall": "Please confirm that you would like to remove this external firewall. Warning: If you are planning to add back the same external firewall, you must reset usage data on the device.",
"message.action.delete.external.load.balancer": "Please confirm that you would like to remove this external load balancer. Warning: If you are planning to add back the same external load balancer, you must reset usage data on the device.",
@ -2438,9 +2441,7 @@
"message.action.delete.pod": "Please confirm that you want to delete this pod.",
"message.action.delete.secondary.storage": "Please confirm that you want to delete this secondary storage.",
"message.action.delete.security.group": "Please confirm that you want to delete this security group.",
"message.action.delete.service.offering": "Please confirm that you want to delete this service offering.",
"message.action.delete.snapshot": "Please confirm that you want to delete this Snapshot.",
"message.action.delete.system.service.offering": "Please confirm that you want to delete this system service offering.",
"message.action.delete.template": "Please confirm that you want to delete this Template.",
"message.action.delete.tungsten.router.table": "Please confirm that you want to remove Route Table from this Network?",
"message.action.delete.volume": "Please confirm that you want to delete this volume. Note: this will not delete any Snapshots of this volume.",
@ -2453,6 +2454,9 @@
"message.action.disable.2FA.user.auth": "Please confirm that you want to disable User two factor authentication.",
"message.action.about.mandate.and.disable.2FA.user.auth": "Two factor authentication is mandated for the User, if this is disabled now User will need to setup two factor authentication again during next login. <br><br>Please confirm that you want to disable.",
"message.action.disable.cluster": "Please confirm that you want to disable this cluster.",
"message.action.disable.disk.offering": "Please confirm that you want to disable this disk offering.",
"message.action.disable.service.offering": "Please confirm that you want to disable this service offering.",
"message.action.disable.system.service.offering": "Please confirm that you want to disable this system service offering.",
"message.action.disable.physical.network": "Please confirm that you want to disable this physical Network.",
"message.action.disable.pod": "Please confirm that you want to disable this pod.",
"message.action.disable.static.nat": "Please confirm that you want to disable static NAT.",
@ -2460,6 +2464,9 @@
"message.action.download.iso": "Please confirm that you want to download this ISO.",
"message.action.download.template": "Please confirm that you want to download this Template.",
"message.action.enable.cluster": "Please confirm that you want to enable this cluster.",
"message.action.enable.disk.offering": "Please confirm that you want to enable this disk offering.",
"message.action.enable.service.offering": "Please confirm that you want to enable this service offering.",
"message.action.enable.system.service.offering": "Please confirm that you want to enable this system service offering.",
"message.action.enable.physical.network": "Please confirm that you want to enable this physical Network.",
"message.action.enable.pod": "Please confirm that you want to enable this pod.",
"message.action.enable.zone": "Please confirm that you want to enable this zone.",

View File

@ -186,7 +186,8 @@ export default {
inputKey: null,
inputValue: null,
fieldValues: {},
isFiltered: false
isFiltered: false,
alertTypes: []
}
},
created () {
@ -347,6 +348,7 @@ export default {
},
async fetchDynamicFieldData (arrayField, searchKeyword) {
const promises = []
let typeIndex = -1
let zoneIndex = -1
let domainIndex = -1
let imageStoreIndex = -1
@ -355,6 +357,14 @@ export default {
let clusterIndex = -1
let groupIndex = -1
if (arrayField.includes('type')) {
if (this.$route.path === '/alert') {
typeIndex = this.fields.findIndex(item => item.name === 'type')
this.fields[typeIndex].loading = true
promises.push(await this.fetchAlertTypes())
}
}
if (arrayField.includes('zoneid')) {
zoneIndex = this.fields.findIndex(item => item.name === 'zoneid')
this.fields[zoneIndex].loading = true
@ -398,6 +408,12 @@ export default {
}
Promise.all(promises).then(response => {
if (typeIndex > -1) {
const types = response.filter(item => item.type === 'type')
if (types && types.length > 0) {
this.fields[typeIndex].opts = this.sortArray(types[0].data)
}
}
if (zoneIndex > -1) {
const zones = response.filter(item => item.type === 'zoneid')
if (zones && zones.length > 0) {
@ -441,6 +457,9 @@ export default {
}
}
}).finally(() => {
if (typeIndex > -1) {
this.fields[typeIndex].loading = false
}
if (zoneIndex > -1) {
this.fields[zoneIndex].loading = false
}
@ -585,6 +604,29 @@ export default {
})
})
},
fetchAlertTypes () {
if (this.alertTypes.length > 0) {
return new Promise((resolve, reject) => {
resolve({
type: 'type',
data: this.alertTypes
})
})
} else {
return new Promise((resolve, reject) => {
api('listAlertTypes').then(json => {
const alerttypes = json.listalerttypesresponse.alerttype.map(a => { return { id: a.alerttypeid, name: a.name } })
this.alertTypes = alerttypes
resolve({
type: 'type',
data: alerttypes
})
}).catch(error => {
reject(error.response.headers['x-description'])
})
})
}
},
fetchGuestNetworkTypes () {
const types = []
if (this.apiName.indexOf('listNetworks') > -1) {

View File

@ -483,6 +483,12 @@ export default {
name: 'details',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
},
{
name: 'events',
resourceType: 'VmSnapshot',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))),
show: () => { return 'listEvents' in store.getters.apis }
},
{
name: 'comments',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/AnnotationsTab.vue')))
@ -990,6 +996,18 @@ export default {
title: 'label.instances',
param: 'affinitygroupid'
}],
tabs: [
{
name: 'details',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
},
{
name: 'events',
resourceType: 'AffinityGroup',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))),
show: () => { return 'listEvents' in store.getters.apis }
}
],
actions: [
{
api: 'createAffinityGroup',

View File

@ -79,6 +79,7 @@ export default {
permission: ['listAlerts'],
columns: ['name', 'description', 'type', 'sent'],
details: ['name', 'id', 'type', 'sent', 'description'],
searchFilters: ['type'],
actions: [
{
api: 'archiveAlerts',

View File

@ -44,6 +44,11 @@ export default {
tabs: [{
name: 'details',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
}, {
name: 'events',
resourceType: 'Host',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))),
show: () => { return 'listEvents' in store.getters.apis }
}, {
name: 'comments',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/AnnotationsTab.vue')))

View File

@ -16,6 +16,8 @@
// under the License.
import { shallowRef, defineAsyncComponent } from 'vue'
import store from '@/store'
export default {
name: 'ilbvm',
title: 'label.internal.lb',
@ -25,6 +27,15 @@ export default {
params: { projectid: '-1' },
columns: ['name', 'state', 'publicip', 'guestnetworkname', 'vpcname', 'version', 'softwareversion', 'hostname', 'account', 'zonename', 'requiresupgrade'],
details: ['name', 'id', 'version', 'softwareversion', 'requiresupgrade', 'guestnetworkname', 'vpcname', 'publicip', 'guestipaddress', 'linklocalip', 'serviceofferingname', 'networkdomain', 'isredundantrouter', 'redundantstate', 'hostname', 'account', 'zonename', 'created', 'hostcontrolstate'],
tabs: [{
name: 'details',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
}, {
name: 'events',
resourceType: 'InternalLbVm',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))),
show: () => { return 'listEvents' in store.getters.apis }
}],
actions: [
{
api: 'startInternalLoadBalancerVM',

View File

@ -1046,6 +1046,11 @@ export default {
name: 'loadbalancerinstance',
component: shallowRef(defineAsyncComponent(() => import('@/views/network/InternalLBAssignedVmTab.vue'))),
show: () => true
}, {
name: 'events',
resourceType: 'LoadBalancerRule',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))),
show: () => { return 'listEvents' in store.getters.apis }
}],
actions: [
{
@ -1162,6 +1167,12 @@ export default {
name: 'details',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
},
{
name: 'events',
resourceType: 'VpnCustomerGateway',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))),
show: () => { return 'listEvents' in store.getters.apis }
},
{
name: 'comments',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/AnnotationsTab.vue')))

View File

@ -36,7 +36,8 @@ export default {
}
return params
},
columns: ['name', 'displaytext', 'cpunumber', 'cpuspeed', 'memory', 'domain', 'zone', 'order'],
filters: ['active', 'inactive'],
columns: ['name', 'displaytext', 'state', 'cpunumber', 'cpuspeed', 'memory', 'domain', 'zone', 'order'],
details: () => {
var fields = ['name', 'id', 'displaytext', 'offerha', 'provisioningtype', 'storagetype', 'iscustomized', 'iscustomizediops', 'limitcpuuse', 'cpunumber', 'cpuspeed', 'memory', 'hosttags', 'tags', 'storagetags', 'domain', 'zone', 'created', 'dynamicscalingenabled', 'diskofferingstrictness', 'encryptroot']
if (store.getters.apis.createServiceOffering &&
@ -62,6 +63,12 @@ export default {
name: 'details',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
},
{
name: 'events',
resourceType: 'ServiceOffering',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))),
show: () => { return 'listEvents' in store.getters.apis }
},
{
name: 'comments',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/AnnotationsTab.vue'))),
@ -96,15 +103,33 @@ export default {
dataView: true,
popup: true,
component: shallowRef(defineAsyncComponent(() => import('@/views/offering/UpdateOfferingAccess.vue')))
},
{
api: 'updateServiceOffering',
icon: 'play-circle-outlined',
label: 'label.action.enable.service.offering',
message: 'message.action.enable.service.offering',
dataView: true,
args: ['state'],
mapping: {
state: {
value: (record) => { return 'Active' }
}
},
groupAction: true,
popup: true,
show: (record) => { return record.state !== 'Active' },
groupMap: (selection) => { return selection.map(x => { return { id: x, state: 'Active' } }) }
}, {
api: 'deleteServiceOffering',
icon: 'delete-outlined',
label: 'label.action.delete.service.offering',
message: 'message.action.delete.service.offering',
icon: 'pause-circle-outlined',
label: 'label.action.disable.service.offering',
message: 'message.action.disable.service.offering',
docHelp: 'adminguide/service_offerings.html#modifying-or-deleting-a-service-offering',
dataView: true,
groupAction: true,
popup: true,
show: (record) => { return record.state === 'Active' },
groupMap: (selection) => { return selection.map(x => { return { id: x } }) }
}]
},
@ -115,8 +140,27 @@ export default {
docHelp: 'adminguide/service_offerings.html#system-service-offerings',
permission: ['listServiceOfferings', 'listInfrastructure'],
params: { issystem: 'true', isrecursive: 'true' },
columns: ['name', 'systemvmtype', 'cpunumber', 'cpuspeed', 'memory', 'storagetype', 'order'],
columns: ['name', 'state', 'systemvmtype', 'cpunumber', 'cpuspeed', 'memory', 'storagetype', 'order'],
filters: ['active', 'inactive'],
details: ['name', 'id', 'displaytext', 'systemvmtype', 'provisioningtype', 'storagetype', 'iscustomized', 'limitcpuuse', 'cpunumber', 'cpuspeed', 'memory', 'storagetags', 'hosttags', 'tags', 'domain', 'zone', 'created', 'dynamicscalingenabled', 'diskofferingstrictness'],
resourceType: 'ServiceOffering',
tabs: [
{
name: 'details',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
},
{
name: 'events',
resourceType: 'ServiceOffering',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))),
show: () => { return 'listEvents' in store.getters.apis }
},
{
name: 'comments',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/AnnotationsTab.vue'))),
show: (record, route, user) => { return ['Admin', 'DomainAdmin'].includes(user.roletype) }
}
],
actions: [{
api: 'createServiceOffering',
icon: 'plus-outlined',
@ -134,16 +178,34 @@ export default {
params: { issystem: 'true' },
docHelp: 'adminguide/service_offerings.html#modifying-or-deleting-a-service-offering',
args: ['name', 'displaytext', 'storagetags', 'hosttags']
}, {
api: 'updateServiceOffering',
icon: 'play-circle-outlined',
label: 'label.action.enable.system.service.offering',
message: 'message.action.enable.system.service.offering',
dataView: true,
params: { issystem: 'true' },
args: ['state'],
mapping: {
state: {
value: (record) => { return 'Active' }
}
},
groupAction: true,
popup: true,
show: (record) => { return record.state !== 'Active' },
groupMap: (selection) => { return selection.map(x => { return { id: x, state: 'Active' } }) }
}, {
api: 'deleteServiceOffering',
icon: 'delete-outlined',
label: 'label.action.delete.system.service.offering',
message: 'message.action.delete.system.service.offering',
icon: 'pause-circle-outlined',
label: 'label.action.disable.system.service.offering',
message: 'message.action.disable.system.service.offering',
docHelp: 'adminguide/service_offerings.html#modifying-or-deleting-a-service-offering',
dataView: true,
params: { issystem: 'true' },
groupAction: true,
popup: true,
show: (record) => { return record.state === 'Active' },
groupMap: (selection) => { return selection.map(x => { return { id: x } }) }
}]
},
@ -160,7 +222,8 @@ export default {
}
return params
},
columns: ['name', 'displaytext', 'disksize', 'domain', 'zone', 'order'],
columns: ['name', 'displaytext', 'state', 'disksize', 'domain', 'zone', 'order'],
filters: ['active', 'inactive'],
details: () => {
var fields = ['name', 'id', 'displaytext', 'disksize', 'provisioningtype', 'storagetype', 'iscustomized', 'disksizestrictness', 'iscustomizediops', 'diskIopsReadRate', 'diskIopsWriteRate', 'diskBytesReadRate', 'diskBytesWriteRate', 'miniops', 'maxiops', 'tags', 'domain', 'zone', 'created', 'encrypt']
if (store.getters.apis.createDiskOffering &&
@ -175,6 +238,12 @@ export default {
name: 'details',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
},
{
name: 'events',
resourceType: 'DiskOffering',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))),
show: () => { return 'listEvents' in store.getters.apis }
},
{
name: 'comments',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/AnnotationsTab.vue'))),
@ -209,15 +278,33 @@ export default {
dataView: true,
popup: true,
component: shallowRef(defineAsyncComponent(() => import('@/views/offering/UpdateOfferingAccess.vue')))
}, {
api: 'updateDiskOffering',
icon: 'play-circle-outlined',
label: 'label.action.enable.disk.offering',
message: 'message.action.enable.disk.offering',
dataView: true,
params: { issystem: 'true' },
args: ['state'],
mapping: {
state: {
value: (record) => { return 'Active' }
}
},
groupAction: true,
popup: true,
show: (record) => { return record.state !== 'Active' },
groupMap: (selection) => { return selection.map(x => { return { id: x, state: 'Active' } }) }
}, {
api: 'deleteDiskOffering',
icon: 'delete-outlined',
label: 'label.action.delete.disk.offering',
message: 'message.action.delete.disk.offering',
icon: 'pause-circle-outlined',
label: 'label.action.disable.disk.offering',
message: 'message.action.disable.disk.offering',
docHelp: 'adminguide/service_offerings.html#modifying-or-deleting-a-service-offering',
dataView: true,
groupAction: true,
popup: true,
show: (record) => { return record.state === 'Active' },
groupMap: (selection) => { return selection.map(x => { return { id: x } }) }
}]
},
@ -234,6 +321,18 @@ export default {
title: 'label.instances',
param: 'backupofferingid'
}],
tabs: [
{
name: 'details',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
},
{
name: 'events',
resourceType: 'BackupOffering',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))),
show: () => { return 'listEvents' in store.getters.apis }
}
],
actions: [{
api: 'importBackupOffering',
icon: 'plus-outlined',
@ -276,6 +375,12 @@ export default {
name: 'details',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
},
{
name: 'events',
resourceType: 'NetworkOffering',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))),
show: () => { return 'listEvents' in store.getters.apis }
},
{
name: 'comments',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/AnnotationsTab.vue'))),
@ -368,6 +473,18 @@ export default {
title: 'label.vpc',
param: 'vpcofferingid'
}],
tabs: [
{
name: 'details',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
},
{
name: 'events',
resourceType: 'VpcOffering',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))),
show: () => { return 'listEvents' in store.getters.apis }
}
],
actions: [{
api: 'createVPCOffering',
icon: 'plus-outlined',

View File

@ -16,6 +16,8 @@
// under the License.
import { shallowRef, defineAsyncComponent } from 'vue'
import store from '@/store'
export default {
name: 'role',
title: 'label.roles',
@ -30,6 +32,11 @@ export default {
}, {
name: 'rules',
component: shallowRef(defineAsyncComponent(() => import('@/views/iam/RolePermissionTab.vue')))
}, {
name: 'events',
resourceType: 'Role',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))),
show: () => { return 'listEvents' in store.getters.apis }
}],
actions: [
{

View File

@ -25,7 +25,7 @@ export default {
docHelp: 'adminguide/accounts.html#users',
hidden: true,
permission: ['listUsers'],
columns: ['username', 'state', 'firstname', 'lastname', 'email', 'account'],
columns: ['username', 'state', 'firstname', 'lastname', 'email', 'account', 'domain'],
details: ['username', 'id', 'firstname', 'lastname', 'email', 'usersource', 'timezone', 'rolename', 'roletype', 'is2faenabled', 'account', 'domain', 'created'],
tabs: [
{

View File

@ -51,7 +51,7 @@
<template #suffixIcon><filter-outlined class="ant-select-suffix" /></template>
<a-select-option
v-if="['Admin', 'DomainAdmin'].includes($store.getters.userInfo.roletype) &&
['vm', 'iso', 'template', 'pod', 'cluster', 'host', 'systemvm', 'router', 'storagepool', 'kubernetes'].includes($route.name) ||
['vm', 'iso', 'template', 'pod', 'cluster', 'host', 'systemvm', 'router', 'storagepool', 'kubernetes', 'computeoffering', 'systemoffering', 'diskoffering'].includes($route.name) ||
['account'].includes($route.name)"
key="all"
:label="$t('label.all')">
@ -690,7 +690,7 @@ export default {
if (['volume'].includes(routeName)) {
return 'user'
}
if (['event'].includes(routeName)) {
if (['event', 'computeoffering', 'systemoffering', 'diskoffering'].includes(routeName)) {
return 'active'
}
return 'self'
@ -769,6 +769,9 @@ export default {
'isofilter' in params && this.routeName === 'iso') {
params.isofilter = 'all'
}
if (['Admin', 'DomainAdmin'].includes(this.$store.getters.userInfo.roletype) && ['computeoffering', 'systemoffering', 'diskoffering'].includes(this.routeName) && this.$route.params.id) {
params.state = 'all'
}
if (Object.keys(this.$route.query).length > 0) {
if ('page' in this.$route.query) {
this.page = Number(this.$route.query.page)
@ -1763,6 +1766,8 @@ export default {
} else {
query.clustertype = filter === 'cloud.managed' ? 'CloudManaged' : 'ExternalManaged'
}
} else if (['computeoffering', 'systemoffering', 'diskoffering'].includes(this.$route.name)) {
query.state = filter
}
query.filter = filter
query.page = '1'

View File

@ -66,6 +66,12 @@ export default {
tabs: [{
name: 'details',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
},
{
name: 'events',
resourceType: 'IpAddress',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))),
show: () => { return 'listEvents' in this.$store.getters.apis }
}],
defaultTabs: [{
name: 'details',