You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metron.apache.org by rm...@apache.org on 2017/04/11 13:51:13 UTC
[02/12] incubator-metron git commit: METRON-623 Management UI
[contributed by Raghu Mitra Kandikonda and Ryan Merriman] closes
apache/incubator-metron#489
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/util/httpUtils.spec.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/util/httpUtils.spec.ts b/metron-interface/metron-config/src/app/util/httpUtils.spec.ts
new file mode 100644
index 0000000..ff1e39d
--- /dev/null
+++ b/metron-interface/metron-config/src/app/util/httpUtils.spec.ts
@@ -0,0 +1,47 @@
+/**
+ * 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.
+ */
+import {HttpUtil} from './httpUtil';
+import {Response, ResponseOptions, ResponseType} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+import {RestError} from '../model/rest-error';
+
+describe('HttpUtil', () => {
+
+ it('should create an instance', () => {
+ expect(HttpUtil.handleError).toBeTruthy();
+ expect(HttpUtil.extractString).toBeTruthy();
+ expect(HttpUtil.extractData).toBeTruthy();
+ });
+
+ it('should handleError', () => {
+ let error500: RestError = {message: 'This is error', responseCode: 500, fullMessage: 'This is error'};
+ let responseOptions = new ResponseOptions();
+ responseOptions.body = error500;
+ let response = new Response(responseOptions);
+ response.type = ResponseType.Basic;
+ expect(HttpUtil.handleError(response)).toEqual(Observable.throw(error500));
+
+ let error404 = new RestError();
+ error404.responseCode = 404;
+ response = new Response(new ResponseOptions());
+ response.type = ResponseType.Basic;
+ response.status = 404;
+ expect(HttpUtil.handleError(response)).toEqual(Observable.throw(error404));
+ });
+
+});
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/util/stringUtils.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/util/stringUtils.ts b/metron-interface/metron-config/src/app/util/stringUtils.ts
new file mode 100644
index 0000000..81c3d57
--- /dev/null
+++ b/metron-interface/metron-config/src/app/util/stringUtils.ts
@@ -0,0 +1,31 @@
+/**
+ * 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.
+ */
+export class StringUtil {
+ public static getIndexOfLastNonAlphaNumeric(str: string): number {
+ let tLastIndex = str.length - 1;
+
+ for (; tLastIndex >= 0; tLastIndex--) {
+ let ch = str[tLastIndex];
+ if (/[^a-zA-Z0-9_]/.test(ch)) {
+ break;
+ }
+ }
+
+ return tLastIndex;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/verticalnavbar/index.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/verticalnavbar/index.ts b/metron-interface/metron-config/src/app/verticalnavbar/index.ts
new file mode 100644
index 0000000..8519f13
--- /dev/null
+++ b/metron-interface/metron-config/src/app/verticalnavbar/index.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.
+ */
+export * from './verticalnavbar.component';
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.component.scss
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.component.scss b/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.component.scss
new file mode 100644
index 0000000..a21e128
--- /dev/null
+++ b/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.component.scss
@@ -0,0 +1,50 @@
+/**
+ * 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.
+ */
+@import "../_variables.scss";
+
+.bootstrap-vertical-nav
+{
+ padding: 10px 0px 0px 5px;
+
+ .nav-link-title
+ {
+ padding: 5px 0px 17px 17px;
+ font-size: 14px;
+ }
+
+ .nav-link.active
+ {
+ border-left: 3px solid $nav-active-color;
+ font-family: Roboto-Regular;
+ font-size: 14px;
+ font-weight: normal;
+ color: $nav-active-text-color;
+ }
+
+ .nav-link
+ {
+ padding-left: 17px;
+ border-left: 3px solid $gray-light;
+ font-family: Roboto-Regular;
+ font-size: 14px;
+ font-weight: normal;
+ color: $text-color-white;
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.component.spec.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.component.spec.ts b/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.component.spec.ts
new file mode 100644
index 0000000..7be3ccd
--- /dev/null
+++ b/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.component.spec.ts
@@ -0,0 +1,53 @@
+/**
+ * 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.
+ */
+import {async, inject, TestBed} from '@angular/core/testing';
+import {Router} from '@angular/router';
+import {VerticalNavbarComponent} from './verticalnavbar.component';
+
+class MockRouter {
+ url: string = '';
+}
+
+describe('VerticalNavbarComponent', () => {
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ providers: [
+ VerticalNavbarComponent,
+ {provide: Router, useClass: MockRouter}
+ ]
+ }).compileComponents();
+
+ }));
+
+ it('can instantiate VerticalNavbarComponent',
+ inject([VerticalNavbarComponent], (verticalNavbarComponent: VerticalNavbarComponent) => {
+ expect(verticalNavbarComponent instanceof VerticalNavbarComponent).toBe(true);
+ }));
+
+ it('check isActive for a URL VerticalNavbarComponent',
+ inject([VerticalNavbarComponent, Router], (component: VerticalNavbarComponent, router: Router) => {
+
+ router.url = '/abc';
+ expect(component.isActive(['/def'])).toEqual(false);
+ expect(component.isActive(['/abc'])).toEqual(true);
+ expect(component.isActive(['/def', '/abc'])).toEqual(true);
+
+ }));
+
+});
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.component.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.component.ts b/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.component.ts
new file mode 100644
index 0000000..4067f6c
--- /dev/null
+++ b/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.component.ts
@@ -0,0 +1,35 @@
+/**
+ * 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.
+ */
+import {Component, ChangeDetectionStrategy} from '@angular/core';
+import {Router} from '@angular/router';
+
+@Component({
+ selector: 'metron-config-vertical-navbar',
+ templateUrl: 'verticalnavbar.html',
+ styleUrls: ['verticalnavbar.component.scss'],
+ changeDetection: ChangeDetectionStrategy.OnPush
+})
+
+export class VerticalNavbarComponent {
+
+ constructor(private router: Router) {}
+
+ isActive(validRoutes: string[]) {
+ return validRoutes.indexOf(this.router.url) !== -1;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.html
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.html b/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.html
new file mode 100644
index 0000000..a4052b3
--- /dev/null
+++ b/metron-interface/metron-config/src/app/verticalnavbar/verticalnavbar.html
@@ -0,0 +1,29 @@
+<!--
+ 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.
+ -->
+<div #verticalnavbar class="bootstrap-vertical-nav full-height">
+
+ <div class="nav-link-title">Operations</div>
+
+ <ul class="nav">
+ <li class="nav-item">
+ <a [routerLink]="['/sensors']" class="nav-link" [ngClass]="{'active': isActive(['/', '/sensors'])}" href="#">Sensors</a>
+ </li>
+ <li class="nav-item">
+ <a [routerLink]="['/general-settings']" class="nav-link" [ngClass]="{'active': isActive(['/general-settings'])}" href="#">General Settings</a>
+ </li>
+ </ul>
+
+</div>
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/.npmignore
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/.npmignore b/metron-interface/metron-config/src/assets/.npmignore
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/ace/LICENSE
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/ace/LICENSE b/metron-interface/metron-config/src/assets/ace/LICENSE
new file mode 100644
index 0000000..4760be2
--- /dev/null
+++ b/metron-interface/metron-config/src/assets/ace/LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2010, Ajax.org B.V.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Ajax.org B.V. nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/ace/mode-grok.js
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/ace/mode-grok.js b/metron-interface/metron-config/src/assets/ace/mode-grok.js
new file mode 100644
index 0000000..9e6329b
--- /dev/null
+++ b/metron-interface/metron-config/src/assets/ace/mode-grok.js
@@ -0,0 +1,106 @@
+/**
+ * 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.
+ */
+ace.define('ace/mode/grok_highlight_rules', function(require, exports, module) {
+
+ "use strict";
+
+ var oop = require("../lib/oop");
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+ var GrokHighlightRules = function() {
+
+ var escapeRe = /\\u[0-9a-fA-F]{4}|\\/;
+
+ this.$rules = {
+ "start" : [
+ {
+ token : "paren.lparen",
+ regex: "\\%{",
+ next : "key"
+ },{
+ token : "comment",
+ regex: "\\s*[-/]\\s*"
+ },{
+ token : "comment",
+ regex: "\\s*\\\\s*"
+ },{
+ defaultToken: "invalid"
+ }
+ ],
+ "key" : [
+ {
+ token: "variable",
+ regex: "[a-zA-Z0-9]*",
+ next : "seperator"
+ },{
+ defaultToken: "invalid"
+ }
+ ],"seperator" : [
+ {
+ token: "seperator",
+ regex: "\\s*:{1}",
+ next : "value"
+ },{
+ defaultToken: "invalid"
+ }
+ ],"value" : [
+ {
+ token: "string",
+ regex: "\\s*[a-zA-Z0-9-_]*",
+ next : "end"
+ },{
+ defaultToken: "invalid"
+ }
+ ],"end" : [
+ {
+ token : "paren.rparen",
+ regex : "\\}\\s*",
+ next: "start"
+ },{
+ defaultToken: "invalid"
+ }
+ ]
+ };
+
+ };
+
+ oop.inherits(GrokHighlightRules, TextHighlightRules);
+
+ exports.GrokHighlightRules = GrokHighlightRules;
+
+});
+
+ace.define('ace/mode/grok', function(require, exports, module) {
+
+ var oop = require("ace/lib/oop");
+ var TextMode = require("ace/mode/text").Mode;
+ var GrokHighlightRules = require("ace/mode/grok_highlight_rules").GrokHighlightRules;
+
+ var Mode = function() {
+ this.HighlightRules = GrokHighlightRules;
+ };
+
+ oop.inherits(Mode, TextMode);
+
+ (function() {
+ }).call(Mode.prototype);
+
+ exports.Mode = Mode;
+});
+
+
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/ace/snippets/grok.js
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/ace/snippets/grok.js b/metron-interface/metron-config/src/assets/ace/snippets/grok.js
new file mode 100644
index 0000000..a48cedf
--- /dev/null
+++ b/metron-interface/metron-config/src/assets/ace/snippets/grok.js
@@ -0,0 +1,24 @@
+/**
+ * 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.
+ */
+ace.define("ace/snippets/grok",["require","exports","module"], function(require, exports, module) {
+ "use strict";
+
+ exports.snippetText =undefined;
+ exports.scope = "grok";
+
+});
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/fonts/Roboto/LICENSE.txt
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/fonts/Roboto/LICENSE.txt b/metron-interface/metron-config/src/assets/fonts/Roboto/LICENSE.txt
new file mode 100755
index 0000000..d645695
--- /dev/null
+++ b/metron-interface/metron-config/src/assets/fonts/Roboto/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Black.ttf
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Black.ttf b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Black.ttf
new file mode 100755
index 0000000..fbde625
Binary files /dev/null and b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Black.ttf differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-BlackItalic.ttf
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-BlackItalic.ttf b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-BlackItalic.ttf
new file mode 100755
index 0000000..60f7782
Binary files /dev/null and b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-BlackItalic.ttf differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Bold.ttf
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Bold.ttf b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Bold.ttf
new file mode 100755
index 0000000..a355c27
Binary files /dev/null and b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Bold.ttf differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-BoldItalic.ttf
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-BoldItalic.ttf b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-BoldItalic.ttf
new file mode 100755
index 0000000..3c9a7a3
Binary files /dev/null and b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-BoldItalic.ttf differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Italic.ttf
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Italic.ttf b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Italic.ttf
new file mode 100755
index 0000000..ff6046d
Binary files /dev/null and b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Italic.ttf differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Light.ttf
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Light.ttf b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Light.ttf
new file mode 100755
index 0000000..94c6bcc
Binary files /dev/null and b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Light.ttf differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-LightItalic.ttf
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-LightItalic.ttf b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-LightItalic.ttf
new file mode 100755
index 0000000..04cc002
Binary files /dev/null and b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-LightItalic.ttf differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Medium.ttf
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Medium.ttf b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Medium.ttf
new file mode 100755
index 0000000..39c63d7
Binary files /dev/null and b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Medium.ttf differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-MediumItalic.ttf
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-MediumItalic.ttf b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-MediumItalic.ttf
new file mode 100755
index 0000000..dc743f0
Binary files /dev/null and b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-MediumItalic.ttf differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Regular.ttf
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Regular.ttf b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Regular.ttf
new file mode 100755
index 0000000..8c082c8
Binary files /dev/null and b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Regular.ttf differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Thin.ttf
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Thin.ttf b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Thin.ttf
new file mode 100755
index 0000000..d695550
Binary files /dev/null and b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-Thin.ttf differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-ThinItalic.ttf
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-ThinItalic.ttf b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-ThinItalic.ttf
new file mode 100755
index 0000000..07172ff
Binary files /dev/null and b/metron-interface/metron-config/src/assets/fonts/Roboto/Roboto-ThinItalic.ttf differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/images/login.jpg
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/images/login.jpg b/metron-interface/metron-config/src/assets/images/login.jpg
new file mode 100644
index 0000000..a76a206
Binary files /dev/null and b/metron-interface/metron-config/src/assets/images/login.jpg differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/assets/images/logo.png
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/assets/images/logo.png b/metron-interface/metron-config/src/assets/images/logo.png
new file mode 100644
index 0000000..a0bc8cb
Binary files /dev/null and b/metron-interface/metron-config/src/assets/images/logo.png differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/environments/environment.prod.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/environments/environment.prod.ts b/metron-interface/metron-config/src/environments/environment.prod.ts
new file mode 100644
index 0000000..3612073
--- /dev/null
+++ b/metron-interface/metron-config/src/environments/environment.prod.ts
@@ -0,0 +1,3 @@
+export const environment = {
+ production: true
+};
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/environments/environment.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/environments/environment.ts b/metron-interface/metron-config/src/environments/environment.ts
new file mode 100644
index 0000000..00313f1
--- /dev/null
+++ b/metron-interface/metron-config/src/environments/environment.ts
@@ -0,0 +1,8 @@
+// The file contents for the current environment will overwrite these during build.
+// The build system defaults to the dev environment which uses `environment.ts`, but if you do
+// `ng build --env=prod` then `environment.prod.ts` will be used instead.
+// The list of which env maps to which file can be found in `angular-cli.json`.
+
+export const environment = {
+ production: false
+};
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/favicon.ico
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/favicon.ico b/metron-interface/metron-config/src/favicon.ico
new file mode 100644
index 0000000..a108a83
Binary files /dev/null and b/metron-interface/metron-config/src/favicon.ico differ
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/index.html
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/index.html b/metron-interface/metron-config/src/index.html
new file mode 100644
index 0000000..2c3f8c5
--- /dev/null
+++ b/metron-interface/metron-config/src/index.html
@@ -0,0 +1,38 @@
+<!--
+ 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.
+ -->
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Metron Configuration</title>
+ <base href="/">
+
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="icon" type="image/x-icon" href="favicon.ico">
+
+</head>
+<body>
+ <metron-config-root>
+ <div style="position: absolute;top: 45%; left: 50%">
+ <i class="fa fa-cog fa-spin fa-3x fa-fw" ></i>
+ <div>Loading ... </div>
+ </div>
+ </metron-config-root>
+
+
+
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/main.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/main.ts b/metron-interface/metron-config/src/main.ts
new file mode 100644
index 0000000..70335e5
--- /dev/null
+++ b/metron-interface/metron-config/src/main.ts
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+import './polyfills.ts';
+
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+import { enableProdMode } from '@angular/core';
+import { environment } from './environments/environment';
+import { AppModule } from './app/app.module';
+
+if (environment.production) {
+ enableProdMode();
+}
+
+platformBrowserDynamic().bootstrapModule(AppModule);
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/polyfills.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/polyfills.ts b/metron-interface/metron-config/src/polyfills.ts
new file mode 100644
index 0000000..640ac99
--- /dev/null
+++ b/metron-interface/metron-config/src/polyfills.ts
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+// This file includes polyfills needed by Angular 2 and is loaded before
+// the app. You can add your own extra polyfills to this file.
+import 'core-js/es6/symbol';
+import 'core-js/es6/object';
+import 'core-js/es6/function';
+import 'core-js/es6/parse-int';
+import 'core-js/es6/parse-float';
+import 'core-js/es6/number';
+import 'core-js/es6/math';
+import 'core-js/es6/string';
+import 'core-js/es6/date';
+import 'core-js/es6/array';
+import 'core-js/es6/regexp';
+import 'core-js/es6/map';
+import 'core-js/es6/set';
+import 'core-js/es6/reflect';
+
+import 'core-js/es7/reflect';
+import 'zone.js/dist/zone';
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/styles.scss
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/styles.scss b/metron-interface/metron-config/src/styles.scss
new file mode 100644
index 0000000..db57e91
--- /dev/null
+++ b/metron-interface/metron-config/src/styles.scss
@@ -0,0 +1,739 @@
+/**
+ * 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.
+ */
+/* You can add global styles to this file, and also import other style files */
+@import "app/_variables.scss";
+@import "app/_main.scss";
+
+$height: 60px;
+
+html,body
+{
+ height:100%;
+ background-color: $gray-dark;
+ color: $text-color-white;
+ font-family: "Roboto";
+}
+
+.header
+{
+ height: $height;
+}
+
+.body-fill
+{
+ height: -webkit-calc(100% - 60px);
+ height: calc(100% - 60px);
+ min-height: -webkit-calc(100% - 60px);
+ min-height: calc(100% - 60px);
+}
+
+.fill
+{
+ min-height: 100%;
+ height: 100%;
+}
+
+.metron-bg-inverse
+{
+ background-color: $gray-dark;
+}
+
+.btn
+{
+ font-size: 0.9em;
+}
+
+.metron-title
+{
+ font-family: Roboto-Medium;
+ font-size: 14px;
+ font-weight: 500;
+ color: $text-color-white;
+}
+
+table, .table
+{
+ margin-top: 0.5rem;
+
+ thead {
+ th {
+ font-family: Roboto-Regular;
+ font-size: 11px;
+ color: $text-color-white;
+ border-top: hidden !important;
+ border-bottom: 2px solid $tundora !important;
+ }
+ }
+ tbody {
+ tr
+ {
+ font-family: Roboto-Regular;
+ font-size: 12px;
+ letter-spacing: 0.1px;
+ color: $table-cell-text-color;
+ td:first-child
+ {
+ color: $text-color-white;
+ }
+ td
+ {
+ border-top: none;
+ border-bottom: 1px solid $tundora;
+ }
+ &:hover
+ {
+ background: $edit-background;
+ border-left: 1px solid $edit-background-border;
+ border-right: 1px solid $edit-background-border;
+ }
+ }
+ }
+ .active
+ {
+ background: $table-selection;
+ border-left: 1px solid $table-selection-lr-border;
+ border-right: 1px solid $table-selection-lr-border;
+ td
+ {
+ border-top: 1px solid $table-selection-tb-border !important;
+ border-bottom: 1px solid $table-selection-tb-border;
+ }
+ }
+}
+
+input:-webkit-autofill {
+ -webkit-box-shadow: 0 0 0px 100px $field-background inset;
+ -webkit-text-fill-color: $form-field-text-color !important;
+ background-color: $field-background !important;
+}
+
+label
+{
+ margin-bottom: 0.17em;
+}
+
+.form-group
+{
+ margin-bottom: 0.2em;
+}
+
+
+.table
+{
+ thead
+ {
+ th
+ {
+ padding: 0.60em;
+ }
+ }
+ tr
+ {
+ td
+ {
+ padding: 0.60em;
+ }
+ }
+}
+
+.form-table {
+ background: $field-background;
+}
+
+.metron-add-button
+{
+ position: fixed;
+ right: 50px;
+ bottom: 37px;
+ background: none;
+ border:none;
+ cursor: pointer;
+
+ &:focus
+ {
+ outline: none;
+ }
+
+ i
+ {
+ color: #ffffff;
+ }
+}
+
+.metron-slider-pane
+{
+ background-color: $gray-light;
+ border: solid 1px $gray-border;
+ height: auto;
+ display: inline-block;
+ vertical-align:top;
+ float: right;
+ padding: 15px 20px 0px $slider-left-padding;
+ word-wrap: break-word;
+ position: relative;
+
+ .close-button
+ {
+ font-size: 26px;
+ cursor: pointer;
+ }
+}
+
+.flexbox-row-reverse
+{
+ min-height: 100%;
+ overflow: auto;
+ display: flex;
+ flex-wrap: wrap;
+ flex-direction: row-reverse;
+ justify-content: flex-start;
+}
+
+@media only screen and (min-width: 500px) {
+ .dialog1x {
+ width: $dialog-1x-width;
+ }
+ .dialog2x {
+ width: $dialog-2x-width;
+ }
+}
+
+@media only screen and (min-width: 2020px) {
+ .dialog1x {
+ width: $dialog-2x-width;
+ }
+ .dialog2x {
+ width: $dialog-4x-width;
+ }
+}
+
+.metron-slider-pane-edit
+{
+ @extend .metron-slider-pane;
+ @extend .metron-edit-pane-background;
+ padding-left: 0;
+ padding-right: 0;
+ min-height: 100%;
+}
+
+.metron-edit-pane-background
+{
+ background: $edit-child-background;
+ border: 1px solid $edit-background-border;
+}
+
+form
+{
+ label
+ {
+ font-family: Roboto-Medium;
+ font-size: 12px;
+ color: $form-label;
+ }
+
+ input
+ {
+ background: $form-input-background;
+ }
+}
+
+.form-label
+{
+ font-family: Roboto-Regular;
+ font-size: 12px;
+ color: $form-label
+}
+
+.form-value
+{
+ font-family: Roboto-Regular;
+ font-size: 14px;
+ color: $form-field-text-color;
+
+}
+
+.form-title
+{
+ font-family: Roboto-Medium;
+ font-size: 18px;
+ color: $form-field-text-color;
+ display: inline-block;
+}
+
+.form-title-subscript
+{
+ font-family: Roboto-Medium;
+ font-size: 12px;
+ color: $title-subscript-color;
+}
+
+.form-seperator
+{
+ border: solid 1px $form-field-separator-color;
+ margin: 10px 0px 10px 0px;
+}
+
+.form-seperator-edit
+{
+ border: solid 1px $edit-background-border;
+ margin: 10px 0px 10px 0px;
+}
+
+.form-edit-button
+{
+ color: $field-button-color;
+ padding-left: 5px;
+ cursor: pointer;
+}
+
+.form-enable-disable-button
+{
+ background-color: $gray-light;
+ border-color: $form-button-border;
+ color: $field-button-color;
+ font-size: 14px;
+ min-width: 90px;
+
+ &:hover
+ {
+
+ }
+
+ &:focus
+ {
+ outline: none;
+ }
+}
+
+
+.form-control, select
+{
+ border: solid 1px $gray-border;
+ background-color: $field-background;
+ font-family: Roboto;
+ font-size: 13px;
+ color: $form-field-text-color;
+ height: 35px;
+
+ &[readonly]
+ {
+ background: $form-field-separator-color;
+ border: 1px solid $gray-border;
+ }
+
+ &:focus
+ {
+ background-color: $field-background;
+ border-color: $gray-border;
+ }
+}
+
+.form-control, textarea
+{
+ border: solid 1px $gray-border;
+ background-color: $field-background;
+ font-family: Roboto;
+ font-size: 13px;
+ color: $form-field-text-color;
+
+ &[readonly]
+ {
+ background: $form-field-separator-color;
+ border: 1px solid $gray-border;
+ }
+
+ &:focus
+ {
+ background-color: $field-background;
+ border-color: $gray-border;
+ }
+}
+
+.input-group button
+{
+ border: solid 1px $gray-border;
+ background: $field-background;
+ border-left: none;
+ font-size: 14px;
+
+ &:focus
+ {
+ outline: none;
+ }
+
+ &[readonly]
+ {
+ background: $form-field-separator-color;
+ border: 1px solid $gray-border;
+ }
+}
+
+@mixin keyframes($animation-name, $start) {
+ @-webkit-keyframes #{$animation-name} {
+ 0% {
+ --webkit-transform: translateX(#{$start});
+ }
+ 100% {
+ -webkit-transform: translateX(0);
+ }
+ }
+ @-moz-keyframes #{$animation-name} {
+ 0% {
+ -moz-transform: translateX(#{$start});
+ }
+ 100% {
+ -moz-transform: translateX(0);
+ }
+ }
+ @-ms-keyframes #{$animation-name} {
+ 0% {
+ -ms-transform: translateX(#{$start});
+ }
+ 100% {
+ -ms-transform: translateX(0);
+ }
+ }
+ @-o-keyframes #{$animation-name} {
+ 0% {
+ -o-transform: translateX(#{$start});
+ }
+ 100% {
+ -o-transform: translateX(0);
+ }
+ }
+ @keyframes #{$animation-name} {
+ 0% {
+ transform: translateX(#{$start});
+ }
+ 100% {
+ transform: translateX(0);
+ }
+ }
+}
+
+@mixin keyframesWidth($animation-name) {
+ @-webkit-keyframes #{$animation-name} {
+ @content
+ }
+ @-moz-keyframes #{$animation-name} {
+ @content
+ }
+ @-ms-keyframes #{$animation-name} {
+ @content
+ }
+ @-o-keyframes #{$animation-name} {
+ @content
+ }
+ @keyframes #{$animation-name} {
+ @content
+ }
+}
+
+@mixin animation($name, $duration, $function)
+{
+ -moz-animation: #{$name} #{$duration} #{$function};
+ -webkit-animation: #{$name} #{$duration} #{$function};
+ animation: #{$name} #{$duration} #{$function};
+}
+
+@include keyframes("keyframe-dialog-rtl", "320px")
+
+.load-right-to-left{
+ @include animation("keyframe-dialog-rtl", "0.5s", "linear")
+}
+
+//@include keyframes("keyframe-dialog-ltr", "320px")
+
+@include keyframesWidth("keyframe-dialog-width")
+{
+ 0% { margin-right: -640px; }
+ 100% { margin-right: 0px; }
+}
+
+.load-left-to-right {
+ @include animation("keyframe-dialog-width", "0.5s", "ease-in-out")
+}
+
+.btn-primary
+{
+ background-color: $form-button-border;
+ border-color: $form-button-border;
+ &:hover, &:active, &:focus
+ {
+ background-color: $form-button-border;
+ border-color: $form-button-border;
+ }
+}
+
+.open > .btn-primary.dropdown-toggle
+{
+ &:hover, &:active, &:focus
+ {
+ background-color: $form-button-border;
+ border-color: $form-button-border;
+ }
+}
+
+.fontawesome-checkbox
+{
+ display: none;
+}
+
+.fontawesome-checkbox ~label
+{
+ margin: 0px;
+ display: inline-block;
+ height: 13px;
+ line-height: 13px;
+ border: 1px solid $gray-border;
+ border-radius: 2px;
+}
+
+.fontawesome-checkbox ~label:before {
+ font-family: "FontAwesome";
+ font-style: normal;
+ font-size: 12px;
+ content: '\f0c8';
+ color: $gray-light;
+}
+
+.fontawesome-checkbox:checked ~ label:before {
+ content: '\f14a';
+ color: $nav-active-color;
+}
+
+.hexa-button
+{
+ display: inline-block;
+ text-align: center;
+ z-index: 0;
+ line-height: 0.7em;
+ font-size: 30px;
+ height: 28px;
+ width: 49px;
+ background: $form-button-border;
+
+ &::before, &::after
+ {
+ position: absolute;
+ content: "";
+ left: 0px;
+ top: 0;
+ z-index: -1;
+ height: 28px;
+ width: 49px;
+ background: $form-button-border;
+ }
+ &::before
+ {
+ @include transform(rotate(60deg));
+ }
+ &::after
+ {
+ @include transform(rotate(-60deg));
+ }
+}
+
+.warning-text
+{
+ color: $warning-color;
+}
+
+.success-text-color
+{
+ color: $ocean-green;
+}
+
+
+.icon-container
+{
+ width: 100px;
+ i
+ {
+ color: #33a6dd;
+ padding: 0px 2px;
+ cursor: pointer;
+ }
+}
+
+.icon-blue
+{
+ i
+ {
+ color: #33a6dd;
+ cursor: pointer;
+ }
+}
+
+.dropdown-item
+{
+ cursor: pointer;
+ color: #818a91;
+
+ &:focus, &:hover
+ {
+ background-color: $edit-background-border ;
+ }
+}
+
+a.blue-label
+{
+ color: #33a6dd;
+ font-size: 14px;
+ text-decoration: none ;
+}
+
+.readonly-view-inline-button {
+ display: inline-block;
+}
+
+.readonly-view-inline-button:not(:last-child) {
+ margin-right: 2px;
+}
+
+.input-placeholder {
+ font-size: 11px;
+ font-style: italic;
+ color:#999999;
+}
+
+.popover
+{
+ border: 1px solid #195d68;
+ //background-color: #0b4451;
+ background-color:#195d68;
+}
+
+.popover-title
+{
+ color: #bdbdbd;
+ background-color:#195d68;
+ border-color: #195d68;
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+}
+
+.popover-content {
+ background-color: $tundora;
+ padding: 9px 14px;
+ color: #bdbdbd;
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+ white-space:pre-wrap;
+}
+
+.metron-dialog.modal
+{
+ .modal-content
+ {
+ background-color: $gray-light;
+ border: solid 1px $gray-border;
+ }
+
+ .close
+ {
+ color: #BDBDBD;
+ text-shadow: 0 1px 0 $silver-color;
+ opacity: 1;
+ font-size: 28px;
+ }
+
+ .modal-title
+ {
+ color: $silver-color;
+ font-size: 18px;
+ }
+
+ .modal-body
+ {
+ color: $dusty-grey;
+ }
+
+ .modal-header
+ {
+ border-bottom: none;
+ }
+
+ .modal-footer
+ {
+ text-align: left;
+ border-top: none;
+ }
+}
+
+button
+{
+ i
+ {
+ color: $text-color-white;
+ }
+}
+
+.icon-button
+{
+ font-size: 16px;
+ cursor: pointer;
+ padding: 8px 10px;
+ border-radius: 4px;
+ border: 1px solid $gray-border;
+ color: $nav-active-text-color;
+ background: $form-field-separator-color;
+}
+
+.details-pane-padding
+{
+ padding: 0px 3px 0px 30px;
+}
+
+.metron-button-bar
+{
+ width: 100%;
+ bottom: 0;
+ position: absolute;
+ z-index: 10;
+ padding-left: 25px;
+ margin-left: ($slider-left-padding)* -1;
+ background: $edit-background;
+ border-top: solid 2px $edit-background-border;
+ border-right: solid 1px $edit-background-border;
+ border-left: solid 1px $edit-background-border;
+ max-height: $button-bar-height;
+}
+
+.tooltip
+{
+ font-family: "Roboto";
+}
+
+.card
+{
+ overflow: auto;
+}
+
+.form-control:focus
+{
+ color: #bdbdbd;
+}
+
+.ace_autocomplete.ace-monokai
+{
+ .ace_content {
+ background: #444;
+ color: #999;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/test.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/test.ts b/metron-interface/metron-config/src/test.ts
new file mode 100644
index 0000000..347d245
--- /dev/null
+++ b/metron-interface/metron-config/src/test.ts
@@ -0,0 +1,64 @@
+/**
+ * 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.
+ */
+import './polyfills.ts';
+
+import 'zone.js/dist/long-stack-trace-zone';
+import 'zone.js/dist/proxy.js';
+import 'zone.js/dist/sync-test';
+import 'zone.js/dist/jasmine-patch';
+import 'zone.js/dist/async-test';
+import 'zone.js/dist/fake-async-test';
+
+import 'jquery/dist/jquery';
+import 'tether/dist/js/tether';
+
+import * as $ from 'jquery';
+window['$'] = window['jQuery'] = $;
+
+import * as Tether from 'tether';
+window['Tether'] = Tether;
+
+import 'ace-builds/src-noconflict/ace.js';
+import 'bootstrap/dist/js/bootstrap';
+import 'bootstrap';
+
+// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
+declare var __karma__: any;
+declare var require: any;
+
+// Prevent Karma from running prematurely.
+__karma__.loaded = function () {};
+
+
+Promise.all([
+ System.import('@angular/core/testing'),
+ System.import('@angular/platform-browser-dynamic/testing')
+])
+ // First, initialize the Angular testing environment.
+ .then(([testing, testingBrowser]) => {
+ testing.getTestBed().initTestEnvironment(
+ testingBrowser.BrowserDynamicTestingModule,
+ testingBrowser.platformBrowserDynamicTesting()
+ );
+ })
+ // Then we find all the tests.
+ .then(() => require.context('./', true, /\.spec\.ts/))
+ // And load the modules.
+ .then(context => context.keys().map(context))
+ // Finally, start Karma to run the tests.
+ .then(__karma__.start, __karma__.error);
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/tsconfig.json
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/tsconfig.json b/metron-interface/metron-config/src/tsconfig.json
new file mode 100644
index 0000000..65756e3
--- /dev/null
+++ b/metron-interface/metron-config/src/tsconfig.json
@@ -0,0 +1,24 @@
+{
+ "compilerOptions": {
+ "declaration": false,
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "lib": ["es6", "dom"],
+ "mapRoot": "./",
+ "module": "es6",
+ "moduleResolution": "node",
+ "outDir": "../dist/out-tsc",
+ "sourceMap": true,
+ "target": "es5",
+ "typeRoots": [
+ "../node_modules/@types"
+ ],
+ "types": [
+ "jasmine",
+ "jquery",
+ "bootstrap",
+ "ace"
+ ]
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/typings.d.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/typings.d.ts b/metron-interface/metron-config/src/typings.d.ts
new file mode 100644
index 0000000..c0aaf0c
--- /dev/null
+++ b/metron-interface/metron-config/src/typings.d.ts
@@ -0,0 +1,23 @@
+/**
+ * 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.
+ */
+// Typings reference file, see links for more information
+// https://github.com/typings/typings
+// https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html
+
+declare var System: any;
+declare var require: any;
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/tslint.json
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/tslint.json b/metron-interface/metron-config/tslint.json
new file mode 100644
index 0000000..93037ac
--- /dev/null
+++ b/metron-interface/metron-config/tslint.json
@@ -0,0 +1,112 @@
+{
+ "rulesDirectory": [
+ "node_modules/codelyzer"
+ ],
+ "rules": {
+ "class-name": true,
+ "comment-format": [
+ true,
+ "check-space"
+ ],
+ "curly": true,
+ "eofline": true,
+ "forin": true,
+ "indent": [
+ true,
+ "spaces"
+ ],
+ "label-position": true,
+ "label-undefined": true,
+ "max-line-length": [
+ true,
+ 140
+ ],
+ "member-access": false,
+ "member-ordering": [
+ true,
+ "static-before-instance",
+ "variables-before-functions"
+ ],
+ "no-arg": true,
+ "no-bitwise": true,
+ "no-console": [
+ true,
+ "debug",
+ "info",
+ "time",
+ "timeEnd",
+ "trace"
+ ],
+ "no-construct": true,
+ "no-debugger": true,
+ "no-duplicate-key": true,
+ "no-duplicate-variable": true,
+ "no-empty": false,
+ "no-eval": true,
+ "no-inferrable-types": true,
+ "no-shadowed-variable": true,
+ "no-string-literal": false,
+ "no-switch-case-fall-through": true,
+ "no-trailing-whitespace": true,
+ "no-unused-expression": true,
+ "no-unused-variable": true,
+ "no-unreachable": true,
+ "no-use-before-declare": true,
+ "no-var-keyword": true,
+ "object-literal-sort-keys": false,
+ "one-line": [
+ true,
+ "check-open-brace",
+ "check-catch",
+ "check-else",
+ "check-whitespace"
+ ],
+ "quotemark": [
+ true,
+ "single"
+ ],
+ "radix": true,
+ "semicolon": [
+ "always"
+ ],
+ "triple-equals": [
+ true,
+ "allow-null-check"
+ ],
+ "typedef-whitespace": [
+ true,
+ {
+ "call-signature": "nospace",
+ "index-signature": "nospace",
+ "parameter": "nospace",
+ "property-declaration": "nospace",
+ "variable-declaration": "nospace"
+ }
+ ],
+ "variable-name": false,
+ "whitespace": [
+ true,
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-separator",
+ "check-type"
+ ],
+
+ "directive-selector-prefix": [true, "metron-config"],
+ "component-selector-prefix": [true, "metron-config"],
+ "directive-selector-name": [true, "camelCase"],
+ "component-selector-name": [true, "kebab-case"],
+ "directive-selector-type": [true, "attribute"],
+ "component-selector-type": [true, "element"],
+ "use-input-property-decorator": true,
+ "use-output-property-decorator": true,
+ "use-host-property-decorator": true,
+ "no-input-rename": true,
+ "no-output-rename": true,
+ "use-life-cycle-interface": true,
+ "use-pipe-transform-interface": true,
+ "component-class-suffix": true,
+ "directive-class-suffix": true
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyStatus.java
----------------------------------------------------------------------
diff --git a/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyStatus.java b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyStatus.java
index 6fc1c01..a057d1b 100644
--- a/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyStatus.java
+++ b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyStatus.java
@@ -28,6 +28,8 @@ public class TopologyStatus {
private Map<String, Object>[] topologyStats;
private Double latency = 0.0;
private Double throughput = 0.0;
+ private Integer emitted = 0;
+ private Integer acked = 0;
public String getId() {
return id;
@@ -61,14 +63,24 @@ public class TopologyStatus {
return throughput;
}
+ public Integer getEmitted() {
+ return emitted;
+ }
+
+ public long getAcked() {
+ return acked;
+ }
+
public void setTopologyStats(List<Map<String, Object>> topologyStats) {
for(Map<String, Object> topologyStatsItem: topologyStats) {
if ("600".equals(topologyStatsItem.get("window"))) {
latency = Double.parseDouble((String) topologyStatsItem.get("completeLatency"));
- int acked = 0;
if (topologyStatsItem.get("acked") != null) {
acked = (int) topologyStatsItem.get("acked");
}
+ if (topologyStatsItem.get("emitted") != null) {
+ emitted= (int) topologyStatsItem.get("emitted");
+ }
throughput = acked / 600.00;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-rest/README.md
----------------------------------------------------------------------
diff --git a/metron-interface/metron-rest/README.md b/metron-interface/metron-rest/README.md
index 8de1982..c52b21d 100644
--- a/metron-interface/metron-rest/README.md
+++ b/metron-interface/metron-rest/README.md
@@ -87,6 +87,7 @@ Request and Response objects are JSON formatted. The JSON schemas are available
| [ `GET /api/v1/global/config`](#get-apiv1globalconfig)|
| [ `DELETE /api/v1/global/config`](#delete-apiv1globalconfig)|
| [ `POST /api/v1/global/config`](#post-apiv1globalconfig)|
+| [ `GET /api/v1/grok/get/statement`](#get-apiv1grokgetstatement)|
| [ `GET /api/v1/grok/list`](#get-apiv1groklist)|
| [ `POST /api/v1/grok/validate`](#post-apiv1grokvalidate)|
| [ `POST /api/v1/hdfs`](#post-apiv1hdfs)|
@@ -158,6 +159,13 @@ Request and Response objects are JSON formatted. The JSON schemas are available
* 200 - Global Config updated. Returns saved Global Config JSON
* 201 - Global Config created. Returns saved Global Config JSON
+### `GET /api/v1/grok/get/statement`
+ * Description: Retrieves a Grok statement from the classpath
+ * Input:
+ * path - Path to classpath resource
+ * Returns:
+ * 200 - Grok statement
+
### `GET /api/v1/grok/list`
* Description: Lists the common Grok statements available in Metron
* Returns:
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/GrokController.java
----------------------------------------------------------------------
diff --git a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/GrokController.java b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/GrokController.java
index d561897..5ce8b83 100644
--- a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/GrokController.java
+++ b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/GrokController.java
@@ -29,6 +29,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@@ -53,4 +54,11 @@ public class GrokController {
ResponseEntity<Map<String, String>> list() throws RestException {
return new ResponseEntity<>(grokService.getCommonGrokPatterns(), HttpStatus.OK);
}
+
+ @ApiOperation(value = "Retrieves a Grok statement from the classpath")
+ @ApiResponse(message = "Grok statement", code = 200)
+ @RequestMapping(value = "/get/statement", method = RequestMethod.GET)
+ ResponseEntity<String> get(@ApiParam(name = "path", value = "Path to classpath resource", required = true) @RequestParam String path) throws RestException {
+ return new ResponseEntity<>(grokService.getStatementFromClasspath(path), HttpStatus.OK);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/HdfsController.java
----------------------------------------------------------------------
diff --git a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/HdfsController.java b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/HdfsController.java
index bf7ae84..c8ff0b6 100644
--- a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/HdfsController.java
+++ b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/HdfsController.java
@@ -64,7 +64,7 @@ public class HdfsController {
}
- @ApiOperation(value = "Writes contents to an HDFS file. Warning: this will overwite the contents of a file if it already exists.")
+ @ApiOperation(value = "Writes contents to an HDFS file. Warning: this will overwrite the contents of a file if it already exists.")
@ApiResponse(message = "Contents were written", code = 200)
@RequestMapping(method = RequestMethod.POST)
ResponseEntity<Void> write(@ApiParam(name="path", value="Path to HDFS file", required=true) @RequestParam String path,
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/KafkaController.java
----------------------------------------------------------------------
diff --git a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/KafkaController.java b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/KafkaController.java
index 876558b..0cd4d54 100644
--- a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/KafkaController.java
+++ b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/KafkaController.java
@@ -69,7 +69,7 @@ public class KafkaController {
return new ResponseEntity<>(kafkaService.listTopics(), HttpStatus.OK);
}
- @ApiOperation(value = "Delets a Kafka topic")
+ @ApiOperation(value = "Deletes a Kafka topic")
@ApiResponses(value = { @ApiResponse(message = "Kafka topic was deleted", code = 200),
@ApiResponse(message = "Kafka topic is missing", code = 404) })
@RequestMapping(value = "/topic/{name}", method = RequestMethod.DELETE)
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/SensorEnrichmentConfigController.java
----------------------------------------------------------------------
diff --git a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/SensorEnrichmentConfigController.java b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/SensorEnrichmentConfigController.java
index 546384a..826be98 100644
--- a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/SensorEnrichmentConfigController.java
+++ b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/SensorEnrichmentConfigController.java
@@ -21,6 +21,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
+import org.apache.metron.common.aggregator.Aggregators;
import org.apache.metron.common.configuration.enrichment.SensorEnrichmentConfig;
import org.apache.metron.rest.RestException;
import org.apache.metron.rest.service.SensorEnrichmentConfigService;
@@ -90,8 +91,15 @@ public class SensorEnrichmentConfigController {
@ApiOperation(value = "Lists the available enrichments")
@ApiResponse(message = "Returns a list of available enrichments", code = 200)
- @RequestMapping(value = "/list/available", method = RequestMethod.GET)
- ResponseEntity<List<String>> getAvailable() throws RestException {
+ @RequestMapping(value = "/list/available/enrichments", method = RequestMethod.GET)
+ ResponseEntity<List<String>> getAvailableEnrichments() throws RestException {
return new ResponseEntity<>(sensorEnrichmentConfigService.getAvailableEnrichments(), HttpStatus.OK);
}
+
+ @ApiOperation(value = "Lists the available threat triage aggregators")
+ @ApiResponse(message = "Returns a list of available threat triage aggregators", code = 200)
+ @RequestMapping(value = "/list/available/threat/triage/aggregators", method = RequestMethod.GET)
+ ResponseEntity<List<String>> getAvailableThreatTriageAggregators() throws RestException {
+ return new ResponseEntity<>(sensorEnrichmentConfigService.getAvailableThreatTriageAggregators(), HttpStatus.OK);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/GrokService.java
----------------------------------------------------------------------
diff --git a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/GrokService.java b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/GrokService.java
index 268d396..adeb1ed 100644
--- a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/GrokService.java
+++ b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/GrokService.java
@@ -31,4 +31,6 @@ public interface GrokService {
File saveTemporary(String statement, String name) throws RestException;
+ String getStatementFromClasspath(String path) throws RestException;
+
}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/SensorEnrichmentConfigService.java
----------------------------------------------------------------------
diff --git a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/SensorEnrichmentConfigService.java b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/SensorEnrichmentConfigService.java
index fe84802..817a57d 100644
--- a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/SensorEnrichmentConfigService.java
+++ b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/SensorEnrichmentConfigService.java
@@ -17,6 +17,7 @@
*/
package org.apache.metron.rest.service;
+import org.apache.metron.common.aggregator.Aggregators;
import org.apache.metron.common.configuration.enrichment.SensorEnrichmentConfig;
import org.apache.metron.rest.RestException;
@@ -37,4 +38,6 @@ public interface SensorEnrichmentConfigService {
List<String> getAvailableEnrichments();
+ List<String> getAvailableThreatTriageAggregators();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/GrokServiceImpl.java
----------------------------------------------------------------------
diff --git a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/GrokServiceImpl.java b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/GrokServiceImpl.java
index 3f2de2f..edae13b 100644
--- a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/GrokServiceImpl.java
+++ b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/GrokServiceImpl.java
@@ -19,6 +19,7 @@ package org.apache.metron.rest.service.impl;
import oi.thekraken.grok.api.Grok;
import oi.thekraken.grok.api.Match;
+import org.apache.commons.io.IOUtils;
import org.apache.directory.api.util.Strings;
import org.apache.hadoop.fs.Path;
import org.apache.metron.rest.RestException;
@@ -110,4 +111,12 @@ public class GrokServiceImpl implements GrokService {
return new Path(grokTempPath, authentication.getName()).toString();
}
+ public String getStatementFromClasspath(String path) throws RestException {
+ try {
+ return IOUtils.toString(getClass().getResourceAsStream(path));
+ } catch (Exception e) {
+ throw new RestException("Could not find a statement at path " + path);
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/SensorEnrichmentConfigServiceImpl.java
----------------------------------------------------------------------
diff --git a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/SensorEnrichmentConfigServiceImpl.java b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/SensorEnrichmentConfigServiceImpl.java
index 2bfef89..d4438a4 100644
--- a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/SensorEnrichmentConfigServiceImpl.java
+++ b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/SensorEnrichmentConfigServiceImpl.java
@@ -19,6 +19,7 @@ package org.apache.metron.rest.service.impl;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.curator.framework.CuratorFramework;
+import org.apache.metron.common.aggregator.Aggregators;
import org.apache.metron.common.configuration.ConfigurationType;
import org.apache.metron.common.configuration.ConfigurationsUtils;
import org.apache.metron.common.configuration.enrichment.SensorEnrichmentConfig;
@@ -29,9 +30,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
@Service
public class SensorEnrichmentConfigServiceImpl implements SensorEnrichmentConfigService {
@@ -113,4 +116,8 @@ public class SensorEnrichmentConfigServiceImpl implements SensorEnrichmentConfig
}};
}
+ @Override
+ public List<String> getAvailableThreatTriageAggregators() {
+ return Arrays.asList(Aggregators.values()).stream().map(Enum::toString).collect(Collectors.toList());
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/SensorParserConfigServiceImpl.java
----------------------------------------------------------------------
diff --git a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/SensorParserConfigServiceImpl.java b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/SensorParserConfigServiceImpl.java
index eddfc8d..37d59d0 100644
--- a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/SensorParserConfigServiceImpl.java
+++ b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/SensorParserConfigServiceImpl.java
@@ -164,6 +164,7 @@ public class SensorParserConfigServiceImpl implements SensorParserConfigService
sensorParserConfig.getParserConfig().put(MetronRestConstants.GROK_PATH_KEY, temporaryGrokFile.toString());
}
parser.configure(sensorParserConfig.getParserConfig());
+ parser.init();
JSONObject results = parser.parse(parseMessageRequest.getSampleData().getBytes()).get(0);
if (isGrokConfig(sensorParserConfig) && temporaryGrokFile != null) {
temporaryGrokFile.delete();
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-rest/src/test/java/org/apache/metron/rest/controller/GrokControllerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/metron-interface/metron-rest/src/test/java/org/apache/metron/rest/controller/GrokControllerIntegrationTest.java b/metron-interface/metron-rest/src/test/java/org/apache/metron/rest/controller/GrokControllerIntegrationTest.java
index e0a9c5b..8888eb0 100644
--- a/metron-interface/metron-rest/src/test/java/org/apache/metron/rest/controller/GrokControllerIntegrationTest.java
+++ b/metron-interface/metron-rest/src/test/java/org/apache/metron/rest/controller/GrokControllerIntegrationTest.java
@@ -18,6 +18,7 @@
package org.apache.metron.rest.controller;
import org.adrianwalker.multilinestring.Multiline;
+import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -30,6 +31,8 @@ import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
+import java.io.File;
+
import static org.apache.metron.rest.MetronRestConstants.TEST_PROFILE;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.httpBasic;
@@ -127,5 +130,16 @@ public class GrokControllerIntegrationTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8")))
.andExpect(jsonPath("$").isNotEmpty());
+
+ String statement = FileUtils.readFileToString(new File("../../metron-platform/metron-parsers/src/main/resources/patterns/squid"));
+ this.mockMvc.perform(get(grokUrl + "/get/statement?path=/patterns/squid").with(httpBasic(user,password)))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.parseMediaType("text/plain;charset=UTF-8")))
+ .andExpect(content().bytes(statement.getBytes()));
+
+ this.mockMvc.perform(get(grokUrl + "/get/statement?path=/bad/path").with(httpBasic(user,password)))
+ .andExpect(status().isInternalServerError())
+ .andExpect(jsonPath("$.responseCode").value(500))
+ .andExpect(jsonPath("$.message").value("Could not find a statement at path /bad/path"));
}
}