knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pzamp...@apache.org
Subject [6/6] knox git commit: KNOX-1279 - HaProvider wizard should include ability to specify ZooKeeper-related properties
Date Wed, 25 Apr 2018 19:18:12 GMT
KNOX-1279 - HaProvider wizard should include ability to specify ZooKeeper-related properties


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/c25abaf0
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/c25abaf0
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/c25abaf0

Branch: refs/heads/master
Commit: c25abaf019fd65afc4b2ec19d0d98aca4310446d
Parents: 5bdd73d
Author: Phil Zampino <pzampino@apache.org>
Authored: Wed Apr 25 15:05:17 2018 -0400
Committer: Phil Zampino <pzampino@apache.org>
Committed: Wed Apr 25 15:05:17 2018 -0400

----------------------------------------------------------------------
 .../ha-provider-config.ts                       | 47 ++++++++++++++++----
 .../src/app/utils/validation-utils.ts           |  7 ++-
 .../applications/admin-ui/app/index.html        |  2 +-
 .../app/inline.8b440394d56c1b9f80b6.bundle.js   |  1 +
 .../app/inline.9a935aa514be6e394488.bundle.js   |  1 -
 .../app/main.2efbd98cdf9b2cd26024.bundle.js     |  1 +
 .../app/main.bdb75642794f8f687810.bundle.js     |  1 -
 7 files changed, 47 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/c25abaf0/gateway-admin-ui/src/app/provider-config-wizard/ha-provider-config.ts
----------------------------------------------------------------------
diff --git a/gateway-admin-ui/src/app/provider-config-wizard/ha-provider-config.ts b/gateway-admin-ui/src/app/provider-config-wizard/ha-provider-config.ts
index 52ebc45..54dea49 100644
--- a/gateway-admin-ui/src/app/provider-config-wizard/ha-provider-config.ts
+++ b/gateway-admin-ui/src/app/provider-config-wizard/ha-provider-config.ts
@@ -22,27 +22,35 @@ export class HaProviderConfig extends DisplayBindingProviderConfig {
 
   public static TYPE: string = 'HaProvider';
 
+  private static ENSEMBLE_REGEXP: RegExp = new RegExp('^([a-zA-Z\\d-.]+:\\d+)(;[a-zA-Z\\d-.]+:\\d+)*$');
+
   public static SERVICE_NAME          = 'Service Name';
   public static MAX_FAILOVER_ATTEMPTS = 'Failover Atttempts Limit';
   public static FAILOVER_SLEEP        = 'Failover Interval';
   public static MAX_RETRY_ATTEMPTS    = 'Retry Attempts Limit';
   public static RETRY_SLEEP           = 'Retry Interval';
+  public static ZK_ENSEMBLE           = 'ZooKeeper Ensemble';
+  public static ZK_NAMESPACE          = 'ZooKeeper Namespace';
 
   private static displayPropertyNames = [ HaProviderConfig.SERVICE_NAME,
                                           HaProviderConfig.MAX_FAILOVER_ATTEMPTS,
                                           HaProviderConfig.FAILOVER_SLEEP,
                                           HaProviderConfig.MAX_RETRY_ATTEMPTS,
-                                          HaProviderConfig.RETRY_SLEEP
+                                          HaProviderConfig.RETRY_SLEEP,
+                                          HaProviderConfig.ZK_ENSEMBLE,
+                                          HaProviderConfig.ZK_NAMESPACE
                                         ];
 
   private static displayPropertyNameBindings: Map<string, string> =
-    new Map([
-      [HaProviderConfig.SERVICE_NAME,          'serviceName'],
-      [HaProviderConfig.MAX_FAILOVER_ATTEMPTS, 'maxFailoverAttempts'],
-      [HaProviderConfig.FAILOVER_SLEEP,        'failoverSleep'],
-      [HaProviderConfig.MAX_RETRY_ATTEMPTS,    'maxRetryAttempts'],
-      [HaProviderConfig.RETRY_SLEEP,           'retrySleep']
-    ] as [string, string][]);
+                                        new Map([
+                                          [HaProviderConfig.SERVICE_NAME,          'serviceName'],
+                                          [HaProviderConfig.MAX_FAILOVER_ATTEMPTS, 'maxFailoverAttempts'],
+                                          [HaProviderConfig.FAILOVER_SLEEP,        'failoverSleep'],
+                                          [HaProviderConfig.MAX_RETRY_ATTEMPTS,    'maxRetryAttempts'],
+                                          [HaProviderConfig.RETRY_SLEEP,           'retrySleep'],
+                                          [HaProviderConfig.ZK_ENSEMBLE,           'zookeeperEnsemble'],
+                                          [HaProviderConfig.ZK_NAMESPACE,          'zookeeperNamespace']
+                                        ] as [string, string][]);
 
   constructor() {
     super();
@@ -70,6 +78,12 @@ export class HaProviderConfig extends DisplayBindingProviderConfig {
         case HaProviderConfig.SERVICE_NAME:
           isValid = ValidationUtils.isValidString(value) && !ValidationUtils.isValidNumber(value);
           break;
+        case HaProviderConfig.ZK_ENSEMBLE:
+          isValid = this.isValidZooKeeperEnsemble(value);
+          break;
+        case HaProviderConfig.ZK_NAMESPACE:
+          isValid = ValidationUtils.isValidString(value);
+          break;
         default:
           isValid = ValidationUtils.isValidNumber(value);
           if (!isValid) {
@@ -81,5 +95,22 @@ export class HaProviderConfig extends DisplayBindingProviderConfig {
     return isValid;
   }
 
+  private isValidZooKeeperEnsemble(value: string): boolean {
+    let isValid: boolean = HaProviderConfig.ENSEMBLE_REGEXP.test(value);
+    if (isValid) {
+      // Check each hostname for validity
+      let addresses: string[] = value.split(';');
+      for (let address of addresses) {
+        if (isValid) {
+          let hostport: string[] = address.split(':');
+          isValid = isValid && ValidationUtils.isValidHostName(hostport[0]);
+        } else {
+          break;
+        }
+      }
+    }
+    return isValid;
+  }
+
 }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/c25abaf0/gateway-admin-ui/src/app/utils/validation-utils.ts
----------------------------------------------------------------------
diff --git a/gateway-admin-ui/src/app/utils/validation-utils.ts b/gateway-admin-ui/src/app/utils/validation-utils.ts
index 0239b72..79e9d07 100644
--- a/gateway-admin-ui/src/app/utils/validation-utils.ts
+++ b/gateway-admin-ui/src/app/utils/validation-utils.ts
@@ -16,8 +16,6 @@
  */
 
 
-import {CASProviderConfig} from "../provider-config-wizard/cas-provider-config";
-
 export class ParsedURL {
 
   static REGEXP: RegExp = new RegExp('^(([^:\/?#]+):)?\/\/(([^\/?#]+):([^\/?#]+))?([^?#]*)(\/?([^#]*))?(#(.*))?');
@@ -195,4 +193,9 @@ export class ValidationUtils {
     return ValidationUtils.HTTP_METHODS.includes(method);
   }
 
+  static isValidHostName(hostName: string): boolean {
+    // For now, make sure it's a valid string, and does NOT exceed the acceptable host name
length
+    return ValidationUtils.isValidString(hostName) && hostName.length < 256;
+  }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/c25abaf0/gateway-applications/src/main/resources/applications/admin-ui/app/index.html
----------------------------------------------------------------------
diff --git a/gateway-applications/src/main/resources/applications/admin-ui/app/index.html
b/gateway-applications/src/main/resources/applications/admin-ui/app/index.html
index 1514f6f..b7a65c9 100644
--- a/gateway-applications/src/main/resources/applications/admin-ui/app/index.html
+++ b/gateway-applications/src/main/resources/applications/admin-ui/app/index.html
@@ -11,4 +11,4 @@
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
---><!doctype html><html><head><meta charset="utf-8"><title>Apache
Knox Manager</title><meta name="viewport" content="width=device-width,initial-scale=1"><link
rel="icon" type="image/x-icon" href="favicon.ico"><meta name="viewport" content="width=device-width,initial-scale=1"><!--
Latest compiled and minified CSS --><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"><!--
Optional theme --><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"><!--
Custom styles for this template --><link href="assets/sticky-footer.css" rel="stylesheet"><script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script><!--
Latest compiled and minified JavaScript --><scr
 ipt src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script><script src="assets/vkbeautify.js"></script><link
href="styles.2ee5b7f4cd59a6cf015e.bundle.css" rel="stylesheet"/></head><body><div
class="navbar-wrapper"><div class="container-fluid"><nav class="navbar navbar-inverse
navbar-static-top"><div class="container-fluid"><div class="navbar-header"><button
type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar"><span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span> <span class="icon-bar"></span> <span
class="icon-bar"></span></button> <a class="navbar-brand" href="#"><img
style="max-width:200px; margin-top: -9px;" src="assets/knox-logo-transparent.gif" alt="Apache
Knox Manager"></a></div></div></nav></div><!-- Content
--><resource-management></res
 ource-management><footer class="footer"><div class="container-fluid"><div>Knox
Manager Version 1.0.0</div><gateway-version></gateway-version></div></footer><script
type="text/javascript" src="inline.9a935aa514be6e394488.bundle.js"></script><script
type="text/javascript" src="scripts.c50bb762c438ae0f8842.bundle.js"></script><script
type="text/javascript" src="main.bdb75642794f8f687810.bundle.js"></script></div></body></html>
\ No newline at end of file
+--><!doctype html><html><head><meta charset="utf-8"><title>Apache
Knox Manager</title><meta name="viewport" content="width=device-width,initial-scale=1"><link
rel="icon" type="image/x-icon" href="favicon.ico"><meta name="viewport" content="width=device-width,initial-scale=1"><!--
Latest compiled and minified CSS --><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"><!--
Optional theme --><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"><!--
Custom styles for this template --><link href="assets/sticky-footer.css" rel="stylesheet"><script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script><!--
Latest compiled and minified JavaScript --><scr
 ipt src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script><script src="assets/vkbeautify.js"></script><link
href="styles.2ee5b7f4cd59a6cf015e.bundle.css" rel="stylesheet"/></head><body><div
class="navbar-wrapper"><div class="container-fluid"><nav class="navbar navbar-inverse
navbar-static-top"><div class="container-fluid"><div class="navbar-header"><button
type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar"><span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span> <span class="icon-bar"></span> <span
class="icon-bar"></span></button> <a class="navbar-brand" href="#"><img
style="max-width:200px; margin-top: -9px;" src="assets/knox-logo-transparent.gif" alt="Apache
Knox Manager"></a></div></div></nav></div><!-- Content
--><resource-management></res
 ource-management><footer class="footer"><div class="container-fluid"><div>Knox
Manager Version 1.0.0</div><gateway-version></gateway-version></div></footer><script
type="text/javascript" src="inline.8b440394d56c1b9f80b6.bundle.js"></script><script
type="text/javascript" src="scripts.c50bb762c438ae0f8842.bundle.js"></script><script
type="text/javascript" src="main.2efbd98cdf9b2cd26024.bundle.js"></script></div></body></html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/c25abaf0/gateway-applications/src/main/resources/applications/admin-ui/app/inline.8b440394d56c1b9f80b6.bundle.js
----------------------------------------------------------------------
diff --git a/gateway-applications/src/main/resources/applications/admin-ui/app/inline.8b440394d56c1b9f80b6.bundle.js
b/gateway-applications/src/main/resources/applications/admin-ui/app/inline.8b440394d56c1b9f80b6.bundle.js
new file mode 100644
index 0000000..3123749
--- /dev/null
+++ b/gateway-applications/src/main/resources/applications/admin-ui/app/inline.8b440394d56c1b9f80b6.bundle.js
@@ -0,0 +1 @@
+!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,c,u){for(var a,i,f,l=0,s=[];l<r.length;l++)t[i=r[l]]&&s.push(t[i][0]),t[i]=0;for(a
in c)Object.prototype.hasOwnProperty.call(c,a)&&(e[a]=c[a]);for(n&&n(r,c,u);s.length;)s.shift()();if(u)for(l=0;l<u.length;l++)f=o(o.s=u[l]);return
f};var r={},t={2:0};function o(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return
e[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.e=function(e){var n=t[e];if(0===n)return
new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,o){n=t[e]=[r,o]});n[2]=r;var
c=document.getElementsByTagName("head")[0],u=document.createElement("script");u.type="text/javascript",u.charset="utf-8",u.async=!0,u.timeout=12e4,o.nc&&u.setAttribute("nonce",o.nc),u.src=o.p+""+e+"."+{0:"2efbd98cdf9b2cd26024",1:"aed76669724804835353"}[e]+".chunk.js";var
a=setTimeout(i,12e4);function i(){u.onerror=u.onload=null,clearTimeout(a);var n=t[e];0!==n&&(n&&n[1](new
Error("Loading chu
 nk "+e+" failed.")),t[e]=void 0)}return u.onerror=u.onload=i,c.appendChild(u),r},o.m=e,o.c=r,o.d=function(e,n,r){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},o.n=function(e){var
n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return
Object.prototype.hasOwnProperty.call(e,n)},o.p="",o.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/c25abaf0/gateway-applications/src/main/resources/applications/admin-ui/app/inline.9a935aa514be6e394488.bundle.js
----------------------------------------------------------------------
diff --git a/gateway-applications/src/main/resources/applications/admin-ui/app/inline.9a935aa514be6e394488.bundle.js
b/gateway-applications/src/main/resources/applications/admin-ui/app/inline.9a935aa514be6e394488.bundle.js
deleted file mode 100644
index 8bf21f4..0000000
--- a/gateway-applications/src/main/resources/applications/admin-ui/app/inline.9a935aa514be6e394488.bundle.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,c,u){for(var a,i,f,l=0,s=[];l<r.length;l++)t[i=r[l]]&&s.push(t[i][0]),t[i]=0;for(a
in c)Object.prototype.hasOwnProperty.call(c,a)&&(e[a]=c[a]);for(n&&n(r,c,u);s.length;)s.shift()();if(u)for(l=0;l<u.length;l++)f=o(o.s=u[l]);return
f};var r={},t={2:0};function o(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return
e[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.e=function(e){var n=t[e];if(0===n)return
new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,o){n=t[e]=[r,o]});n[2]=r;var
c=document.getElementsByTagName("head")[0],u=document.createElement("script");u.type="text/javascript",u.charset="utf-8",u.async=!0,u.timeout=12e4,o.nc&&u.setAttribute("nonce",o.nc),u.src=o.p+""+e+"."+{0:"bdb75642794f8f687810",1:"aed76669724804835353"}[e]+".chunk.js";var
a=setTimeout(i,12e4);function i(){u.onerror=u.onload=null,clearTimeout(a);var n=t[e];0!==n&&(n&&n[1](new
Error("Loading chu
 nk "+e+" failed.")),t[e]=void 0)}return u.onerror=u.onload=i,c.appendChild(u),r},o.m=e,o.c=r,o.d=function(e,n,r){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},o.n=function(e){var
n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return
Object.prototype.hasOwnProperty.call(e,n)},o.p="",o.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file


Mime
View raw message