metron-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickal...@apache.org
Subject [10/21] metron git commit: METRON-1476 Update to Angular 6.1.3 (sardell via nickwallen) closes apache/metron#1096
Date Tue, 18 Sep 2018 14:54:51 GMT
http://git-wip-us.apache.org/repos/asf/metron/blob/33792c24/metron-interface/metron-alerts/src/app/utils/elasticsearch-utils.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-alerts/src/app/utils/elasticsearch-utils.ts b/metron-interface/metron-alerts/src/app/utils/elasticsearch-utils.ts
index 1f5bcfc..6c297da 100644
--- a/metron-interface/metron-alerts/src/app/utils/elasticsearch-utils.ts
+++ b/metron-interface/metron-alerts/src/app/utils/elasticsearch-utils.ts
@@ -36,7 +36,7 @@ export class ElasticsearchUtils {
      } catch (e) {}
   }
 
-  public static extractColumnNameData(res: Response): ColumnMetadata[] {
+  public static extractColumnNameData(res): ColumnMetadata[] {
     let response: any = res || {};
     let columnMetadata: ColumnMetadata[] = [];
     let seen: string[] = [];
@@ -54,7 +54,7 @@ export class ElasticsearchUtils {
     return columnMetadata;
   }
 
-  public static extractAlertsData(res: Response): SearchResponse {
+  public static extractAlertsData(res): SearchResponse {
     let response: any = res || {};
     let searchResponse: SearchResponse = new SearchResponse();
     searchResponse.total = response['hits']['total'];

http://git-wip-us.apache.org/repos/asf/metron/blob/33792c24/metron-interface/metron-alerts/src/app/utils/httpUtil.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-alerts/src/app/utils/httpUtil.ts b/metron-interface/metron-alerts/src/app/utils/httpUtil.ts
index dfcb61f..6c99490 100644
--- a/metron-interface/metron-alerts/src/app/utils/httpUtil.ts
+++ b/metron-interface/metron-alerts/src/app/utils/httpUtil.ts
@@ -1,3 +1,4 @@
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -15,34 +16,34 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Response} from '@angular/http';
-import {Observable}     from 'rxjs/Observable';
+import {HttpErrorResponse} from '@angular/common/http';
 import {RestError} from '../model/rest-error';
+import {throwError as observableThrowError, Observable} from 'rxjs';
 
 export class HttpUtil {
 
-  public static extractString(res: Response): string {
-    let text: string = res.text();
+  public static extractString(res: HttpErrorResponse): string {
+    let text: string = res.toString();
     return text || '';
   }
 
-  public static extractData(res: Response): any {
-    let body = res.json();
+  public static extractData(res: HttpErrorResponse): any {
+    let body = res;
     return body || {};
   }
 
-  public static handleError(res: Response): Observable<RestError> {
+  public static handleError(res: HttpErrorResponse): Observable<RestError> {
     // In a real world app, we might use a remote logging infrastructure
     // We'd also dig deeper into the error to get a better message
     let restError: RestError;
     if (res.status === 401) {
       window.location.assign('/login?sessionExpired=true');
     } else if (res.status !== 404) {
-      restError = res.json();
+      restError = res;
     } else {
       restError = new RestError();
-      restError.responseCode = 404;
+      restError.status = 404;
     }
-    return Observable.throw(restError);
+    return observableThrowError(restError);
   }
 }

http://git-wip-us.apache.org/repos/asf/metron/blob/33792c24/metron-interface/metron-alerts/src/global-shim.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-alerts/src/global-shim.ts b/metron-interface/metron-alerts/src/global-shim.ts
new file mode 100644
index 0000000..38cdd93
--- /dev/null
+++ b/metron-interface/metron-alerts/src/global-shim.ts
@@ -0,0 +1,18 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
+(window as any).global = window;

http://git-wip-us.apache.org/repos/asf/metron/blob/33792c24/metron-interface/metron-alerts/src/main.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-alerts/src/main.ts b/metron-interface/metron-alerts/src/main.ts
index ef1d816..8a1e24f 100644
--- a/metron-interface/metron-alerts/src/main.ts
+++ b/metron-interface/metron-alerts/src/main.ts
@@ -25,4 +25,7 @@ if (environment.production) {
   enableProdMode();
 }
 
-platformBrowserDynamic().bootstrapModule(AppModule);
+platformBrowserDynamic().bootstrapModule(AppModule, {
+  preserveWhitespaces: true
+})
+.catch(err => console.log(err));

http://git-wip-us.apache.org/repos/asf/metron/blob/33792c24/metron-interface/metron-alerts/src/polyfills.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-alerts/src/polyfills.ts b/metron-interface/metron-alerts/src/polyfills.ts
index a18604d..de8faa5 100644
--- a/metron-interface/metron-alerts/src/polyfills.ts
+++ b/metron-interface/metron-alerts/src/polyfills.ts
@@ -32,6 +32,8 @@
  * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
  */
 
+import './global-shim';
+
 /***************************************************************************************************
  * BROWSER POLYFILLS
  */

http://git-wip-us.apache.org/repos/asf/metron/blob/33792c24/metron-interface/metron-alerts/src/tsconfig.app.json
----------------------------------------------------------------------
diff --git a/metron-interface/metron-alerts/src/tsconfig.app.json b/metron-interface/metron-alerts/src/tsconfig.app.json
index f697dd7..2d7bae8 100644
--- a/metron-interface/metron-alerts/src/tsconfig.app.json
+++ b/metron-interface/metron-alerts/src/tsconfig.app.json
@@ -9,6 +9,9 @@
       "bootstrap"
     ]
   },
+  "angularCompilerOptions": {
+    "preserveWhitespaces": true
+  },
   "exclude": [
     "test.ts",
     "**/*.spec.ts"

http://git-wip-us.apache.org/repos/asf/metron/blob/33792c24/metron-interface/metron-alerts/src/tsconfig.spec.json
----------------------------------------------------------------------
diff --git a/metron-interface/metron-alerts/src/tsconfig.spec.json b/metron-interface/metron-alerts/src/tsconfig.spec.json
index 510e3f1..15458ed 100644
--- a/metron-interface/metron-alerts/src/tsconfig.spec.json
+++ b/metron-interface/metron-alerts/src/tsconfig.spec.json
@@ -11,7 +11,8 @@
     ]
   },
   "files": [
-    "test.ts"
+    "test.ts",
+    "polyfills.ts"
   ],
   "include": [
     "**/*.spec.ts",

http://git-wip-us.apache.org/repos/asf/metron/blob/33792c24/metron-interface/metron-config/README.md
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/README.md b/metron-interface/metron-config/README.md
index 7ae774b..944e5cb 100644
--- a/metron-interface/metron-config/README.md
+++ b/metron-interface/metron-config/README.md
@@ -22,7 +22,7 @@ This module provides a user interface for management functions in Metron.
 ## Prerequisites
 
 * A network accessible Metron REST application
-* nodejs v6.9+ (nodejs can be installed on Full Dev with `curl --silent --location https://rpm.nodesource.com/setup_6.x
| bash - && yum install -y nodejs`)
+* nvm (or a similar node verison manager) should be installed. The node version required
for this project is listed in the [.nvmrc](https://github.com/creationix/nvm#nvmrc) file.
 
 ## Installation
 
@@ -92,10 +92,11 @@ The application will be available at http://host:4200 assuming the port
is set t
 
 The Management UI can also be started in development mode.  This allows changes to web assets
to be seen interactively.
 
-1. Install the application with dev dependencies:
+1. Switch to the correct node version and install all the dependent node_modules using the
following commands:
 
     ```
     cd metron-interface/metron-config
+    nvm use
     npm install
     ```
 


Mime
View raw message