Repository: ambari Updated Branches: refs/heads/branch-feature-logsearch-ui 4bfc6f13e -> ed660940a
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.html deleted file mode 100644 index 827f63c..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.html +++ /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. ---> - -<accordion-panel *ngFor="let log of logs | async; let i = index" [toggleId]="'details-' + i" class="col-md-12"> - <ng-template> - <div [ngClass]="'hexagon ' + log.className"></div> - <div [ngClass]="'col-md-1 log-status ' + log.className">{{log.level}}</div> - <div class="col-md-3"> - <div class="log-type">{{log.type}}</div> - <time class="log-time">{{log.time}}</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">{{log.message}}</div> - </div> - </ng-template> -</accordion-panel> http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.less deleted file mode 100644 index 6ed0463..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.less +++ /dev/null @@ -1,128 +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; - background-color: @main-background-color; // TODO implement actual color - - .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 { - overflow: hidden; - max-height: @default-line-height * 2em; - padding-right: 65px; - white-space: pre-wrap; - } - - .log-actions { - position: absolute; - right: 40px; - top: 0; - border: @input-border; - - &.collapsing + .log-content, &.collapse.in + .log-content { - min-height: 6em; - max-height: none; - } - - .action-icon { - .clickable-item; - display: block; - padding: 5px; - } - } - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.spec.ts deleted file mode 100644 index 072bfcd..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.spec.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 {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import {StoreModule} from '@ngrx/store'; -import {AuditLogsService, auditLogs} from '@app/services/storage/audit-logs.service'; -import {ServiceLogsService, serviceLogs} from '@app/services/storage/service-logs.service'; -import {HttpClientService} from '@app/services/http-client.service'; -import {FilteringService} from '@app/services/filtering.service'; - -import {LogsListComponent} from './logs-list.component'; - -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 - }) - ], - providers: [ - { - provide: HttpClientService, - useValue: httpClient - }, - AuditLogsService, - ServiceLogsService, - FilteringService - ], - schemas: [CUSTOM_ELEMENTS_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/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.ts deleted file mode 100644 index 6bc5ab9..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/logs-list/logs-list.component.ts +++ /dev/null @@ -1,96 +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 'rxjs/add/operator/map'; -import {HttpClientService} from '@app/services/http-client.service'; -import {ServiceLogsService} from '@app/services/storage/service-logs.service'; -import {FilteringService} from '@app/services/filtering.service'; - -@Component({ - selector: 'logs-list', - templateUrl: './logs-list.component.html', - styleUrls: ['./logs-list.component.less'] -}) -export class LogsListComponent implements OnInit { - - constructor(private httpClient: HttpClientService, private serviceLogsStorage: ServiceLogsService, private filtering: FilteringService) { - this.filtering.filteringSubject.subscribe(this.loadLogs.bind(this)); - } - - ngOnInit() { - this.loadLogs(); - } - - @Input() - private logsArrayId: string; - - private readonly usedFilters = { - clusters: ['clusters'], - text: ['iMessage'], - timeRange: ['end_time', 'start_time'], - components: ['component_name'], - levels: ['level'] - }; - - private logs = this.serviceLogsStorage.getInstances().map(logs => { - return logs.map(log => { - return { - type: log.type, - level: log.level, - className: log.level.toLowerCase(), - message: log.log_message, - time: new Date(log.logtime).toLocaleDateString() + ' ' + new Date(log.logtime).toLocaleTimeString() // TODO use moment with custom time zone - } - }); - }); - - private loadLogs(): void { - this.httpClient.get(this.logsArrayId, this.getParams()).subscribe(response => { - this.serviceLogsStorage.clear(); - const logs = response.json().logList; - this.serviceLogsStorage.addInstances(logs); - }); - } - - private getParams(): any { - let params = {}; - Object.keys(this.usedFilters).forEach(key => { - const inputFilter = this.filtering.filters[key], - inputValue = inputFilter.selectedValue, - paramNames = this.usedFilters[key]; - paramNames.forEach(paramName => { - let value; - const valueGetter = this.filtering.valueGetters[paramName]; - if (valueGetter) { - if (paramName === 'start_time') { - value = valueGetter(inputValue, params['end_time']); - } else { - value = valueGetter(inputValue); - } - } else { - value = inputValue; - } - if (value) { - params[paramName] = value; - } - }); - }, this); - return params; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/main-container/main-container.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/main-container/main-container.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/main-container/main-container.component.html deleted file mode 100644 index 61562d2..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/main-container/main-container.component.html +++ /dev/null @@ -1,20 +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. ---> - -<login-form *ngIf="!httpClient.isAuthorized"></login-form> -<filters-panel *ngIf="httpClient.isAuthorized" class="row"></filters-panel> -<logs-list *ngIf="httpClient.isAuthorized" [logsArrayId]="'serviceLogs'"></logs-list> http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/main-container/main-container.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/main-container/main-container.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/main-container/main-container.component.spec.ts deleted file mode 100644 index 536f1ef..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/main-container/main-container.component.spec.ts +++ /dev/null @@ -1,49 +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 {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], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - providers: [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/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/main-container/main-container.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/main-container/main-container.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/main-container/main-container.component.ts deleted file mode 100644 index d2e6a7f..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/main-container/main-container.component.ts +++ /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. - */ - -import {Component, OnInit} from '@angular/core'; -import {HttpClientService} from '@app/services/http-client.service'; - -@Component({ - selector: 'main-container', - templateUrl: './main-container.component.html' -}) -export class MainContainerComponent implements OnInit { - - constructor(private httpClient: HttpClientService) {} - - ngOnInit() { - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.html deleted file mode 100644 index 132d717..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.html +++ /dev/null @@ -1,27 +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 class="dropdown-menu" [isFilter]="isFilter" *ngIf="hasSubItems" [items]="subItems" - (selectedItemChange)="setSelectedValue($event)"></ul> -</div> http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.less deleted file mode 100644 index 6a3a43d..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/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/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.spec.ts deleted file mode 100644 index 424d322..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.spec.ts +++ /dev/null @@ -1,126 +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 {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: [ - TranslateModule.forRoot({ - provide: TranslateLoader, - useFactory: HttpLoaderFactory, - deps: [Http] - })], - providers: [ - 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/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.ts deleted file mode 100644 index ded01b7..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.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 {Component, AfterViewInit, Input, ViewChild, ElementRef} from '@angular/core'; -import {ComponentActionsService} from '@app/services/component-actions.service'; -import {FilteringService} from '@app/services/filtering.service'; -import * as $ from 'jquery'; - -@Component({ - selector: 'menu-button', - templateUrl: './menu-button.component.html', - styleUrls: ['./menu-button.component.less'] -}) -export class MenuButtonComponent implements AfterViewInit { - - constructor(private actions: ComponentActionsService, private filtering: FilteringService) { - } - - ngAfterViewInit() { - } - - @ViewChild('dropdown') - dropdown: ElementRef; - - @Input() - label?: string; - - @Input() - action: string; - - @Input() - isFilter: boolean; - - @Input() - filterInstance?: any; - - @Input() - iconClass: string; - - @Input() - labelClass?: string; - - @Input() - subItems?: any[]; - - @Input() - hideCaret?: boolean; - - 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(); - } - } - - setSelectedValue(options: any): void { - if (this.filterInstance.selectedValue !== options.value) { - this.filterInstance.selectedValue = options.value; - this.filterInstance.selectedLabel = options.label; - this.filtering.filteringSubject.next(null); - } - }; - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/top-menu/top-menu.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/top-menu/top-menu.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/top-menu/top-menu.component.html deleted file mode 100644 index 6898354..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/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/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/top-menu/top-menu.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/top-menu/top-menu.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/top-menu/top-menu.component.less deleted file mode 100644 index e5e85f4..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/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/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/top-menu/top-menu.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/top-menu/top-menu.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/top-menu/top-menu.component.spec.ts deleted file mode 100644 index 1649a50..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/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/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/top-menu/top-menu.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/top-menu/top-menu.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/top-menu/top-menu.component.ts deleted file mode 100644 index 73b6131..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/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/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/variables.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/variables.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/variables.less deleted file mode 100644 index 9a8ea09..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/variables.less +++ /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. - */ - -// 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 12px; -@block-margin-top: 20px; -@link-color: #1491C1; -@link-hover-color: #23527C; -@grey-color: #666; -@default-line-height: 1.42857143; -@main-background-color: #ECECEC; - -@fatal-color: #830A0A; -@error-color: #E81D1D; -@warning-color: #FF8916; -@info-color: #2577B5; -@debug-color: #65E8FF; -@trace-color: #888; -@unknown-color: #BDBDBD; - -// 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; - } -}
