This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch 4.19
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.19 by this push:
     new 0f544c9a3b0 api/ui: add specifyvlan to network response (#10236)
0f544c9a3b0 is described below

commit 0f544c9a3b01adec4d723907e27577883c361fbf
Author: Wei Zhou <weiz...@apache.org>
AuthorDate: Thu Jan 30 15:35:33 2025 +0100

    api/ui: add specifyvlan to network response (#10236)
---
 .../java/org/apache/cloudstack/api/response/NetworkResponse.java | 8 ++++++++
 server/src/main/java/com/cloud/api/ApiResponseHelper.java        | 1 +
 ui/src/config/section/network.js                                 | 9 ++++++---
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git 
a/api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java 
b/api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java
index 1049740bf55..24f76215d09 100644
--- a/api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java
+++ b/api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java
@@ -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;
     }
diff --git a/server/src/main/java/com/cloud/api/ApiResponseHelper.java 
b/server/src/main/java/com/cloud/api/ApiResponseHelper.java
index 68761f6eed5..ed7a51d215c 100644
--- a/server/src/main/java/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/main/java/com/cloud/api/ApiResponseHelper.java
@@ -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());
             }
diff --git a/ui/src/config/section/network.js b/ui/src/config/section/network.js
index 986a2c206c7..edbe4bb37b7 100644
--- a/ui/src/config/section/network.js
+++ b/ui/src/config/section/network.js
@@ -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,

Reply via email to