Skip to content

Commit

Permalink
Add domainpath to listnetwork and UI network tab (apache#7386)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrelefevre authored Oct 12, 2023
1 parent 0c14e46 commit 3486a3c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement
@Param(description = "the domain name of the network owner")
private String domain;

@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the Domain the network belongs to", since = "4.19.0.0")
private String domainPath;

@SerializedName("isdefault")
@Param(description = "true if network is default, false otherwise")
private Boolean isDefault;
Expand Down Expand Up @@ -420,6 +424,10 @@ public void setDomainName(String domain) {
this.domain = domain;
}

public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}

public void setNetworkOfferingAvailability(String networkOfferingAvailability) {
this.networkOfferingAvailability = networkOfferingAvailability;
}
Expand Down
4 changes: 4 additions & 0 deletions server/src/main/java/com/cloud/api/ApiResponseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -2572,6 +2572,10 @@ public NetworkResponse createNetworkResponse(ResponseView view, Network network)
Domain domain = ApiDBUtils.findDomainById(domainNetworkDetails.first());
if (domain != null) {
response.setDomainId(domain.getUuid());

StringBuilder domainPath = new StringBuilder("ROOT");
(domainPath.append(domain.getPath())).deleteCharAt(domainPath.length() - 1);
response.setDomainPath(domainPath.toString());
}
}
response.setSubdomainAccess(domainNetworkDetails.second());
Expand Down
6 changes: 3 additions & 3 deletions ui/src/config/section/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ export default {
permission: ['listNetworks'],
resourceType: 'Network',
columns: () => {
var fields = ['name', 'state', 'type', 'vpcname', 'cidr', 'ip6cidr', 'broadcasturi', 'account', 'domain', 'zonename']
var fields = ['name', 'state', 'type', 'vpcname', 'cidr', 'ip6cidr', 'broadcasturi', 'domainpath', 'account', 'zonename']
if (!isAdmin()) {
fields = fields.filter(function (e) { return e !== 'broadcasturi' })
}
return fields
},
details: () => {
var fields = ['name', 'id', 'description', 'type', 'traffictype', 'vpcid', 'vlan', 'broadcasturi', 'cidr', 'ip6cidr', 'netmask', 'gateway', 'aclname', 'ispersistent', 'restartrequired', 'reservediprange', 'redundantrouter', 'networkdomain', 'egressdefaultpolicy', 'zonename', 'account', 'domain', 'associatednetwork', 'associatednetworkid', 'ip6firewall', 'ip6routing', 'ip6routes', 'dns1', 'dns2', 'ip6dns1', 'ip6dns2', 'publicmtu', 'privatemtu']
var fields = ['name', 'id', 'description', 'type', 'traffictype', 'vpcid', 'vlan', 'broadcasturi', 'cidr', 'ip6cidr', 'netmask', 'gateway', 'aclname', 'ispersistent', 'restartrequired', 'reservediprange', 'redundantrouter', 'networkdomain', 'egressdefaultpolicy', 'zonename', 'account', 'domainpath', 'associatednetwork', 'associatednetworkid', 'ip6firewall', 'ip6routing', 'ip6routes', 'dns1', 'dns2', 'ip6dns1', 'ip6dns2', 'publicmtu', 'privatemtu']
if (!isAdmin()) {
fields = fields.filter(function (e) { return e !== 'broadcasturi' })
}
return fields
},
filters: ['all', 'account', 'domain', 'shared'],
filters: ['all', 'account', 'domainpath', 'shared'],
searchFilters: ['keyword', 'zoneid', 'domainid', 'account', 'type', 'tags'],
related: [{
name: 'vm',
Expand Down

0 comments on commit 3486a3c

Please sign in to comment.