Skip to content

Commit a9afbce

Browse files
committed
UI related work and fixes in updateDnsServer cmd
1 parent 0df50ce commit a9afbce

File tree

15 files changed

+1003
-70
lines changed

15 files changed

+1003
-70
lines changed

api/src/main/java/org/apache/cloudstack/dns/DnsServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ enum State {
4141

4242
long getAccountId();
4343

44-
boolean isPublicServer();
44+
boolean getPublicServer();
4545

4646
Date getCreated();
4747

server/src/main/java/com/cloud/user/AccountManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3640,7 +3640,7 @@ public void checkAccess(Account caller, DnsServer dnsServer) throws PermissionDe
36403640
if (caller.getId() == dnsServer.getAccountId()) {
36413641
return;
36423642
}
3643-
if (!dnsServer.isPublicServer()) {
3643+
if (!dnsServer.getPublicServer()) {
36443644
throw new PermissionDeniedException(caller + "is not allowed to access the DNS server " + dnsServer.getName());
36453645
}
36463646
Account owner = getAccount(dnsServer.getAccountId());

server/src/main/java/org/apache/cloudstack/dns/DnsProviderManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public DnsServer updateDnsServer(UpdateDnsServerCmd cmd) {
230230
dnsServer.setPort(cmd.getPort());
231231
}
232232
if (cmd.isPublic() != null) {
233-
dnsServer.setIsPublic(cmd.isPublic());
233+
dnsServer.setPublicServer(cmd.isPublic());
234234
}
235235

236236
if (cmd.getPublicDomainSuffix() != null) {
@@ -476,7 +476,7 @@ public DnsZone allocateDnsZone(CreateDnsZoneCmd cmd) {
476476
Account caller = CallContext.current().getCallingAccount();
477477
boolean isOwner = (server.getAccountId() == caller.getId());
478478
if (!isOwner) {
479-
if (!server.isPublicServer()) {
479+
if (!server.getPublicServer()) {
480480
throw new PermissionDeniedException("You do not have permission to use this DNS server.");
481481
}
482482
dnsZoneName = DnsProviderUtil.appendPublicSuffixToZone(dnsZoneName, server.getPublicDomainSuffix());

server/src/main/java/org/apache/cloudstack/dns/dao/DnsServerDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public Pair<List<DnsServerVO>, Integer> searchDnsServer(Long dnsServerId, Long a
110110

111111
sb.and().op(ApiConstants.ACCOUNT_ID, sb.entity().getAccountId(), SearchCriteria.Op.EQ);
112112
if (!CollectionUtils.isEmpty(domainIds)) {
113-
sb.or().op(ApiConstants.IS_PUBLIC, sb.entity().isPublicServer(), SearchCriteria.Op.EQ);
113+
sb.or().op(ApiConstants.IS_PUBLIC, sb.entity().getPublicServer(), SearchCriteria.Op.EQ);
114114
sb.and(ApiConstants.DOMAIN_IDS, sb.entity().getDomainId(), SearchCriteria.Op.IN);
115115
sb.cp();
116116
}

server/src/main/java/org/apache/cloudstack/dns/vo/DnsServerVO.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636

3737
import org.apache.cloudstack.dns.DnsProviderType;
3838
import org.apache.cloudstack.dns.DnsServer;
39-
import org.apache.cloudstack.dns.DnsZone;
4039

4140
import com.cloud.utils.StringUtils;
4241
import com.cloud.utils.db.Encrypt;
@@ -123,7 +122,7 @@ public DnsServerVO(String name, String url, Integer port, String externalServerI
123122
this.publicDomainSuffix = publicDomainSuffix;
124123
this.publicServer = isPublic;
125124
this.state = State.Enabled;
126-
this.nameServers = String.join(",", nameServers);;
125+
this.nameServers = String.join(",", nameServers);
127126
}
128127

129128
@Override
@@ -133,7 +132,7 @@ public long getId() {
133132

134133
@Override
135134
public Class<?> getEntityType() {
136-
return DnsZone.class;
135+
return DnsServer.class;
137136
}
138137

139138
@Override
@@ -176,7 +175,7 @@ public String getUuid() {
176175
return uuid;
177176
}
178177

179-
public boolean isPublicServer() {
178+
public boolean getPublicServer() {
180179
return publicServer;
181180
}
182181

@@ -202,8 +201,8 @@ public void setNameServers(String nameServers) {
202201
this.nameServers = nameServers;
203202
}
204203

205-
public void setIsPublic(boolean value) {
206-
publicServer = value;
204+
public void setPublicServer(boolean value) {
205+
this.publicServer = value;
207206
}
208207

209208
public void setPublicDomainSuffix(String publicDomainSuffix) {

ui/public/locales/en.json

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,6 @@
292292
"label.add.internal.lb": "Add internal LB",
293293
"label.add.ip.range": "Add IP Range",
294294
"label.add.ipv4.subnet": "Add IPv4 Subnet for Routed Networks",
295-
"label.dns.server": "DNS Server",
296-
"label.dns.add.server": "Add DNS Server",
297-
"label.dns.update.server": "Update DNS Server",
298-
"label.dns.delete.server": "Delete DNS Server",
299-
"label.dnsrecords": "DNS Records",
300295
"label.add.ip.v6.prefix": "Add IPv6 prefix",
301296
"label.add.isolated.network": "Add Isolated Network",
302297
"label.add.kubernetes.cluster": "Add Kubernetes Cluster",
@@ -654,6 +649,7 @@
654649
"label.console.proxy": "Console proxy",
655650
"label.console.proxy.vm": "Console proxy VM",
656651
"label.contains": "Contains",
652+
"label.contents": "Contents",
657653
"label.continue": "Continue",
658654
"label.continue.install": "Continue with installation",
659655
"label.controlnodes": "Control nodes",
@@ -718,7 +714,6 @@
718714
"label.created": "Created",
719715
"label.creating": "Creating",
720716
"label.creating.iprange": "Creating IP ranges",
721-
"label.dns.credentials": "DNS API key",
722717
"label.nameservers": "DNS Nameservers",
723718
"label.credit": "Credit",
724719
"label.cron": "Cron expression",
@@ -943,9 +938,26 @@
943938
"label.dns": "DNS",
944939
"label.dns1": "DNS 1",
945940
"label.dns2": "DNS 2",
941+
"label.dns.add.record": "Add DNS Record",
942+
"label.dns.add.server": "Add DNS Server",
943+
"label.dns.add.zone": "Add DNS Zone",
944+
"label.dns.credentials": "DNS API key",
945+
"label.dns.delete.server": "Delete DNS Server",
946+
"label.dns.delete.zone": "Delete DNS Zone",
946947
"label.dns.records": "DNS Records",
948+
"label.dns.record.name.tooltip": "The hostname or subdomain for this record (e.g. www)",
949+
"label.dns.record.type.tooltip": "The DNS record type",
950+
"label.dns.record.contents.tooltip": "The content values for this DNS record (type and press Enter to add)",
951+
"label.dns.record.ttl.tooltip": "Time to live in seconds",
952+
"label.dns.record.url": "Instance URL",
953+
"label.dns.server": "DNS Server",
954+
"label.dnsservername": "DNS Server name",
955+
"label.dns.servers": "DNS Servers",
947956
"label.dns.zone": "DNS Zone",
948957
"label.dns.zones": "DNS Zones",
958+
"label.dns.update.server": "Update DNS Server",
959+
"label.dns.update.zone": "Update DNS Zone",
960+
"label.dnsrecords": "DNS Records",
949961
"label.domain": "Domain",
950962
"label.domain.id": "Domain ID",
951963
"label.domain.name": "Domain name",
@@ -2594,6 +2606,7 @@
25942606
"label.two.factor.authentication.static.pin": "Your Two factor authentication static PIN",
25952607
"label.two.factor.authentication": "Two Factor Authentication",
25962608
"label.2FA": "2FA",
2609+
"label.ttl": "TTL",
25972610
"label.tungsten.fabric": "Tungsten Fabric",
25982611
"label.tungsten.fabric.provider": "Tungsten Fabric Provider",
25992612
"label.tungsten.fabric.routing": "Tungsten Fabric Routing",
@@ -2954,7 +2967,9 @@
29542967
"message.action.delete.backup.schedule": "Please confirm that you want to delete this backup schedule?",
29552968
"message.action.delete.cluster": "Please confirm that you want to delete this Cluster.",
29562969
"message.action.delete.custom.action": "Please confirm that you want to delete this custom action.",
2970+
"message.confirm.delete.dns.record": "Are you sure you want to delete this DNS record?",
29572971
"message.action.delete.dns.server": "Please confirm you want to delete this DNS server.",
2972+
"message.action.delete.dns.zone": "Please confirm you want to delete this DNS zone.",
29582973
"message.action.delete.domain": "Please confirm that you want to delete this domain.",
29592974
"message.action.delete.extension": "Please confirm that you want to delete the extension",
29602975
"message.action.delete.external.firewall": "Please confirm that you would like to remove this external firewall. Warning: If you are planning to add back the same external firewall, you must reset usage data on the device.",
@@ -3862,6 +3877,12 @@
38623877
"message.success.add.bgp.peer": "Successfully added new BGP peer",
38633878
"message.success.add.egress.rule": "Successfully added new egress rule",
38643879
"message.success.add.firewall.rule": "Successfully added new firewall rule",
3880+
"message.success.add.dns.server": "Successfully added DNS server",
3881+
"message.success.add.dns.zone": "Successfully added DNS zone",
3882+
"message.success.update.dns.server": "Successfully updated DNS server",
3883+
"message.success.update.dns.zone": "Successfully updated DNS zone",
3884+
"message.success.add.dns.record": "Successfully added DNS record",
3885+
"message.success.delete.dns.record": "Successfully deleted DNS record",
38653886
"message.success.add.guest.network": "Successfully created guest Network",
38663887
"message.success.add.gpu.device": "Successfully added GPU device",
38673888
"message.success.add.interface.static.route": "Successfully added interface Static Route",
@@ -4158,6 +4179,9 @@
41584179
"migrate.from": "Migrate from",
41594180
"migrate.to": "Migrate to",
41604181
"migrationPolicy": "Migration policy",
4182+
"placeholder.dns.record.name": "e.g. www",
4183+
"placeholder.dns.record.type": "Select record type",
4184+
"placeholder.dns.record.contents": "Type a value and hit Enter",
41614185
"placeholder.quota.tariff.activationrule": "Quota tariff's activation rule",
41624186
"placeholder.quota.tariff.description": "Quota tariff's description",
41634187
"placeholder.quota.tariff.enddate": "Quota tariff's end date",

ui/src/components/view/ListView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ export default {
12191219
'/zone', '/pod', '/cluster', '/host', '/storagepool', '/imagestore', '/systemvm', '/router', '/ilbvm', '/annotation',
12201220
'/computeoffering', '/systemoffering', '/diskoffering', '/backupoffering', '/networkoffering', '/vpcoffering',
12211221
'/tungstenfabric', '/oauthsetting', '/guestos', '/guestoshypervisormapping', '/webhook', 'webhookdeliveries', 'webhookfilters', '/quotatariff', '/sharedfs',
1222-
'/ipv4subnets', '/managementserver', '/gpucard', '/gpudevices', '/vgpuprofile', '/extension', '/snapshotpolicy', '/backupschedule'].join('|'))
1222+
'/ipv4subnets', '/managementserver', '/gpucard', '/gpudevices', '/vgpuprofile', '/extension', '/snapshotpolicy', '/backupschedule', '/dnsserver', '/dnszone'].join('|'))
12231223
.test(this.$route.path)
12241224
},
12251225
enableGroupAction () {

ui/src/config/section/network.js

Lines changed: 55 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,47 +1488,15 @@ export default {
14881488
}
14891489
]
14901490
},
1491-
{
1492-
name: 'dnsrecords',
1493-
title: 'label.dns.records',
1494-
icon: 'global-outlined',
1495-
hidden: true,
1496-
permission: ['listDnsRecords'],
1497-
columns: ['name', 'url', 'provider'],
1498-
details: ['name', 'url', 'provider', 'ispublic', 'port', 'nameservers'],
1499-
related: [{
1500-
name: 'vm',
1501-
title: 'label.dns.zone',
1502-
param: 'dnszoneid'
1503-
}]
1504-
},
1505-
{
1506-
name: 'dnszones',
1507-
title: 'label.dns.zones',
1508-
icon: 'global-outlined',
1509-
hidden: true,
1510-
permission: ['listDnsZones'],
1511-
columns: ['name', 'state', 'dnsservername', 'dnsserveraccount'],
1512-
details: ['name', 'state', 'dnsservername', 'dnsserveraccount'],
1513-
tabs: [{
1514-
name: 'details',
1515-
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
1516-
},
1517-
{
1518-
name: 'dnsrecords',
1519-
component: shallowRef(defineAsyncComponent(() => import('@/views/network/InternalLBAssignedVmTab.vue'))),
1520-
show: () => true
1521-
}]
1522-
},
15231491
{
15241492
name: 'dnsserver',
15251493
title: 'label.dns.server',
15261494
icon: 'global-outlined',
15271495
permission: ['listDnsServers'],
15281496
columns: ['name', 'url', 'provider'],
1529-
details: ['name', 'url', 'abc', 'provider', 'ispublic', 'port', 'nameservers', 'domain', 'account'],
1497+
details: ['name', 'url', 'provider', 'ispublic', 'port', 'nameservers', 'domain', 'account'],
15301498
related: [{
1531-
name: 'dnszones',
1499+
name: 'dnszone',
15321500
title: 'label.dns.zone',
15331501
param: 'dnsserverid'
15341502
}],
@@ -1550,7 +1518,7 @@ export default {
15501518
label: 'label.dns.update.server',
15511519
dataView: true,
15521520
popup: true,
1553-
component: shallowRef(defineAsyncComponent(() => import('@/views/network/dns/AddDnsServer.vue'))),
1521+
component: shallowRef(defineAsyncComponent(() => import('@/views/network/dns/UpdateDnsServer.vue'))),
15541522
show: (record) => { return true }
15551523
},
15561524
{
@@ -1564,6 +1532,58 @@ export default {
15641532
groupMap: (selection) => { return selection.map(x => { return { id: x } }) }
15651533
}
15661534
]
1535+
},
1536+
{
1537+
name: 'dnszone',
1538+
title: 'label.dns.zones',
1539+
icon: 'global-outlined',
1540+
permission: ['listDnsZones'],
1541+
columns: ['name', 'state', 'dnsservername', 'account'],
1542+
details: ['name', 'id', 'state', 'dnsservername', 'dnsserverid', 'account', 'domainpath'],
1543+
tabs: [{
1544+
name: 'details',
1545+
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
1546+
},
1547+
{
1548+
name: 'dns.records',
1549+
component: shallowRef(defineAsyncComponent(() => import('@/views/network/dns/DnsRecordsTab.vue'))),
1550+
show: () => true
1551+
}],
1552+
actions: [
1553+
{
1554+
api: 'createDnsZone',
1555+
icon: 'plus-outlined',
1556+
label: 'label.dns.add.zone',
1557+
listView: true,
1558+
popup: true,
1559+
disabled: (record) => false,
1560+
component: shallowRef(defineAsyncComponent(() => import('@/views/network/dns/AddDnsZone.vue'))),
1561+
show: () => {
1562+
return true
1563+
}
1564+
},
1565+
{
1566+
api: 'updateDnsZone',
1567+
icon: 'edit-outlined',
1568+
label: 'label.dns.update.zone',
1569+
dataView: true,
1570+
popup: true,
1571+
disabled: (record) => false,
1572+
component: shallowRef(defineAsyncComponent(() => import('@/views/network/dns/UpdateDnsZone.vue'))),
1573+
show: (record) => { return true }
1574+
},
1575+
{
1576+
api: 'deleteDnsZone',
1577+
icon: 'delete-outlined',
1578+
label: 'label.dns.delete.zone',
1579+
message: 'message.action.delete.dns.zone',
1580+
dataView: true,
1581+
groupAction: true,
1582+
disabled: (record) => false,
1583+
show: (record) => { return true },
1584+
groupMap: (selection) => { return selection.map(x => { return { id: x } }) }
1585+
}
1586+
]
15671587
}
15681588
]
15691589
}

ui/src/views/network/NicsTable.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
{{ record.isolationuri }}
5959
</a-descriptions-item>
6060

61-
<a-descriptions-item :label="$t('label.dns_url')" v-if="record.dns_url">
62-
{{ record.dns_url }}
61+
<a-descriptions-item :label="$t('label.dns.record.url')" v-if="record.dnsrecordurl">
62+
{{ record.dnsrecordurl }}
6363
</a-descriptions-item>
6464
</template>
6565
</a-descriptions>

0 commit comments

Comments
 (0)