AMBARI-21315 Log Search UI: provide data storage functionality with mock data. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/603297ae Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/603297ae Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/603297ae Branch: refs/heads/branch-feature-logsearch-ui Commit: 603297ae862b633b5e562fe73860674cab2cfe94 Parents: 84a59d7 Author: ababiichuk <ababiic...@hortonworks.com> Authored: Wed May 31 19:54:05 2017 +0300 Committer: ababiichuk <ababiic...@hortonworks.com> Committed: Thu Jun 22 15:35:04 2017 +0300 ---------------------------------------------------------------------- .../ambari-logsearch-web-new/package.json | 4 +- .../src/app/app.module.ts | 38 +- .../src/app/login-form/login-form.component.ts | 2 +- .../menu-button/menu-button.component.spec.ts | 4 +- .../app/menu-button/menu-button.component.ts | 4 +- .../src/app/models/audit-log.model.ts | 46 ++ .../src/app/models/bar-graph.model.ts | 24 + .../src/app/models/common-entry.model.ts | 22 + .../src/app/models/count.model.ts | 22 + .../src/app/models/filter.model.ts | 25 + .../src/app/models/graph.model.ts | 23 + .../src/app/models/log.model.ts | 37 + .../src/app/models/node.model.ts | 29 + .../src/app/models/service-log.model.ts | 27 + .../app/models/solr-collection-state.model.ts | 23 + .../src/app/models/store.model.ts | 95 +++ .../src/app/models/user-config.model.ts | 26 + .../src/app/services/actions.service.spec.ts | 33 - .../src/app/services/actions.service.ts | 47 -- .../services/component-actions.service.spec.ts | 33 + .../app/services/component-actions.service.ts | 47 ++ .../src/app/services/mock-api-data.service.ts | 741 ++++++++++++++++++- .../app/services/storage/audit-logs.service.ts | 34 + .../app/services/storage/bar-graphs.service.ts | 34 + .../src/app/services/storage/filters.service.ts | 34 + .../src/app/services/storage/graphs.service.ts | 34 + .../src/app/services/storage/nodes.service.ts | 34 + .../services/storage/service-logs.service.ts | 34 + .../services/storage/user-configs.service.ts | 34 + .../src/tsconfig.app.json | 2 +- .../ambari-logsearch-web-new/tsconfig.json | 5 + 31 files changed, 1502 insertions(+), 95 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/package.json ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/package.json b/ambari-logsearch/ambari-logsearch-web-new/package.json index bda2556..0994703 100644 --- a/ambari-logsearch/ambari-logsearch-web-new/package.json +++ b/ambari-logsearch/ambari-logsearch-web-new/package.json @@ -19,6 +19,8 @@ "@angular/platform-browser": "^4.0.0", "@angular/platform-browser-dynamic": "^4.0.0", "@angular/router": "^4.0.0", + "@ngrx/core": "^1.2.0", + "@ngrx/store": "^2.2.2", "@ngx-translate/core": "^6.0.1", "@ngx-translate/http-loader": "^0.0.3", "bootstrap": "^3.3.7", @@ -41,9 +43,9 @@ "karma": "~1.4.1", "karma-chrome-launcher": "~2.0.0", "karma-cli": "~1.0.1", + "karma-coverage-istanbul-reporter": "^0.2.0", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", - "karma-coverage-istanbul-reporter": "^0.2.0", "protractor": "~5.1.0", "ts-node": "~2.0.0", "tslint": "~4.5.0", http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/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 e8dee1b..f4ee972 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 @@ -25,13 +25,21 @@ import {mockApiDataService} from './services/mock-api-data.service' import {AlertModule} from 'ngx-bootstrap'; import {TranslateModule, TranslateLoader} from '@ngx-translate/core'; import {TranslateHttpLoader} from '@ngx-translate/http-loader'; -import {HttpClientService} from './services/http-client.service'; -import {ActionsService} from './services/actions.service'; +import {StoreModule} from '@ngrx/store'; +import {HttpClientService} from '@app/services/http-client.service'; +import {ComponentActionsService} from '@app/services/component-actions.service'; +import {AuditLogsService, auditLogs} from '@app/services/storage/audit-logs.service'; +import {ServiceLogsService, serviceLogs} from '@app/services/storage/service-logs.service'; +import {BarGraphsService, barGraphs} from '@app/services/storage/bar-graphs.service'; +import {GraphsService, graphs} from '@app/services/storage/graphs.service'; +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.component'; -import {LoginFormComponent} from './login-form/login-form.component'; -import {TopMenuComponent} from './top-menu/top-menu.component'; -import {MenuButtonComponent} from './menu-button/menu-button.component'; +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'; export function HttpLoaderFactory(http: Http) { return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); @@ -58,11 +66,27 @@ export function HttpLoaderFactory(http: Http) { useFactory: HttpLoaderFactory, deps: [Http] } + }), + StoreModule.provideStore({ + auditLogs, + serviceLogs, + barGraphs, + graphs, + nodes, + userConfigs, + filters }) ], providers: [ HttpClientService, - ActionsService + ComponentActionsService, + AuditLogsService, + ServiceLogsService, + BarGraphsService, + GraphsService, + NodesService, + UserConfigsService, + FiltersService ], bootstrap: [AppComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA] http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/login-form/login-form.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/login-form/login-form.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/login-form/login-form.component.ts index bffa412..400e65b 100644 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/login-form/login-form.component.ts +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/login-form/login-form.component.ts @@ -18,7 +18,7 @@ import {Component, OnInit} from '@angular/core'; import 'rxjs/add/operator/finally'; -import {HttpClientService} from '../services/http-client.service'; +import {HttpClientService} from '@app/services/http-client.service'; @Component({ selector: 'login-form', http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.spec.ts index 62afe07..5419b36 100644 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.spec.ts +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.spec.ts @@ -20,7 +20,7 @@ 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 {ActionsService} from '../services/actions.service'; +import {ComponentActionsService} from '@app/services/component-actions.service'; import {MenuButtonComponent} from './menu-button.component'; @@ -41,7 +41,7 @@ describe('MenuButtonComponent', () => { useFactory: HttpLoaderFactory, deps: [Http] })], - providers: [ActionsService] + providers: [ComponentActionsService] }) .compileComponents(); })); http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.ts index 2af5a44..716d3ae 100644 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.ts +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/menu-button/menu-button.component.ts @@ -17,7 +17,7 @@ */ import {Component, AfterViewInit, Input, ViewChild, ElementRef} from '@angular/core'; -import {ActionsService} from '../services/actions.service'; +import {ComponentActionsService} from '@app/services/component-actions.service'; @Component({ selector: 'menu-button', @@ -26,7 +26,7 @@ import {ActionsService} from '../services/actions.service'; }) export class MenuButtonComponent implements AfterViewInit { - constructor(private actions: ActionsService) { + constructor(private actions: ComponentActionsService) { } ngAfterViewInit() { http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/models/audit-log.model.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/models/audit-log.model.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/audit-log.model.ts new file mode 100644 index 0000000..ef8fe14 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/audit-log.model.ts @@ -0,0 +1,46 @@ +/** + * 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 {Log} from '@app/models/log.model'; + +export interface AuditLog extends Log { + policy?: string; + reason?: string; + result: number; + text?: string; + tags?: string[]; + resource?: string; + sess?: string; + access?: string; + logType: string; + tags_str?: string; + resType?: string; + reqUser: string; + reqData?: string; + repoType: number; + repo: string; + proxyUsers?: string[]; + evtTime: string; + enforcer: string; + reqContext?: string; + cliType?: string; + cliIP?: string; + agent?: string; + agentHost?: string; + action?: string; +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/models/bar-graph.model.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/models/bar-graph.model.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/bar-graph.model.ts new file mode 100644 index 0000000..f53d56d --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/bar-graph.model.ts @@ -0,0 +1,24 @@ +/** + * 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 {CommonEntry} from '@app/models/common-entry.model'; + +export interface BarGraph { + dataCount: CommonEntry[], + name: string; +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/models/common-entry.model.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/models/common-entry.model.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/common-entry.model.ts new file mode 100644 index 0000000..15d2be7 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/common-entry.model.ts @@ -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. + */ + +export interface CommonEntry { + name: string; + value: string; +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/models/count.model.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/models/count.model.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/count.model.ts new file mode 100644 index 0000000..095e8e7 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/count.model.ts @@ -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. + */ + +export interface Count { + name: string; + count: number; +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/models/filter.model.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/models/filter.model.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/filter.model.ts new file mode 100644 index 0000000..6ceaec1 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/filter.model.ts @@ -0,0 +1,25 @@ +/** + * 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. + */ + +export interface Filter { + label: string; + hosts: string[]; + defaultLevels: string[]; + overrideLevels: string[]; + expiryTime: string; +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/models/graph.model.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/models/graph.model.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/graph.model.ts new file mode 100644 index 0000000..5021654 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/graph.model.ts @@ -0,0 +1,23 @@ +/** + * 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. + */ + +export interface Graph { + name: string; + count: string; + dataList?: Graph[] +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/models/log.model.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/models/log.model.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/log.model.ts new file mode 100644 index 0000000..825b4cf --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/log.model.ts @@ -0,0 +1,37 @@ +/** + * 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. + */ + +export interface Log { + type: string; + _version_: number; + id: string; + file?: string; + seq_num: number; + bundle_id?: string; + case_id?: string; + log_message: string; + logfile_line_number: number; + message_md5: string; + cluster: string; + event_count: number; + event_md5: string; + event_dur_ms: number; + _ttl_: string; + _expire_at_: string; + _router_field_?: number; +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/models/node.model.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/models/node.model.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/node.model.ts new file mode 100644 index 0000000..1128827 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/node.model.ts @@ -0,0 +1,29 @@ +/** + * 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 {CommonEntry} from '@app/models/common-entry.model'; + +export interface Node { + name: string; + type?: number; + value: string; + isParent: boolean; + isRoot: boolean; + childs?: Node[]; + logLevelCount: CommonEntry[]; +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/models/service-log.model.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/models/service-log.model.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/service-log.model.ts new file mode 100644 index 0000000..e386ad5 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/service-log.model.ts @@ -0,0 +1,27 @@ +/** + * 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 {Log} from '@app/models/log.model'; + +export interface ServiceLog extends Log { + path: string; + host: string; + level: string; + logtime: string; + ip: string; +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/models/solr-collection-state.model.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/models/solr-collection-state.model.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/solr-collection-state.model.ts new file mode 100644 index 0000000..9c40f4a --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/solr-collection-state.model.ts @@ -0,0 +1,23 @@ +/** + * 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. + */ + +export interface SolrCollectionState { + znodeReady: boolean; + configurationUploaded: boolean; + solrCollectionReady: boolean; +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/models/store.model.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/models/store.model.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/store.model.ts new file mode 100644 index 0000000..1f3a89c --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/store.model.ts @@ -0,0 +1,95 @@ +/** + * 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 {Observable} from 'rxjs/Observable'; +import {Store, Action} from '@ngrx/store'; +import {AuditLog} from '@app/models/audit-log.model'; +import {ServiceLog} from '@app/models/service-log.model'; +import {BarGraph} from '@app/models/bar-graph.model'; +import {Graph} from '@app/models/graph.model'; +import {Node} from '@app/models/node.model'; +import {UserConfig} from '@app/models/user-config.model'; +import {Filter} from '@app/models/filter.model'; + +export const storeActions = { + ADD: 'ADD', + DELETE: 'DELETE', + CLEAR: 'CLEAR' +}; + +export interface AppStore { + auditLogs: AuditLog[]; + serviceLogs: ServiceLog[]; + barGraphs: BarGraph[]; + graphs: Graph[]; + nodes: Node[]; + userConfigs: UserConfig[]; + filters: Filter[]; +} + +export class ModelService { + + constructor(private modelName: string, private store: Store<AppStore>) {} + + getInstances(): Observable<any> { + return this.store.select(this.modelName); + } + + addInstance(instance: any): void { + this.store.dispatch({ + type: storeActions.ADD, + payload: [instance] + }); + } + + addInstances(instances: any[]): void { + this.store.dispatch({ + type: storeActions.ADD, + payload: instances + }); + } + + deleteInstance(instance: any): void { + this.store.dispatch({ + type: storeActions.DELETE, + payload: instance + }); + } + + clear(): void { + this.store.dispatch({ + type: storeActions.CLEAR + }); + } + +} + +export function reducer(state: any, action: Action): any { + switch (action.type) { + case storeActions.ADD: + return [...state, ...action.payload]; + case storeActions.DELETE: + return state.filter(instance => { + return instance.id !== action.payload.id; + }); + case storeActions.CLEAR: + return []; + default: + return state; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/models/user-config.model.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/models/user-config.model.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/user-config.model.ts new file mode 100644 index 0000000..3c3b884 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/user-config.model.ts @@ -0,0 +1,26 @@ +/** + * 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. + */ + +export interface UserConfig { + id: string; + userName: string; + filtername: string; + values: string; + shareNameList: string[]; + rowType: string; +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/services/actions.service.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/actions.service.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/actions.service.spec.ts deleted file mode 100644 index a14e0db..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/actions.service.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {TestBed, inject} from '@angular/core/testing'; - -import {ActionsService} from './actions.service'; - -describe('ActionsService', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [ActionsService] - }); - }); - - it('should create service', inject([ActionsService], (service: ActionsService) => { - expect(service).toBeTruthy(); - })); -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/services/actions.service.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/actions.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/actions.service.ts deleted file mode 100644 index 2bcd909..0000000 --- a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/actions.service.ts +++ /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 {Injectable} from '@angular/core'; - -@Injectable() -export class ActionsService { - - constructor() { - } - - //TODO implement actions - - undo() { - } - - redo() { - } - - refresh() { - } - - openHistory() { - } - - openAlerts() { - } - - openUserDetails() { - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/services/component-actions.service.spec.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/component-actions.service.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/component-actions.service.spec.ts new file mode 100644 index 0000000..303fdab --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/component-actions.service.spec.ts @@ -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 {TestBed, inject} from '@angular/core/testing'; + +import {ComponentActionsService} from './component-actions.service'; + +describe('ComponentActionsService', () => { + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [ComponentActionsService] + }); + }); + + it('should create service', inject([ComponentActionsService], (service: ComponentActionsService) => { + expect(service).toBeTruthy(); + })); +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/services/component-actions.service.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/component-actions.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/component-actions.service.ts new file mode 100644 index 0000000..1a1062e --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/component-actions.service.ts @@ -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 {Injectable} from '@angular/core'; + +@Injectable() +export class ComponentActionsService { + + constructor() { + } + + //TODO implement actions + + undo() { + } + + redo() { + } + + refresh() { + } + + openHistory() { + } + + openAlerts() { + } + + openUserDetails() { + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/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 da32c7e..be39536 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 @@ -20,6 +20,745 @@ import {InMemoryDbService} from 'angular-in-memory-web-api'; export class mockApiDataService implements InMemoryDbService { createDb() { - return {}; + return { + audit: { + logs: { + logList: [ + { + policy: 'policy', + reason: 'Authentication required', + result: 0, + text: 'Please log in', + tags: [ + 'ambari_agent' + ], + resource: '/ambari-agent', + sess: '0', + access: '0', + logType: 'AmbariAudit', + tags_str: 'ambari_agent', + resType: 'agent', + reqUser: 'admin', + reqData: 'data', + repoType: 1, + repo: 'ambari', + proxyUsers: [ + 'admin' + ], + evtTime: '2017-05-29T11:30:22.531Z', + enforcer: 'ambari-acl', + reqContext: 'ambari', + cliType: 'GET', + cliIP: '192.168.0.1', + agent: 'agent', + agentHost: 'localhost', + action: 'SERVICE_CHECK', + type: 'ambari-audit', + _version_: 2, + id: 'id0', + file: 'ambari-agent.log', + seq_num: 3, + bundle_id: 'b0', + case_id: 'c0', + log_message: 'User(admin), Operation(SERVICE_CHECK)', + logfile_line_number: 4, + message_md5: '12345678900987654321', + cluster: 'cl0', + event_count: 0, + event_md5: '09876543211234567890', + event_dur_ms: 100, + _ttl_: "+7DAYS", + _expire_at_: '2017-05-29T11:30:22.531Z', + _router_field_: 5 + }, + { + policy: 'policy', + reason: 'Server error', + result: 1, + text: 'Something went wrong', + tags: [ + 'ambari_agent' + ], + resource: '/ambari-agent', + sess: '1', + access: '1', + logType: 'AmbariAudit', + tags_str: 'ambari_server', + resType: 'server', + reqUser: 'user', + reqData: 'data', + repoType: 1, + repo: 'ambari', + proxyUsers: [ + 'user' + ], + evtTime: '2017-05-29T11:30:22.531Z', + enforcer: 'hdfs', + reqContext: 'ambari_server', + cliType: 'PUT', + cliIP: '192.168.0.1', + agent: 'agent', + agentHost: 'localhost', + action: 'SERVICE_CHECK', + type: 'ambari-audit', + _version_: 4, + id: 'id1', + file: 'ambari-agent.log', + seq_num: 5, + bundle_id: 'b1', + case_id: 'c1', + log_message: 'User(user), Operation(SERVICE_CHECK)', + logfile_line_number: 6, + message_md5: '10293847561029384756', + cluster: 'cl1', + event_count: 2, + event_md5: '01928374650192837465', + event_dur_ms: 500, + _ttl_: "+7DAYS", + _expire_at_: '2017-05-29T11:30:22.531Z', + _router_field_: 10 + } + ], + bargraph: { + graphData: [ + { + dataCount: [ + { + name: 'n0', + value: 1 + }, + { + name: 'n1', + value: 2 + } + ], + name: 'graph0' + }, + { + dataCount: [ + { + name: 'n2', + value: 10 + }, + { + name: 'n3', + value: 20 + } + ], + name: 'graph1' + } + ] + }, + components: {}, + resources: { + graphData: [ + { + dataCount: [ + { + name: 'n16', + value: 800 + }, + { + name: 'n17', + value: 400 + } + ], + name: 'graph8' + }, + { + dataCount: [ + { + name: 'n18', + value: 600 + }, + { + name: 'n19', + value: 300 + } + ], + name: 'graph9' + } + ] + }, + schema: { + fields: '' + }, + serviceload: { + graphData: [ + { + dataCount: [ + { + name: 'n4', + value: 1 + }, + { + name: 'n5', + value: 2 + } + ], + name: 'graph2' + }, + { + dataCount: [ + { + name: 'n6', + value: 10 + }, + { + name: 'n7', + value: 20 + } + ], + name: 'graph3' + } + ] + } + } + }, + public: { + config: {} + }, + service: { + logs: { + logList: [ + { + path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log', + host: 'h0', + level: 'WARN', + logtime: '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: [ + { + name: 'n1', + count: 50, + dataList: null + }, + { + name: 'n2', + count: 200, + dataList: null + } + ] + }, + { + name: 'n3', + count: 10, + dataList: [ + { + name: 'n4', + count: 5, + dataList: null + }, + { + name: 'n5', + count: 20, + dataList: null + } + ] + } + ] + }, + components: { + count: { + anygraph: { + graphData: [ + { + dataCount: [ + { + name: 'n8', + value: 50 + }, + { + name: 'n9', + value: 100 + } + ], + name: 'graph4' + }, + { + dataCount: [ + { + name: 'n10', + value: 5 + }, + { + name: 'n11', + value: 10 + } + ], + name: 'graph5' + } + ] + } + }, + levels: { + counts: { + vNodeList: [ + { + name: 'ambari', + type: 0, + logLevelCount: [ + { + name: 'ERROR', + value: '10' + }, + { + name: 'WARN', + value: '50' + } + ], + childs: [ + { + name: 'hdfs', + type: 2, + logLevelCount: [ + { + name: 'ERROR', + value: '10' + }, + { + name: 'WARN', + value: '20' + } + ], + isParent: false, + isRoot: false + }, + { + name: 'zookeeper', + type: 3, + logLevelCount: [ + { + name: 'ERROR', + value: '20' + }, + { + name: 'WARN', + value: '40' + } + ], + isParent: false, + isRoot: false + } + ], + isParent: true, + isRoot: false + }, + { + name: 'ambari_agent', + type: 1, + logLevelCount: [ + { + name: 'ERROR', + value: '100' + }, + { + name: 'WARN', + value: '500' + } + ], + isParent: false, + isRoot: false + } + ] + } + } + }, + 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' + }, + { + name: 'WARN', + value: '500' + } + ], + childs: [ + { + name: 'ambari_metrics', + type: 2, + logLevelCount: [ + { + name: 'ERROR', + value: '100' + }, + { + name: 'WARN', + value: '200' + } + ], + isParent: false, + isRoot: false + }, + { + name: 'hbase', + type: 3, + logLevelCount: [ + { + name: 'ERROR', + value: '200' + }, + { + name: 'WARN', + value: '400' + } + ], + isParent: false, + isRoot: false + } + ], + isParent: true, + isRoot: false + }, + { + name: 'ambari_server', + type: 1, + logLevelCount: [ + { + name: 'ERROR', + value: '1000' + }, + { + name: 'WARN', + value: '5000' + } + ], + isParent: false, + isRoot: false + } + ] + }, + count: { + getvCounts: [ + { + name: 'n20', + count: 100 + }, + { + name: 'n21', + count: 200 + } + ] + } + }, + levels: { + counts: { + getvNameValues: [ + { + name: 'n22', + count: 1000 + }, + { + name: 'n23', + count: 2000 + } + ] + } + }, + schema: { + fields: '' + }, + serviceconfig: '', + tree: { + vNodeList: [ + { + name: 'ambari', + type: 0, + logLevelCount: [ + { + name: 'ERROR', + value: '1000' + }, + { + name: 'WARN', + value: '5000' + } + ], + 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: 'ambari_server', + type: 1, + logLevelCount: [ + { + name: 'ERROR', + value: '10000' + }, + { + name: 'WARN', + value: '50000' + } + ], + isParent: false, + isRoot: false + } + ] + }, + truncated: { + logList: [ + { + path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log', + host: 'h0', + level: 'WARN', + logtime: '2017-05-28T11:30:22.531Z', + ip: '192.168.0.1', + logfile_line_number: 8, + type: 'ams_collector', + _version_: 9, + id: 'id2', + file: 'ambari-metrics-collector.log', + seq_num: 10, + bundle_id: 'b2', + case_id: 'c2', + log_message: 'Connection refused', + message_md5: '1357908642', + cluster: 'cl2', + event_count: 5, + event_md5: '1908755391', + event_dur_ms: 200, + _ttl_: "+5DAYS", + _expire_at_: '2017-05-29T11:30:22.531Z', + _router_field_: 20 + }, + { + path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log', + host: 'h1', + level: 'ERROR', + logtime: '2017-05-28T10:30:22.531Z', + ip: '192.168.0.2', + type: 'ams_collector', + _version_: 14, + id: 'id3', + file: 'ambari-metrics-collector.log', + seq_num: 15, + bundle_id: 'b3', + case_id: 'c3', + log_message: 'Connection refused', + logfile_line_number: 16, + message_md5: '1357908642', + cluster: 'cl3', + event_count: 2, + event_md5: '1029384756', + event_dur_ms: 700, + _ttl_: "+5DAYS", + _expire_at_: '2017-05-29T10:30:22.531Z', + _router_field_: 5 + } + ] + } + } + }, + status: { + auditlogs: { + znodeReady: true, + solrCollectionReady: true, + solrAliasReady: false, + configurationUploaded: true + }, + servicelogs: { + znodeReady: true, + solrCollectionReady: true, + configurationUploaded: true + }, + userconfig: { + znodeReady: true, + solrCollectionReady: true, + configurationUploaded: true + } + }, + userconfig: { + userConfigList: [ + { + id: 'c0', + userName: 'admin', + filtername: 'service', + values: 'hdfs', + shareNameList: [ + 's0', + 's1' + ], + rowType: 'history' + }, + { + id: 'c0', + userName: 'user', + filtername: 'component', + values: 'namenode', + shareNameList: [ + 's2', + 's3' + ], + rowType: 'history' + } + ], + filters: { + filter0: { + label: 'filter0', + hosts: [ + 'h0', + 'h1' + ], + defaultLevels: [ + 'l0', + 'l1' + ], + overrideLevels: [ + 'l2', + 'l3' + ], + expiryTime: '2017-05-29T11:30:22.531Z' + }, + filter1: { + label: 'filter1', + hosts: [ + 'h1', + 'h2' + ], + defaultLevels: [ + 'l4', + 'l5' + ], + overrideLevels: [ + 'l6', + 'l7' + ], + expiryTime: '2017-05-30T11:30:22.531Z' + } + }, + names: [] + } + }; } } http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/audit-logs.service.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/audit-logs.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/audit-logs.service.ts new file mode 100644 index 0000000..706d2f3 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/audit-logs.service.ts @@ -0,0 +1,34 @@ +/** + * 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 {Injectable} from '@angular/core'; +import {Action, ActionReducer, Store} from '@ngrx/store'; +import {AuditLog} from '@app/models/audit-log.model'; +import {AppStore, ModelService, reducer} from '@app/models/store.model'; + +@Injectable() +export class AuditLogsService extends ModelService { + constructor(store: Store<AppStore>) { + super('auditLogs', store); + } +} + +export const auditLogs: ActionReducer<AuditLog[]> = (state: AuditLog[] = [], action: Action) => { + return reducer(state, action); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/bar-graphs.service.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/bar-graphs.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/bar-graphs.service.ts new file mode 100644 index 0000000..2e2db5b --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/bar-graphs.service.ts @@ -0,0 +1,34 @@ +/** + * 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 {Injectable} from '@angular/core'; +import {Action, ActionReducer, Store} from '@ngrx/store'; +import {BarGraph} from '@app/models/bar-graph.model'; +import {AppStore, ModelService, reducer} from '@app/models/store.model'; + +@Injectable() +export class BarGraphsService extends ModelService { + constructor(store: Store<AppStore>) { + super('barGraphs', store); + } +} + +export const barGraphs: ActionReducer<BarGraph[]> = (state: BarGraph[] = [], action: Action) => { + return reducer(state, action); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/filters.service.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/filters.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/filters.service.ts new file mode 100644 index 0000000..99d2140 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/filters.service.ts @@ -0,0 +1,34 @@ +/** + * 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 {Injectable} from '@angular/core'; +import {Action, ActionReducer, Store} from '@ngrx/store'; +import {Filter} from '@app/models/filter.model'; +import {AppStore, ModelService, reducer} from '@app/models/store.model'; + +@Injectable() +export class FiltersService extends ModelService { + constructor(store: Store<AppStore>) { + super('filters', store); + } +} + +export const filters: ActionReducer<Filter[]> = (state: Filter[] = [], action: Action) => { + return reducer(state, action); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/graphs.service.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/graphs.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/graphs.service.ts new file mode 100644 index 0000000..1c32d34 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/graphs.service.ts @@ -0,0 +1,34 @@ +/** + * 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 {Injectable} from '@angular/core'; +import {Action, ActionReducer, Store} from '@ngrx/store'; +import {Graph} from '@app/models/graph.model'; +import {AppStore, ModelService, reducer} from '@app/models/store.model'; + +@Injectable() +export class GraphsService extends ModelService { + constructor(store: Store<AppStore>) { + super('graphs', store); + } +} + +export const graphs: ActionReducer<Graph[]> = (state: Graph[] = [], action: Action) => { + return reducer(state, action); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/nodes.service.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/nodes.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/nodes.service.ts new file mode 100644 index 0000000..b194f94 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/nodes.service.ts @@ -0,0 +1,34 @@ +/** + * 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 {Injectable} from '@angular/core'; +import {Action, ActionReducer, Store} from '@ngrx/store'; +import {Node} from '@app/models/node.model'; +import {AppStore, ModelService, reducer} from '@app/models/store.model'; + +@Injectable() +export class NodesService extends ModelService { + constructor(store: Store<AppStore>) { + super('nodes', store); + } +} + +export const nodes: ActionReducer<Node[]> = (state: Node[] = [], action: Action) => { + return reducer(state, action); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/service-logs.service.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/service-logs.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/service-logs.service.ts new file mode 100644 index 0000000..6859653 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/service-logs.service.ts @@ -0,0 +1,34 @@ +/** + * 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 {Injectable} from '@angular/core'; +import {Action, ActionReducer, Store} from '@ngrx/store'; +import {ServiceLog} from '@app/models/service-log.model'; +import {AppStore, ModelService, reducer} from '@app/models/store.model'; + +@Injectable() +export class ServiceLogsService extends ModelService { + constructor(store: Store<AppStore>) { + super('serviceLogs', store); + } +} + +export const serviceLogs: ActionReducer<ServiceLog[]> = (state: ServiceLog[] = [], action: Action) => { + return reducer(state, action); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/user-configs.service.ts ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/user-configs.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/user-configs.service.ts new file mode 100644 index 0000000..2c770f0 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/user-configs.service.ts @@ -0,0 +1,34 @@ +/** + * 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 {Injectable} from '@angular/core'; +import {Action, ActionReducer, Store} from '@ngrx/store'; +import {UserConfig} from '@app/models/user-config.model'; +import {AppStore, ModelService, reducer} from '@app/models/store.model'; + +@Injectable() +export class UserConfigsService extends ModelService { + constructor(store: Store<AppStore>) { + super('userConfigs', store); + } +} + +export const userConfigs: ActionReducer<UserConfig[]> = (state: UserConfig[] = [], action: Action) => { + return reducer(state, action); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/src/tsconfig.app.json ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/tsconfig.app.json b/ambari-logsearch/ambari-logsearch-web-new/src/tsconfig.app.json index 5e2507d..7166e04 100644 --- a/ambari-logsearch/ambari-logsearch-web-new/src/tsconfig.app.json +++ b/ambari-logsearch/ambari-logsearch-web-new/src/tsconfig.app.json @@ -3,7 +3,7 @@ "compilerOptions": { "outDir": "../out-tsc/app", "module": "es2015", - "baseUrl": "", + "baseUrl": ".", "types": [] }, "exclude": [ http://git-wip-us.apache.org/repos/asf/ambari/blob/603297ae/ambari-logsearch/ambari-logsearch-web-new/tsconfig.json ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-web-new/tsconfig.json b/ambari-logsearch/ambari-logsearch-web-new/tsconfig.json index a35a8ee..12163cb 100644 --- a/ambari-logsearch/ambari-logsearch-web-new/tsconfig.json +++ b/ambari-logsearch/ambari-logsearch-web-new/tsconfig.json @@ -3,6 +3,11 @@ "compilerOptions": { "outDir": "./dist/out-tsc", "baseUrl": "src", + "paths": { + "@app/*": [ + "app/*" + ] + }, "sourceMap": true, "declaration": false, "moduleResolution": "node",