You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2017/06/22 13:16:45 UTC
[18/21] ambari git commit: AMBARI-21321 Log Search UI: fix mock data
service. (ababiichuk)
AMBARI-21321 Log Search UI: fix mock data service. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/56681d79
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/56681d79
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/56681d79
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 56681d79f25cbd98f70be8d23f3ae46619a90707
Parents: c3d8e31
Author: ababiichuk <ab...@hortonworks.com>
Authored: Fri Jun 16 15:05:09 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Thu Jun 22 15:44:46 2017 +0300
----------------------------------------------------------------------
.../accordion-panel.component.less | 2 +-
.../accordion-panel.component.spec.ts | 2 +-
.../accordion-panel.component.ts | 2 +-
.../src/app/app.component.less | 2 +-
.../src/app/app.module.ts | 38 +-
.../filter-dropdown.component.less | 2 +-
.../filter-dropdown.component.spec.ts | 2 +-
.../filter-dropdown.component.ts | 2 +-
.../filter-text-field.component.less | 2 +-
.../filter-text-field.component.spec.ts | 2 +-
.../filter-text-field.component.ts | 2 +-
.../app/login-form/login-form.component.less | 2 +-
.../src/app/logs-list/logs-list.component.less | 2 +-
.../app/logs-list/logs-list.component.spec.ts | 2 +-
.../src/app/logs-list/logs-list.component.ts | 2 +-
.../app/menu-button/menu-button.component.less | 2 +-
.../src/app/services/http-client.service.ts | 4 +-
.../app/services/mock-api-data.service.spec.ts | 81 ++
.../src/app/services/mock-api-data.service.ts | 1260 +++++++++---------
.../src/app/top-menu/top-menu.component.less | 2 +-
20 files changed, 788 insertions(+), 627 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/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
index f3630bb..8366952 100644
--- 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
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/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
index d1b185e..3706d51 100644
--- 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
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/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
index ae7fd7e..e48349e 100644
--- 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
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/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
index fba0ae6..f948b12 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.less
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/app.component.less
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/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 659172d..6670082 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
@@ -17,15 +17,16 @@
*/
import {BrowserModule} from '@angular/platform-browser';
-import {NgModule, CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
+import {NgModule, CUSTOM_ELEMENTS_SCHEMA, Injector} from '@angular/core';
import {FormsModule} from '@angular/forms';
-import {HttpModule, Http} from '@angular/http';
-import {InMemoryWebApiModule} from 'angular-in-memory-web-api';
-import {mockApiDataService} from './services/mock-api-data.service'
+import {HttpModule, Http, XHRBackend, BrowserXhr, ResponseOptions, XSRFStrategy} from '@angular/http';
+import {InMemoryBackendService} from 'angular-in-memory-web-api';
import {AlertModule} from 'ngx-bootstrap';
import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
import {StoreModule} from '@ngrx/store';
+import {environment} from '../environments/environment';
+import {mockApiDataService} from '@app/services/mock-api-data.service'
import {HttpClientService} from '@app/services/http-client.service';
import {ComponentActionsService} from '@app/services/component-actions.service';
import {FilteringService} from '@app/services/filtering.service';
@@ -51,7 +52,23 @@ import {AccordionPanelComponent} from '@app/accordion-panel/accordion-panel.comp
import {LogsListComponent} from '@app/logs-list/logs-list.component';
export function HttpLoaderFactory(http: Http) {
- return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
+ // adding 'static' parameter to step over mock data request
+ return new TranslateHttpLoader(http, 'assets/i18n/', '.json?static=true');
+}
+
+export function getXHRBackend(injector: Injector, browser: BrowserXhr, xsrf: XSRFStrategy, options: ResponseOptions): any {
+ if (environment.production) {
+ return new XHRBackend(browser, options, xsrf);
+ } else {
+ return new InMemoryBackendService(
+ injector,
+ new mockApiDataService(),
+ {
+ passThruUnknownUrl: true,
+ rootPath: ''
+ }
+ );
+ }
}
@NgModule({
@@ -72,10 +89,6 @@ export function HttpLoaderFactory(http: Http) {
BrowserModule,
FormsModule,
HttpModule,
- InMemoryWebApiModule.forRoot(mockApiDataService, {
- passThruUnknownUrl: true,
- rootPath: ''
- }),
AlertModule.forRoot(),
TranslateModule.forRoot({
loader: {
@@ -104,7 +117,12 @@ export function HttpLoaderFactory(http: Http) {
GraphsService,
NodesService,
UserConfigsService,
- FiltersService
+ FiltersService,
+ {
+ provide: XHRBackend,
+ useFactory: getXHRBackend,
+ deps: [Injector, BrowserXhr, XSRFStrategy, ResponseOptions]
+ }
],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.less
index 2c97a17..ec8e84b 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.less
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.less
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.spec.ts
index 49eaf1f..ba0bd03 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.spec.ts
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.ts
index 65446da..de6e79b 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-dropdown/filter-dropdown.component.ts
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.less
index 3a9dcac..1395959 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.less
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.less
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.spec.ts
index d1df7b0..c54171a 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.spec.ts
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.ts
index c86d4cb..6bab2e6 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/filter-text-field/filter-text-field.component.ts
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/ambari-logsearch/ambari-logsearch-web-new/src/app/login-form/login-form.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/login-form/login-form.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/login-form/login-form.component.less
index b84296a..f760ee8 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/login-form/login-form.component.less
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/login-form/login-form.component.less
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/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
index 1179e55..6bf54fe 100644
--- 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
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/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
index 6442864..53cdee6 100644
--- 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
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/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
index 107fb0d..5fd0ce5 100644
--- 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
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/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
index d6024c2..6a3a43d 100644
--- 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
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/ambari-logsearch/ambari-logsearch-web-new/src/app/services/http-client.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/http-client.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/http-client.service.ts
index 2b69f45..84f82b3 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/http-client.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/http-client.service.ts
@@ -21,7 +21,6 @@ import {Observable} from 'rxjs/Observable';
import {Http, XHRBackend, Request, RequestOptions, RequestOptionsArgs, Response} from '@angular/http';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
-import {environment} from '@app/../environments/environment';
@Injectable()
export class HttpClientService extends Http {
@@ -75,8 +74,7 @@ export class HttpClientService extends Http {
}
post(url: string, body: any, options?: RequestOptionsArgs):Observable<Response> {
- return environment.production ?
- super.post(this.generateUrlString(url), body, options) : super.get(this.generateUrlString(url), options);
+ return super.post(this.generateUrlString(url), body, options);
}
put(url: string, body: any, options?: RequestOptionsArgs):Observable<Response> {
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/ambari-logsearch/ambari-logsearch-web-new/src/app/services/mock-api-data.service.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/mock-api-data.service.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/mock-api-data.service.spec.ts
new file mode 100644
index 0000000..410f70d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/mock-api-data.service.spec.ts
@@ -0,0 +1,81 @@
+/**
+ * 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 {TestBed, inject} from '@angular/core/testing';
+import {mockApiDataService} from './mock-api-data.service';
+
+describe('mockApiDataService', () => {
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [mockApiDataService]
+ });
+ });
+
+ it('should create service', inject([mockApiDataService], (service: mockApiDataService) => {
+ expect(service).toBeTruthy();
+ }));
+
+ describe('#parseUrl()', () => {
+ const cases = [
+ {
+ url: 'root',
+ base: '/',
+ collectionName: 'root',
+ query: '',
+ title: 'one-level depth url, no query params'
+ },
+ {
+ url: 'root?param0=1¶m1=2',
+ base: '/',
+ collectionName: 'root',
+ query: 'param0=1¶m1=2',
+ title: 'one-level depth url with query params'
+ },
+ {
+ url: 'root/resources/collection',
+ base: 'root/resources/',
+ collectionName: 'collection',
+ query: '',
+ title: 'more than one-level depth url, no query params'
+ },
+ {
+ url: 'root/resources/collection?param0=1¶m1=2',
+ base: 'root/resources/',
+ collectionName: 'collection',
+ query: 'param0=1¶m1=2',
+ title: 'more than one-level depth url with query params'
+ }
+ ];
+
+ cases.forEach(test => {
+ describe(test.title, () => {
+ it('base', inject([mockApiDataService], (service: mockApiDataService) => {
+ expect(service.parseUrl(test.url).base).toEqual(test.base);
+ }));
+
+ it('collectionName', inject([mockApiDataService], (service: mockApiDataService) => {
+ expect(service.parseUrl(test.url).collectionName).toEqual(test.collectionName);
+ }));
+
+ it('query', inject([mockApiDataService], (service: mockApiDataService) => {
+ expect(service.parseUrl(test.url).query.toString()).toEqual(test.query);
+ }));
+ });
+ });
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/ambari-logsearch/ambari-logsearch-web-new/src/app/services/mock-api-data.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/mock-api-data.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/mock-api-data.service.ts
index ff2ed2c..a6215e6 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/mock-api-data.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/mock-api-data.service.ts
@@ -16,350 +16,398 @@
* limitations under the License.
*/
-import {InMemoryDbService} from 'angular-in-memory-web-api';
+import {URLSearchParams, Response, ResponseOptions} from '@angular/http';
+import {InMemoryDbService, InMemoryBackendService, createErrorResponse} from 'angular-in-memory-web-api';
+import {Observable} from 'rxjs/Observable';
+import {Subscriber} from 'rxjs/Subscriber';
+
+export class mockBackendService extends InMemoryBackendService {
+ getLocation(url: string): any {
+ return super.getLocation(url);
+ }
+}
export class mockApiDataService implements InMemoryDbService {
+
+ parseUrl(url: string): any {
+ const urlLocation = mockBackendService.prototype.getLocation(url),
+ query = urlLocation.search && new URLSearchParams(urlLocation.search.substr(1)),
+ splitUrl = urlLocation.pathname.substr(1).split('/'),
+ urlPartsCount = splitUrl.length,
+ collectionName = splitUrl[urlPartsCount - 1],
+ base = splitUrl.slice(0, urlPartsCount - 1).join('/') + '/';
+ return {
+ base: base,
+ collectionName: collectionName,
+ query: query
+ };
+ }
+
+ get(interceptorArgs: any): Observable<Response> {
+ const query = interceptorArgs.requestInfo.query,
+ path = interceptorArgs.requestInfo.base + interceptorArgs.requestInfo.collectionName,
+ pathArray = path.split('/').filter(part => part !== '');
+ if (query && query.paramsMap.has('static') && interceptorArgs.passThruBackend) {
+ return interceptorArgs.passThruBackend.createConnection(interceptorArgs.requestInfo.req).response;
+ } else {
+ let is404 = false;
+ const data = pathArray.reduce((currentObject, currentKey, index, array) => {
+ if (!currentObject && index < array.length - 1) {
+ return {};
+ } else if (currentObject.hasOwnProperty(currentKey)) {
+ return currentObject[currentKey];
+ } else {
+ is404 = true;
+ return {};
+ }
+ }, interceptorArgs.db);
+ if (is404) {
+ return new Observable<Response>((subscriber: Subscriber<Response>) => subscriber.error(new Response(createErrorResponse(
+ interceptorArgs.requestInfo.req, 404, 'Not found'
+ ))));
+ } else {
+ return new Observable<Response>((subscriber: Subscriber<Response>) => subscriber.next(new Response(new ResponseOptions({
+ status: 200,
+ body: data
+ }))));
+ }
+ }
+ }
+
+ post(interceptorArgs: any) {
+ // TODO implement posting data to mock object except login call
+ return this.get(interceptorArgs);
+ }
+
createDb() {
return {
login: {},
- audit: {
- logs: {
- logList: [
- {
- policy: 'policy',
- reason: 'Authentication required',
- result: 0,
- text: 'Please log in',
- tags: [
- 'ambari_agent'
- ],
- resource: '/ambari-agent',
- sess: '0',
- access: '0',
- logType: 'AmbariAudit',
- tags_str: 'ambari_agent',
- resType: 'agent',
- reqUser: 'admin',
- reqData: 'data',
- repoType: 1,
- repo: 'ambari',
- proxyUsers: [
- 'admin'
- ],
- evtTime: '2017-05-29T11:30:22.531Z',
- enforcer: 'ambari-acl',
- reqContext: 'ambari',
- cliType: 'GET',
- cliIP: '192.168.0.1',
- agent: 'agent',
- agentHost: 'localhost',
- action: 'SERVICE_CHECK',
- type: 'ambari-audit',
- _version_: 2,
- id: 'id0',
- file: 'ambari-agent.log',
- seq_num: 3,
- bundle_id: 'b0',
- case_id: 'c0',
- log_message: 'User(admin), Operation(SERVICE_CHECK)',
- logfile_line_number: 4,
- message_md5: '12345678900987654321',
- cluster: 'cl0',
- event_count: 0,
- event_md5: '09876543211234567890',
- event_dur_ms: 100,
- _ttl_: "+7DAYS",
- _expire_at_: '2017-05-29T11:30:22.531Z',
- _router_field_: 5
- },
- {
- policy: 'policy',
- reason: 'Server error',
- result: 1,
- text: 'Something went wrong',
- tags: [
- 'ambari_agent'
- ],
- resource: '/ambari-agent',
- sess: '1',
- access: '1',
- logType: 'AmbariAudit',
- tags_str: 'ambari_server',
- resType: 'server',
- reqUser: 'user',
- reqData: 'data',
- repoType: 1,
- repo: 'ambari',
- proxyUsers: [
- 'user'
+ api: {
+ v1: {
+ audit: {
+ logs: {
+ logList: [
+ {
+ policy: 'policy',
+ reason: 'Authentication required',
+ result: 0,
+ text: 'Please log in',
+ tags: [
+ 'ambari_agent'
+ ],
+ resource: '/ambari-agent',
+ sess: '0',
+ access: '0',
+ logType: 'AmbariAudit',
+ tags_str: 'ambari_agent',
+ resType: 'agent',
+ reqUser: 'admin',
+ reqData: 'data',
+ repoType: 1,
+ repo: 'ambari',
+ proxyUsers: [
+ 'admin'
+ ],
+ evtTime: '2017-05-29T11:30:22.531Z',
+ enforcer: 'ambari-acl',
+ reqContext: 'ambari',
+ cliType: 'GET',
+ cliIP: '192.168.0.1',
+ agent: 'agent',
+ agentHost: 'localhost',
+ action: 'SERVICE_CHECK',
+ type: 'ambari-audit',
+ _version_: 2,
+ id: 'id0',
+ file: 'ambari-agent.log',
+ seq_num: 3,
+ bundle_id: 'b0',
+ case_id: 'c0',
+ log_message: 'User(admin), Operation(SERVICE_CHECK)',
+ logfile_line_number: 4,
+ message_md5: '12345678900987654321',
+ cluster: 'cl0',
+ event_count: 0,
+ event_md5: '09876543211234567890',
+ event_dur_ms: 100,
+ _ttl_: "+7DAYS",
+ _expire_at_: '2017-05-29T11:30:22.531Z',
+ _router_field_: 5
+ },
+ {
+ policy: 'policy',
+ reason: 'Server error',
+ result: 1,
+ text: 'Something went wrong',
+ tags: [
+ 'ambari_agent'
+ ],
+ resource: '/ambari-agent',
+ sess: '1',
+ access: '1',
+ logType: 'AmbariAudit',
+ tags_str: 'ambari_server',
+ resType: 'server',
+ reqUser: 'user',
+ reqData: 'data',
+ repoType: 1,
+ repo: 'ambari',
+ proxyUsers: [
+ 'user'
+ ],
+ evtTime: '2017-05-29T11:30:22.531Z',
+ enforcer: 'hdfs',
+ reqContext: 'ambari_server',
+ cliType: 'PUT',
+ cliIP: '192.168.0.1',
+ agent: 'agent',
+ agentHost: 'localhost',
+ action: 'SERVICE_CHECK',
+ type: 'ambari-audit',
+ _version_: 4,
+ id: 'id1',
+ file: 'ambari-agent.log',
+ seq_num: 5,
+ bundle_id: 'b1',
+ case_id: 'c1',
+ log_message: 'User(user), Operation(SERVICE_CHECK)',
+ logfile_line_number: 6,
+ message_md5: '10293847561029384756',
+ cluster: 'cl1',
+ event_count: 2,
+ event_md5: '01928374650192837465',
+ event_dur_ms: 500,
+ _ttl_: "+7DAYS",
+ _expire_at_: '2017-05-29T11:30:22.531Z',
+ _router_field_: 10
+ }
],
- evtTime: '2017-05-29T11:30:22.531Z',
- enforcer: 'hdfs',
- reqContext: 'ambari_server',
- cliType: 'PUT',
- cliIP: '192.168.0.1',
- agent: 'agent',
- agentHost: 'localhost',
- action: 'SERVICE_CHECK',
- type: 'ambari-audit',
- _version_: 4,
- id: 'id1',
- file: 'ambari-agent.log',
- seq_num: 5,
- bundle_id: 'b1',
- case_id: 'c1',
- log_message: 'User(user), Operation(SERVICE_CHECK)',
- logfile_line_number: 6,
- message_md5: '10293847561029384756',
- cluster: 'cl1',
- event_count: 2,
- event_md5: '01928374650192837465',
- event_dur_ms: 500,
- _ttl_: "+7DAYS",
- _expire_at_: '2017-05-29T11:30:22.531Z',
- _router_field_: 10
- }
- ],
- bargraph: {
- graphData: [
- {
- dataCount: [
- {
- name: 'n0',
- value: 1
- },
- {
- name: 'n1',
- value: 2
- }
- ],
- name: 'graph0'
- },
- {
- dataCount: [
- {
- name: 'n2',
- value: 10
- },
- {
- name: 'n3',
- value: 20
- }
- ],
- name: 'graph1'
- }
- ]
- },
- components: {},
- resources: {
- graphData: [
- {
- dataCount: [
- {
- name: 'n16',
- value: 800
- },
- {
- name: 'n17',
- value: 400
- }
- ],
- name: 'graph8'
- },
- {
- dataCount: [
- {
- name: 'n18',
- value: 600
- },
- {
- name: 'n19',
- value: 300
- }
- ],
- name: 'graph9'
- }
- ]
- },
- schema: {
- fields: ''
- },
- serviceload: {
- graphData: [
- {
- dataCount: [
+ bargraph: {
+ graphData: [
{
- name: 'n4',
- value: 1
+ dataCount: [
+ {
+ name: 'n0',
+ value: 1
+ },
+ {
+ name: 'n1',
+ value: 2
+ }
+ ],
+ name: 'graph0'
},
{
- name: 'n5',
- value: 2
+ dataCount: [
+ {
+ name: 'n2',
+ value: 10
+ },
+ {
+ name: 'n3',
+ value: 20
+ }
+ ],
+ name: 'graph1'
}
- ],
- name: 'graph2'
+ ]
},
- {
- dataCount: [
- {
- name: 'n6',
- value: 10
- },
- {
- name: 'n7',
- value: 20
- }
- ],
- name: 'graph3'
- }
- ]
- }
- }
- },
- public: {
- config: {}
- },
- service: {
- logs: {
- logList: [
- {
- path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
- host: 'h0',
- level: 'WARN',
- logtime: '2017-05-28T11:30:22.531Z',
- ip: '192.168.0.1',
- logfile_line_number: 8,
- type: 'ams_collector',
- _version_: 9,
- id: 'id2',
- file: 'ambari-metrics-collector.log',
- seq_num: 10,
- bundle_id: 'b2',
- case_id: 'c2',
- log_message: 'Connection refused',
- message_md5: '1357908642',
- cluster: 'cl2',
- event_count: 5,
- event_md5: '1908755391',
- event_dur_ms: 200,
- _ttl_: "+5DAYS",
- _expire_at_: '2017-05-29T11:30:22.531Z',
- _router_field_: 20
- },
- {
- path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
- host: 'h1',
- level: 'ERROR',
- logtime: '2017-05-28T10:30:22.531Z',
- ip: '192.168.0.2',
- type: 'ams_collector',
- _version_: 14,
- id: 'id3',
- file: 'ambari-metrics-collector.log',
- seq_num: 15,
- bundle_id: 'b3',
- case_id: 'c3',
- log_message: 'Connection refused',
- logfile_line_number: 16,
- message_md5: '1357908642',
- cluster: 'cl3',
- event_count: 2,
- event_md5: '1029384756',
- event_dur_ms: 700,
- _ttl_: "+5DAYS",
- _expire_at_: '2017-05-29T10:30:22.531Z',
- _router_field_: 5
- }
- ],
- aggregated: {
- graphData: [
- {
- name: 'n0',
- count: 100,
- dataList: [
+ components: {},
+ resources: {
+ graphData: [
{
- name: 'n1',
- count: 50,
- dataList: null
+ dataCount: [
+ {
+ name: 'n16',
+ value: 800
+ },
+ {
+ name: 'n17',
+ value: 400
+ }
+ ],
+ name: 'graph8'
},
{
- name: 'n2',
- count: 200,
- dataList: null
+ dataCount: [
+ {
+ name: 'n18',
+ value: 600
+ },
+ {
+ name: 'n19',
+ value: 300
+ }
+ ],
+ name: 'graph9'
}
]
},
- {
- name: 'n3',
- count: 10,
- dataList: [
+ schema: {
+ fields: ''
+ },
+ serviceload: {
+ graphData: [
{
- name: 'n4',
- count: 5,
- dataList: null
+ dataCount: [
+ {
+ name: 'n4',
+ value: 1
+ },
+ {
+ name: 'n5',
+ value: 2
+ }
+ ],
+ name: 'graph2'
},
{
- name: 'n5',
- count: 20,
- dataList: null
+ dataCount: [
+ {
+ name: 'n6',
+ value: 10
+ },
+ {
+ name: 'n7',
+ value: 20
+ }
+ ],
+ name: 'graph3'
}
]
}
- ]
+ }
},
- components: {
- count: {
- anygraph: {
+ public: {
+ config: {}
+ },
+ service: {
+ logs: {
+ logList: [
+ {
+ path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
+ host: 'h0',
+ level: 'WARN',
+ logtime: '2017-05-28T11:30:22.531Z',
+ ip: '192.168.0.1',
+ logfile_line_number: 8,
+ type: 'ams_collector',
+ _version_: 9,
+ id: 'id2',
+ file: 'ambari-metrics-collector.log',
+ seq_num: 10,
+ bundle_id: 'b2',
+ case_id: 'c2',
+ log_message: 'Connection refused',
+ message_md5: '1357908642',
+ cluster: 'cl2',
+ event_count: 5,
+ event_md5: '1908755391',
+ event_dur_ms: 200,
+ _ttl_: "+5DAYS",
+ _expire_at_: '2017-05-29T11:30:22.531Z',
+ _router_field_: 20
+ },
+ {
+ path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
+ host: 'h1',
+ level: 'ERROR',
+ logtime: '2017-05-28T10:30:22.531Z',
+ ip: '192.168.0.2',
+ type: 'ams_collector',
+ _version_: 14,
+ id: 'id3',
+ file: 'ambari-metrics-collector.log',
+ seq_num: 15,
+ bundle_id: 'b3',
+ case_id: 'c3',
+ log_message: 'Connection refused',
+ logfile_line_number: 16,
+ message_md5: '1357908642',
+ cluster: 'cl3',
+ event_count: 2,
+ event_md5: '1029384756',
+ event_dur_ms: 700,
+ _ttl_: "+5DAYS",
+ _expire_at_: '2017-05-29T10:30:22.531Z',
+ _router_field_: 5
+ }
+ ],
+ aggregated: {
graphData: [
{
- dataCount: [
+ name: 'n0',
+ count: 100,
+ dataList: [
{
- name: 'n8',
- value: 50
+ name: 'n1',
+ count: 50,
+ dataList: null
},
{
- name: 'n9',
- value: 100
+ name: 'n2',
+ count: 200,
+ dataList: null
}
- ],
- name: 'graph4'
+ ]
},
{
- dataCount: [
+ name: 'n3',
+ count: 10,
+ dataList: [
{
- name: 'n10',
- value: 5
+ name: 'n4',
+ count: 5,
+ dataList: null
},
{
- name: 'n11',
- value: 10
+ name: 'n5',
+ count: 20,
+ dataList: null
}
- ],
- name: 'graph5'
+ ]
}
]
- }
- },
- levels: {
- counts: {
- vNodeList: [
- {
- name: 'ambari',
- type: 0,
- logLevelCount: [
+ },
+ components: {
+ count: {
+ anygraph: {
+ graphData: [
{
- name: 'ERROR',
- value: '10'
+ dataCount: [
+ {
+ name: 'n8',
+ value: 50
+ },
+ {
+ name: 'n9',
+ value: 100
+ }
+ ],
+ name: 'graph4'
},
{
- name: 'WARN',
- value: '50'
+ dataCount: [
+ {
+ name: 'n10',
+ value: 5
+ },
+ {
+ name: 'n11',
+ value: 10
+ }
+ ],
+ name: 'graph5'
}
- ],
- childs: [
+ ]
+ }
+ },
+ levels: {
+ counts: {
+ vNodeList: [
{
- name: 'hdfs',
- type: 2,
+ name: 'ambari',
+ type: 0,
logLevelCount: [
{
name: 'ERROR',
@@ -367,114 +415,114 @@ export class mockApiDataService implements InMemoryDbService {
},
{
name: 'WARN',
- value: '20'
+ value: '50'
}
],
- isParent: false,
+ childs: [
+ {
+ name: 'hdfs',
+ type: 2,
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '10'
+ },
+ {
+ name: 'WARN',
+ value: '20'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ },
+ {
+ name: 'zookeeper',
+ type: 3,
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '20'
+ },
+ {
+ name: 'WARN',
+ value: '40'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ }
+ ],
+ isParent: true,
isRoot: false
},
{
- name: 'zookeeper',
- type: 3,
+ name: 'ambari_agent',
+ type: 1,
logLevelCount: [
{
name: 'ERROR',
- value: '20'
+ value: '100'
},
{
name: 'WARN',
- value: '40'
+ value: '500'
}
],
isParent: false,
isRoot: false
}
+ ]
+ }
+ }
+ },
+ files: {
+ hostLogFiles: {
+ clusters: [
+ 'c0',
+ 'c1'
+ ],
+ services: [
+ 'hdfs',
+ 'zookeeper'
+ ]
+ }
+ },
+ histogram: {
+ graphData: [
+ {
+ dataCount: [
+ {
+ name: 'n12',
+ value: 1000
+ },
+ {
+ name: 'n13',
+ value: 2000
+ }
],
- isParent: true,
- isRoot: false
+ name: 'graph6'
},
{
- name: 'ambari_agent',
- type: 1,
- logLevelCount: [
+ dataCount: [
{
- name: 'ERROR',
- value: '100'
+ name: 'n14',
+ value: 700
},
{
- name: 'WARN',
- value: '500'
+ name: 'n15',
+ value: 900
}
],
- isParent: false,
- isRoot: false
+ name: 'graph7'
}
]
- }
- }
- },
- files: {
- hostLogFiles: {
- clusters: [
- 'c0',
- 'c1'
- ],
- services: [
- 'hdfs',
- 'zookeeper'
- ]
- }
- },
- histogram: {
- graphData: [
- {
- dataCount: [
- {
- name: 'n12',
- value: 1000
- },
- {
- name: 'n13',
- value: 2000
- }
- ],
- name: 'graph6'
},
- {
- dataCount: [
- {
- name: 'n14',
- value: 700
- },
- {
- name: 'n15',
- value: 900
- }
- ],
- name: 'graph7'
- }
- ]
- },
- hosts: {
- components: {
- vNodeList: [
- {
- name: 'ambari',
- type: 0,
- logLevelCount: [
- {
- name: 'ERROR',
- value: '100'
- },
+ hosts: {
+ components: {
+ vNodeList: [
{
- name: 'WARN',
- value: '500'
- }
- ],
- childs: [
- {
- name: 'ambari_metrics',
- type: 2,
+ name: 'ambari',
+ type: 0,
logLevelCount: [
{
name: 'ERROR',
@@ -482,100 +530,100 @@ export class mockApiDataService implements InMemoryDbService {
},
{
name: 'WARN',
- value: '200'
+ value: '500'
}
],
- isParent: false,
+ childs: [
+ {
+ name: 'ambari_metrics',
+ type: 2,
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '100'
+ },
+ {
+ name: 'WARN',
+ value: '200'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ },
+ {
+ name: 'hbase',
+ type: 3,
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '200'
+ },
+ {
+ name: 'WARN',
+ value: '400'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ }
+ ],
+ isParent: true,
isRoot: false
},
{
- name: 'hbase',
- type: 3,
+ name: 'ambari_server',
+ type: 1,
logLevelCount: [
{
name: 'ERROR',
- value: '200'
+ value: '1000'
},
{
name: 'WARN',
- value: '400'
+ value: '5000'
}
],
isParent: false,
isRoot: false
}
- ],
- isParent: true,
- isRoot: false
+ ]
},
- {
- name: 'ambari_server',
- type: 1,
- logLevelCount: [
+ count: {
+ getvCounts: [
{
- name: 'ERROR',
- value: '1000'
+ name: 'n20',
+ count: 100
},
{
- name: 'WARN',
- value: '5000'
+ name: 'n21',
+ count: 200
}
- ],
- isParent: false,
- isRoot: false
- }
- ]
- },
- count: {
- getvCounts: [
- {
- name: 'n20',
- count: 100
- },
- {
- name: 'n21',
- count: 200
+ ]
}
- ]
- }
- },
- levels: {
- counts: {
- getvNameValues: [
- {
- name: 'n22',
- count: 1000
- },
- {
- name: 'n23',
- count: 2000
+ },
+ levels: {
+ counts: {
+ getvNameValues: [
+ {
+ name: 'n22',
+ count: 1000
+ },
+ {
+ name: 'n23',
+ count: 2000
+ }
+ ]
}
- ]
- }
- },
- schema: {
- fields: ''
- },
- serviceconfig: '',
- tree: {
- vNodeList: [
- {
- name: 'ambari',
- type: 0,
- logLevelCount: [
- {
- name: 'ERROR',
- value: '1000'
- },
- {
- name: 'WARN',
- value: '5000'
- }
- ],
- childs: [
+ },
+ schema: {
+ fields: ''
+ },
+ serviceconfig: '',
+ tree: {
+ vNodeList: [
{
- name: 'yarn',
- type: 2,
+ name: 'ambari',
+ type: 0,
logLevelCount: [
{
name: 'ERROR',
@@ -583,182 +631,198 @@ export class mockApiDataService implements InMemoryDbService {
},
{
name: 'WARN',
- value: '2000'
+ value: '5000'
}
],
- isParent: false,
+ childs: [
+ {
+ name: 'yarn',
+ type: 2,
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '1000'
+ },
+ {
+ name: 'WARN',
+ value: '2000'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ },
+ {
+ name: 'hive',
+ type: 3,
+ logLevelCount: [
+ {
+ name: 'ERROR',
+ value: '2000'
+ },
+ {
+ name: 'WARN',
+ value: '4000'
+ }
+ ],
+ isParent: false,
+ isRoot: false
+ }
+ ],
+ isParent: true,
isRoot: false
},
{
- name: 'hive',
- type: 3,
+ name: 'ambari_server',
+ type: 1,
logLevelCount: [
{
name: 'ERROR',
- value: '2000'
+ value: '10000'
},
{
name: 'WARN',
- value: '4000'
+ value: '50000'
}
],
isParent: false,
isRoot: false
}
- ],
- isParent: true,
- isRoot: false
+ ]
},
- {
- name: 'ambari_server',
- type: 1,
- logLevelCount: [
+ truncated: {
+ logList: [
{
- name: 'ERROR',
- value: '10000'
+ path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
+ host: 'h0',
+ level: 'WARN',
+ logtime: '2017-05-28T11:30:22.531Z',
+ ip: '192.168.0.1',
+ logfile_line_number: 8,
+ type: 'ams_collector',
+ _version_: 9,
+ id: 'id2',
+ file: 'ambari-metrics-collector.log',
+ seq_num: 10,
+ bundle_id: 'b2',
+ case_id: 'c2',
+ log_message: 'Connection refused',
+ message_md5: '1357908642',
+ cluster: 'cl2',
+ event_count: 5,
+ event_md5: '1908755391',
+ event_dur_ms: 200,
+ _ttl_: "+5DAYS",
+ _expire_at_: '2017-05-29T11:30:22.531Z',
+ _router_field_: 20
},
{
- name: 'WARN',
- value: '50000'
+ path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
+ host: 'h1',
+ level: 'ERROR',
+ logtime: '2017-05-28T10:30:22.531Z',
+ ip: '192.168.0.2',
+ type: 'ams_collector',
+ _version_: 14,
+ id: 'id3',
+ file: 'ambari-metrics-collector.log',
+ seq_num: 15,
+ bundle_id: 'b3',
+ case_id: 'c3',
+ log_message: 'Connection refused',
+ logfile_line_number: 16,
+ message_md5: '1357908642',
+ cluster: 'cl3',
+ event_count: 2,
+ event_md5: '1029384756',
+ event_dur_ms: 700,
+ _ttl_: "+5DAYS",
+ _expire_at_: '2017-05-29T10:30:22.531Z',
+ _router_field_: 5
}
- ],
- isParent: false,
- isRoot: false
+ ]
}
- ]
+ }
},
- truncated: {
- logList: [
+ status: {
+ auditlogs: {
+ znodeReady: true,
+ solrCollectionReady: true,
+ solrAliasReady: false,
+ configurationUploaded: true
+ },
+ servicelogs: {
+ znodeReady: true,
+ solrCollectionReady: true,
+ configurationUploaded: true
+ },
+ userconfig: {
+ znodeReady: true,
+ solrCollectionReady: true,
+ configurationUploaded: true
+ }
+ },
+ userconfig: {
+ userConfigList: [
{
- path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
- host: 'h0',
- level: 'WARN',
- logtime: '2017-05-28T11:30:22.531Z',
- ip: '192.168.0.1',
- logfile_line_number: 8,
- type: 'ams_collector',
- _version_: 9,
- id: 'id2',
- file: 'ambari-metrics-collector.log',
- seq_num: 10,
- bundle_id: 'b2',
- case_id: 'c2',
- log_message: 'Connection refused',
- message_md5: '1357908642',
- cluster: 'cl2',
- event_count: 5,
- event_md5: '1908755391',
- event_dur_ms: 200,
- _ttl_: "+5DAYS",
- _expire_at_: '2017-05-29T11:30:22.531Z',
- _router_field_: 20
+ id: 'c0',
+ userName: 'admin',
+ filtername: 'service',
+ values: 'hdfs',
+ shareNameList: [
+ 's0',
+ 's1'
+ ],
+ rowType: 'history'
},
{
- path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
- host: 'h1',
- level: 'ERROR',
- logtime: '2017-05-28T10:30:22.531Z',
- ip: '192.168.0.2',
- type: 'ams_collector',
- _version_: 14,
- id: 'id3',
- file: 'ambari-metrics-collector.log',
- seq_num: 15,
- bundle_id: 'b3',
- case_id: 'c3',
- log_message: 'Connection refused',
- logfile_line_number: 16,
- message_md5: '1357908642',
- cluster: 'cl3',
- event_count: 2,
- event_md5: '1029384756',
- event_dur_ms: 700,
- _ttl_: "+5DAYS",
- _expire_at_: '2017-05-29T10:30:22.531Z',
- _router_field_: 5
+ id: 'c0',
+ userName: 'user',
+ filtername: 'component',
+ values: 'namenode',
+ shareNameList: [
+ 's2',
+ 's3'
+ ],
+ rowType: 'history'
}
- ]
- }
- }
- },
- status: {
- auditlogs: {
- znodeReady: true,
- solrCollectionReady: true,
- solrAliasReady: false,
- configurationUploaded: true
- },
- servicelogs: {
- znodeReady: true,
- solrCollectionReady: true,
- configurationUploaded: true
- },
- userconfig: {
- znodeReady: true,
- solrCollectionReady: true,
- configurationUploaded: true
- }
- },
- userconfig: {
- userConfigList: [
- {
- id: 'c0',
- userName: 'admin',
- filtername: 'service',
- values: 'hdfs',
- shareNameList: [
- 's0',
- 's1'
],
- rowType: 'history'
- },
- {
- id: 'c0',
- userName: 'user',
- filtername: 'component',
- values: 'namenode',
- shareNameList: [
- 's2',
- 's3'
- ],
- rowType: 'history'
- }
- ],
- filters: {
- filter0: {
- label: 'filter0',
- hosts: [
- 'h0',
- 'h1'
- ],
- defaultLevels: [
- 'l0',
- 'l1'
- ],
- overrideLevels: [
- 'l2',
- 'l3'
- ],
- expiryTime: '2017-05-29T11:30:22.531Z'
- },
- filter1: {
- label: 'filter1',
- hosts: [
- 'h1',
- 'h2'
- ],
- defaultLevels: [
- 'l4',
- 'l5'
- ],
- overrideLevels: [
- 'l6',
- 'l7'
- ],
- expiryTime: '2017-05-30T11:30:22.531Z'
+ filters: {
+ filter0: {
+ label: 'filter0',
+ hosts: [
+ 'h0',
+ 'h1'
+ ],
+ defaultLevels: [
+ 'l0',
+ 'l1'
+ ],
+ overrideLevels: [
+ 'l2',
+ 'l3'
+ ],
+ expiryTime: '2017-05-29T11:30:22.531Z'
+ },
+ filter1: {
+ label: 'filter1',
+ hosts: [
+ 'h1',
+ 'h2'
+ ],
+ defaultLevels: [
+ 'l4',
+ 'l5'
+ ],
+ overrideLevels: [
+ 'l6',
+ 'l7'
+ ],
+ expiryTime: '2017-05-30T11:30:22.531Z'
+ }
+ },
+ names: []
}
- },
- names: []
+ }
}
};
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/56681d79/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
index 2e8e77a..e5e85f4 100644
--- 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
@@ -1,4 +1,4 @@
-/*
+/**
* 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.