You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mr...@apache.org on 2017/09/11 04:39:06 UTC
[36/94] [abbrv] [partial] ambari git commit: AMBARI-21870. Integrate
LogSearch new UI with the server and get rid of the old one (oleewere)
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
new file mode 100644
index 0000000..0ef17de
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
@@ -0,0 +1,73 @@
+/**
+ * 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, ComponentFixture, TestBed} from '@angular/core/testing';
+import {Http} from '@angular/http';
+import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
+import {TranslateHttpLoader} from '@ngx-translate/http-loader';
+import {StoreModule} from '@ngrx/store';
+import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
+import {ComponentActionsService} from '@app/services/component-actions.service';
+import {TimeZoneAbbrPipe} from '@app/pipes/timezone-abbr.pipe';
+import {ModalComponent} from '@app/components/modal/modal.component';
+
+import {TimeZonePickerComponent} from './timezone-picker.component';
+
+export function HttpLoaderFactory(http: Http) {
+ return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
+}
+
+describe('TimeZonePickerComponent', () => {
+ let component: TimeZonePickerComponent;
+ let fixture: ComponentFixture<TimeZonePickerComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [
+ TimeZonePickerComponent,
+ ModalComponent,
+ TimeZoneAbbrPipe
+ ],
+ imports: [
+ StoreModule.provideStore({
+ appSettings
+ }),
+ TranslateModule.forRoot({
+ provide: TranslateLoader,
+ useFactory: HttpLoaderFactory,
+ deps: [Http]
+ })
+ ],
+ providers: [
+ AppSettingsService,
+ ComponentActionsService
+ ],
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(TimeZonePickerComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create component', () => {
+ expect(component).toBeTruthy();
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.ts
new file mode 100644
index 0000000..32f6474
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.ts
@@ -0,0 +1,77 @@
+/**
+ * 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 * as $ from 'jquery';
+import '@vendor/js/WorldMapGenerator.min';
+import {AppSettingsService} from '@app/services/storage/app-settings.service';
+import {ComponentActionsService} from '@app/services/component-actions.service';
+
+@Component({
+ selector: 'timezone-picker',
+ templateUrl: './timezone-picker.component.html',
+ styleUrls: ['./timezone-picker.component.less']
+})
+export class TimeZonePickerComponent {
+
+ constructor(private appSettings: AppSettingsService, private actions: ComponentActionsService) {
+ appSettings.getParameter('timeZone').subscribe(value => this.timeZone = value);
+ }
+
+ readonly mapElementId = 'timezone-map';
+
+ private readonly mapOptions = {
+ quickLink: [
+ {
+ PST: 'PST',
+ MST: 'MST',
+ CST: 'CST',
+ EST: 'EST',
+ GMT: 'GMT',
+ LONDON: 'Europe/London',
+ IST: 'IST'
+ }
+ ]
+ };
+
+ private mapElement: any;
+
+ private timeZoneSelect: JQuery;
+
+ isTimeZonePickerDisplayed: boolean = false;
+
+ timeZone: string;
+
+ setTimeZonePickerDisplay(isDisplayed: boolean): void {
+ this.isTimeZonePickerDisplayed = isDisplayed;
+ }
+
+ initMap(): void {
+ this.mapElement = $(`#${this.mapElementId}`);
+ this.mapElement.WorldMapGenerator(this.mapOptions);
+ this.timeZoneSelect = this.mapElement.find('select');
+ this.timeZoneSelect.removeClass('btn btn-default').addClass('form-control').val(this.timeZone);
+ }
+
+ setTimeZone(): void {
+ const timeZone = this.timeZoneSelect.val();
+ this.actions.setTimeZone(timeZone);
+ this.setTimeZonePickerDisplay(false);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.html
new file mode 100644
index 0000000..6898354
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.html
@@ -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.
+-->
+
+<menu-button *ngFor="let item of items" [label]="item.label" [action]="item.action"
+ [iconClass]="item.iconClass" [labelClass]="item.labelClass"
+ [subItems]="item.subItems" [hideCaret]="item.hideCaret">
+</menu-button>
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.less
new file mode 100644
index 0000000..e5e85f4
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.less
@@ -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 '../variables';
+
+:host {
+ .default-flex;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.spec.ts
new file mode 100644
index 0000000..1649a50
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.spec.ts
@@ -0,0 +1,45 @@
+/**
+ * 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 {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
+import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+
+import {TopMenuComponent} from './top-menu.component';
+
+describe('TopMenuComponent', () => {
+ let component: TopMenuComponent;
+ let fixture: ComponentFixture<TopMenuComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [TopMenuComponent],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(TopMenuComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create component', () => {
+ expect(component).toBeTruthy();
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.ts
new file mode 100644
index 0000000..73b6131
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.ts
@@ -0,0 +1,122 @@
+/**
+ * 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, OnInit} from '@angular/core';
+
+@Component({
+ selector: 'top-menu',
+ templateUrl: './top-menu.component.html',
+ styleUrls: ['./top-menu.component.less']
+})
+export class TopMenuComponent implements OnInit {
+
+ constructor() {
+ }
+
+ ngOnInit() {
+ }
+
+ //TODO implement loading of real data into subItems
+ readonly items = [
+ {
+ iconClass: 'fa fa-arrow-left',
+ label: 'topMenu.undo',
+ labelClass: 'unstyled-link',
+ action: 'undo',
+ subItems: [
+ {
+ label: 'Apply \'Last week\' filter'
+ },
+ {
+ label: 'Clear all filters'
+ },
+ {
+ label: 'Apply \'HDFS\' filter'
+ },
+ {
+ label: 'Apply \'Errors\' filter'
+ }
+ ]
+ },
+ {
+ iconClass: 'fa fa-arrow-right',
+ label: 'topMenu.redo',
+ labelClass: 'unstyled-link',
+ action: 'redo',
+ subItems: [
+ {
+ label: 'Apply \'Warnings\' filter'
+ },
+ {
+ label: 'Switch to graph mode'
+ },
+ {
+ label: 'Apply \'Custom Date\' filter'
+ }
+ ]
+ },
+ {
+ iconClass: 'fa fa-refresh',
+ label: 'topMenu.refresh',
+ labelClass: 'unstyled-link',
+ action: 'refresh'
+ },
+ {
+ iconClass: 'fa fa-history',
+ label: 'topMenu.history',
+ labelClass: 'unstyled-link',
+ action: 'openHistory',
+ subItems: [
+ {
+ label: 'Apply \'Custom Date\' filter'
+ },
+ {
+ label: 'Switch to graph mode'
+ },
+ {
+ label: 'Apply \'Warnings\' filter'
+ },
+ {
+ label: 'Apply \'Last week\' filter'
+ },
+ {
+ label: 'Clear all filters'
+ },
+ {
+ label: 'Apply \'HDFS\' filter'
+ },
+ {
+ label: 'Apply \'Errors\' filter'
+ }
+ ]
+ },
+ {
+ iconClass: 'fa fa-user unstyled-link',
+ hideCaret: true,
+ subItems: [
+ {
+ label: 'Options'
+ },
+ {
+ label: 'Logout'
+ }
+ ]
+ }
+ ];
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/components/variables.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/variables.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/variables.less
new file mode 100644
index 0000000..f72183c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/variables.less
@@ -0,0 +1,118 @@
+/**
+ * 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.
+ */
+
+// Variables
+@navbar-background-color: #323544;
+@h1-vertical-margin: 20px;
+@button-border-radius: 4px;
+@input-border: 1px solid #CFD3D7;
+@button-border-radius: 4px;
+@input-group-addon-padding: 6px 0 6px 12px;
+@block-margin-top: 20px;
+@link-color: #1491C1;
+@link-hover-color: #23527C;
+@grey-color: #666;
+@default-line-height: 1.42857143;
+@main-background-color: #ECECEC;
+@filters-panel-background-color: #FFF;
+@filters-panel-padding: 10px 0;
+@list-header-background-color: #F2F2F2;
+@checkbox-top: 4px;
+
+@fatal-color: #830A0A;
+@error-color: #E81D1D;
+@warning-color: #FF8916;
+@info-color: #2577B5;
+@debug-color: #65E8FF;
+@trace-color: #888;
+@unknown-color: #BDBDBD;
+@submit-color: #5CB85C;
+@submit-hover-color: #449D44;
+
+// Mixins
+.flex-vertical-align {
+ display: flex;
+ align-items: center;
+}
+
+.default-flex {
+ .flex-vertical-align;
+ justify-content: space-between;
+}
+
+.common-hexagon(@side, @color) {
+ display: block;
+ position: absolute;
+ margin: (@side / 3.464101615) 0;
+ width: @side;
+ height: @side / 1.732050808;
+ background-color: @color;
+
+ &:before, &:after {
+ display: block;
+ position: absolute;
+ width: 0;
+ border-left: (@side / 2) solid transparent;
+ border-right: (@side / 2) solid transparent;
+ content: '';
+ }
+
+ &:before {
+ bottom: 100%;
+ border-bottom: (@side / 3.464101615) solid @color;
+ }
+
+ &:after {
+ top: 100%;
+ border-top: (@side / 3.464101615) solid @color;
+ }
+}
+
+.clickable-item {
+ cursor: pointer;
+ color: @link-color;
+
+ &:hover {
+ color: @link-hover-color;
+ }
+}
+
+.full-size {
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+}
+
+.dropdown-item-default {
+ display: block;
+ padding: 3px 20px;
+ clear: both;
+ font-weight: 400;
+ line-height: 1.42857143;
+ color: #333;
+ white-space: nowrap;
+ cursor: pointer;
+
+ &:hover {
+ color: #262626;
+ text-decoration: none;
+ background-color: #f5f5f5;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts b/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
new file mode 100644
index 0000000..f23139b
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
@@ -0,0 +1,1067 @@
+/**
+ * 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 * as moment from 'moment';
+
+export const mockData = {
+ login: {},
+ api: {
+ v1: {
+ audit: {
+ logs: {
+ logList: [
+ {
+ policy: 'policy',
+ reason: 'Authentication required',
+ result: 0,
+ text: 'Please log in',
+ tags: [
+ 'ambari_agent'
+ ],
+ resource: '/ambari-agent',
+ sess: '0',
+ access: '0',
+ logType: 'AmbariAudit',
+ tags_str: 'ambari_agent',
+ resType: 'agent',
+ reqUser: 'admin',
+ reqData: 'data',
+ repoType: 1,
+ repo: 'ambari',
+ proxyUsers: [
+ 'admin'
+ ],
+ evtTime: '2017-05-29T11:30:22.531Z',
+ enforcer: 'ambari-acl',
+ reqContext: 'ambari',
+ cliType: 'GET',
+ cliIP: '192.168.0.1',
+ agent: 'agent',
+ agentHost: 'localhost',
+ action: 'SERVICE_CHECK',
+ type: 'ambari-audit',
+ _version_: 2,
+ id: 'id0',
+ file: 'ambari-agent.log',
+ seq_num: 3,
+ bundle_id: 'b0',
+ case_id: 'c0',
+ log_message: 'User(admin), Operation(SERVICE_CHECK)',
+ logfile_line_number: 4,
+ message_md5: '12345678900987654321',
+ cluster: 'cl0',
+ event_count: 0,
+ event_md5: '09876543211234567890',
+ event_dur_ms: 100,
+ _ttl_: '+7DAYS',
+ _expire_at_: '2017-05-29T11:30:22.531Z',
+ _router_field_: 5
+ },
+ {
+ policy: 'policy',
+ reason: 'Server error',
+ result: 1,
+ text: 'Something went wrong',
+ tags: [
+ 'ambari_agent'
+ ],
+ resource: '/ambari-agent',
+ sess: '1',
+ access: '1',
+ logType: 'AmbariAudit',
+ tags_str: 'ambari_server',
+ resType: 'server',
+ reqUser: 'user',
+ reqData: 'data',
+ repoType: 1,
+ repo: 'ambari',
+ proxyUsers: [
+ 'user'
+ ],
+ evtTime: '2017-05-29T11:30:22.531Z',
+ enforcer: 'hdfs',
+ reqContext: 'ambari_server',
+ cliType: 'PUT',
+ cliIP: '192.168.0.1',
+ agent: 'agent',
+ agentHost: 'localhost',
+ action: 'SERVICE_CHECK',
+ type: 'ambari-audit',
+ _version_: 4,
+ id: 'id1',
+ file: 'ambari-agent.log',
+ seq_num: 5,
+ bundle_id: 'b1',
+ case_id: 'c1',
+ log_message: 'User(user), Operation(SERVICE_CHECK)',
+ logfile_line_number: 6,
+ message_md5: '10293847561029384756',
+ cluster: 'cl1',
+ event_count: 2,
+ event_md5: '01928374650192837465',
+ event_dur_ms: 500,
+ _ttl_: '+7DAYS',
+ _expire_at_: '2017-05-29T11:30:22.531Z',
+ _router_field_: 10
+ }
+ ],
+ bargraph: {
+ graphData: [
+ {
+ dataCount: [
+ {
+ name: 'n0',
+ value: 1
+ },
+ {
+ name: 'n1',
+ value: 2
+ }
+ ],
+ name: 'graph0'
+ },
+ {
+ dataCount: [
+ {
+ name: 'n2',
+ value: 10
+ },
+ {
+ name: 'n3',
+ value: 20
+ }
+ ],
+ name: 'graph1'
+ }
+ ]
+ },
+ components: {},
+ resources: {
+ graphData: [
+ {
+ dataCount: [
+ {
+ name: 'n16',
+ value: 800
+ },
+ {
+ name: 'n17',
+ value: 400
+ }
+ ],
+ name: 'graph8'
+ },
+ {
+ dataCount: [
+ {
+ name: 'n18',
+ value: 600
+ },
+ {
+ name: 'n19',
+ value: 300
+ }
+ ],
+ name: 'graph9'
+ }
+ ]
+ },
+ schema: {
+ fields: {
+ 'cluster': 'key_lower_case',
+ 'ws_status': 'text_ws',
+ 'reason': 'text_std_token_lower_case',
+ 'agent': 'key_lower_case',
+ 'Base URL': 'key_lower_case',
+ 'sess': 'key_lower_case',
+ 'type': 'key_lower_case',
+ 'seq_num': 'tlong',
+ 'path': 'key_lower_case',
+ 'ugi': 'key_lower_case',
+ 'host': 'key_lower_case',
+ 'case_id': 'key_lower_case',
+ 'action': 'key_lower_case',
+ 'id': 'string',
+ 'logger_name': 'key_lower_case',
+ 'text': 'text_std_token_lower_case',
+ 'Repo id': 'key_lower_case',
+ 'Stack version': 'tdouble',
+ 'logfile_line_number': 'tint',
+ 'Status': 'tlong',
+ 'RequestId': 'tlong',
+ 'level': 'key_lower_case',
+ 'resource': 'key_lower_case',
+ 'resType': 'key_lower_case',
+ 'ip': 'key_lower_case',
+ 'Hostname': 'key_lower_case',
+ 'Roles': 'key_lower_case',
+ 'Stack': 'key_lower_case',
+ 'req_self_id': 'key_lower_case',
+ 'repoType': 'tint',
+ 'VersionNote': 'key_lower_case',
+ 'Cluster name': 'key_lower_case',
+ 'bundle_id': 'key_lower_case',
+ 'cliType': 'key_lower_case',
+ 'reqContext': 'key_lower_case',
+ 'ws_result_status': 'text_ws',
+ 'proxyUsers': 'key_lower_case',
+ 'RequestType': 'key_lower_case',
+ 'Repositories': 'key_lower_case',
+ 'logType': 'key_lower_case',
+ 'Repo version': 'key_lower_case',
+ 'TaskId': 'tlong',
+ 'User': 'key_lower_case',
+ 'access': 'key_lower_case',
+ 'dst': 'key_lower_case',
+ 'perm': 'key_lower_case',
+ 'event_count': 'tlong',
+ 'repo': 'key_lower_case',
+ 'reqUser': 'key_lower_case',
+ 'task_id': 'tlong',
+ 'Operation': 'key_lower_case',
+ 'Reason': 'key_lower_case',
+ 'reqData': 'text_std_token_lower_case',
+ 'result': 'tint',
+ 'file': 'key_lower_case',
+ 'log_message': 'key_lower_case',
+ 'agentHost': 'key_lower_case',
+ 'Component': 'key_lower_case',
+ 'authType': 'key_lower_case',
+ 'Display name': 'key_lower_case',
+ 'policy': 'tlong',
+ 'cliIP': 'key_lower_case',
+ 'OS': 'key_lower_case',
+ 'RemoteIp': 'key_lower_case',
+ 'ResultStatus': 'tlong',
+ 'evtTime': 'tdate',
+ 'VersionNumber': 'key_lower_case',
+ 'url': 'key_lower_case',
+ 'req_caller_id': 'key_lower_case',
+ 'enforcer': 'key_lower_case',
+ 'Command': 'key_lower_case'
+ }
+ },
+ serviceload: {
+ graphData: [
+ {
+ dataCount: [
+ {
+ name: 'n4',
+ value: 1
+ },
+ {
+ name: 'n5',
+ value: 2
+ }
+ ],
+ name: 'graph2'
+ },
+ {
+ dataCount: [
+ {
+ name: 'n6',
+ value: 10
+ },
+ {
+ name: 'n7',
+ value: 20
+ }
+ ],
+ name: 'graph3'
+ }
+ ]
+ }
+ }
+ },
+ public: {
+ config: {}
+ },
+ service: {
+ logs: {
+ logList: [
+ {
+ path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
+ host: 'h0',
+ level: 'WARN',
+ logtime: moment().valueOf(),
+ ip: '192.168.0.1',
+ logfile_line_number: 8,
+ type: 'ams_collector',
+ _version_: 9,
+ id: 'id2',
+ file: 'ambari-metrics-collector.log',
+ seq_num: 10,
+ bundle_id: 'b2',
+ case_id: 'c2',
+ log_message: 'Connection refused.\nPlease check Ambari Metrics.\nCheck log file for details.',
+ message_md5: '1357908642',
+ cluster: 'cl2',
+ event_count: 5,
+ event_md5: '1908755391',
+ event_dur_ms: 200,
+ _ttl_: '+5DAYS',
+ _expire_at_: moment().add(5, 'd').valueOf(),
+ _router_field_: 20
+ },
+ {
+ path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
+ host: 'h1',
+ level: 'ERROR',
+ logtime: moment().subtract(2, 'd'),
+ ip: '192.168.0.2',
+ type: 'ams_collector',
+ _version_: 14,
+ id: 'id3',
+ file: 'ambari-metrics-collector.log',
+ seq_num: 15,
+ bundle_id: 'b3',
+ case_id: 'c3',
+ log_message: 'Connection refused.\nPlease check Ambari Metrics.\nCheck log file for details.',
+ logfile_line_number: 16,
+ message_md5: '1357908642',
+ cluster: 'cl3',
+ event_count: 2,
+ event_md5: '1029384756',
+ event_dur_ms: 700,
+ _ttl_: '+5DAYS',
+ _expire_at_: moment().add(3, 'd').valueOf(),
+ _router_field_: 5
+ },
+ {
+ path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
+ host: 'h1',
+ level: 'FATAL',
+ logtime: moment().subtract(10, 'd').valueOf(),
+ ip: '192.168.0.3',
+ type: 'ambari_agent',
+ _version_: 14,
+ id: 'id4',
+ file: 'ambari-agent.log',
+ seq_num: 15,
+ bundle_id: 'b4',
+ case_id: 'c4',
+ log_message: 'Connection refused.\nPlease check Ambari Agent.\nCheck log file for details.',
+ logfile_line_number: 16,
+ message_md5: '1038027502',
+ cluster: 'cl4',
+ event_count: 2,
+ event_md5: '67589403',
+ event_dur_ms: 100,
+ _ttl_: '+5DAYS',
+ _expire_at_: moment().subtract(5, 'd').valueOf(),
+ _router_field_: 45
+ },
+ {
+ path: '/var/log/ambari-metrics-collector/zookeeper-server.log',
+ host: 'h1',
+ level: 'INFO',
+ logtime: moment().subtract(25, 'h').valueOf(),
+ ip: '192.168.0.4',
+ type: 'zookeeper_server',
+ _version_: 14,
+ id: 'id4',
+ file: 'zookeeper_server.log',
+ seq_num: 15,
+ bundle_id: 'b0',
+ case_id: 'c0',
+ log_message: 'Connection refused.\nPlease check ZooKeeper Server.\nCheck log file for details.',
+ logfile_line_number: 16,
+ message_md5: '1038027502',
+ cluster: 'cl0',
+ event_count: 2,
+ event_md5: '67589403',
+ event_dur_ms: 1000,
+ _ttl_: '+5DAYS',
+ _expire_at_: moment().subtract(25, 'h').add(5, 'd').valueOf(),
+ _router_field_: 55
+ },
+ {
+ path: '/var/log/ambari-metrics-collector/zookeeper-server.log',
+ host: 'h1',
+ level: 'DEBUG',
+ logtime: moment().subtract(25, 'd').valueOf(),
+ ip: '192.168.0.4',
+ type: 'zookeeper_server',
+ _version_: 14,
+ id: 'id4',
+ file: 'zookeeper_server.log',
+ seq_num: 15,
+ bundle_id: 'b0',
+ case_id: 'c0',
+ log_message: 'Connection refused.\nPlease check ZooKeeper Server.\nCheck log file for details.',
+ logfile_line_number: 16,
+ message_md5: '1038027502',
+ cluster: 'cl1',
+ event_count: 2,
+ event_md5: '67589403',
+ event_dur_ms: 1000,
+ _ttl_: '+5DAYS',
+ _expire_at_: moment().subtract(20, 'd').valueOf(),
+ _router_field_: 55
+ },
+ {
+ path: '/var/log/ambari-metrics-collector/zookeeper-client.log',
+ host: 'h1',
+ level: 'TRACE',
+ logtime: moment().subtract(2, 'h').valueOf(),
+ ip: '192.168.0.4',
+ type: 'zookeeper_client',
+ _version_: 14,
+ id: 'id4',
+ file: 'zookeeper_client.log',
+ seq_num: 15,
+ bundle_id: 'b0',
+ case_id: 'c0',
+ log_message: 'Connection refused.\nPlease check ZooKeeper Client.\nCheck log file for details.',
+ logfile_line_number: 16,
+ message_md5: '1038027502',
+ cluster: 'cl1',
+ event_count: 2,
+ event_md5: '67589403',
+ event_dur_ms: 1000,
+ _ttl_: '+5DAYS',
+ _expire_at_: moment().subtract(2, 'h').add(5, 'd').valueOf(),
+ _router_field_: 55
+ },
+ {
+ path: '/var/log/ambari-metrics-collector/zookeeper-client.log',
+ host: 'h1',
+ level: 'UNKNOWN',
+ logtime: moment().subtract(31, 'd').valueOf(),
+ ip: '192.168.0.4',
+ type: 'zookeeper_client',
+ _version_: 14,
+ id: 'id4',
+ file: 'zookeeper_client.log',
+ seq_num: 15,
+ bundle_id: 'b0',
+ case_id: 'c0',
+ log_message: 'Connection refused.\nPlease check ZooKeeper Client.\nCheck log file for details.',
+ logfile_line_number: 16,
+ message_md5: '1038027502',
+ cluster: 'cl1',
+ event_count: 2,
+ event_md5: '67589403',
+ event_dur_ms: 1000,
+ _ttl_: '+5DAYS',
+ _expire_at_: moment().subtract(26, 'd').valueOf(),
+ _router_field_: 55
+ }
+ ],
+ aggregated: {
+ graphData: [
+ {
+ name: 'n0',
+ count: 100,
+ dataList: [
+ {
+ name: 'n1',
+ count: 50,
+ dataList: null
+ },
+ {
+ name: 'n2',
+ count: 200,
+ dataList: null
+ }
+ ]
+ },
+ {
+ name: 'n3',
+ count: 10,
+ dataList: [
+ {
+ name: 'n4',
+ count: 5,
+ dataList: null
+ },
+ {
+ name: 'n5',
+ count: 20,
+ dataList: null
+ }
+ ]
+ }
+ ]
+ },
+ components: {
+ count: {
+ anygraph: {
+ graphData: [
+ {
+ dataCount: [
+ {
+ name: 'n8',
+ value: 50
+ },
+ {
+ name: 'n9',
+ value: 100
+ }
+ ],
+ name: 'graph4'
+ },
+ {
+ dataCount: [
+ {
+ name: 'n10',
+ value: 5
+ },
+ {
+ name: 'n11',
+ value: 10
+ }
+ ],
+ name: 'graph5'
+ }
+ ]
+ }
+ },
+ levels: {
+ counts: {
+ vNodeList: [
+ {
+ name: 'ambari',
+ type: 0,
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '10'
+ },
+ {
+ name: 'WARN',
+ value: '50'
+ }
+ ],
+ childs: [
+ {
+ name: 'hdfs',
+ type: 2,
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '10'
+ },
+ {
+ name: 'WARN',
+ value: '20'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ },
+ {
+ name: 'zookeeper',
+ type: 3,
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '20'
+ },
+ {
+ name: 'WARN',
+ value: '40'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ }
+ ],
+ isParent: true,
+ isRoot: false
+ },
+ {
+ name: 'ambari_agent',
+ type: 1,
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '100'
+ },
+ {
+ name: 'WARN',
+ value: '500'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ }
+ ]
+ }
+ },
+ groupList: [
+ {
+ type: 'ams_collector'
+ },
+ {
+ type: 'ambari_agent'
+ },
+ {
+ type: 'zookeeper_server'
+ },
+ {
+ type: 'zookeeper_client'
+ }
+ ]
+ },
+ files: {
+ hostLogFiles: {
+ clusters: [
+ 'c0',
+ 'c1'
+ ],
+ services: [
+ 'hdfs',
+ 'zookeeper'
+ ]
+ }
+ },
+ histogram: {
+ graphData: [
+ {
+ dataCount: [
+ {
+ name: moment().toISOString(),
+ value: '1000'
+ },
+ {
+ name: moment().subtract(1, 'h').toISOString(),
+ value: '2000'
+ }
+ ],
+ name: 'ERROR'
+ },
+ {
+ dataCount: [
+ {
+ name: moment().toISOString(),
+ value: '700'
+ },
+ {
+ name: moment().subtract(1, 'h').toISOString(),
+ value: '900'
+ }
+ ],
+ name: 'WARN'
+ }
+ ]
+ },
+ hosts: {
+ groupList: [
+ {
+ host: 'h0'
+ },
+ {
+ host: 'h1'
+ }
+ ],
+ components: {
+ vNodeList: [
+ {
+ name: 'ambari',
+ type: 0,
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '100'
+ },
+ {
+ name: 'WARN',
+ value: '500'
+ }
+ ],
+ childs: [
+ {
+ name: 'ambari_metrics',
+ type: 2,
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '100'
+ },
+ {
+ name: 'WARN',
+ value: '200'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ },
+ {
+ name: 'hbase',
+ type: 3,
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '200'
+ },
+ {
+ name: 'WARN',
+ value: '400'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ }
+ ],
+ isParent: true,
+ isRoot: false
+ },
+ {
+ name: 'ambari_server',
+ type: 1,
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '1000'
+ },
+ {
+ name: 'WARN',
+ value: '5000'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ }
+ ]
+ },
+ count: {
+ getvCounts: [
+ {
+ name: 'n20',
+ count: 100
+ },
+ {
+ name: 'n21',
+ count: 200
+ }
+ ]
+ }
+ },
+ levels: {
+ counts: {
+ getvNameValues: [
+ {
+ name: 'n22',
+ count: 1000
+ },
+ {
+ name: 'n23',
+ count: 2000
+ }
+ ]
+ }
+ },
+ schema: {
+ fields: {
+ cluster: 'key_lower_case',
+ method: 'key_lower_case',
+ level: 'key_lower_case',
+ event_count: 'tlong',
+ ip: 'string',
+ rowtype: 'key_lower_case',
+ key_log_message: 'key_lower_case',
+ type: 'key_lower_case',
+ seq_num: 'tlong',
+ path: 'key_lower_case',
+ logtype: 'key_lower_case',
+ file: 'key_lower_case',
+ line_number: 'tint',
+ thread_name: 'key_lower_case',
+ bundle_id: 'key_lower_case',
+ host: 'key_lower_case',
+ case_id: 'key_lower_case',
+ log_message: 'text_std_token_lower_case',
+ id: 'string',
+ logger_name: 'key_lower_case',
+ text: 'text_std_token_lower_case',
+ logfile_line_number: 'tint',
+ logtime: 'tdate'
+ }
+ },
+ serviceconfig: '',
+ tree: {
+ vNodeList: [
+ {
+ name: 'h0',
+ type: 'H',
+ value: '1',
+ childs: [
+ {
+ name: 'ams_collector',
+ type: 'C',
+ value: '1',
+ logLevelCount: [
+ {
+ name: 'WARN',
+ value: '1'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ }
+ ],
+ logLevelCount: [
+ {
+ name: 'WARN',
+ value: '1'
+ }
+ ],
+ isParent: true,
+ isRoot: true
+ },
+ {
+ name: 'h1',
+ type: 'H',
+ value: '6',
+ childs: [
+ {
+ name: 'ams_collector',
+ type: 'C',
+ value: '1',
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '1'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ },
+ {
+ name: 'ambari_agent',
+ type: 'C',
+ value: '1',
+ logLevelCount: [
+ {
+ name: 'FATAL',
+ value: '1'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ },
+ {
+ name: 'zookeeper_server',
+ type: 'C',
+ value: '2',
+ logLevelCount: [
+ {
+ name: 'INFO',
+ value: '1'
+ },
+ {
+ name: 'DEBUG',
+ value: '1'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ },
+ {
+ name: 'zookeeper_client',
+ type: 'C',
+ value: '2',
+ logLevelCount: [
+ {
+ name: 'TRACE',
+ value: '1'
+ },
+ {
+ name: 'UNKNOWN',
+ value: '1'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ }
+ ],
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '1'
+ },
+ {
+ name: 'FATAL',
+ value: '1'
+ },
+ {
+ name: 'INFO',
+ value: '1'
+ },
+ {
+ name: 'DEBUG',
+ value: '1'
+ },
+ {
+ name: 'TRACE',
+ value: '1'
+ },
+ {
+ name: 'UNKNOWN',
+ value: '1'
+ }
+ ],
+ isParent: true,
+ isRoot: true
+ }
+ ]
+ },
+ truncated: {
+ logList: [
+ {
+ path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
+ host: 'h0',
+ level: 'WARN',
+ logtime: '2017-05-28T11:30:22.531Z',
+ ip: '192.168.0.1',
+ logfile_line_number: 8,
+ type: 'ams_collector',
+ _version_: 9,
+ id: 'id2',
+ file: 'ambari-metrics-collector.log',
+ seq_num: 10,
+ bundle_id: 'b2',
+ case_id: 'c2',
+ log_message: 'Connection refused',
+ message_md5: '1357908642',
+ cluster: 'cl2',
+ event_count: 5,
+ event_md5: '1908755391',
+ event_dur_ms: 200,
+ _ttl_: '+5DAYS',
+ _expire_at_: '2017-05-29T11:30:22.531Z',
+ _router_field_: 20
+ },
+ {
+ path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
+ host: 'h1',
+ level: 'ERROR',
+ logtime: '2017-05-28T10:30:22.531Z',
+ ip: '192.168.0.2',
+ type: 'ams_collector',
+ _version_: 14,
+ id: 'id3',
+ file: 'ambari-metrics-collector.log',
+ seq_num: 15,
+ bundle_id: 'b3',
+ case_id: 'c3',
+ log_message: 'Connection refused',
+ logfile_line_number: 16,
+ message_md5: '1357908642',
+ cluster: 'cl3',
+ event_count: 2,
+ event_md5: '1029384756',
+ event_dur_ms: 700,
+ _ttl_: '+5DAYS',
+ _expire_at_: '2017-05-29T10:30:22.531Z',
+ _router_field_: 5
+ }
+ ]
+ },
+ clusters: [
+ 'cl0',
+ 'cl1',
+ 'cl2',
+ 'cl3',
+ 'cl4'
+ ]
+ }
+ },
+ status: {
+ auditlogs: {
+ znodeReady: true,
+ solrCollectionReady: true,
+ solrAliasReady: false,
+ configurationUploaded: true
+ },
+ servicelogs: {
+ znodeReady: true,
+ solrCollectionReady: true,
+ configurationUploaded: true
+ },
+ userconfig: {
+ znodeReady: true,
+ solrCollectionReady: true,
+ configurationUploaded: true
+ }
+ },
+ userconfig: {
+ userConfigList: [
+ {
+ id: 'c0',
+ userName: 'admin',
+ filtername: 'service',
+ values: 'hdfs',
+ shareNameList: [
+ 's0',
+ 's1'
+ ],
+ rowType: 'history'
+ },
+ {
+ id: 'c0',
+ userName: 'user',
+ filtername: 'component',
+ values: 'namenode',
+ shareNameList: [
+ 's2',
+ 's3'
+ ],
+ rowType: 'history'
+ }
+ ],
+ filters: {
+ filter0: {
+ label: 'filter0',
+ hosts: [
+ 'h0',
+ 'h1'
+ ],
+ defaultLevels: [
+ 'l0',
+ 'l1'
+ ],
+ overrideLevels: [
+ 'l2',
+ 'l3'
+ ],
+ expiryTime: '2017-05-29T11:30:22.531Z'
+ },
+ filter1: {
+ label: 'filter1',
+ hosts: [
+ 'h1',
+ 'h2'
+ ],
+ defaultLevels: [
+ 'l4',
+ 'l5'
+ ],
+ overrideLevels: [
+ 'l6',
+ 'l7'
+ ],
+ expiryTime: '2017-05-30T11:30:22.531Z'
+ }
+ },
+ names: []
+ }
+ }
+ }
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/app-settings.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/app-settings.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/app-settings.model.ts
new file mode 100644
index 0000000..11821a3
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/app-settings.model.ts
@@ -0,0 +1,27 @@
+/**
+ * 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 * as moment from 'moment-timezone';
+
+export interface AppSettings {
+ timeZone: string;
+}
+
+export const defaultSettings: AppSettings = {
+ timeZone: moment.tz.guess()
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/app-state.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/app-state.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/app-state.model.ts
new file mode 100644
index 0000000..2995002
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/app-state.model.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.
+ */
+
+export interface AppState {
+ isAuthorized: boolean;
+ isInitialLoading: boolean;
+ isLoginInProgress: boolean;
+ isAuditLogsSet: boolean;
+ isServiceLogsSet: boolean;
+}
+
+export const initialState: AppState = {
+ isAuthorized: false,
+ isInitialLoading: false,
+ isLoginInProgress: false,
+ isAuditLogsSet: false,
+ isServiceLogsSet: false
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/audit-log-field.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/audit-log-field.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/audit-log-field.model.ts
new file mode 100644
index 0000000..96372a1
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/audit-log-field.model.ts
@@ -0,0 +1,225 @@
+/**
+ * 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 {LogField} from '@app/models/log-field.model';
+
+const columnsNamesMap = {
+ access: {
+ displayName: 'logs.accessType',
+ isDisplayed: true
+ },
+ action: {
+ displayName: 'logs.action'
+ },
+ agent: {
+ displayName: 'logs.agent'
+ },
+ agentHost: {
+ displayName: 'logs.agentHost'
+ },
+ authType: {
+ displayName: 'logs.authType'
+ },
+ bundle_id: {
+ displayName: 'logs.bundleId'
+ },
+ case_id: {
+ displayName: 'logs.caseId'
+ },
+ cliIP: {
+ displayName: 'logs.clientIp',
+ isDisplayed: true
+ },
+ cliType: {
+ displayName: 'logs.clientType'
+ },
+ cluster: {
+ displayName: 'logs.cluster'
+ },
+ dst: {
+ displayName: 'logs.dst'
+ },
+ evtTime: {
+ displayName: 'logs.eventTime',
+ isDisplayed: true
+ },
+ file: {
+ displayName: 'logs.file'
+ },
+ host: {
+ displayName: 'logs.host'
+ },
+ id: {
+ displayName: 'logs.id'
+ },
+ ip: {
+ displayName: 'logs.ip'
+ },
+ level: {
+ displayName: 'logs.level'
+ },
+ log_message: {
+ displayName: 'logs.message'
+ },
+ logType: {
+ displayName: 'logs.logType'
+ },
+ logfile_line_number: {
+ displayName: 'logs.logfileLineNumber'
+ },
+ logger_name: {
+ displayName: 'logs.loggerName'
+ },
+ logtime: {
+ displayName: 'logs.logTime'
+ },
+ path: {
+ displayName: 'logs.path'
+ },
+ perm: {
+ displayName: 'logs.perm'
+ },
+ policy: {
+ displayName: 'logs.policy'
+ },
+ proxyUsers: {
+ displayName: 'logs.proxyUsers'
+ },
+ reason: {
+ displayName: 'logs.reason'
+ },
+ repo: {
+ displayName: 'logs.repo',
+ isDisplayed: true
+ },
+ repoType: {
+ displayName: 'logs.repoType'
+ },
+ req_caller_id: {
+ displayName: 'logs.reqCallerId'
+ },
+ reqContext: {
+ displayName: 'logs.reqContext'
+ },
+ reqData: {
+ displayName: 'logs.reqData'
+ },
+ req_self_id: {
+ displayName: 'logs.reqSelfId'
+ },
+ resType: {
+ displayName: 'logs.resType'
+ },
+ resource: {
+ displayName: 'logs.resource',
+ isDisplayed: true
+ },
+ result: {
+ displayName: 'logs.result',
+ isDisplayed: true
+ },
+ sess: {
+ displayName: 'logs.session'
+ },
+ text: {
+ displayName: 'logs.text'
+ },
+ type: {
+ displayName: 'logs.type'
+ },
+ ugi: {
+ displayName: 'logs.ugi'
+ },
+ reqUser: {
+ displayName: 'logs.user',
+ isDisplayed: true
+ },
+ ws_base_url: {
+ displayName: 'logs.baseUrl'
+ },
+ ws_command: {
+ displayName: 'logs.command'
+ },
+ ws_component: {
+ displayName: 'logs.component'
+ },
+ ws_details: {
+ displayName: 'logs.details'
+ },
+ ws_display_name: {
+ displayName: 'logs.displayName'
+ },
+ ws_os: {
+ displayName: 'logs.os'
+ },
+ ws_repo_id: {
+ displayName: 'logs.repoId'
+ },
+ ws_repo_version: {
+ displayName: 'logs.repoVersion'
+ },
+ ws_repositories: {
+ displayName: 'logs.repositories'
+ },
+ ws_request_id: {
+ displayName: 'logs.requestId'
+ },
+ ws_result_status: {
+ displayName: 'logs.resultStatus'
+ },
+ ws_roles: {
+ displayName: 'logs.roles'
+ },
+ ws_stack_version: {
+ displayName: 'logs.stackVersion'
+ },
+ ws_stack: {
+ displayName: 'logs.stack'
+ },
+ ws_status: {
+ displayName: 'logs.status'
+ },
+ ws_task_id: {
+ displayName: 'logs.taskId'
+ },
+ ws_version_note: {
+ displayName: 'logs.versionNote'
+ },
+ ws_version_number: {
+ displayName: 'logs.versionNumber'
+ },
+ tags: {
+ isAvailable: false
+ },
+ tags_str: {
+ isAvailable: false
+ },
+ seq_num: {
+ isAvailable: false
+ }
+};
+
+export class AuditLogField extends LogField {
+ constructor(name: string) {
+ super(name);
+ const preset = columnsNamesMap[this.name];
+ if (preset) {
+ Object.assign(this, preset);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/audit-log.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/audit-log.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/audit-log.model.ts
new file mode 100644
index 0000000..2b34cd6
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/audit-log.model.ts
@@ -0,0 +1,46 @@
+/**
+ * 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 {Log} from '@app/models/log.model';
+
+export interface AuditLog extends Log {
+ policy?: string;
+ reason?: string;
+ result: number;
+ text?: string;
+ tags?: string[];
+ resource?: string;
+ sess?: string;
+ access?: string;
+ logType: string;
+ tags_str?: string;
+ resType?: string;
+ reqUser: string;
+ reqData?: string;
+ repoType: number;
+ repo: string;
+ proxyUsers?: string[];
+ evtTime: string;
+ enforcer: string;
+ reqContext?: string;
+ cliType?: string;
+ cliIP?: string;
+ agent?: string;
+ agentHost?: string;
+ action?: string;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/bar-graph.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/bar-graph.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/bar-graph.model.ts
new file mode 100644
index 0000000..a197bf5
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/bar-graph.model.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 {CommonEntry} from '@app/models/common-entry.model';
+
+export interface BarGraph {
+ dataCount: CommonEntry[],
+ name: string;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/common-entry.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/common-entry.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/common-entry.model.ts
new file mode 100644
index 0000000..dad82ab
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/common-entry.model.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 interface CommonEntry {
+ name: string;
+ value: string;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/count.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/count.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/count.model.ts
new file mode 100644
index 0000000..02fc41c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/count.model.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 interface Count {
+ name: string;
+ count: number;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/filter.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/filter.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/filter.model.ts
new file mode 100644
index 0000000..c7ff662
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/filter.model.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 interface Filter {
+ label: string;
+ hosts: string[];
+ defaultLevels: string[];
+ overrideLevels: string[];
+ expiryTime: string;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/graph.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/graph.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/graph.model.ts
new file mode 100644
index 0000000..04966b2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/graph.model.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 interface Graph {
+ name: string;
+ count: string;
+ dataList?: Graph[]
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/log-field.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/log-field.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/log-field.model.ts
new file mode 100644
index 0000000..0e738ab
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/log-field.model.ts
@@ -0,0 +1,27 @@
+/**
+ * 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 LogField {
+ constructor(name: string) {
+ this.name = name;
+ }
+ name: string;
+ displayName: string = this.name;
+ isDisplayed: boolean = false;
+ isAvailable: boolean = true;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/log.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/log.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/log.model.ts
new file mode 100644
index 0000000..188bbd2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/log.model.ts
@@ -0,0 +1,37 @@
+/**
+ * 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 interface Log {
+ type: string;
+ _version_: number;
+ id: string;
+ file?: string;
+ seq_num: number;
+ bundle_id?: string;
+ case_id?: string;
+ log_message: string;
+ logfile_line_number: number;
+ message_md5: string;
+ cluster: string;
+ event_count: number;
+ event_md5: string;
+ event_dur_ms: number;
+ _ttl_: string;
+ _expire_at_: number;
+ _router_field_?: number;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/node.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/node.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/node.model.ts
new file mode 100644
index 0000000..2891d142
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/node.model.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 {CommonEntry} from '@app/models/common-entry.model';
+
+export interface Node {
+ name: string;
+ type?: string;
+ value: string;
+ isParent: boolean;
+ isRoot: boolean;
+ childs?: Node[];
+ logLevelCount: CommonEntry[];
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/service-log-field.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/service-log-field.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/service-log-field.model.ts
new file mode 100644
index 0000000..081eecf
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/service-log-field.model.ts
@@ -0,0 +1,107 @@
+/**
+ * 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 {LogField} from '@app/models/log-field.model';
+
+const columnsNamesMap = {
+ log_message: {
+ displayName: 'logs.message',
+ isDisplayed: true
+ },
+ bundle_id: {
+ displayName: 'logs.bundleId'
+ },
+ case_id: {
+ displayName: 'logs.caseId'
+ },
+ cluster: {
+ displayName: 'logs.cluster'
+ },
+ event_count: {
+ displayName: 'logs.eventCount'
+ },
+ file: {
+ displayName: 'logs.file'
+ },
+ host: {
+ displayName: 'logs.host'
+ },
+ id: {
+ displayName: 'logs.id'
+ },
+ ip: {
+ displayName: 'logs.ip'
+ },
+ level: {
+ displayName: 'logs.level',
+ isDisplayed: true
+ },
+ line_number: {
+ displayName: 'logs.lineNumber'
+ },
+ logtype: {
+ displayName: 'logs.logType'
+ },
+ logfile_line_number: {
+ displayName: 'logs.logfileLineNumber'
+ },
+ logger_name: {
+ displayName: 'logs.loggerName'
+ },
+ logtime: {
+ isDisplayed: true
+ },
+ method: {
+ displayName: 'logs.method'
+ },
+ path: {
+ displayName: 'logs.path'
+ },
+ rowtype: {
+ displayName: 'logs.rowType'
+ },
+ thread_name: {
+ displayName: 'logs.threadName'
+ },
+ type: {
+ displayName: 'logs.type',
+ isDisplayed: true
+ },
+ tags: {
+ isAvailable: false
+ },
+ text: {
+ isAvailable: false
+ },
+ message: {
+ isAvailable: false
+ },
+ seq_num: {
+ isAvailable: false
+ }
+};
+
+export class ServiceLogField extends LogField {
+ constructor(name: string) {
+ super(name);
+ const preset = columnsNamesMap[this.name];
+ if (preset) {
+ Object.assign(this, preset);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/service-log.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/service-log.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/service-log.model.ts
new file mode 100644
index 0000000..ee27343
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/service-log.model.ts
@@ -0,0 +1,27 @@
+/**
+ * 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 {Log} from '@app/models/log.model';
+
+export interface ServiceLog extends Log {
+ path: string;
+ host: string;
+ level: string;
+ logtime: number;
+ ip: string;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/solr-collection-state.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/solr-collection-state.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/solr-collection-state.model.ts
new file mode 100644
index 0000000..0824dda
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/solr-collection-state.model.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 interface SolrCollectionState {
+ znodeReady: boolean;
+ configurationUploaded: boolean;
+ solrCollectionReady: boolean;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/store.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/store.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/store.model.ts
new file mode 100644
index 0000000..31d52b3
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/store.model.ts
@@ -0,0 +1,169 @@
+/**
+ * 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 {Observable} from 'rxjs/Observable';
+import {Store, Action} from '@ngrx/store';
+import {AppSettings} from '@app/models/app-settings.model';
+import {AppState} from '@app/models/app-state.model';
+import {AuditLog} from '@app/models/audit-log.model';
+import {ServiceLog} from '@app/models/service-log.model';
+import {BarGraph} from '@app/models/bar-graph.model';
+import {Graph} from '@app/models/graph.model';
+import {Node} from '@app/models/node.model';
+import {UserConfig} from '@app/models/user-config.model';
+import {Filter} from '@app/models/filter.model';
+import {AuditLogField} from '@app/models/audit-log-field.model';
+import {ServiceLogField} from '@app/models/service-log-field.model';
+
+export const storeActions = {
+ 'ARRAY.ADD': 'ADD',
+ 'ARRAY.DELETE.PRIMITIVE': 'DELETE_PRIMITIVE',
+ 'ARRAY.DELETE.OBJECT': 'DELETE_OBJECT',
+ 'ARRAY.CLEAR': 'CLEAR',
+ 'ARRAY.MAP': 'MAP',
+
+ 'OBJECT.SET': 'SET'
+};
+
+export interface AppStore {
+ appSettings: AppSettings;
+ appState: AppState;
+ auditLogs: AuditLog[];
+ serviceLogs: ServiceLog[];
+ serviceLogsHistogramData: BarGraph[];
+ graphs: Graph[];
+ hosts: Node[];
+ userConfigs: UserConfig[];
+ filters: Filter[];
+ clusters: string[];
+ components: string[];
+ serviceLogsFields: ServiceLogField[];
+ auditLogsFields: AuditLogField[];
+}
+
+export class ModelService {
+
+ constructor(modelName: string, store: Store<AppStore>) {
+ this.modelName = modelName;
+ this.store = store;
+ }
+
+ protected modelName: string;
+
+ protected store: Store<AppStore>;
+
+ getAll(): Observable<any> {
+ return this.store.select(this.modelName);
+ }
+
+}
+
+export class CollectionModelService extends ModelService {
+
+ addInstance(instance: any): void {
+ this.addInstances([instance]);
+ }
+
+ addInstances(instances: any[]): void {
+ this.store.dispatch({
+ type: `${storeActions['ARRAY.ADD']}_${this.modelName}`,
+ payload: instances
+ });
+ }
+
+ deleteObjectInstance(instance: any): void {
+ this.store.dispatch({
+ type: `${storeActions['ARRAY.DELETE.OBJECT']}_${this.modelName}`,
+ payload: instance
+ });
+ }
+
+ deletePrimitiveInstance(instance: any): void {
+ this.store.dispatch({
+ type: `${storeActions['ARRAY.DELETE.PRIMITIVE']}_${this.modelName}`,
+ payload: instance
+ });
+ }
+
+ clear(): void {
+ this.store.dispatch({
+ type: `${storeActions['ARRAY.CLEAR']}_${this.modelName}`
+ });
+ }
+
+ mapCollection(modifier: (item: any) => {}): void {
+ this.store.dispatch({
+ type: `${storeActions['ARRAY.MAP']}_${this.modelName}`,
+ payload: {
+ modifier: modifier
+ }
+ });
+ }
+
+}
+
+export class ObjectModelService extends ModelService {
+
+ getParameter(key: string): Observable<any> {
+ return this.store.select(this.modelName, key);
+ }
+
+ setParameter(key: string, value: any): void {
+ let payload = {};
+ payload[key] = value;
+ this.setParameters(payload);
+ }
+
+ setParameters(params: any): void {
+ this.store.dispatch({
+ type: `${storeActions['OBJECT.SET']}_${this.modelName}`,
+ payload: params
+ });
+ }
+
+}
+
+export function getCollectionReducer(modelName: string, defaultState: any = []): any {
+ return (state: any = defaultState, action: Action) => {
+ switch (action.type) {
+ case `${storeActions['ARRAY.ADD']}_${modelName}`:
+ return [...state, ...action.payload];
+ case `${storeActions['ARRAY.DELETE.OBJECT']}_${modelName}`:
+ return state.filter(instance => instance.id !== action.payload.id);
+ case `${storeActions['ARRAY.DELETE.PRIMITIVE']}_${modelName}`:
+ return state.filter(item => item !== action.payload);
+ case `${storeActions['ARRAY.CLEAR']}_${modelName}`:
+ return [];
+ case `${storeActions['ARRAY.MAP']}_${modelName}`:
+ return state.map(action.payload.modifier);
+ default:
+ return state;
+ }
+ };
+}
+
+export function getObjectReducer(modelName: string, defaultState: any = {}) {
+ return (state: any = defaultState, action: Action): any => {
+ switch (action.type) {
+ case `${storeActions['OBJECT.SET']}_${modelName}`:
+ return Object.assign({}, state, action.payload);
+ default:
+ return state;
+ }
+ };
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/app/models/user-config.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/models/user-config.model.ts b/ambari-logsearch/ambari-logsearch-web/src/app/models/user-config.model.ts
new file mode 100644
index 0000000..f52761c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/models/user-config.model.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 interface UserConfig {
+ id: string;
+ userName: string;
+ filtername: string;
+ values: string;
+ shareNameList: string[];
+ rowType: string;
+}