Skip to content

Commit 32fbcb8

Browse files
weizhouapachedhslove
authored andcommitted
api/ui: add specifyvlan to network response (apache#10236)
1 parent 1ac10fe commit 32fbcb8

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
@@ -196,6 +196,10 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement
196196
@Param(description = "true network requires restart")
197197
private Boolean restartRequired;
198198

199+
@SerializedName(ApiConstants.SPECIFY_VLAN)
200+
@Param(description = "true if network supports specifying vlan, false otherwise")
201+
private Boolean specifyVlan;
202+
199203
@SerializedName(ApiConstants.SPECIFY_IP_RANGES)
200204
@Param(description = "true if network supports specifying ip ranges, false otherwise")
201205
private Boolean specifyIpRanges;
@@ -520,6 +524,10 @@ public void setRestartRequired(Boolean restartRequired) {
520524
this.restartRequired = restartRequired;
521525
}
522526

527+
public void setSpecifyVlan(Boolean specifyVlan) {
528+
this.specifyVlan = specifyVlan;
529+
}
530+
523531
public void setSpecifyIpRanges(Boolean specifyIpRanges) {
524532
this.specifyIpRanges = specifyIpRanges;
525533
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,6 +2574,7 @@ public NetworkResponse createNetworkResponse(ResponseView view, Network network)
25742574
response.setIsSystem(networkOffering.isSystemOnly());
25752575
response.setNetworkOfferingAvailability(networkOffering.getAvailability().toString());
25762576
response.setIsPersistent(networkOffering.isPersistent());
2577+
response.setSpecifyVlan(networkOffering.isSpecifyVlan());
25772578
if (Network.GuestType.Isolated.equals(network.getGuestType()) && network.getVpcId() == null) {
25782579
response.setEgressDefaultPolicy(networkOffering.isEgressDefaultPolicy());
25792580
}

ui/src/config/section/network.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ export default {
145145
label: 'label.update.network',
146146
dataView: true,
147147
disabled: (record, user) => {
148-
return !record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))
148+
return (!record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))) ||
149+
(record.type === 'Shared' && record.specifyvlan && !['Admin'].includes(user.userInfo.roletype))
149150
},
150151
popup: true,
151152
component: shallowRef(defineAsyncComponent(() => import('@/views/network/UpdateNetwork.vue')))
@@ -157,7 +158,8 @@ export default {
157158
message: 'message.restart.network',
158159
dataView: true,
159160
disabled: (record, user) => {
160-
return !record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))
161+
return (!record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))) ||
162+
(record.type === 'Shared' && record.specifyvlan && !['Admin'].includes(user.userInfo.roletype))
161163
},
162164
args: (record, store, isGroupAction) => {
163165
var fields = []
@@ -198,7 +200,8 @@ export default {
198200
message: 'message.action.delete.network',
199201
dataView: true,
200202
disabled: (record, user) => {
201-
return !record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))
203+
return (!record.projectid && (record.account !== user.userInfo.account && !['Admin', 'DomainAdmin'].includes(user.userInfo.roletype))) ||
204+
(record.type === 'Shared' && record.specifyvlan && !['Admin'].includes(user.userInfo.roletype))
202205
},
203206
groupAction: true,
204207
popup: true,

0 commit comments

Comments
 (0)