http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.spec.ts deleted file mode 100644 index 71039ed..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.spec.ts +++ /dev/null @@ -1,82 +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 {Http} from '@angular/http'; -import {FormsModule} from '@angular/forms'; -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 {FilteringService} from '@app/services/filtering.service'; -import {UtilsService} from '@app/services/utils.service'; -import {ComponentActionsService} from '@app/services/component-actions.service'; - -import {FilterTextFieldComponent} from './filter-text-field.component'; - -export function HttpLoaderFactory(http: Http) { - return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); -} - -describe('FilterTextFieldComponent', () => { - let component: FilterTextFieldComponent; - let fixture: ComponentFixture<FilterTextFieldComponent>; - const filtering = { - filters: { - f: {} - } - }; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [FilterTextFieldComponent], - imports: [ - FormsModule, - TranslateModule.forRoot({ - provide: TranslateLoader, - useFactory: HttpLoaderFactory, - deps: [Http] - }), - StoreModule.provideStore({ - appSettings - }) - ], - providers: [ - AppSettingsService, - { - provide: FilteringService, - useValue: filtering - }, - UtilsService, - ComponentActionsService - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(FilterTextFieldComponent); - 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/filter-text-field/filter-text-field.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.ts deleted file mode 100644 index 2b6bfea..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.ts +++ /dev/null @@ -1,87 +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, forwardRef} from '@angular/core'; -import {ControlValueAccessor, NG_VALUE_ACCESSOR, FormGroup} from '@angular/forms'; -import {Subject} from 'rxjs/Subject'; -import 'rxjs/add/operator/debounceTime'; -import {UtilsService} from '@app/services/utils.service'; - -@Component({ - selector: 'filter-text-field', - templateUrl: './filter-text-field.component.html', - styleUrls: ['./filter-text-field.component.less'], - providers: [ - { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => FilterTextFieldComponent), - multi: true - } - ] -}) -export class FilterTextFieldComponent implements ControlValueAccessor { - - constructor(private utils: UtilsService) { - this.valueSubject.debounceTime(this.debounceInterval).subscribe(value => this.updateValue({ - value - })); - } - - @Input() - label: string; - - private selectedValue: string; - - private onChange: (fn: any) => void; - - private readonly debounceInterval = 1500; - - instantValue: string; - - private valueSubject = new Subject<string>(); - - get value(): any { - return this.selectedValue; - } - - set value(newValue: any) { - this.selectedValue = newValue; - this.onChange(newValue); - } - - updateValue(options: any) { - const value = options && options.value; - if (this.utils.valueHasChanged(this.selectedValue, value)) { - this.value = value; - } - } - - writeValue() { - } - - registerOnChange(callback: any): void { - this.onChange = callback; - } - - registerOnTouched() { - } - - updateInstantValue(value: string): void { - this.valueSubject.next(value); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.html deleted file mode 100644 index 6df6988..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.html +++ /dev/null @@ -1,46 +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="col-md-12" [formGroup]="filtersForm"> - <div class="form-inline filter-input-container col-md-8"> - <filter-dropdown [label]="filters.clusters.label" formControlName="clusters" [options]="filters.clusters.options" - [defaultLabel]="filters.clusters.defaultLabel" [isMultipleChoice]="true"></filter-dropdown> - <filter-text-field [label]="filters.text.label" - formControlName="text"></filter-text-field> - <filter-dropdown formControlName="timeRange" [options]="filters.timeRange.options" - [defaultLabel]="filters.timeRange.defaultLabel"></filter-dropdown> - <timezone-picker></timezone-picker> - <!--button class="btn btn-success" type="button"> - <span class="fa fa-search"></span> - </button--> - </div> - <div class="default-flex col-md-4"> - <a href="#"> - <span class="fa fa-search-minus"></span> {{'filter.excluded' | translate}} - </a> - <filter-button formControlName="hosts" [label]="filters.hosts.label" - [iconClass]="filters.hosts.iconClass" [subItems]="filters.hosts.options" - [isMultipleChoice]="true" [isRightAlign]="true" - additionalLabelComponentSetter="getDataForHostsNodeBar"></filter-button> - <filter-button formControlName="components" [label]="filters.components.label" - [iconClass]="filters.components.iconClass" [subItems]="filters.components.options" - [isMultipleChoice]="true" [isRightAlign]="true"></filter-button> - <filter-button formControlName="levels" [label]="filters.levels.label" [iconClass]="filters.levels.iconClass" - [subItems]="filters.levels.options" [isMultipleChoice]="true" [isRightAlign]="true"></filter-button> - <menu-button label="filter.capture" iconClass="fa fa-caret-right"></menu-button> - </div> -</form> http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.less deleted file mode 100644 index 9ab09ef..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.less +++ /dev/null @@ -1,51 +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: block; - padding: @filters-panel-padding; - background-color: @filters-panel-background-color; - - .filter-input-container { - .flex-vertical-align; - justify-content: flex-start; - - .btn-success { - border-top-left-radius: 0; - border-bottom-left-radius: 0; - } - - filter-dropdown, dropdown-button, timezone-picker { - border: @input-border; - - &:not(:last-child) { - border-right-width: 0; - } - - &:first-child { - border-radius: @button-border-radius 0 0 @button-border-radius; - } - - &:last-child { - border-radius: 0 @button-border-radius @button-border-radius 0; - } - } - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.spec.ts deleted file mode 100644 index b1cf990..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.spec.ts +++ /dev/null @@ -1,93 +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 {NO_ERRORS_SCHEMA} from '@angular/core'; -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 {ClustersService, clusters} from '@app/services/storage/clusters.service'; -import {ComponentsService, components} from '@app/services/storage/components.service'; -import {HostsService, hosts} from '@app/services/storage/hosts.service'; -import {FilteringService} from '@app/services/filtering.service'; -import {HttpClientService} from '@app/services/http-client.service'; -import {UtilsService} from '@app/services/utils.service'; - -import {FiltersPanelComponent} from './filters-panel.component'; - -export function HttpLoaderFactory(http: Http) { - return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); -} - -describe('FiltersPanelComponent', () => { - let component: FiltersPanelComponent; - let fixture: ComponentFixture<FiltersPanelComponent>; - - beforeEach(async(() => { - const httpClient = { - get: () => { - return { - subscribe: () => { - } - } - } - }; - TestBed.configureTestingModule({ - declarations: [FiltersPanelComponent], - imports: [ - StoreModule.provideStore({ - appSettings, - clusters, - components, - hosts - }), - TranslateModule.forRoot({ - provide: TranslateLoader, - useFactory: HttpLoaderFactory, - deps: [Http] - }) - ], - providers: [ - AppSettingsService, - ClustersService, - ComponentsService, - HostsService, - FilteringService, - { - provide: HttpClientService, - useValue: httpClient - }, - UtilsService - ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(FiltersPanelComponent); - 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/filters-panel/filters-panel.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.ts deleted file mode 100644 index e407021..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.ts +++ /dev/null @@ -1,44 +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 {FormGroup} from '@angular/forms'; -import {FilteringService} from '@app/services/filtering.service'; - -@Component({ - selector: 'filters-panel', - templateUrl: './filters-panel.component.html', - styleUrls: ['./filters-panel.component.less'] -}) -export class FiltersPanelComponent { - - constructor(private filtering: FilteringService) { - this.filtering.loadClusters(); - this.filtering.loadComponents(); - this.filtering.loadHosts(); - } - - get filters(): any { - return this.filtering.filters; - } - - get filtersForm(): FormGroup { - return this.filtering.filtersForm; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.html deleted file mode 100644 index a34cfb8..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.html +++ /dev/null @@ -1,33 +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 class="login-form well col-md-4 col-md-offset-4 col-sm-offset-4"> - <div class="alert alert-danger" *ngIf="isLoginAlertDisplayed" [innerHTML]="'authorization.error' | translate"></div> - <form #loginForm="ngForm" (ngSubmit)="login()"> - <div class="form-group"> - <label for="username">{{'authorization.name' | translate}}</label> - <input class="form-control" type="text" id="username" name="username" required [(ngModel)]="username"> - </div> - <div class="form-group"> - <label for="password">{{'authorization.password' | translate}}</label> - <input class="form-control" type="password" id="password" name="password" required [(ngModel)]="password"> - </div> - <button class="btn btn-success" [disabled]="!loginForm.form.valid || isLoginInProgress"> - {{'authorization.signIn' | translate}} - </button> - </form> -</div> http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.less deleted file mode 100644 index f760ee8..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.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'; - -.login-form { - margin-top: @block-margin-top; -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.spec.ts deleted file mode 100644 index fd54fe6..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.spec.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 {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import {FormsModule} from '@angular/forms'; -import {HttpModule, Http} from '@angular/http'; -import {TranslateModule, TranslateLoader} from '@ngx-translate/core'; -import {TranslateHttpLoader} from '@ngx-translate/http-loader'; -import {StoreModule} from '@ngrx/store'; -import {AppStateService, appState} from '@app/services/storage/app-state.service'; -import {HttpClientService} from '@app/services/http-client.service'; - -import {LoginFormComponent} from './login-form.component'; - -export function HttpLoaderFactory(http: Http) { - return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); -} - -describe('LoginFormComponent', () => { - let component: LoginFormComponent; - let fixture: ComponentFixture<LoginFormComponent>; - - let authMock = { - isError: false - }; - const httpClient = { - isAuthorized: true, - postFormData: () => { - return { - subscribe: (success: () => void, error: () => void) => { - authMock.isError ? error() : success(); - } - } - } - }; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [LoginFormComponent], - imports: [ - HttpModule, - FormsModule, - TranslateModule.forRoot({ - provide: TranslateLoader, - useFactory: HttpLoaderFactory, - deps: [Http] - }), - StoreModule.provideStore({ - appState - }) - ], - providers: [ - AppStateService, - { - provide: HttpClientService, - useValue: httpClient - } - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(LoginFormComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create component', () => { - expect(component).toBeTruthy(); - }); - - describe('#login()', () => { - const cases = [ - { - isError: true, - isLoginAlertDisplayed: true, - isAuthorized: false, - title: 'login failure' - }, - { - isError: false, - isLoginAlertDisplayed: false, - isAuthorized: true, - title: 'login success' - } - ]; - - cases.forEach(test => { - describe(test.title, () => { - beforeEach(() => { - authMock.isError = test.isError; - component.login(); - }); - - it('isLoginAlertDisplayed', () => { - expect(component.isLoginAlertDisplayed).toEqual(test.isLoginAlertDisplayed); - }); - - it('isLoginInProgress', () => { - expect(component.isLoginInProgress).toEqual(false); - }); - }); - }); - - }); -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.ts deleted file mode 100644 index 2bc45404..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.ts +++ /dev/null @@ -1,59 +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 'rxjs/add/operator/finally'; -import {HttpClientService} from '@app/services/http-client.service'; -import {AppStateService} from '@app/services/storage/app-state.service'; - -@Component({ - selector: 'login-form', - templateUrl: './login-form.component.html', - styleUrls: ['./login-form.component.less'] -}) -export class LoginFormComponent { - - constructor(private httpClient: HttpClientService, private appState: AppStateService) { - appState.getParameter('isLoginInProgress').subscribe(value => this.isLoginInProgress = value); - } - - username: string; - - password: string; - - isLoginAlertDisplayed: boolean; - - isLoginInProgress: boolean; - - private setIsAuthorized(value: boolean): void { - this.appState.setParameters({ - isAuthorized: value, - isLoginInProgress: false - }); - this.isLoginAlertDisplayed = !value; - } - - login() { - this.appState.setParameter('isLoginInProgress', true); - this.httpClient.postFormData('login', { - username: this.username, - password: this.password - }).subscribe(() => this.setIsAuthorized(true), () => this.setIsAuthorized(false)); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.html deleted file mode 100644 index a43f6c0..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.html +++ /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. ---> - -<time-histogram class="col-md-12" [data]="histogramData" [customOptions]="histogramOptions"></time-histogram> -<dropdown-button class="pull-right" label="logs.columns" [options]="availableColumns | async" [isRightAlign]="true" - isMultipleChoice="true" action="updateSelectedColumns" - [additionalArgs]="logsTypeMapObject.fieldsModel"></dropdown-button> -<logs-list [logs]="logs | async" [totalCount]="totalCount" [displayedColumns]="displayedColumns"></logs-list> http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.less deleted file mode 100644 index 60082d6..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.less +++ /dev/null @@ -1,25 +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: block; - overflow: hidden; - padding-top: @block-margin-top; -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.spec.ts deleted file mode 100644 index 30c6a33..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.spec.ts +++ /dev/null @@ -1,102 +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 {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; -import {StoreModule} from '@ngrx/store'; -import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service'; -import {AppStateService, appState} from '@app/services/storage/app-state.service'; -import {ClustersService, clusters} from '@app/services/storage/clusters.service'; -import {ComponentsService, components} from '@app/services/storage/components.service'; -import {AuditLogsService, auditLogs} from '@app/services/storage/audit-logs.service'; -import {AuditLogsFieldsService, auditLogsFields} from '@app/services/storage/audit-logs-fields.service'; -import {ServiceLogsService, serviceLogs} from '@app/services/storage/service-logs.service'; -import {ServiceLogsFieldsService, serviceLogsFields} from '@app/services/storage/service-logs-fields.service'; -import {ServiceLogsHistogramDataService, serviceLogsHistogramData} from '@app/services/storage/service-logs-histogram-data.service'; -import {HostsService, hosts} from '@app/services/storage/hosts.service'; -import {HttpClientService} from '@app/services/http-client.service'; -import {FilteringService} from '@app/services/filtering.service'; -import {UtilsService} from '@app/services/utils.service'; -import {LogsContainerService} from '@app/services/logs-container.service'; - -import {LogsContainerComponent} from './logs-container.component'; - -describe('LogsContainerComponent', () => { - const httpClient = { - get: () => { - return { - subscribe: () => { - } - }; - } - }; - let component: LogsContainerComponent; - let fixture: ComponentFixture<LogsContainerComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [LogsContainerComponent], - imports: [ - StoreModule.provideStore({ - appSettings, - appState, - clusters, - components, - auditLogs, - auditLogsFields, - serviceLogs, - serviceLogsFields, - serviceLogsHistogramData, - hosts - }) - ], - providers: [ - { - provide: HttpClientService, - useValue: httpClient - }, - AppSettingsService, - AppStateService, - ClustersService, - ComponentsService, - AuditLogsService, - AuditLogsFieldsService, - ServiceLogsService, - ServiceLogsFieldsService, - ServiceLogsHistogramDataService, - HostsService, - FilteringService, - UtilsService, - LogsContainerService - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(LogsContainerComponent); - component = fixture.componentInstance; - component.logsType = 'serviceLogs'; - 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/logs-container/logs-container.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.ts deleted file mode 100644 index 3e2a6c7..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.ts +++ /dev/null @@ -1,105 +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'; -import {Observable} from 'rxjs/Observable'; -import 'rxjs/add/operator/map'; -import {FilteringService} from '@app/services/filtering.service'; -import {LogsContainerService} from '@app/services/logs-container.service'; -import {ServiceLogsHistogramDataService} from '@app/services/storage/service-logs-histogram-data.service'; -import {AppStateService} from '@app/services/storage/app-state.service'; -import {AuditLog} from '@app/models/audit-log.model'; -import {ServiceLog} from '@app/models/service-log.model'; -import {LogField} from '@app/models/log-field.model'; - -@Component({ - selector: 'logs-container', - templateUrl: './logs-container.component.html', - styleUrls: ['./logs-container.component.less'] -}) -export class LogsContainerComponent implements OnInit { - - constructor(private serviceLogsHistogramStorage: ServiceLogsHistogramDataService, private appState: AppStateService, private filtering: FilteringService, private logsContainer: LogsContainerService) { - serviceLogsHistogramStorage.getAll().subscribe(data => this.histogramData = this.logsContainer.getHistogramData(data)); - } - - ngOnInit() { - const fieldsModel = this.logsTypeMapObject.fieldsModel, - logsModel = this.logsTypeMapObject.logsModel; - this.appState.getParameter(this.logsTypeMapObject.isSetFlag).subscribe(value => this.isLogsSet = value); - this.availableColumns = fieldsModel.getAll().map(fields => { - return fields.filter(field => field.isAvailable).map(field => { - return { - value: field.name, - label: field.displayName || field.name, - isChecked: field.isDisplayed - }; - }); - }); - fieldsModel.getAll().subscribe(columns => { - const availableFields = columns.filter(field => field.isAvailable), - availableNames = availableFields.map(field => field.name); - if (availableNames.length && !this.isLogsSet) { - this.logs = logsModel.getAll().map(logs => logs.map(log => { - let logObject = availableNames.reduce((obj, key) => Object.assign(obj, { - [key]: log[key] - }), {}); - if (logObject.level) { - logObject.className = logObject.level.toLowerCase(); - } - return logObject; - })); - this.appState.setParameter(this.logsTypeMapObject.isSetFlag, true); - } - this.displayedColumns = columns.filter(column => column.isAvailable && column.isDisplayed); - }); - this.logsContainer.loadLogs(this.logsType); - this.filtersForm.valueChanges.subscribe(() => this.logsContainer.loadLogs(this.logsType)); - } - - @Input() - logsType: string; - - private isLogsSet: boolean = false; - - get logsTypeMapObject(): any { - return this.logsContainer.logsTypeMap[this.logsType]; - } - - get totalCount(): number { - return this.logsContainer.totalCount; - } - - logs: Observable<AuditLog[] | ServiceLog[]>; - - availableColumns: Observable<LogField[]>; - - displayedColumns: any[] = []; - - histogramData: any; - - readonly histogramOptions = { - keysWithColors: this.logsContainer.colors - }; - - private get filtersForm(): FormGroup { - return this.filtering.filtersForm; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.html deleted file mode 100644 index 888c524..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.html +++ /dev/null @@ -1,54 +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 *ngIf="logs && logs.length" [formGroup]="filtersForm" class="pull-right"> - <filter-dropdown [label]="filters.sorting.label" formControlName="sorting" [options]="filters.sorting.options" - [defaultLabel]="filters.sorting.defaultLabel" [isRightAlign]="true"></filter-dropdown> -</form> -<div class="col-md-12 text-center" *ngIf="logs && logs.length"> - <div class="logs-header"> - <div class="col-md-1">{{'logs.status' | translate}}</div> - <div class="col-md-11">{{'logs.details' | translate}}</div> - </div> -</div> -<accordion-panel *ngFor="let log of logs; let i = index" [toggleId]="'details-' + i" class="col-md-12"> - <ng-template> - <div *ngIf="isColumnDisplayed('level')" [ngClass]="'hexagon ' + log.className"></div> - <div *ngIf="isColumnDisplayed('level')" [ngClass]="'col-md-1 log-status ' + log.className">{{log.level}}</div> - <div *ngIf="isColumnDisplayed('type') || isColumnDisplayed('logtime')" class="col-md-3"> - <div *ngIf="isColumnDisplayed('type')" class="log-type">{{log.type}}</div> - <time *ngIf="isColumnDisplayed('logtime')" class="log-time"> - {{log.logtime | amTz: timeZone | amDateFormat: timeFormat}} - </time> - </div> - <div class="col-md-6 log-content-wrapper"> - <div class="collapse log-actions" attr.id="details-{{i}}"> - <span class="action-icon fa fa-search"></span> - <span class="action-icon fa fa-external-link"></span> - <span class="action-icon fa fa-bullseye"></span> - </div> - <div class="log-content-inner-wrapper"> - <div class="log-content" *ngIf="isColumnDisplayed('log_message')">{{log.log_message}}</div> - </div> - </div> - <div *ngFor="let column of displayedColumns"> - <div *ngIf="customStyledColumns.indexOf(column.name) === -1" [innerHTML]="log[column.name]" class="col-md-1"></div> - </div> - </ng-template> -</accordion-panel> -<pagination class="col-md-12" *ngIf="logs && logs.length" [totalCount]="totalCount" [filtersForm]="filtersForm" - [filterInstance]="filters.pageSize" [currentCount]="logs.length"></pagination> http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.less deleted file mode 100644 index 91d796f..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.less +++ /dev/null @@ -1,138 +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'; - -.logs-header { - // TODO get rid of magic numbers, base on actual design - margin: 10px 0; - padding: 5px 0; - background-color: @list-header-background-color; // TODO implement actual color - overflow: hidden; - text-transform: uppercase; -} - -/deep/ filter-dropdown { - justify-content: flex-end; -} - -.hexagon { - // TODO get rid of magic numbers, base on actual design - left: -7.5px; - - &.fatal { - .common-hexagon(15px, @fatal-color); - } - - &.error { - .common-hexagon(15px, @error-color); - } - - &.warn { - .common-hexagon(15px, @warning-color); - } - - &.info { - .common-hexagon(15px, @info-color); - } - - &.debug { - .common-hexagon(15px, @debug-color); - } - - &.trace { - .common-hexagon(15px, @trace-color); - } - - &.unknown { - .common-hexagon(15px, @unknown-color); - } -} - -.log-status { - text-transform: uppercase; - - &.fatal { - color: @fatal-color; - } - - &.error { - color: @error-color; - } - - &.warn { - color: @warning-color; - } - - &.info { - color: @info-color; - } - - &.debug { - color: @debug-color; - } - - &.trace { - color: @trace-color; - } - - &.unknown { - color: @unknown-color; - } -} - -.log-type { - color: @link-color; -} - -.log-time { - color: @grey-color; -} - -.log-content-wrapper { - position: relative; - - // TODO get rid of magic numbers, base on actual design - .log-content-inner-wrapper { - overflow: hidden; - max-height: @default-line-height * 2em; - padding-right: 65px; - - .log-content { - white-space: pre-wrap; - } - } - - .log-actions { - position: absolute; - right: 40px; - top: 0; - border: @input-border; - - &.collapsing + .log-content-inner-wrapper, &.collapse.in + .log-content-inner-wrapper { - min-height: 6em; - max-height: none; - overflow-x: auto; - } - - .action-icon { - .clickable-item; - display: block; - padding: 5px; - } - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.spec.ts deleted file mode 100644 index 02c3b23..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.spec.ts +++ /dev/null @@ -1,102 +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 {NO_ERRORS_SCHEMA} from '@angular/core'; -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 {MomentModule} from 'angular2-moment'; -import {MomentTimezoneModule} from 'angular-moment-timezone'; -import {AuditLogsService, auditLogs} from '@app/services/storage/audit-logs.service'; -import {ServiceLogsService, serviceLogs} from '@app/services/storage/service-logs.service'; -import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service'; -import {ClustersService, clusters} from '@app/services/storage/clusters.service'; -import {ComponentsService, components} from '@app/services/storage/components.service'; -import {HostsService, hosts} from '@app/services/storage/hosts.service'; -import {HttpClientService} from '@app/services/http-client.service'; -import {FilteringService} from '@app/services/filtering.service'; -import {UtilsService} from '@app/services/utils.service'; - -import {LogsListComponent} from './logs-list.component'; - -export function HttpLoaderFactory(http: Http) { - return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); -} - -describe('LogsListComponent', () => { - let component: LogsListComponent; - let fixture: ComponentFixture<LogsListComponent>; - const httpClient = { - get: () => { - return { - subscribe: () => { - } - }; - } - }; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [LogsListComponent], - imports: [ - StoreModule.provideStore({ - auditLogs, - serviceLogs, - appSettings, - clusters, - components, - hosts - }), - MomentModule, - MomentTimezoneModule, - TranslateModule.forRoot({ - provide: TranslateLoader, - useFactory: HttpLoaderFactory, - deps: [Http] - }) - ], - providers: [ - { - provide: HttpClientService, - useValue: httpClient - }, - AuditLogsService, - ServiceLogsService, - AppSettingsService, - ClustersService, - ComponentsService, - HostsService, - FilteringService, - UtilsService - ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(LogsListComponent); - 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/logs-list/logs-list.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.ts deleted file mode 100644 index 6d73dcb..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.ts +++ /dev/null @@ -1,62 +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'; -import {FormGroup} from '@angular/forms'; -import 'rxjs/add/operator/map'; -import {FilteringService} from '@app/services/filtering.service'; - -@Component({ - selector: 'logs-list', - templateUrl: './logs-list.component.html', - styleUrls: ['./logs-list.component.less'] -}) -export class LogsListComponent { - - constructor(private filtering: FilteringService) { - } - - @Input() - logs: any[] = []; - - @Input() - totalCount: number = 0; - - @Input() - displayedColumns: any[] = []; - - readonly customStyledColumns = ['level', 'type', 'logtime', 'log_message']; - - timeFormat: string = 'DD/MM/YYYY HH:mm:ss'; - - get timeZone(): string { - return this.filtering.timeZone; - } - - get filters(): any { - return this.filtering.filters; - } - - get filtersForm(): FormGroup { - return this.filtering.filtersForm; - } - - isColumnDisplayed(key: string): boolean { - return this.displayedColumns.some(column => column.name === key); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.html deleted file mode 100644 index 69b3887..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.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. ---> - -<ng-template [ngTemplateOutlet]="template"></ng-template> -<div *ngIf="isInitialLoading" class="text-center"> - <span class="fa fa-spinner fa-spin"></span> -</div> -<login-form *ngIf="!isInitialLoading && !isAuthorized"></login-form> -<filters-panel *ngIf="isAuthorized" class="row"></filters-panel> -<logs-container *ngIf="isAuthorized" logsType="serviceLogs"></logs-container> http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.less deleted file mode 100644 index 9736628..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.less +++ /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. - */ - -@import '../variables'; - -:host { - .full-size; - overflow-x: hidden; -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.spec.ts deleted file mode 100644 index 42fba68..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.spec.ts +++ /dev/null @@ -1,65 +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 {HttpModule} from '@angular/http'; -import {StoreModule} from '@ngrx/store'; -import {AppStateService, appState} from '@app/services/storage/app-state.service'; -import {AuditLogsFieldsService, auditLogsFields} from '@app/services/storage/audit-logs-fields.service'; -import {ServiceLogsFieldsService, serviceLogsFields} from '@app/services/storage/service-logs-fields.service'; -import {HttpClientService} from '@app/services/http-client.service'; - -import {MainContainerComponent} from './main-container.component'; - -describe('MainContainerComponent', () => { - let component: MainContainerComponent; - let fixture: ComponentFixture<MainContainerComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [MainContainerComponent], - imports: [ - HttpModule, - StoreModule.provideStore({ - appState, - auditLogsFields, - serviceLogsFields - }) - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - providers: [ - AppStateService, - AuditLogsFieldsService, - ServiceLogsFieldsService, - HttpClientService - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(MainContainerComponent); - 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/main-container/main-container.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.ts deleted file mode 100644 index 53d58cf..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.ts +++ /dev/null @@ -1,66 +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, ContentChild, TemplateRef} from '@angular/core'; -import {HttpClientService} from '@app/services/http-client.service'; -import {AppStateService} from '@app/services/storage/app-state.service'; -import {AuditLogsFieldsService} from '@app/services/storage/audit-logs-fields.service'; -import {ServiceLogsFieldsService} from '@app/services/storage/service-logs-fields.service'; -import {AuditLogField} from '@app/models/audit-log-field.model'; -import {ServiceLogField} from '@app/models/service-log-field.model'; - -@Component({ - selector: 'main-container', - templateUrl: './main-container.component.html', - styleUrls: ['./main-container.component.less'] -}) -export class MainContainerComponent { - - constructor(private httpClient: HttpClientService, private appState: AppStateService, private auditLogsFieldsStorage: AuditLogsFieldsService, private serviceLogsFieldsStorage: ServiceLogsFieldsService) { - this.loadColumnsNames(); - appState.getParameter('isAuthorized').subscribe(value => this.isAuthorized = value); - appState.getParameter('isInitialLoading').subscribe(value => this.isInitialLoading = value); - } - - @ContentChild(TemplateRef) - template; - - isAuthorized: boolean = false; - - isInitialLoading: boolean = false; - - private loadColumnsNames(): void { - this.httpClient.get('serviceLogsFields').subscribe(response => { - const jsonResponse = response.json(); - if (jsonResponse) { - this.serviceLogsFieldsStorage.addInstances(this.getColumnsArray(jsonResponse, ServiceLogField)); - } - }); - this.httpClient.get('auditLogsFields').subscribe(response => { - const jsonResponse = response.json(); - if (jsonResponse) { - this.auditLogsFieldsStorage.addInstances(this.getColumnsArray(jsonResponse, AuditLogField)); - } - }); - } - - private getColumnsArray(keysObject: any, fieldClass: any): any[] { - return Object.keys(keysObject).map(key => new fieldClass(key)); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.html deleted file mode 100644 index 2f05656..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.html +++ /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. ---> - -<div #dropdown [ngClass]="{'dropdown': hasSubItems, 'text-center': true}"> - <a [ngClass]="iconClass + ' icon'" (mousedown)="onMouseDown($event)" (mouseup)="onMouseUp($event)" - (click)="$event.stopPropagation()"></a> - <a #dropdownToggle class="dropdown-toggle caret" data-toggle="dropdown" *ngIf="hasCaret"></a> - <br> - <a *ngIf="label" (mousedown)="onMouseDown($event)" [ngClass]="labelClass" (mouseup)="onMouseUp($event)" - (click)="$event.stopPropagation()">{{label | translate}}</a> - <ul data-component="dropdown-list" *ngIf="hasSubItems" [items]="subItems" (selectedItemChange)="updateValue($event)" - [isMultipleChoice]="isMultipleChoice" [additionalLabelComponentSetter]="additionalLabelComponentSetter" - [ngClass]="{'dropdown-menu': true, 'dropdown-menu-right': isRightAlign}"></ul> -</div> http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.less deleted file mode 100644 index 6a3a43d..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.less +++ /dev/null @@ -1,33 +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. - */ - -:host { - display: inline-block; - cursor: pointer; - - a:hover, a:focus { - text-decoration: none; - } - - .icon { - padding: 5px; - } - - .unstyled-link { - color: inherit; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.spec.ts deleted file mode 100644 index 6c9e021..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.spec.ts +++ /dev/null @@ -1,133 +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 {NO_ERRORS_SCHEMA} from '@angular/core'; -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 {FilteringService} from '@app/services/filtering.service'; - -import {MenuButtonComponent} from './menu-button.component'; - -export function HttpLoaderFactory(http: Http) { - return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); -} - -describe('MenuButtonComponent', () => { - let component: MenuButtonComponent; - let fixture: ComponentFixture<MenuButtonComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [MenuButtonComponent], - imports: [ - StoreModule.provideStore({ - appSettings - }), - TranslateModule.forRoot({ - provide: TranslateLoader, - useFactory: HttpLoaderFactory, - deps: [Http] - }) - ], - providers: [ - AppSettingsService, - ComponentActionsService, - FilteringService - ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(MenuButtonComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create component', () => { - expect(component).toBeTruthy(); - }); - - describe('#hasSubItems', () => { - const cases = [ - { - subItems: null, - hasSubItems: false, - title: 'no sub-items' - }, - { - subItems: [], - hasSubItems: false, - title: 'empty sub-items array' - }, - { - subItems: [{}], - hasSubItems: true, - title: 'sub-items present' - } - ]; - - cases.forEach((test) => { - it(test.title, () => { - component.subItems = test.subItems; - expect(component.hasSubItems).toEqual(test.hasSubItems); - }); - }); - }); - - describe('#hasCaret', () => { - const cases = [ - { - subItems: null, - hasCaret: false, - title: 'no sub-items' - }, - { - subItems: [], - hasCaret: false, - title: 'empty sub-items array' - }, - { - subItems: [{}], - hideCaret: false, - hasCaret: true, - title: 'sub-items present, caret not hidden' - }, - { - subItems: [{}], - hideCaret: true, - hasCaret: true, - title: 'sub-items present, caret hidden' - } - ]; - - cases.forEach((test) => { - it(test.title, () => { - component.subItems = test.subItems; - component.hideCaret = Boolean(test.hideCaret); - expect(component.hasSubItems).toEqual(test.hasCaret); - }); - }); - }); -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.ts deleted file mode 100644 index b674ec6..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/menu-button/menu-button.component.ts +++ /dev/null @@ -1,97 +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, ViewChild, ElementRef} from '@angular/core'; -import {ComponentActionsService} from '@app/services/component-actions.service'; -import * as $ from 'jquery'; - -@Component({ - selector: 'menu-button', - templateUrl: './menu-button.component.html', - styleUrls: ['./menu-button.component.less'] -}) -export class MenuButtonComponent { - - constructor(protected actions: ComponentActionsService) { - } - - @ViewChild('dropdown') - dropdown: ElementRef; - - @Input() - label?: string; - - @Input() - action: string; - - @Input() - iconClass: string; - - @Input() - labelClass?: string; - - @Input() - subItems?: any[]; - - @Input() - isMultipleChoice: boolean = false; - - @Input() - hideCaret: boolean = false; - - @Input() - isRightAlign: boolean = false; - - @Input() - additionalLabelComponentSetter?: string; - - get hasSubItems(): boolean { - return Boolean(this.subItems && this.subItems.length); - } - - get hasCaret(): boolean { - return this.hasSubItems && !this.hideCaret; - } - - private clickStartTime: number; - - private readonly longClickInterval = 1000; - - onMouseDown(event: MouseEvent): void { - if (this.action && event.button === 0) { - this.clickStartTime = (new Date()).getTime(); - } - } - - onMouseUp(event: MouseEvent): void { - if (event.button === 0) { - const clickEndTime = (new Date()).getTime(); - if (this.hasSubItems && (!this.action || clickEndTime - this.clickStartTime >= this.longClickInterval)) { - $(this.dropdown.nativeElement).toggleClass('open'); - } else if (this.action) { - this.actions[this.action](); - } - event.stopPropagation(); - } - } - - updateValue(options: any) { - // TODO implement value change behaviour - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/modal/modal.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/modal/modal.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/modal/modal.component.html deleted file mode 100644 index abd7bc8..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/modal/modal.component.html +++ /dev/null @@ -1,40 +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 class="modal-backdrop in"></div> -<div class="modal in"> - <div [ngClass]="{'modal-dialog': true, 'modal-sm': isSmallModal, 'modal-lg': isLargeModal}"> - <div class="modal-content"> - <div *ngIf="showHeader" class="modal-header"> - <button *ngIf="showCloseButton" type="button" class="close" data-dismiss="modal" (click)="onClose()"> - <span>×</span> - </button> - <h4 *ngIf="title">{{title}}</h4> - </div> - <div class="modal-body"> - <div *ngIf="bodyText">{{bodyText}}</div> - <ng-template *ngIf="bodyTemplate" [ngTemplateOutlet]="bodyTemplate"></ng-template> - </div> - <div *ngIf="showFooter" class="modal-footer"> - <button *ngIf="showCancelButton" class="btn {{cancelButtonClassName}}" - (click)="onCancel()">{{cancelButtonLabel | translate}}</button> - <button *ngIf="showSubmitButton" class="btn {{submitButtonClassName}}" - (click)="onSubmit()">{{submitButtonLabel | translate}}</button> - </div> - </div> - </div> -</div> http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web-new/src/app/components/modal/modal.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/modal/modal.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/modal/modal.component.spec.ts deleted file mode 100644 index 802bd13..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/modal/modal.component.spec.ts +++ /dev/null @@ -1,57 +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 {ModalComponent} from './modal.component'; - -export function HttpLoaderFactory(http: Http) { - return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); -} - -describe('ModalComponent', () => { - let component: ModalComponent; - let fixture: ComponentFixture<ModalComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ModalComponent], - imports: [ - TranslateModule.forRoot({ - provide: TranslateLoader, - useFactory: HttpLoaderFactory, - deps: [Http] - }) - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ModalComponent); - 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/modal/modal.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/modal/modal.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/modal/modal.component.ts deleted file mode 100644 index 32f59f6..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/modal/modal.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, AfterViewInit, ElementRef, Input, Output, ContentChild, TemplateRef, EventEmitter} from '@angular/core'; -import * as $ from 'jquery'; - -@Component({ - selector: 'modal', - templateUrl: './modal.component.html' -}) -export class ModalComponent implements OnInit, AfterViewInit { - - constructor(private element: ElementRef) { - this.rootElement = $(this.element.nativeElement); - } - - ngOnInit() { - this.modalElements = this.rootElement.find('.in'); - this.show(); - } - - ngAfterViewInit() { - this.init.emit(); - } - - private rootElement: JQuery; - - private modalElements: JQuery; - - @Input() - showHeader: boolean = true; - - @Input() - title: string = ''; - - @Input() - showCloseButton: boolean = true; - - @Input() - bodyText: string = ''; - - @Input() - showFooter: boolean = true; - - @Input() - showSubmitButton: boolean = true; - - @Input() - submitButtonLabel: string = 'modal.submit'; - - @Input() - submitButtonClassName: string = 'btn-success'; - - @Input() - showCancelButton: boolean = true; - - @Input() - cancelButtonLabel: string = 'modal.cancel'; - - @Input() - cancelButtonClassName: string = 'btn-default'; - - @Input() - isSmallModal: boolean = false; - - @Input() - isLargeModal: boolean = false; - - @ContentChild(TemplateRef) - bodyTemplate; - - @Output() - init: EventEmitter<any> = new EventEmitter(); - - @Output() - submit: EventEmitter<any> = new EventEmitter(); - - @Output() - cancel: EventEmitter<any> = new EventEmitter(); - - @Output() - close: EventEmitter<any> = new EventEmitter(); - - show(): void { - this.modalElements.show(); - } - - hide(): void { - this.modalElements.hide(); - } - - onSubmit(): void { - this.hide(); - this.submit.emit(); - } - - onCancel(): void { - this.hide(); - this.cancel.emit(); - } - - onClose(): void { - this.hide(); - this.close.emit(); - } - -} 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.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/node-bar/node-bar.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/node-bar/node-bar.component.html deleted file mode 100644 index 96c8619..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/node-bar/node-bar.component.html +++ /dev/null @@ -1,19 +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 *ngFor="let item of data" class="bar-sector" - [ngStyle]="{'background-color': item.color, 'width': (item.value / totalCount * 100) + '%'}"></div> 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.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/node-bar/node-bar.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/node-bar/node-bar.component.less deleted file mode 100644 index b78b847..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/node-bar/node-bar.component.less +++ /dev/null @@ -1,39 +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. - */ - -@bar-height: 8px; - -:host { - display: block; - width: 100%; - - .bar-sector { - display: inline-block; - height: @bar-height; - - &:first-child { - border-top-left-radius: @bar-height / 2; - border-bottom-left-radius: @bar-height / 2; - } - - &:last-child { - border-top-right-radius: @bar-height / 2; - border-bottom-right-radius: @bar-height / 2; - } - } -}