http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/global.scss ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/global.scss b/metron-interface/metron-config/src/app/global.scss new file mode 100644 index 0000000..8b64cab --- /dev/null +++ b/metron-interface/metron-config/src/app/global.scss @@ -0,0 +1,594 @@ +/** + * 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"; +@import "_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 #404040 !important; + } + } + 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-bottom: 1px solid #404040 !important; + } + } + .active + { + background: $edit-background; + border-left: 1px solid $edit-background-border; + border-right: 1px solid $edit-background-border; + td + { + border-top: 1px solid $edit-background-border !important; + border-bottom: 1px solid $edit-background-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; + } + +.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 25px; + word-wrap: break-word; + + .close-button + { + font-size: 26px; + cursor: pointer; + } +} + +.dialog1x +{ + width: 320px; +} + +.dialog2x +{ + width :640px +} + +//.metron-slider-pane-edit +//{ +// @extend .metron-slider-pane; +// background: $edit-background; +// border: 1px solid $edit-background-border; +//} +// +//.metron-slider-pane-edit-child +//{ +// @extend .metron-slider-pane-edit; +// background-color: #083b44; +//} + +form +{ + label + { + font-family: Roboto-Medium; + font-size: 12px; + //letter-spacing: -0.8px; + color: $form-label; + } + + input + { + background: $form-input-background; + } +} + +.form-label +{ + font-family: Roboto-Medium; + font-size: 12px; + //letter-spacing: -0.8px; + color: $form-label +} + +.form-value +{ + font-family: Roboto; + 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; + + &: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; + } +} + +.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; +} + +.icon-container +{ + width: 100px; + i + { + color: #33a6dd; + padding: 0px 2px; + 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 ; +} + +.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: #404040; + 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; + } +}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/index.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/index.ts b/metron-interface/metron-config/src/app/index.ts new file mode 100644 index 0000000..1639c33 --- /dev/null +++ b/metron-interface/metron-config/src/app/index.ts @@ -0,0 +1,22 @@ +/** + * 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 './environment'; +export * from './app.component'; +export * from './app.routes'; +export * from './app.config'; +export * from './app.config.interface'; http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/login/login.component.html ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/login/login.component.html b/metron-interface/metron-config/src/app/login/login.component.html new file mode 100644 index 0000000..dcd5c34 --- /dev/null +++ b/metron-interface/metron-config/src/app/login/login.component.html @@ -0,0 +1,28 @@ +<!-- + 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 class="fill login-pane" style=""> + <form (ngSubmit)="login()" class="login-card"> + <img class="logo-img-card" src="assets/images/logo.png"/> + <label class="label"> USERNAME </label> + <input class="form-control" name="user" [(ngModel)]="user" required autofocus> + <label class="label"> PASSWORD </label> + <input type="password" name="password" class="form-control" [(ngModel)]="password" required> + <div class="my-1" style="color:#a94442"> + {{loginFailure}} + <button class="btn btn-primary pull-right" type="submit" (click)="login()">LOG IN</button> + </div> + </form> +</div> http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/login/login.component.scss ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/login/login.component.scss b/metron-interface/metron-config/src/app/login/login.component.scss new file mode 100644 index 0000000..8289a2f --- /dev/null +++ b/metron-interface/metron-config/src/app/login/login.component.scss @@ -0,0 +1,55 @@ +/** + * 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"; + +.login-pane { + background: url(/assets/images/login.jpg); + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; +} + +.label +{ + font-size: 0.8em; + color: $login-label; +} + +.login-card +{ + top: 25%; + height: 380px; + width: 480px; + opacity: 0.8; + margin: 0 auto; + border: none; + padding: 20px 25px 30px; + background-color: $black; + display: block; + position: relative; +} + +.logo-img-card +{ + margin: 0 auto 10px; + display: block; + width: 390px; + height: 120px; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/login/login.component.spec.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/login/login.component.spec.ts b/metron-interface/metron-config/src/app/login/login.component.spec.ts new file mode 100644 index 0000000..0cf3554 --- /dev/null +++ b/metron-interface/metron-config/src/app/login/login.component.spec.ts @@ -0,0 +1,65 @@ +/** + * 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 {AuthenticationService} from '../service/authentication.service'; +import {LoginComponent} from './login.component'; + +class MockAuthenticationService { + + public login(username: string, password: string, onError): void { + if (username === 'success') { + onError({status: 200}); + } + + if (username === 'failure') { + onError({status: 401}); + } + } +} + +describe('LoginComponent', () => { + + beforeEach(async(() => { + TestBed.configureTestingModule({ + providers: [ + LoginComponent, + {provide: AuthenticationService, useClass: MockAuthenticationService} + ] + }) + .compileComponents(); + + })); + + it('can instantiate login component', inject([LoginComponent], (loginComponent: LoginComponent) => { + expect(loginComponent instanceof LoginComponent).toBe(true); + })); + + it('can instantiate login component', inject([LoginComponent], (loginComponent: LoginComponent) => { + loginComponent.user = 'success'; + loginComponent.password = 'success'; + loginComponent.login(); + expect(loginComponent.loginFailure).toEqual(''); + + loginComponent.user = 'failure'; + loginComponent.password = 'failure'; + loginComponent.login(); + expect(loginComponent.loginFailure).toEqual('Login failed for failure'); + + })); + +}); http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/login/login.component.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/login/login.component.ts b/metron-interface/metron-config/src/app/login/login.component.ts new file mode 100644 index 0000000..cdd672a --- /dev/null +++ b/metron-interface/metron-config/src/app/login/login.component.ts @@ -0,0 +1,43 @@ +/** + * 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 } from '@angular/core'; +import { AuthenticationService } from '../service/authentication.service'; + +@Component({ + selector: 'metron-config-login', + templateUrl: 'login.component.html', + styleUrls: ['login.component.scss'], +}) +export class LoginComponent { + + user: string; + password: string; + loginFailure: string = ''; + + constructor(private authenticationService: AuthenticationService) { + } + + login(): void { + this.authenticationService.login(this.user, this.password, error => { + if (error.status === 401) { + this.loginFailure = 'Login failed for ' + this.user; + } + }); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/login/login.module.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/login/login.module.ts b/metron-interface/metron-config/src/app/login/login.module.ts new file mode 100644 index 0000000..6efd125 --- /dev/null +++ b/metron-interface/metron-config/src/app/login/login.module.ts @@ -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. + */ +import { NgModule } from '@angular/core'; +import {routing} from "./login.routing"; + +@NgModule ({ + imports: [ routing ] +}) +export class LoginModule { } http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/login/login.routing.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/login/login.routing.ts b/metron-interface/metron-config/src/app/login/login.routing.ts new file mode 100644 index 0000000..7d2d22e --- /dev/null +++ b/metron-interface/metron-config/src/app/login/login.routing.ts @@ -0,0 +1,25 @@ +/** + * 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 { ModuleWithProviders } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import {LoginComponent} from "./login.component"; + + +export const routing: ModuleWithProviders = RouterModule.forChild([ + { path: '', component: LoginComponent} +]); http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/autocomplete-option.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/autocomplete-option.ts b/metron-interface/metron-config/src/app/model/autocomplete-option.ts new file mode 100644 index 0000000..8006696 --- /dev/null +++ b/metron-interface/metron-config/src/app/model/autocomplete-option.ts @@ -0,0 +1,30 @@ +/** + * 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 AutocompleteOption { + name: string; + title: string; + description: string; + isFunction: boolean; + isActive: boolean; + + constructor(name?: string, title?: string, description?: string) { + this.name = name; + this.title = title; + this.description = description; + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/field-transformation.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/field-transformation.ts b/metron-interface/metron-config/src/app/model/field-transformation.ts new file mode 100644 index 0000000..f53a447 --- /dev/null +++ b/metron-interface/metron-config/src/app/model/field-transformation.ts @@ -0,0 +1,20 @@ +/** + * 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 FieldTransformation { + name: string; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/field-transformer.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/field-transformer.ts b/metron-interface/metron-config/src/app/model/field-transformer.ts new file mode 100644 index 0000000..ace68c7 --- /dev/null +++ b/metron-interface/metron-config/src/app/model/field-transformer.ts @@ -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. + */ +export class FieldTransformer { + input: string[]; + output: string[]; + transformation: string; + config: {}; + initialized: boolean; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/grok-validation.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/grok-validation.ts b/metron-interface/metron-config/src/app/model/grok-validation.ts new file mode 100644 index 0000000..52e4026 --- /dev/null +++ b/metron-interface/metron-config/src/app/model/grok-validation.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. + */ +export class GrokValidation { + patternLabel: string; + statement: string; + sampleData: string; + results: {}; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/kafka-topic.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/kafka-topic.ts b/metron-interface/metron-config/src/app/model/kafka-topic.ts new file mode 100644 index 0000000..799488f --- /dev/null +++ b/metron-interface/metron-config/src/app/model/kafka-topic.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. + */ +export class KafkaTopic { + name: string; + numPartitions: number; + replicationFactor: number; + properties: any = {}; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/parse-message-request.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/parse-message-request.ts b/metron-interface/metron-config/src/app/model/parse-message-request.ts new file mode 100644 index 0000000..053d7ad --- /dev/null +++ b/metron-interface/metron-config/src/app/model/parse-message-request.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. + */ +import {SensorParserConfig} from './sensor-parser-config'; +export class ParseMessageRequest { + sensorParserConfig: SensorParserConfig; + grokStatement: string; + sampleData: string; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/rest-error.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/rest-error.ts b/metron-interface/metron-config/src/app/model/rest-error.ts new file mode 100644 index 0000000..5daee25 --- /dev/null +++ b/metron-interface/metron-config/src/app/model/rest-error.ts @@ -0,0 +1,22 @@ +/** + * 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 RestError { + responseCode: number; + message: string; + fullMessage: string; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/risk-level-rule.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/risk-level-rule.ts b/metron-interface/metron-config/src/app/model/risk-level-rule.ts new file mode 100644 index 0000000..1cd4e8a --- /dev/null +++ b/metron-interface/metron-config/src/app/model/risk-level-rule.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. + */ +export class RiskLevelRule { + name: string = ''; + comment: string = ''; + rule: string = ''; + score: number = 0; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/sensor-enrichment-config.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/sensor-enrichment-config.ts b/metron-interface/metron-config/src/app/model/sensor-enrichment-config.ts new file mode 100644 index 0000000..3a3ac8b --- /dev/null +++ b/metron-interface/metron-config/src/app/model/sensor-enrichment-config.ts @@ -0,0 +1,44 @@ +/** + * 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 {ThreatTriageConfig} from './threat-triage-config'; +export class SensorEnrichmentConfig { + enrichment: EnrichmentConfig; + threatIntel: ThreatIntelConfig; + configuration: {}; + + constructor() { + this.enrichment = new EnrichmentConfig(); + this.threatIntel = new ThreatIntelConfig(); + } +} + +export class EnrichmentConfig { + fieldMap = {}; + fieldToTypeMap = {}; + config = {}; +} + +export class ThreatIntelConfig { + fieldMap = {}; + fieldToTypeMap = {}; + config = {}; + triageConfig: ThreatTriageConfig; + constructor() { + this.triageConfig = new ThreatTriageConfig(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/sensor-enrichments.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/sensor-enrichments.ts b/metron-interface/metron-config/src/app/model/sensor-enrichments.ts new file mode 100644 index 0000000..92f303f --- /dev/null +++ b/metron-interface/metron-config/src/app/model/sensor-enrichments.ts @@ -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. + */ +import {ThreatTriageConfig} from './threat-triage-config'; +export class SensorEnrichments { + sensorName: string; + fieldEnrichments: {}; + fieldThreatIntels: {}; + threatTriageConfig: ThreatTriageConfig; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/sensor-indexing-config.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/sensor-indexing-config.ts b/metron-interface/metron-config/src/app/model/sensor-indexing-config.ts new file mode 100644 index 0000000..4b945de --- /dev/null +++ b/metron-interface/metron-config/src/app/model/sensor-indexing-config.ts @@ -0,0 +1,28 @@ +/** + * 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 SensorIndexingConfig { + index: string; + batchSize: number = 1; + enabled: boolean = true; +} + +export class IndexingConfigurations { + hdfs: SensorIndexingConfig = new SensorIndexingConfig(); + elasticsearch: SensorIndexingConfig = new SensorIndexingConfig(); + solr: SensorIndexingConfig = new SensorIndexingConfig(); +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/sensor-parser-config-history.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/sensor-parser-config-history.ts b/metron-interface/metron-config/src/app/model/sensor-parser-config-history.ts new file mode 100644 index 0000000..0aed6fe --- /dev/null +++ b/metron-interface/metron-config/src/app/model/sensor-parser-config-history.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 {SensorParserConfig} from './sensor-parser-config'; +export class SensorParserConfigHistory { + createdBy: string; + modifiedBy: string; + createdDate: string; + modifiedByDate: string; + config: SensorParserConfig; + + constructor() { + this.config = new SensorParserConfig(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/sensor-parser-config.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/sensor-parser-config.ts b/metron-interface/metron-config/src/app/model/sensor-parser-config.ts new file mode 100644 index 0000000..c0d907d --- /dev/null +++ b/metron-interface/metron-config/src/app/model/sensor-parser-config.ts @@ -0,0 +1,33 @@ +/** + * 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 {FieldTransformer} from './field-transformer'; +export class SensorParserConfig { + parserClassName: string; + filterClassName: string; + sensorTopic: string; + writerClassName: string; + errorWriterClassName: string; + invalidWriterClassName: string; + parserConfig: {}; + fieldTransformations: FieldTransformer[]; + + constructor() { + this.parserConfig = {}; + this.fieldTransformations = []; + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/sensor-parser-context.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/sensor-parser-context.ts b/metron-interface/metron-config/src/app/model/sensor-parser-context.ts new file mode 100644 index 0000000..29217fe --- /dev/null +++ b/metron-interface/metron-config/src/app/model/sensor-parser-context.ts @@ -0,0 +1,22 @@ +/** + * 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 {SensorParserConfig} from './sensor-parser-config'; +export class SensorParserContext { + sampleData: any; + sensorParserConfig: SensorParserConfig; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/sensor-parser-info.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/sensor-parser-info.ts b/metron-interface/metron-config/src/app/model/sensor-parser-info.ts new file mode 100644 index 0000000..330b59c --- /dev/null +++ b/metron-interface/metron-config/src/app/model/sensor-parser-info.ts @@ -0,0 +1,25 @@ +/** + * 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 {SensorParserConfig} from './sensor-parser-config'; +export class SensorParserInfo { + createdBy: string; + modifiedBy: string; + createdDate: string; + modifiedByDate: string; + config: SensorParserConfig; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/sensor-parser-response.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/sensor-parser-response.ts b/metron-interface/metron-config/src/app/model/sensor-parser-response.ts new file mode 100644 index 0000000..92af2d3 --- /dev/null +++ b/metron-interface/metron-config/src/app/model/sensor-parser-response.ts @@ -0,0 +1,21 @@ +/** + * 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 SensorParserResponse { + status: string; + message: string; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/sensor-parser-status.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/sensor-parser-status.ts b/metron-interface/metron-config/src/app/model/sensor-parser-status.ts new file mode 100644 index 0000000..c0cab0c --- /dev/null +++ b/metron-interface/metron-config/src/app/model/sensor-parser-status.ts @@ -0,0 +1,25 @@ +/** + * 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 SensorParserStatus { + id: string; + name: string; + status: string; + latency: string; + throughput: string; + state: string; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/stellar-function-description.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/stellar-function-description.ts b/metron-interface/metron-config/src/app/model/stellar-function-description.ts new file mode 100644 index 0000000..5dd7f9a --- /dev/null +++ b/metron-interface/metron-config/src/app/model/stellar-function-description.ts @@ -0,0 +1,30 @@ +/** + * 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 StellarFunctionDescription { + name: string; + description: string; + params: string[]; + returns: string; + + constructor(name: string, description: string, params: string[], returns?: string) { + this.name = name; + this.description = description; + this.params = params; + this.returns = returns; + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/threat-triage-config.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/threat-triage-config.ts b/metron-interface/metron-config/src/app/model/threat-triage-config.ts new file mode 100644 index 0000000..2dc7524 --- /dev/null +++ b/metron-interface/metron-config/src/app/model/threat-triage-config.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. + */ +import {RiskLevelRule} from './risk-level-rule'; +export class ThreatTriageConfig { + riskLevelRules: RiskLevelRule[] = []; + aggregator: string = 'MAX'; + aggregationConfig = {}; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/topology-response.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/topology-response.ts b/metron-interface/metron-config/src/app/model/topology-response.ts new file mode 100644 index 0000000..97a5c84 --- /dev/null +++ b/metron-interface/metron-config/src/app/model/topology-response.ts @@ -0,0 +1,21 @@ +/** + * 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 TopologyResponse { + status: string; + message: string; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/model/topology-status.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/model/topology-status.ts b/metron-interface/metron-config/src/app/model/topology-status.ts new file mode 100644 index 0000000..a8fad1c --- /dev/null +++ b/metron-interface/metron-config/src/app/model/topology-status.ts @@ -0,0 +1,26 @@ +/** + * 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 TopologyStatus { + id: string; + name: string; + status: string; + latency: number; + throughput: number; + emitted: number; + acked: number; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/navbar/index.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/navbar/index.ts b/metron-interface/metron-config/src/app/navbar/index.ts new file mode 100644 index 0000000..ab58b3e --- /dev/null +++ b/metron-interface/metron-config/src/app/navbar/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 './navbar.component'; http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/navbar/navbar.component.scss ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/navbar/navbar.component.scss b/metron-interface/metron-config/src/app/navbar/navbar.component.scss new file mode 100644 index 0000000..5a0b0be --- /dev/null +++ b/metron-interface/metron-config/src/app/navbar/navbar.component.scss @@ -0,0 +1,28 @@ +/** + * 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"; + +.logout { + padding-left: 10px; + font-family: Roboto-Regular; +} + +.logout-link{ + color: $form-button-border; + cursor: pointer; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/navbar/navbar.component.spec.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/navbar/navbar.component.spec.ts b/metron-interface/metron-config/src/app/navbar/navbar.component.spec.ts new file mode 100644 index 0000000..d0bd4e0 --- /dev/null +++ b/metron-interface/metron-config/src/app/navbar/navbar.component.spec.ts @@ -0,0 +1,48 @@ +/** + * 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, TestBed, ComponentFixture} from '@angular/core/testing'; +import {NavbarComponent} from './navbar.component'; +import {AuthenticationService} from '../service/authentication.service'; + +class MockAuthenticationService { +} + +describe('NavbarComponent', () => { + let fixture: ComponentFixture<NavbarComponent>; + let navbarComponent: NavbarComponent; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ NavbarComponent], + providers: [ + NavbarComponent, + {provide: AuthenticationService, useClass: MockAuthenticationService} + ] + }); + + fixture = TestBed.createComponent(NavbarComponent); + navbarComponent = fixture.componentInstance; + + })); + + it('can instantiate SampleDataComponent', async(() => { + expect(navbarComponent instanceof NavbarComponent).toBe(true); + fixture.destroy(); + })); + +}); http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/navbar/navbar.component.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/navbar/navbar.component.ts b/metron-interface/metron-config/src/app/navbar/navbar.component.ts new file mode 100644 index 0000000..45c15ef --- /dev/null +++ b/metron-interface/metron-config/src/app/navbar/navbar.component.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. + */ +import {Component} from '@angular/core'; +import {AuthenticationService} from '../service/authentication.service'; + +@Component({ + selector: 'metron-config-navbar', + templateUrl: 'navbar.html', + styleUrls: ['navbar.component.scss'] +}) + +export class NavbarComponent { + + constructor(private authenticationService: AuthenticationService) { + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/navbar/navbar.html ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/navbar/navbar.html b/metron-interface/metron-config/src/app/navbar/navbar.html new file mode 100644 index 0000000..3af1c7c --- /dev/null +++ b/metron-interface/metron-config/src/app/navbar/navbar.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. + --> +<nav class="metron-nav navbar navbar-dark"> + <button class="navbar-toggler hidden-sm-up" type="button" data-toggle="collapse" data-target="#exCollapsingNavbar"> + ☰ + </button> + <div class="collapse navbar-toggleable-xs pull-left" id="exCollapsingNavbar"> + <a class="navbar-brand" href="#"><img src="assets/images/logo.png" alt="Logo" width=110></a> + </div> + + <div class="form-inline pull-right"> + <i class="fa fa-user " style="padding-left: 11px" aria-hidden="true"></i> + <div *ngIf="authenticationService.currentUser != null" class="fa logout">Logged in as {{authenticationService.currentUser}} - <span class="logout-link" (click)="authenticationService.logout()">Logout</span></div> + </div> + +</nav> http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/rxjs-operators.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/rxjs-operators.ts b/metron-interface/metron-config/src/app/rxjs-operators.ts new file mode 100644 index 0000000..11c86fb --- /dev/null +++ b/metron-interface/metron-config/src/app/rxjs-operators.ts @@ -0,0 +1,32 @@ +/** + * 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 'rxjs/Rx'; // adds ALL RxJS statics & operators to Observable + +// See node_module/rxjs/Rxjs.js +// Import just the rxjs statics and operators we need for THIS app. + +// Statics +import 'rxjs/add/observable/throw'; + +// Operators +import 'rxjs/add/operator/catch'; +import 'rxjs/add/operator/debounceTime'; +import 'rxjs/add/operator/distinctUntilChanged'; +import 'rxjs/add/operator/map'; +import 'rxjs/add/operator/switchMap'; +import 'rxjs/add/operator/toPromise'; http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/sensors/sensor-field-schema/index.ts ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/sensors/sensor-field-schema/index.ts b/metron-interface/metron-config/src/app/sensors/sensor-field-schema/index.ts new file mode 100644 index 0000000..621e31a --- /dev/null +++ b/metron-interface/metron-config/src/app/sensors/sensor-field-schema/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 './sensor-field-schema.component'; http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.html ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.html b/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.html new file mode 100644 index 0000000..18b4b82 --- /dev/null +++ b/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.html @@ -0,0 +1,113 @@ +<!-- + 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 class="metron-slider-pane-edit fill load-left-to-right dialog2x"> + + <div class="form-title">Schema</div> + <i class="fa fa-times pull-right close-button" aria-hidden="true" (click)="onCancel()"></i> + + + <form role="form" class="fieldschema-form"> + <metron-config-sample-data [topic]="sensorParserConfig.sensorTopic" (onSampleDataChanged)="onSampleDataChanged($event)" (onSampleDataNotAvailable)="onSampleDataNotAvailable($event)"></metron-config-sample-data> + + <br><br> + + <div class="metron-bg-inverse"> + <div class="p-2"> + + <div class="row placeholder" *ngIf="fieldSchemaRows.length===0 || (parserResult === {})"> + A data sample is need to view/configure the complete schema. + </div> + + <div class="row mx-0" *ngIf="fieldSchemaRows.length>0"> + <div class="col-md-3 title text-grey"> Field </div> + <div class="col-md-9 title text-grey"> Changes </div> + </div> + + <div *ngFor="let fieldSchemaRow of fieldSchemaRows" class="row pb-1 mx-0"> + <!-- Readonly Field Schema Row --> + <div class="field-schema-row" *ngIf="!fieldSchemaRow.showConfig" [class.field-suppressed]="fieldSchemaRow.isRemoved"> + <div class="col-md-3 field-schema-cell-title"> {{ fieldSchemaRow.outputFieldName }} </div> + <div class="col-md-7 field-schema-cell-value" [innerHtml]="getChanges(fieldSchemaRow)"> </div> + <div class="col-md-2 field-schema-cell icon-blue" style="font-size: 16px"> + <i *ngIf="!fieldSchemaRow.isParserGenerated" class="fa fa-trash pull-right" aria-hidden="true" (click)="onDelete(fieldSchemaRow)"></i> + <i class="fa fa-pencil pull-right" aria-hidden="true" (click)="fieldSchemaRow.showConfig=true"></i> + <i *ngIf="!fieldSchemaRow.isRemoved" class="fa fa-ban pull-right" aria-hidden="true" (click)="onRemove(fieldSchemaRow)"></i> + <i *ngIf="fieldSchemaRow.isRemoved" class="fa fa-check-circle-o pull-right" style="color:lightgreen" aria-hidden="true" (click)="onEnable(fieldSchemaRow)"></i> + + </div> + </div> + + <!-- Editable Enrichments Pane --> + <div class="config container" *ngIf="fieldSchemaRow.showConfig"> + + <!--Title--> + <div class="row py-1"> + <div class="col-md-10 enrichments-edit-title"> {{ fieldSchemaRow.outputFieldName }} </div> + <div class="col-md-2 enrichment-cell"> + <i class="fa fa-times-circle pull-right small-close-button" aria-hidden="true" (click)="onCancelChange(fieldSchemaRow)"></i> + </div> + </div> + + <!--Input Field Name--> + <div class="form-group px-1 col-md-10" *ngIf="fieldSchemaRow.isNew"> + <label>INPUT FIELD</label> + <select [(ngModel)]="fieldSchemaRow.inputFieldName" [ngModelOptions]="{standalone: true}" (ngModelChange)="fieldSchemaRow.outputFieldName=fieldSchemaRow.inputFieldName+'_copy'"> + <option [disabled] [selected]> </option> + <option *ngFor="let fieldSchemaRow of fieldSchemaRows" [attr.hidden]="fieldSchemaRow.isNew"> {{ fieldSchemaRow.inputFieldName }} </option> + </select> + </div> + + <!-- Output Field Name--> + <div class="form-group px-1 col-md-10" *ngIf="fieldSchemaRow.isNew || !fieldSchemaRow.isParserGenerated"> + <label>NAME</label> + <input type="text" class="form-control" [name]="fieldSchemaRow.outputFieldName" [(ngModel)]="fieldSchemaRow.outputFieldName" [ngModelOptions]="{standalone: true}"> + </div> + + <!-- Transforms --> + <div class="form-group px-1 col-md-12"> + <label>TRANSFORMATIONS</label> + <metron-config-multiple-input [type]="'select'" [availableItems]="transformOptions" [(configuredItems)]="fieldSchemaRow.transformConfigured" (onConfigChange)="onTransformsChange(fieldSchemaRow)"> </metron-config-multiple-input> + <div class="edit-pane-readonly rounded col-md-10"> {{ fieldSchemaRow.preview }} </div> + </div> + + <!-- Enrichmnets --> + <div class="form-group px-1 col-md-12"> + <label>ENRICHMENTS</label> + <metron-config-multiple-input [availableItems]="enrichmentOptions" [(configuredItems)]="fieldSchemaRow.enrichmentConfigured" [allowDuplicates]="false"> </metron-config-multiple-input> + </div> + + <!-- Threat Intel --> + <div class="form-group px-1 col-md-12"> + <label>THREAT INTEL </label> + <metron-config-multiple-input [availableItems]="threatIntelOptions" [(configuredItems)]="fieldSchemaRow.threatIntelConfigured" [allowDuplicates]="false"> </metron-config-multiple-input> + </div> + + <div class="form-group p-1 col-md-12"> + <button type="submit" class="btn form-enable-disable-button pull-left" (click)="onSaveChange(fieldSchemaRow)">SAVE</button> + </div> + + </div> + </div> + + <div class="row mx-0 add-button" *ngIf="fieldSchemaRows.length > 0"> + <button type="submit" class="btn form-enable-disable-button" (click)="addNewRule()"><i class="fa fa-plus" aria-hidden="true"></i></button> + </div> + + </div> + </div> + + </form> +</div> http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ef8cd8f/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.scss ---------------------------------------------------------------------- diff --git a/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.scss b/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.scss new file mode 100644 index 0000000..f248a70 --- /dev/null +++ b/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.scss @@ -0,0 +1,168 @@ +/** + * 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"; + +.form-title +{ + padding-left: 25px; +} + +.title +{ + font-size: 12px; +} + +.close-button +{ + padding-right: 20px; +} + +.field-schema-row +{ + display: table; + width: 100%; + padding: 10px 0px 10px 0px; + background: #383838; +} + +.field-schema-edit-title +{ + font-size: 15px; + font-weight: bold; +} + +.field-schema-cell +{ + float: none; + font-size: 13px; + height: 15px; + line-height: 15px; + display: table-cell; + vertical-align: middle; + word-break: break-all; + font-family: Roboto-Regular; +} + +.field-schema-cell-title +{ + @extend .field-schema-cell; + color: $silver-color; + font-size: 14px; +} + +.field-schema-cell-value +{ + @extend .field-schema-cell; + font-size: 13px; +} + +.small-close-button { + font-size:20px; + color:$silver-color; + cursor: pointer; +} + +.config +{ + background: $edit-background; + border: 1px solid $edit-background-border; +} + +.enrichment-cell +{ + display: table-cell; + vertical-align: middle; + float: none; + min-height: 35px; + line-height: 20px; +} + +.enrichments-edit-title +{ + font-size: 15px; + font-weight: bold; +} + +.transform-info-row +{ + display: table; + width: 100%; + min-height: 35px; +} + +.edit-pane-readonly +{ + background: $edit-child-background; + font-size: 12px; + margin-bottom: 0.5em; + font-style: italic; + padding: 0.5rem 0.75rem; + border: none; + line-height: 1.5em; + height: 35px; +} + +.field-suppressed +{ + background-color: #262626; + color: #737373; + .field-schema-cell-title + { + color: #737373; + } +} + +.metron-bg-inverse +{ + background: #2e2e2e; + margin-bottom: 70px; +} + +select +{ + width: 100%; + display: block; +} + +.placeholder +{ + text-align: center; + font-size: 13px; + color: $text-color-white; +} + +.add-button +{ + button + { + width: 100%; + height: 35px; + padding: 0px; + } + i + { + font-size: 1.5em; + color: $field-button-color; + } +} + +.fieldschema-form +{ + padding-left: 25px; + padding-right: 20px; +}