Commits

Genki Sugawara  committed 3c2e7fc

fix input check

  • Participants
  • Parent commits 9f04454
  • Tags 0.1.7-2

Comments (0)

Files changed (2)

File Resources/chrome/content/rrset-create-window.js

   var value = $V('rrset-create-window-value');
   var comment = $V('rrset-create-window-comment');
 
-  if (type != 'AA' && (!name || !ttl || !value)) {
-    alert("Please input 'Name', 'TTL' and 'Value'.");
+  if (!name || !value) {
+    alert("Please input 'Name' and 'Value'.");
+    return;
+  }
+
+  if (type != 'AA' && !ttl) {
+    alert("Please input 'TTL'.");
     return;
   }
 
     alert("Please input 'Identifier' and 'Weight'.");
   }
 
-  if (type == 'AA' && ttl) {
-    alert("A (Alias) cannot set TTL.");
-    return;
+  if (type == 'AA') {
+    if (ttl) {
+      alert("A (Alias) cannot set TTL.");
+      return;
+    }
+
+    var endpoint = ELBClient.getEndpoint(value);
+
+    if (!endpoint) {
+      alert('Cannot get ELB endpoint.');
+      return;
+    }
   }
 
   args.accepted = true;

File Resources/chrome/content/rrset-edit-window.js

   var value = $V('rrset-edit-window-value');
   var comment = $V('rrset-edit-window-comment');
 
-  if (type != 'AA' && (!name || !ttl || !value)) {
-    alert("Please input 'Name', 'TTL' and 'Value'.");
+  if (!name || !value) {
+    alert("Please input 'Name' and 'Value'.");
+    return;
+  }
+
+  if (type != 'AA' && !ttl) {
+    alert("Please input 'TTL'.");
     return;
   }
 
     alert("Please input 'Identifier' and 'Weight'.");
   }
 
-  if (type == 'AA' && ttl) {
-    alert("A (Alias) cannot set TTL.");
-    return;
+  if (type == 'AA') {
+    if (ttl) {
+      alert("A (Alias) cannot set TTL.");
+      return;
+    }
+
+    var endpoint = ELBClient.getEndpoint(value);
+
+    if (!endpoint) {
+      alert('Cannot get ELB endpoint.');
+      return;
+    }
   }
 
   args.accepted = true;