http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/node-bar/node-bar.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/node-bar/node-bar.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/node-bar/node-bar.component.spec.ts deleted file mode 100644 index d47436e..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/node-bar/node-bar.component.spec.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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 {NodeBarComponent} from './node-bar.component'; - -describe('NodeBarComponent', () => { - let component: NodeBarComponent; - let fixture: ComponentFixture<NodeBarComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [NodeBarComponent] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(NodeBarComponent); - 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-new/src/app/components/node-bar/node-bar.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/node-bar/node-bar.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/node-bar/node-bar.component.ts deleted file mode 100644 index c7b3ead..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/node-bar/node-bar.component.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * 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, Input} from '@angular/core'; - -@Component({ - selector: 'node-bar', - templateUrl: './node-bar.component.html', - styleUrls: ['./node-bar.component.less'] -}) -export class NodeBarComponent { - - @Input() - data: any[] = []; - - get totalCount(): number { - return this.data.reduce((currentValue, currentItem) => currentValue + Number(currentItem.value), 0); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.html deleted file mode 100644 index c227a2b..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.html +++ /dev/null @@ -1,23 +0,0 @@ -<!-- - 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. ---> - -<button class="btn btn-link" [disabled]="currentPage === 0" (click)="updateValue(true)"> - <span class="pagination-control fa fa-chevron-left"></span> -</button> -<button class="btn btn-link" [disabled]="currentPage === pagesCount - 1" (click)="updateValue()"> - <span class="pagination-control fa fa-chevron-right"></span> -</button> http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.less deleted file mode 100644 index 8238eaf..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.less +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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'; - -.pagination-control { - .clickable-item; -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.spec.ts deleted file mode 100644 index 489f79c..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.spec.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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 {PaginationControlsComponent} from './pagination-controls.component'; - -describe('PaginationControlsComponent', () => { - let component: PaginationControlsComponent; - let fixture: ComponentFixture<PaginationControlsComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [PaginationControlsComponent] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PaginationControlsComponent); - 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-new/src/app/components/pagination-controls/pagination-controls.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.ts deleted file mode 100644 index c71844c..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination-controls/pagination-controls.component.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * 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, forwardRef, Input, Output, EventEmitter} from '@angular/core'; -import {ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; - -@Component({ - selector: 'pagination-controls', - templateUrl: './pagination-controls.component.html', - styleUrls: ['./pagination-controls.component.less'], - providers: [ - { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => PaginationControlsComponent), - multi: true - } - ] -}) -export class PaginationControlsComponent implements ControlValueAccessor { - - private onChange: (fn: any) => void; - - currentPage: number = 0; - - @Input() - totalCount: number; - - @Input() - pagesCount: number; - - @Output() - currentPageChange: EventEmitter<number> = new EventEmitter(); - - get value(): number { - return this.currentPage; - } - - set value(newValue: number) { - this.currentPage = newValue; - this.currentPageChange.emit(newValue); - this.onChange(newValue); - } - - updateValue(isDecrement?: boolean) { - isDecrement? this.value-- : this.value++; - } - - writeValue() { - } - - registerOnChange(callback: any): void { - this.onChange = callback; - } - - registerOnTouched() { - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.html deleted file mode 100644 index be6591b..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.html +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - 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. ---> - -<form class="pagination-form col-md-12" [formGroup]="filtersForm"> - <filter-dropdown [label]="filterInstance.label" formControlName="pageSize" [options]="filterInstance.options" - [defaultLabel]="filterInstance.defaultLabel" [isRightAlign]="true" isDropup="true"></filter-dropdown> - <span>{{'pagination.numbers' | translate: numbersTranslateParams}}</span> - <pagination-controls formControlName="page" [totalCount]="totalCount" [pagesCount]="pagesCount" - (currentPageChange)="setCurrentPage($event)"></pagination-controls> -</form> http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.less deleted file mode 100644 index df8ad2d..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.less +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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 { - display: flex; - - .pagination-form { - .flex-vertical-align; - justify-content: flex-end; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.spec.ts deleted file mode 100644 index 7a15bbc..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.spec.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * 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 {NO_ERRORS_SCHEMA} from '@angular/core'; -import {Http} from '@angular/http'; -import {TranslateModule, TranslateLoader} from '@ngx-translate/core'; -import {TranslateHttpLoader} from '@ngx-translate/http-loader'; - -import {PaginationComponent} from './pagination.component'; - -export function HttpLoaderFactory(http: Http) { - return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); -} - -describe('PaginationComponent', () => { - let component: PaginationComponent; - let fixture: ComponentFixture<PaginationComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [ - TranslateModule.forRoot({ - provide: TranslateLoader, - useFactory: HttpLoaderFactory, - deps: [Http] - }) - ], - declarations: [PaginationComponent], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PaginationComponent); - component = fixture.componentInstance; - component.filterInstance = {}; - component.filtersForm = { - controls: { - pageSize: { - valueChanges: { - subscribe: () => {} - } - } - } - }; - 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-new/src/app/components/pagination/pagination.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.ts deleted file mode 100644 index d38d0d8..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/pagination/pagination.component.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * 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, Input} from '@angular/core'; -import {FormGroup} from '@angular/forms'; - -@Component({ - selector: 'pagination', - templateUrl: './pagination.component.html', - styleUrls: ['./pagination.component.less'] -}) -export class PaginationComponent implements OnInit { - - ngOnInit() { - this.setPageSizeFromString(this.filterInstance.defaultValue); - this.filtersForm.controls.pageSize.valueChanges.subscribe(value => this.setPageSizeFromString(value)); - } - - @Input() - filtersForm: FormGroup; - - @Input() - filterInstance: any; - - @Input() - currentCount?: number; - - @Input() - totalCount: number; - - private pageSize: number = 0; - - setPageSizeFromString(value: string) { - this.pageSize = parseInt(value); - } - - private currentPage: number = 0; - - get numbersTranslateParams(): any { - const pageSize = this.pageSize, - startIndex = (this.currentPage * pageSize) + 1; - return { - startIndex, - endIndex: startIndex + Math.min(pageSize, this.currentCount) - 1, - totalCount: this.totalCount - } - } - - get pagesCount(): number { - return Math.ceil(this.totalCount / this.pageSize); - } - - setCurrentPage(pageNumber: number) { - this.currentPage = pageNumber; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.html deleted file mode 100644 index 299e46e..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.html +++ /dev/null @@ -1,18 +0,0 @@ -<!-- - 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 #container></div> http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.less deleted file mode 100644 index d891862..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.less +++ /dev/null @@ -1,29 +0,0 @@ -/** - * 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. - */ - -/deep/ .axis { - .domain { - display: none; - } - - .tick { - line { - display: none; - } - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.spec.ts deleted file mode 100644 index 9e056be..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.spec.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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 {StoreModule} from '@ngrx/store'; -import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service'; - -import {TimeHistogramComponent} from './time-histogram.component'; - -describe('TimeHistogramComponent', () => { - let component: TimeHistogramComponent; - let fixture: ComponentFixture<TimeHistogramComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [TimeHistogramComponent], - imports: [ - StoreModule.provideStore({ - appSettings - }) - ], - providers: [ - AppSettingsService - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(TimeHistogramComponent); - 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-new/src/app/components/time-histogram/time-histogram.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.ts deleted file mode 100644 index 7856ecc..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.ts +++ /dev/null @@ -1,161 +0,0 @@ -/** - * 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, AfterViewInit, OnChanges, Input, ViewChild, ElementRef} from '@angular/core'; -import * as d3 from 'd3'; -import * as moment from 'moment-timezone'; -import {AppSettingsService} from '@app/services/storage/app-settings.service'; - -@Component({ - selector: 'time-histogram', - templateUrl: './time-histogram.component.html', - styleUrls: ['./time-histogram.component.less'] -}) -export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges { - - constructor(private appSettings: AppSettingsService) { - appSettings.getParameter('timeZone').subscribe(value => { - this.timeZone = value; - this.createHistogram(); - }); - } - - ngOnInit() { - Object.assign(this.options, this.defaultOptions, this.customOptions); - } - - ngAfterViewInit() { - this.htmlElement = this.element.nativeElement; - this.host = d3.select(this.htmlElement); - } - - ngOnChanges() { - this.createHistogram(); - } - - @ViewChild('container') - element: ElementRef; - - @Input() - customOptions: any; - - @Input() - data: any; - - private readonly defaultOptions = { - margin: { - top: 20, - right: 20, - bottom: 40, - left: 50 - }, - height: 200, - tickPadding: 10, - columnWidth: 20 - }; - - private options: any = {}; - - private timeZone: string; - - private host; - - private svg; - - private width; - - private xScale; - - private yScale; - - private colorScale; - - private xAxis; - - private yAxis; - - private htmlElement: HTMLElement; - - histogram: any; - - private createHistogram(): void { - if (this.host) { - this.setup(); - this.buildSVG(); - this.populate(); - } - } - - private setup(): void { - const margin = this.options.margin, - keysWithColors = this.options.keysWithColors, - keys = Object.keys(keysWithColors), - colors = keys.reduce((array, key) => [...array, keysWithColors[key]], []); - this.width = this.htmlElement.clientWidth - margin.left - margin.right; - this.xScale = d3.scaleTime().range([0, this.width]); - this.yScale = d3.scaleLinear().range([this.options.height, 0]); - this.colorScale = d3.scaleOrdinal(colors); - } - - private buildSVG(): void { - const margin = this.options.margin; - this.host.html(''); - this.svg = this.host.append('svg').attr('width', this.width + margin.left + margin.right) - .attr('height', this.options.height + margin.top + margin.bottom).append('g') - .attr('transform', `translate(${margin.left},${margin.top})`); - } - - private drawXAxis(): void { - this.xAxis = d3.axisBottom(this.xScale) - .tickFormat(tick => moment(tick).tz(this.timeZone).format('MM/DD HH:mm')) - .tickPadding(this.options.tickPadding); - this.svg.append('g').attr('class', 'axis').attr('transform', `translate(0,${this.options.height})`).call(this.xAxis); - } - - private drawYAxis(): void { - this.yAxis = d3.axisLeft(this.yScale).tickFormat((tick: number) => { - if (Number.isInteger(tick)) { - return tick.toFixed(0); - } else { - return; - } - }).tickPadding(this.options.tickPadding); - this.svg.append('g').attr('class', 'axis').call(this.yAxis).append('text'); - } - - private populate(): void { - const keys = Object.keys(this.options.keysWithColors), - data = this.data, - timeStamps = Object.keys(data), - formattedData = timeStamps.map(timeStamp => Object.assign({ - timeStamp: timeStamp - }, data[timeStamp])), - layers = (d3.stack().keys(keys)(formattedData)), - columnWidth = this.options.columnWidth; - this.xScale.domain(d3.extent(formattedData, item => item.timeStamp)); - this.yScale.domain([0, d3.max(formattedData, item => keys.reduce((sum, key) => sum + item[key], 0))]); - this.drawXAxis(); - this.drawYAxis(); - const layer = this.svg.selectAll().data(d3.transpose<any>(layers)).enter().append('g'); - layer.selectAll().data(item => item).enter().append('rect') - .attr('x', item => this.xScale(item.data.timeStamp) - columnWidth / 2).attr('y', item => this.yScale(item[1])) - .attr('height', item => this.yScale(item[0]) - this.yScale(item[1])).attr('width', columnWidth.toString()) - .style('fill', (item, index) => this.colorScale(index)); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.html deleted file mode 100644 index 3cb196e..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.html +++ /dev/null @@ -1,26 +0,0 @@ -<!-- - 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. ---> - -<button class="btn btn-link" (click)="setTimeZonePickerDisplay(true)"> - {{timeZone | timeZoneAbbr}} <span class="caret"></span> -</button> -<modal *ngIf="isTimeZonePickerDisplayed" [showCloseButton]="false" [isLargeModal]="true" - (init)="initMap()" (cancel)="setTimeZonePickerDisplay(false)" (submit)="setTimeZone()"> - <ng-template> - <div attr.id="{{mapElementId}}"></div> - </ng-template> -</modal> http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.less deleted file mode 100644 index 4fa043d..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.less +++ /dev/null @@ -1,45 +0,0 @@ -/** - * 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'; - -.btn-link { - // TODO implement actual colors - color: @submit-color; - - &:hover { - color: @submit-hover-color; - } -} - -/deep/ #timezone-map { - .Cbox { - .quickLink { - padding-top: 4px; - } - } - - .hoverZone { - display: inline-block; - - &:after { - content: '\007C\00a0\00a0'; - visibility: hidden; - } - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.spec.ts deleted file mode 100644 index 0ef17de..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.spec.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * 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-new/src/app/components/timezone-picker/timezone-picker.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.ts deleted file mode 100644 index 32f6474..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/timezone-picker/timezone-picker.component.ts +++ /dev/null @@ -1,77 +0,0 @@ -/** - * 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-new/src/app/components/top-menu/top-menu.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/top-menu/top-menu.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/top-menu/top-menu.component.html deleted file mode 100644 index 6898354..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/top-menu/top-menu.component.html +++ /dev/null @@ -1,21 +0,0 @@ -<!-- - 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-new/src/app/components/top-menu/top-menu.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/top-menu/top-menu.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/top-menu/top-menu.component.less deleted file mode 100644 index e5e85f4..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/top-menu/top-menu.component.less +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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-new/src/app/components/top-menu/top-menu.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/top-menu/top-menu.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/top-menu/top-menu.component.spec.ts deleted file mode 100644 index 1649a50..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/top-menu/top-menu.component.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * 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-new/src/app/components/top-menu/top-menu.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/top-menu/top-menu.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/top-menu/top-menu.component.ts deleted file mode 100644 index 73b6131..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/top-menu/top-menu.component.ts +++ /dev/null @@ -1,122 +0,0 @@ -/** - * 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-new/src/app/components/variables.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/variables.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/variables.less deleted file mode 100644 index f72183c..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/variables.less +++ /dev/null @@ -1,118 +0,0 @@ -/** - * 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-new/src/app/mock-data.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/mock-data.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/mock-data.ts deleted file mode 100644 index f23139b..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/mock-data.ts +++ /dev/null @@ -1,1067 +0,0 @@ -/** - * 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