Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D093E2004F1 for ; Wed, 30 Aug 2017 14:41:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CF42B168ED7; Wed, 30 Aug 2017 12:41:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3B1B3168EBD for ; Wed, 30 Aug 2017 14:41:21 +0200 (CEST) Received: (qmail 7914 invoked by uid 500); 30 Aug 2017 12:41:15 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 5952 invoked by uid 99); 30 Aug 2017 12:41:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Aug 2017 12:41:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 41D90F5594; Wed, 30 Aug 2017 12:41:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ababiichuk@apache.org To: commits@ambari.apache.org Date: Wed, 30 Aug 2017 12:41:33 -0000 Message-Id: <77eb1d26f4de445f9b39697185eb92b1@git.apache.org> In-Reply-To: <3a8849d216a74c388eac4c1acbb06769@git.apache.org> References: <3a8849d216a74c388eac4c1acbb06769@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [23/50] [abbrv] ambari git commit: AMBARI-21342 Log Search UI: production build doesn't work. (ababiichuk) archived-at: Wed, 30 Aug 2017 12:41:23 -0000 AMBARI-21342 Log Search UI: production build doesn't work. (ababiichuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ed660940 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ed660940 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ed660940 Branch: refs/heads/trunk Commit: ed660940aaa2ad3a37bb2713c515db775c3a7ed3 Parents: 4bfc6f1 Author: ababiichuk Authored: Mon Jun 26 15:57:20 2017 +0300 Committer: ababiichuk Committed: Mon Jun 26 15:57:20 2017 +0300 ---------------------------------------------------------------------- .../accordion-panel.component.html | 25 ---- .../accordion-panel.component.less | 42 ------ .../accordion-panel.component.spec.ts | 42 ------ .../accordion-panel.component.ts | 38 ------ .../src/app/app.component.html | 32 ----- .../src/app/app.component.less | 47 ------- .../src/app/app.component.spec.ts | 59 --------- .../src/app/app.component.ts | 39 ------ .../src/app/app.module.ts | 22 ++-- .../accordion-panel.component.html | 25 ++++ .../accordion-panel.component.less | 42 ++++++ .../accordion-panel.component.spec.ts | 42 ++++++ .../accordion-panel.component.ts | 38 ++++++ .../src/app/components/app.component.html | 32 +++++ .../src/app/components/app.component.less | 47 +++++++ .../src/app/components/app.component.spec.ts | 59 +++++++++ .../src/app/components/app.component.ts | 43 +++++++ .../dropdown-list/dropdown-list.component.html | 20 +++ .../dropdown-list/dropdown-list.component.less | 22 ++++ .../dropdown-list.component.spec.ts | 92 +++++++++++++ .../dropdown-list/dropdown-list.component.ts | 51 ++++++++ .../filter-dropdown.component.html | 23 ++++ .../filter-dropdown.component.less | 31 +++++ .../filter-dropdown.component.spec.ts | 97 ++++++++++++++ .../filter-dropdown.component.ts | 50 ++++++++ .../filter-text-field.component.html | 21 +++ .../filter-text-field.component.less | 33 +++++ .../filter-text-field.component.spec.ts | 63 +++++++++ .../filter-text-field.component.ts | 41 ++++++ .../filters-panel/filters-panel.component.html | 38 ++++++ .../filters-panel/filters-panel.component.less | 45 +++++++ .../filters-panel.component.spec.ts | 59 +++++++++ .../filters-panel/filters-panel.component.ts | 39 ++++++ .../login-form/login-form.component.html | 33 +++++ .../login-form/login-form.component.less | 22 ++++ .../login-form/login-form.component.spec.ts | 121 ++++++++++++++++++ .../login-form/login-form.component.ts | 60 +++++++++ .../logs-list/logs-list.component.html | 35 +++++ .../logs-list/logs-list.component.less | 128 +++++++++++++++++++ .../logs-list/logs-list.component.spec.ts | 72 +++++++++++ .../components/logs-list/logs-list.component.ts | 96 ++++++++++++++ .../main-container.component.html | 20 +++ .../main-container.component.spec.ts | 49 +++++++ .../main-container/main-container.component.ts | 37 ++++++ .../menu-button/menu-button.component.html | 27 ++++ .../menu-button/menu-button.component.less | 33 +++++ .../menu-button/menu-button.component.spec.ts | 126 ++++++++++++++++++ .../menu-button/menu-button.component.ts | 102 +++++++++++++++ .../components/top-menu/top-menu.component.html | 21 +++ .../components/top-menu/top-menu.component.less | 22 ++++ .../top-menu/top-menu.component.spec.ts | 45 +++++++ .../components/top-menu/top-menu.component.ts | 122 ++++++++++++++++++ .../src/app/components/variables.less | 87 +++++++++++++ .../dropdown-list/dropdown-list.component.html | 20 --- .../dropdown-list/dropdown-list.component.less | 22 ---- .../dropdown-list.component.spec.ts | 92 ------------- .../dropdown-list/dropdown-list.component.ts | 51 -------- .../filter-dropdown.component.html | 23 ---- .../filter-dropdown.component.less | 31 ----- .../filter-dropdown.component.spec.ts | 97 -------------- .../filter-dropdown.component.ts | 50 -------- .../filter-text-field.component.html | 21 --- .../filter-text-field.component.less | 33 ----- .../filter-text-field.component.spec.ts | 63 --------- .../filter-text-field.component.ts | 41 ------ .../filters-panel/filters-panel.component.html | 38 ------ .../filters-panel/filters-panel.component.less | 45 ------- .../filters-panel.component.spec.ts | 59 --------- .../filters-panel/filters-panel.component.ts | 35 ----- .../app/login-form/login-form.component.html | 33 ----- .../app/login-form/login-form.component.less | 22 ---- .../app/login-form/login-form.component.spec.ts | 121 ------------------ .../src/app/login-form/login-form.component.ts | 60 --------- .../src/app/logs-list/logs-list.component.html | 35 ----- .../src/app/logs-list/logs-list.component.less | 128 ------------------- .../app/logs-list/logs-list.component.spec.ts | 72 ----------- .../src/app/logs-list/logs-list.component.ts | 96 -------------- .../main-container.component.html | 20 --- .../main-container.component.spec.ts | 49 ------- .../main-container/main-container.component.ts | 33 ----- .../app/menu-button/menu-button.component.html | 27 ---- .../app/menu-button/menu-button.component.less | 33 ----- .../menu-button/menu-button.component.spec.ts | 126 ------------------ .../app/menu-button/menu-button.component.ts | 102 --------------- .../src/app/top-menu/top-menu.component.html | 21 --- .../src/app/top-menu/top-menu.component.less | 22 ---- .../src/app/top-menu/top-menu.component.spec.ts | 45 ------- .../src/app/top-menu/top-menu.component.ts | 122 ------------------ .../src/app/variables.less | 87 ------------- 89 files changed, 2322 insertions(+), 2310 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.html deleted file mode 100644 index b2ce3a0..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.html +++ /dev/null @@ -1,25 +0,0 @@ - - -
-
- -
- -
-
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.less deleted file mode 100644 index 8366952..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.less +++ /dev/null @@ -1,42 +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'; - -.panel-body { - position: relative; - - .accordion-toggle { - position: absolute; - - // TODO get rid of magic numbers, base on actual design - right: 10px; - top: 15px; - - .toggle-icon { - .clickable-item; - - &:before { - content: '\F077'; - } - - &.collapsed:before { - content: '\F078'; - } - } - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.spec.ts deleted file mode 100644 index 3706d51..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.spec.ts +++ /dev/null @@ -1,42 +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 {AccordionPanelComponent} from './accordion-panel.component'; - -describe('AccordionPanelComponent', () => { - let component: AccordionPanelComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [AccordionPanelComponent] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(AccordionPanelComponent); - 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/accordion-panel/accordion-panel.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.ts deleted file mode 100644 index e48349e..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/accordion-panel/accordion-panel.component.ts +++ /dev/null @@ -1,38 +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, ContentChild, TemplateRef} from '@angular/core'; - -@Component({ - selector: 'accordion-panel', - templateUrl: './accordion-panel.component.html', - styleUrls: ['./accordion-panel.component.less'] -}) -export class AccordionPanelComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - - @Input() - private toggleId: string; - - @ContentChild(TemplateRef) - private template; - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.html deleted file mode 100644 index 267e08b..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.html +++ /dev/null @@ -1,32 +0,0 @@ - - -
- -
- - - - - http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.less deleted file mode 100644 index f948b12..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.less +++ /dev/null @@ -1,47 +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 { - line-height: @default-line-height; - - .navbar { - margin-bottom: 0; - border-radius: 0; - background-color: @navbar-background-color; - color: #fff; - - .container-fluid { - .default-flex; - } - - h1 { - flex-basis: 70%; - margin-bottom: @h1-vertical-margin; - text-transform: uppercase; - - &.full-flex-width { - flex-basis: 100%; - } - } - - /deep/ top-menu { - flex-basis: 30%; - } - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.spec.ts deleted file mode 100644 index 96cb0b4..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.spec.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 {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; -import {TestBed, async} from '@angular/core/testing'; -import {Http} from '@angular/http'; -import {TranslateModule, TranslateLoader} from '@ngx-translate/core'; -import {TranslateHttpLoader} from '@ngx-translate/http-loader'; -import {HttpClientService} from './services/http-client.service'; - -import {AppComponent} from './app.component'; - -export function HttpLoaderFactory(http: Http) { - return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); -} - -describe('AppComponent', () => { - beforeEach(async(() => { - const httpClient = { - get: () => {} - }; - TestBed.configureTestingModule({ - declarations: [AppComponent], - imports: [TranslateModule.forRoot({ - provide: TranslateLoader, - useFactory: HttpLoaderFactory, - deps: [Http] - })], - providers: [ - { - provide: HttpClientService, - useValue: httpClient - }, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }).compileComponents(); - })); - - it('should create the app', async(() => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app).toBeTruthy(); - })); -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.ts deleted file mode 100644 index e86a8a1..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.ts +++ /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. - */ - -import {Component} from '@angular/core'; -import {TranslateService} from '@ngx-translate/core'; -import {HttpClientService} from '@app/services/http-client.service'; - -@Component({ - selector: 'app-root', - templateUrl: './app.component.html', - styleUrls: ['./app.component.less'] -}) - -export class AppComponent { - - constructor(private httpClient: HttpClientService, private translate: TranslateService) { - translate.setDefaultLang('en'); - translate.use('en'); - } - - ngOnInit() { - this.httpClient.get('status'); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/app.module.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/app.module.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/app.module.ts index 6670082..a095a97 100644 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/app.module.ts +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/app.module.ts @@ -39,17 +39,17 @@ import {NodesService, nodes} from '@app/services/storage/nodes.service'; import {UserConfigsService, userConfigs} from '@app/services/storage/user-configs.service'; import {FiltersService, filters} from '@app/services/storage/filters.service'; -import {AppComponent} from '@app/app.component'; -import {LoginFormComponent} from '@app/login-form/login-form.component'; -import {TopMenuComponent} from '@app/top-menu/top-menu.component'; -import {MenuButtonComponent} from '@app/menu-button/menu-button.component'; -import {MainContainerComponent} from '@app/main-container/main-container.component'; -import {FiltersPanelComponent} from '@app/filters-panel/filters-panel.component'; -import {FilterDropdownComponent} from '@app/filter-dropdown/filter-dropdown.component'; -import {DropdownListComponent} from '@app/dropdown-list/dropdown-list.component'; -import {FilterTextFieldComponent} from '@app/filter-text-field/filter-text-field.component'; -import {AccordionPanelComponent} from '@app/accordion-panel/accordion-panel.component'; -import {LogsListComponent} from '@app/logs-list/logs-list.component'; +import {AppComponent} from '@app/components/app.component'; +import {LoginFormComponent} from '@app/components/login-form/login-form.component'; +import {TopMenuComponent} from '@app/components/top-menu/top-menu.component'; +import {MenuButtonComponent} from '@app/components/menu-button/menu-button.component'; +import {MainContainerComponent} from '@app/components/main-container/main-container.component'; +import {FiltersPanelComponent} from '@app/components/filters-panel/filters-panel.component'; +import {FilterDropdownComponent} from '@app/components/filter-dropdown/filter-dropdown.component'; +import {DropdownListComponent} from '@app/components/dropdown-list/dropdown-list.component'; +import {FilterTextFieldComponent} from '@app/components/filter-text-field/filter-text-field.component'; +import {AccordionPanelComponent} from '@app/components/accordion-panel/accordion-panel.component'; +import {LogsListComponent} from '@app/components/logs-list/logs-list.component'; export function HttpLoaderFactory(http: Http) { // adding 'static' parameter to step over mock data request http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.html new file mode 100644 index 0000000..b2ce3a0 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.html @@ -0,0 +1,25 @@ + + +
+
+ +
+ +
+
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.less new file mode 100644 index 0000000..8366952 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.less @@ -0,0 +1,42 @@ +/** + * 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'; + +.panel-body { + position: relative; + + .accordion-toggle { + position: absolute; + + // TODO get rid of magic numbers, base on actual design + right: 10px; + top: 15px; + + .toggle-icon { + .clickable-item; + + &:before { + content: '\F077'; + } + + &.collapsed:before { + content: '\F078'; + } + } + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.spec.ts new file mode 100644 index 0000000..3706d51 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.spec.ts @@ -0,0 +1,42 @@ +/** + * 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 {AccordionPanelComponent} from './accordion-panel.component'; + +describe('AccordionPanelComponent', () => { + let component: AccordionPanelComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [AccordionPanelComponent] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AccordionPanelComponent); + 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/components/accordion-panel/accordion-panel.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.ts new file mode 100644 index 0000000..85031b6 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/accordion-panel/accordion-panel.component.ts @@ -0,0 +1,38 @@ +/** + * 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, ContentChild, TemplateRef} from '@angular/core'; + +@Component({ + selector: 'accordion-panel', + templateUrl: './accordion-panel.component.html', + styleUrls: ['./accordion-panel.component.less'] +}) +export class AccordionPanelComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + + @Input() + toggleId: string; + + @ContentChild(TemplateRef) + template; + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.html new file mode 100644 index 0000000..5add5d5 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.html @@ -0,0 +1,32 @@ + + +
+ +
+ + + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.less new file mode 100644 index 0000000..f948b12 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.less @@ -0,0 +1,47 @@ +/** + * 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 { + line-height: @default-line-height; + + .navbar { + margin-bottom: 0; + border-radius: 0; + background-color: @navbar-background-color; + color: #fff; + + .container-fluid { + .default-flex; + } + + h1 { + flex-basis: 70%; + margin-bottom: @h1-vertical-margin; + text-transform: uppercase; + + &.full-flex-width { + flex-basis: 100%; + } + } + + /deep/ top-menu { + flex-basis: 30%; + } + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.spec.ts new file mode 100644 index 0000000..3442132 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.spec.ts @@ -0,0 +1,59 @@ +/** + * 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 {TestBed, async} from '@angular/core/testing'; +import {Http} from '@angular/http'; +import {TranslateModule, TranslateLoader} from '@ngx-translate/core'; +import {TranslateHttpLoader} from '@ngx-translate/http-loader'; +import {HttpClientService} from '@app/services/http-client.service'; + +import {AppComponent} from './app.component'; + +export function HttpLoaderFactory(http: Http) { + return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); +} + +describe('AppComponent', () => { + beforeEach(async(() => { + const httpClient = { + get: () => {} + }; + TestBed.configureTestingModule({ + declarations: [AppComponent], + imports: [TranslateModule.forRoot({ + provide: TranslateLoader, + useFactory: HttpLoaderFactory, + deps: [Http] + })], + providers: [ + { + provide: HttpClientService, + useValue: httpClient + }, + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] + }).compileComponents(); + })); + + it('should create the app', async(() => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.debugElement.componentInstance; + expect(app).toBeTruthy(); + })); +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.ts new file mode 100644 index 0000000..c5a17c2 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/app.component.ts @@ -0,0 +1,43 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {Component} from '@angular/core'; +import {TranslateService} from '@ngx-translate/core'; +import {HttpClientService} from '@app/services/http-client.service'; + +@Component({ + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.less'] +}) + +export class AppComponent { + + constructor(private httpClient: HttpClientService, private translate: TranslateService) { + translate.setDefaultLang('en'); + translate.use('en'); + } + + ngOnInit() { + this.httpClient.get('status'); + } + + get isAuthorized() { + return this.httpClient.isAuthorized; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.html new file mode 100644 index 0000000..db4ee79 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.html @@ -0,0 +1,20 @@ + + +
  • + {{item.label | translate}} +
  • http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.less new file mode 100644 index 0000000..d0f079a --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.less @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +:host { + max-height: 500px; // TODO get rid of magic number, base on actual design + overflow-y: auto; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.spec.ts new file mode 100644 index 0000000..445ee97 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.spec.ts @@ -0,0 +1,92 @@ +/** + * 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 {DropdownListComponent} from './dropdown-list.component'; + +export function HttpLoaderFactory(http: Http) { + return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); +} + +describe('DropdownListComponent', () => { + let component: DropdownListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [DropdownListComponent], + imports: [TranslateModule.forRoot({ + provide: TranslateLoader, + useFactory: HttpLoaderFactory, + deps: [Http] + })] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DropdownListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create component', () => { + expect(component).toBeTruthy(); + }); + + describe('#changeSelectedItem()', () => { + + beforeEach(() => { + spyOn(component.selectedItemChange, 'emit').and.callFake(() => {}); + }); + + describe('not a filter list', () => { + it('event should not be emitted', () => { + component.isFilter = false; + component.changeSelectedItem({}); + expect(component.selectedItemChange.emit).not.toHaveBeenCalled(); + }); + }); + + describe('filter list', () => { + const options = { + label: 'l', + value: 'v' + }; + + beforeEach(() => { + component.isFilter = true; + component.changeSelectedItem(options); + }); + + it('event should be emitted', () => { + expect(component.selectedItemChange.emit).toHaveBeenCalled(); + }); + + it('event emitter should be called with correct arguments', () => { + expect(component.selectedItemChange.emit).toHaveBeenCalledWith(options); + }); + + }); + + }); +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.ts new file mode 100644 index 0000000..808fcf8 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/dropdown-list/dropdown-list.component.ts @@ -0,0 +1,51 @@ +/** + * 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, Output, EventEmitter} from '@angular/core'; + +@Component({ + selector: 'ul.dropdown-menu', + templateUrl: './dropdown-list.component.html', + styleUrls: ['./dropdown-list.component.less'] +}) +export class DropdownListComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + + @Input() + items: any[]; + + @Input() + defaultAction: Function; + + @Input() + isFilter: boolean; + + @Output() + selectedItemChange: EventEmitter = new EventEmitter(); + + changeSelectedItem(options: any): void { + if (this.isFilter) { + this.selectedItemChange.emit(options); + } + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.html new file mode 100644 index 0000000..1ac663e --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.html @@ -0,0 +1,23 @@ + + +
    {{filterInstance.label | translate}}
    + + http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.less new file mode 100644 index 0000000..ec8e84b --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.less @@ -0,0 +1,31 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@import '../variables'; + +:host { + position: relative; + .default-flex; + + .filter-label { + padding: @input-group-addon-padding; + } + + .btn { + text-transform: none; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts new file mode 100644 index 0000000..e0414f3 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts @@ -0,0 +1,97 @@ +/** + * 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 {FilteringService} from '@app/services/filtering.service'; + +import {FilterDropdownComponent} from './filter-dropdown.component'; + +export function HttpLoaderFactory(http: Http) { + return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); +} + +describe('FilterDropdownComponent', () => { + let component: FilterDropdownComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [FilterDropdownComponent], + imports: [TranslateModule.forRoot({ + provide: TranslateLoader, + useFactory: HttpLoaderFactory, + deps: [Http] + })], + providers: [FilteringService], + schemas: [NO_ERRORS_SCHEMA] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(FilterDropdownComponent); + component = fixture.componentInstance; + component.filterInstance = { + options: [ + { + value: 'v0', + label: 'l0' + }, + { + value: 'v1', + label: 'l1' + } + ] + }; + fixture.detectChanges(); + }); + + it('should create component', () => { + expect(component).toBeTruthy(); + }); + + describe('should take initial filter values from 1st item', () => { + it('selectedValue', () => { + expect(component.filterInstance.selectedValue).toEqual('v0'); + }); + + it('selectedLabel', () => { + expect(component.filterInstance.selectedLabel).toEqual('l0'); + }); + }); + + describe('#setSelectedValue()', () => { + beforeEach(() => { + component.setSelectedValue({ + value: 'v2', + label: 'l2' + }); + }); + + it('selectedValue', () => { + expect(component.filterInstance.selectedValue).toEqual('v2'); + }); + + it('selectedLabel', () => { + expect(component.filterInstance.selectedLabel).toEqual('l2'); + }); + }); +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.ts new file mode 100644 index 0000000..faaafcb --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-dropdown/filter-dropdown.component.ts @@ -0,0 +1,50 @@ +/** + * 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 {FilteringService} from '@app/services/filtering.service'; + +@Component({ + selector: 'filter-dropdown', + templateUrl: './filter-dropdown.component.html', + styleUrls: ['./filter-dropdown.component.less'] +}) +export class FilterDropdownComponent implements OnInit { + + constructor(private filtering: FilteringService) { + } + + ngOnInit() { + this.filterInstance.selectedValue = this.filterInstance.options[0].value; + this.filterInstance.selectedLabel = this.filterInstance.options[0].label; + } + + @Input() + filterInstance: any; + + @Input() + options: any[]; + + 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/components/filter-text-field/filter-text-field.component.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.html new file mode 100644 index 0000000..ed3c4ba --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.html @@ -0,0 +1,21 @@ + + +
    + {{filterInstance.label | translate}} + +
    http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.less ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.less new file mode 100644 index 0000000..1395959 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.less @@ -0,0 +1,33 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@import '../variables'; + +.input-group { + border: @input-border; + border-right-width: 0; +} + +.input-group-addon { + border: none; + background-color: transparent; + text-transform: uppercase; + + & + input { + border: none; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/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 new file mode 100644 index 0000000..e4f026c --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.spec.ts @@ -0,0 +1,63 @@ +/** + * 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 {FilteringService} from '@app/services/filtering.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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [FilterTextFieldComponent], + imports: [ + FormsModule, + TranslateModule.forRoot({ + provide: TranslateLoader, + useFactory: HttpLoaderFactory, + deps: [Http] + }) + ], + providers: [FilteringService], + schemas: [CUSTOM_ELEMENTS_SCHEMA] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(FilterTextFieldComponent); + component = fixture.componentInstance; + component.filterInstance = {}; + 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/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 new file mode 100644 index 0000000..3f23ffd --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filter-text-field/filter-text-field.component.ts @@ -0,0 +1,41 @@ +/** + * 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 {FilteringService} from '@app/services/filtering.service'; + +@Component({ + selector: 'filter-text-field', + templateUrl: './filter-text-field.component.html', + styleUrls: ['./filter-text-field.component.less'] +}) +export class FilterTextFieldComponent implements OnInit { + + constructor(private filtering: FilteringService) { + } + + ngOnInit() { + } + + @Input() + filterInstance: any; + + onValueChange() { + this.filtering.filteringSubject.next(null); + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/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 new file mode 100644 index 0000000..e278a09 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.html @@ -0,0 +1,38 @@ + + +
    + + + + + +
    + http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/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 new file mode 100644 index 0000000..46a157c --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.less @@ -0,0 +1,45 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@import '../variables'; + +.filter-input-container { + .flex-vertical-align; + justify-content: flex-start; + + .btn-success { + border-top-left-radius: 0; + border-bottom-left-radius: 0; + } + + filter-dropdown { + 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/ed660940/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 new file mode 100644 index 0000000..934f37a --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.spec.ts @@ -0,0 +1,59 @@ +/** + * 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 {TranslateModule, TranslateLoader} from '@ngx-translate/core'; +import {TranslateHttpLoader} from '@ngx-translate/http-loader'; +import {FilteringService} from '@app/services/filtering.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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [FiltersPanelComponent], + imports: [TranslateModule.forRoot({ + provide: TranslateLoader, + useFactory: HttpLoaderFactory, + deps: [Http] + })], + providers: [FilteringService], + schemas: [CUSTOM_ELEMENTS_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/ed660940/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 new file mode 100644 index 0000000..f7b8429 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/filters-panel/filters-panel.component.ts @@ -0,0 +1,39 @@ +/** + * 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 {FilteringService} from '@app/services/filtering.service'; + +@Component({ + selector: 'filters-panel', + templateUrl: './filters-panel.component.html', + styleUrls: ['./filters-panel.component.less'] +}) +export class FiltersPanelComponent implements OnInit { + + constructor(private filtering: FilteringService) { + } + + ngOnInit() { + } + + get filters() { + return this.filtering.filters; + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/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 new file mode 100644 index 0000000..37a96e9 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.html @@ -0,0 +1,33 @@ + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/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 new file mode 100644 index 0000000..f760ee8 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.less @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@import '../variables'; + +.login-form { + margin-top: @block-margin-top; +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/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 new file mode 100644 index 0000000..0498ee4 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.spec.ts @@ -0,0 +1,121 @@ +/** + * 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 {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; + + let authMock = { + isError: false + }; + const httpClient = { + isAuthorized: true, + post: () => { + return { + finally: (callback: () => void) => { + callback(); + 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] + }) + ], + providers: [ + { + 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('isRequestInProgress', () => { + expect(component.isRequestInProgress).toEqual(false); + }) + }); + }); + + }); +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/ed660940/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 new file mode 100644 index 0000000..2a93775 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/login-form/login-form.component.ts @@ -0,0 +1,60 @@ +/** + * 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 'rxjs/add/operator/finally'; +import {HttpClientService} from '@app/services/http-client.service'; + +@Component({ + selector: 'login-form', + templateUrl: './login-form.component.html', + styleUrls: ['./login-form.component.less'] +}) +export class LoginFormComponent implements OnInit { + + constructor(private httpClient: HttpClientService) { + } + + ngOnInit() { + } + + username: string; + + password: string; + + isLoginAlertDisplayed: boolean; + + isRequestInProgress: boolean; + + login() { + this.isRequestInProgress = true; + this.httpClient.post('login', { + username: this.username, + password: this.password + }).finally(() => { + this.isRequestInProgress = false; + }).subscribe(() => { + this.isLoginAlertDisplayed = false; + this.httpClient.isAuthorized = true; + }, () => { + this.isLoginAlertDisplayed = true; + this.httpClient.isAuthorized = false; + }); + } + +}