api/ui: add specifyvlan to network response (#10236)

This commit is contained in:
Wei Zhou 2025-01-30 15:35:33 +01:00 committed by GitHub
parent ee0dc5b2d6
commit 0f544c9a3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View File

@ -187,6 +187,10 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement
@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;
@ -487,6 +491,10 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement
this.restartRequired = restartRequired;
}
public void setSpecifyVlan(Boolean specifyVlan) {
this.specifyVlan = specifyVlan;
}
public void setSpecifyIpRanges(Boolean specifyIpRanges) {
this.specifyIpRanges = specifyIpRanges;
}

View File

@ -2504,6 +2504,7 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setIsSystem(networkOffering.isSystemOnly());
response.setNetworkOfferingAvailability(networkOffering.getAvailability().toString());
response.setIsPersistent(networkOffering.isPersistent());
response.setSpecifyVlan(networkOffering.isSpecifyVlan());
if (Network.GuestType.Isolated.equals(network.getGuestType()) && network.getVpcId() == null) {
response.setEgressDefaultPolicy(networkOffering.isEgressDefaultPolicy());
}

View File

@ -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')))
@ -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 = []
@ -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,