Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@
@Param(description = "true network requires restart")
private Boolean restartRequired;

@SerializedName(ApiConstants.SPECIFY_VLAN)
@Param(description = "true if network supports specifying vlan, false otherwise")
private Boolean specifyVlan;

@SerializedName(ApiConstants.SPECIFY_IP_RANGES)
@Param(description = "true if network supports specifying ip ranges, false otherwise")
private Boolean specifyIpRanges;
Expand Down Expand Up @@ -487,6 +491,10 @@
this.restartRequired = restartRequired;
}

public void setSpecifyVlan(Boolean specifyVlan) {
this.specifyVlan = specifyVlan;
}

Check warning on line 496 in api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java#L494-L496

Added lines #L494 - L496 were not covered by tests

public void setSpecifyIpRanges(Boolean specifyIpRanges) {
this.specifyIpRanges = specifyIpRanges;
}
Expand Down
1 change: 1 addition & 0 deletions server/src/main/java/com/cloud/api/ApiResponseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -2504,6 +2504,7 @@
response.setIsSystem(networkOffering.isSystemOnly());
response.setNetworkOfferingAvailability(networkOffering.getAvailability().toString());
response.setIsPersistent(networkOffering.isPersistent());
response.setSpecifyVlan(networkOffering.isSpecifyVlan());

Check warning on line 2507 in server/src/main/java/com/cloud/api/ApiResponseHelper.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/api/ApiResponseHelper.java#L2507

Added line #L2507 was not covered by tests
if (Network.GuestType.Isolated.equals(network.getGuestType()) && network.getVpcId() == null) {
response.setEgressDefaultPolicy(networkOffering.isEgressDefaultPolicy());
}
Expand Down
9 changes: 6 additions & 3 deletions ui/src/config/section/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ export default {
label: 'label.update.network',
dataView: true,
disabled: (record, user) => {
return !record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))
return (!record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))) ||
(record.type === 'Shared' && record.specifyvlan && !['Admin'].includes(user.userInfo.roletype))
},
popup: true,
component: shallowRef(defineAsyncComponent(() => import('@/views/network/UpdateNetwork.vue')))
Expand All @@ -153,7 +154,8 @@ export default {
message: 'message.restart.network',
dataView: true,
disabled: (record, user) => {
return !record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))
return (!record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))) ||
(record.type === 'Shared' && record.specifyvlan && !['Admin'].includes(user.userInfo.roletype))
},
args: (record, store, isGroupAction) => {
var fields = []
Expand Down Expand Up @@ -194,7 +196,8 @@ export default {
message: 'message.action.delete.network',
dataView: true,
disabled: (record, user) => {
return !record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))
return (!record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))) ||
(record.type === 'Shared' && record.specifyvlan && !['Admin'].includes(user.userInfo.roletype))
},
groupAction: true,
popup: true,
Expand Down