Skip to content

Commit 0f544c9

Browse files
api/ui: add specifyvlan to network response (#10236)
1 parent ee0dc5b commit 0f544c9

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement
187187
@Param(description = "true network requires restart")
188188
private Boolean restartRequired;
189189

190+
@SerializedName(ApiConstants.SPECIFY_VLAN)
191+
@Param(description = "true if network supports specifying vlan, false otherwise")
192+
private Boolean specifyVlan;
193+
190194
@SerializedName(ApiConstants.SPECIFY_IP_RANGES)
191195
@Param(description = "true if network supports specifying ip ranges, false otherwise")
192196
private Boolean specifyIpRanges;
@@ -487,6 +491,10 @@ public void setRestartRequired(Boolean restartRequired) {
487491
this.restartRequired = restartRequired;
488492
}
489493

494+
public void setSpecifyVlan(Boolean specifyVlan) {
495+
this.specifyVlan = specifyVlan;
496+
}
497+
490498
public void setSpecifyIpRanges(Boolean specifyIpRanges) {
491499
this.specifyIpRanges = specifyIpRanges;
492500
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2504,6 +2504,7 @@ public NetworkResponse createNetworkResponse(ResponseView view, Network network)
25042504
response.setIsSystem(networkOffering.isSystemOnly());
25052505
response.setNetworkOfferingAvailability(networkOffering.getAvailability().toString());
25062506
response.setIsPersistent(networkOffering.isPersistent());
2507+
response.setSpecifyVlan(networkOffering.isSpecifyVlan());
25072508
if (Network.GuestType.Isolated.equals(network.getGuestType()) && network.getVpcId() == null) {
25082509
response.setEgressDefaultPolicy(networkOffering.isEgressDefaultPolicy());
25092510
}

ui/src/config/section/network.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ export default {
141141
label: 'label.update.network',
142142
dataView: true,
143143
disabled: (record, user) => {
144-
return !record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))
144+
return (!record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))) ||
145+
(record.type === 'Shared' && record.specifyvlan && !['Admin'].includes(user.userInfo.roletype))
145146
},
146147
popup: true,
147148
component: shallowRef(defineAsyncComponent(() => import('@/views/network/UpdateNetwork.vue')))
@@ -153,7 +154,8 @@ export default {
153154
message: 'message.restart.network',
154155
dataView: true,
155156
disabled: (record, user) => {
156-
return !record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))
157+
return (!record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))) ||
158+
(record.type === 'Shared' && record.specifyvlan && !['Admin'].includes(user.userInfo.roletype))
157159
},
158160
args: (record, store, isGroupAction) => {
159161
var fields = []
@@ -194,7 +196,8 @@ export default {
194196
message: 'message.action.delete.network',
195197
dataView: true,
196198
disabled: (record, user) => {
197-
return !record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))
199+
return (!record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))) ||
200+
(record.type === 'Shared' && record.specifyvlan && !['Admin'].includes(user.userInfo.roletype))
198201
},
199202
groupAction: true,
200203
popup: true,

0 commit comments

Comments
 (0)