You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2017/10/04 14:56:39 UTC
[4/5] ambari git commit: AMBARI-22129 Log Search UI: reorganize
classes structure. (ababiichuk)
AMBARI-22129 Log Search UI: reorganize classes structure. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b4966c10
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b4966c10
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b4966c10
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: b4966c10b3369264c07a1daa934a4f872379cdb7
Parents: de981ca
Author: ababiichuk <ab...@hortonworks.com>
Authored: Wed Oct 4 15:41:26 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Wed Oct 4 17:09:13 2017 +0300
----------------------------------------------------------------------
.../classes/active-service-log-entry.class.ts | 23 --
.../src/app/classes/active-service-log-entry.ts | 23 ++
.../src/app/classes/histogram-options.class.ts | 36 ---
.../src/app/classes/histogram-options.ts | 36 +++
.../src/app/classes/list-item.class.ts | 26 ---
.../src/app/classes/list-item.ts | 26 +++
.../src/app/classes/models/app-settings.ts | 27 +++
.../src/app/classes/models/app-state.ts | 43 ++++
.../src/app/classes/models/audit-log-field.ts | 225 +++++++++++++++++++
.../src/app/classes/models/audit-log.ts | 46 ++++
.../src/app/classes/models/bar-graph.ts | 24 ++
.../src/app/classes/models/common-entry.ts | 22 ++
.../src/app/classes/models/count.ts | 22 ++
.../src/app/classes/models/filter.ts | 25 +++
.../src/app/classes/models/graph.ts | 23 ++
.../src/app/classes/models/log-field.ts | 27 +++
.../src/app/classes/models/log.ts | 38 ++++
.../src/app/classes/models/node.ts | 30 +++
.../src/app/classes/models/service-log-field.ts | 107 +++++++++
.../src/app/classes/models/service-log.ts | 27 +++
.../app/classes/models/solr-collection-state.ts | 23 ++
.../src/app/classes/models/store.ts | 180 +++++++++++++++
.../src/app/classes/models/user-config.ts | 26 +++
.../queries/audit-logs-query-params.class.ts | 46 ----
.../classes/queries/audit-logs-query-params.ts | 46 ++++
.../app/classes/queries/query-params.class.ts | 23 --
.../src/app/classes/queries/query-params.ts | 23 ++
...ce-logs-histogram-query-params.class.spec.ts | 203 -----------------
...service-logs-histogram-query-params.class.ts | 70 ------
.../service-logs-histogram-query-params.spec.ts | 203 +++++++++++++++++
.../service-logs-histogram-query-params.ts | 70 ++++++
.../queries/service-logs-query-params.class.ts | 30 ---
.../queries/service-logs-query-params.ts | 30 +++
...service-logs-truncated-query-params.class.ts | 36 ---
.../service-logs-truncated-query-params.ts | 36 +++
.../classes/service-log-context-entry.class.ts | 26 ---
.../app/classes/service-log-context-entry.ts | 26 +++
.../dropdown-button.component.ts | 2 +-
.../dropdown-list/dropdown-list.component.ts | 2 +-
.../filter-button/filter-button.component.ts | 2 +-
.../filters-panel/filters-panel.component.ts | 4 +-
.../log-context/log-context.component.ts | 4 +-
.../logs-container/logs-container.component.ts | 10 +-
.../components/logs-list/logs-list.component.ts | 4 +-
.../main-container/main-container.component.ts | 6 +-
.../menu-button/menu-button.component.ts | 2 +-
.../search-box/search-box.component.ts | 2 +-
.../time-histogram/time-histogram.component.ts | 2 +-
.../src/app/models/app-settings.model.ts | 27 ---
.../src/app/models/app-state.model.ts | 43 ----
.../src/app/models/audit-log-field.model.ts | 225 -------------------
.../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-field.model.ts | 27 ---
.../src/app/models/log.model.ts | 38 ----
.../src/app/models/node.model.ts | 30 ---
.../src/app/models/service-log-field.model.ts | 107 ---------
.../src/app/models/service-log.model.ts | 27 ---
.../app/models/solr-collection-state.model.ts | 23 --
.../src/app/models/store.model.ts | 180 ---------------
.../src/app/models/user-config.model.ts | 26 ---
.../app/services/component-actions.service.ts | 4 +-
.../src/app/services/filtering.service.spec.ts | 4 +-
.../src/app/services/filtering.service.ts | 4 +-
.../src/app/services/http-client.service.ts | 8 +-
.../src/app/services/logs-container.service.ts | 2 +-
.../services/storage/app-settings.service.ts | 4 +-
.../app/services/storage/app-state.service.ts | 4 +-
.../storage/audit-logs-fields.service.ts | 2 +-
.../app/services/storage/audit-logs.service.ts | 2 +-
.../app/services/storage/clusters.service.ts | 2 +-
.../app/services/storage/components.service.ts | 2 +-
.../src/app/services/storage/filters.service.ts | 2 +-
.../src/app/services/storage/graphs.service.ts | 2 +-
.../src/app/services/storage/hosts.service.ts | 2 +-
.../storage/service-logs-fields.service.ts | 2 +-
.../service-logs-histogram-data.service.ts | 2 +-
.../storage/service-logs-truncated.service.ts | 2 +-
.../services/storage/service-logs.service.ts | 2 +-
.../services/storage/user-configs.service.ts | 2 +-
84 files changed, 1481 insertions(+), 1481 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/active-service-log-entry.class.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/active-service-log-entry.class.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/active-service-log-entry.class.ts
deleted file mode 100644
index d3d7d95..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/active-service-log-entry.class.ts
+++ /dev/null
@@ -1,23 +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.
- */
-
-export interface ActiveServiceLogEntry {
- id: string;
- host_name: string;
- component_name: string;
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/active-service-log-entry.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/active-service-log-entry.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/active-service-log-entry.ts
new file mode 100644
index 0000000..d3d7d95
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/active-service-log-entry.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 ActiveServiceLogEntry {
+ id: string;
+ host_name: string;
+ component_name: string;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/histogram-options.class.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/histogram-options.class.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/histogram-options.class.ts
deleted file mode 100644
index dee5d98..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/histogram-options.class.ts
+++ /dev/null
@@ -1,36 +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.
- */
-
-export interface HistogramMarginOptions {
- top: number;
- right: number;
- bottom: number;
- left: number;
-}
-
-export interface HistogramStyleOptions {
- margin?: HistogramMarginOptions;
- height?: number;
- tickPadding?: number;
- columnWidth?: number;
- dragAreaColor?: string;
-}
-
-export interface HistogramOptions extends HistogramStyleOptions {
- keysWithColors: {[key: string]: string};
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/histogram-options.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/histogram-options.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/histogram-options.ts
new file mode 100644
index 0000000..dee5d98
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/histogram-options.ts
@@ -0,0 +1,36 @@
+/**
+ * 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 HistogramMarginOptions {
+ top: number;
+ right: number;
+ bottom: number;
+ left: number;
+}
+
+export interface HistogramStyleOptions {
+ margin?: HistogramMarginOptions;
+ height?: number;
+ tickPadding?: number;
+ columnWidth?: number;
+ dragAreaColor?: string;
+}
+
+export interface HistogramOptions extends HistogramStyleOptions {
+ keysWithColors: {[key: string]: string};
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/list-item.class.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/list-item.class.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/list-item.class.ts
deleted file mode 100644
index 1aaaecc..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/list-item.class.ts
+++ /dev/null
@@ -1,26 +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.
- */
-
-export interface ListItem {
- id?: string;
- label?: string;
- value: any;
- iconClass?: string;
- isChecked?: boolean;
- action?: string;
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/list-item.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/list-item.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/list-item.ts
new file mode 100644
index 0000000..1aaaecc
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/list-item.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 ListItem {
+ id?: string;
+ label?: string;
+ value: any;
+ iconClass?: string;
+ isChecked?: boolean;
+ action?: string;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/app-settings.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/app-settings.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/app-settings.ts
new file mode 100644
index 0000000..11821a3
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/app-settings.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 * as moment from 'moment-timezone';
+
+export interface AppSettings {
+ timeZone: string;
+}
+
+export const defaultSettings: AppSettings = {
+ timeZone: moment.tz.guess()
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/app-state.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/app-state.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/app-state.ts
new file mode 100644
index 0000000..beeb670
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/app-state.ts
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {ActiveServiceLogEntry} from '@app/classes/active-service-log-entry';
+
+export interface AppState {
+ isAuthorized: boolean;
+ isInitialLoading: boolean;
+ isLoginInProgress: boolean;
+ isAuditLogsSet: boolean;
+ isServiceLogsSet: boolean;
+ activeLogsType?: string;
+ isServiceLogsFileView: boolean;
+ isServiceLogContextView: boolean;
+ activeLog: ActiveServiceLogEntry | null;
+}
+
+export const initialState: AppState = {
+ isAuthorized: false,
+ isInitialLoading: false,
+ isLoginInProgress: false,
+ isAuditLogsSet: false,
+ isServiceLogsSet: false,
+ activeLogsType: 'serviceLogs', // TODO implement setting the parameter depending on user's navigation
+ isServiceLogsFileView: false,
+ isServiceLogContextView: false,
+ activeLog: null
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/audit-log-field.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/audit-log-field.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/audit-log-field.ts
new file mode 100644
index 0000000..40ad27e
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/audit-log-field.ts
@@ -0,0 +1,225 @@
+/**
+ * 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 {LogField} from '@app/classes/models/log-field';
+
+const columnsNamesMap = {
+ access: {
+ displayName: 'logs.accessType',
+ isDisplayed: true
+ },
+ action: {
+ displayName: 'logs.action'
+ },
+ agent: {
+ displayName: 'logs.agent'
+ },
+ agentHost: {
+ displayName: 'logs.agentHost'
+ },
+ authType: {
+ displayName: 'logs.authType'
+ },
+ bundle_id: {
+ displayName: 'logs.bundleId'
+ },
+ case_id: {
+ displayName: 'logs.caseId'
+ },
+ cliIP: {
+ displayName: 'logs.clientIp',
+ isDisplayed: true
+ },
+ cliType: {
+ displayName: 'logs.clientType'
+ },
+ cluster: {
+ displayName: 'logs.cluster'
+ },
+ dst: {
+ displayName: 'logs.dst'
+ },
+ evtTime: {
+ displayName: 'logs.eventTime',
+ isDisplayed: true
+ },
+ file: {
+ displayName: 'logs.file'
+ },
+ host: {
+ displayName: 'logs.host'
+ },
+ id: {
+ displayName: 'logs.id'
+ },
+ ip: {
+ displayName: 'logs.ip'
+ },
+ level: {
+ displayName: 'logs.level'
+ },
+ log_message: {
+ displayName: 'logs.message'
+ },
+ logType: {
+ displayName: 'logs.logType'
+ },
+ logfile_line_number: {
+ displayName: 'logs.logfileLineNumber'
+ },
+ logger_name: {
+ displayName: 'logs.loggerName'
+ },
+ logtime: {
+ displayName: 'logs.logTime'
+ },
+ path: {
+ displayName: 'logs.path'
+ },
+ perm: {
+ displayName: 'logs.perm'
+ },
+ policy: {
+ displayName: 'logs.policy'
+ },
+ proxyUsers: {
+ displayName: 'logs.proxyUsers'
+ },
+ reason: {
+ displayName: 'logs.reason'
+ },
+ repo: {
+ displayName: 'logs.repo',
+ isDisplayed: true
+ },
+ repoType: {
+ displayName: 'logs.repoType'
+ },
+ req_caller_id: {
+ displayName: 'logs.reqCallerId'
+ },
+ reqContext: {
+ displayName: 'logs.reqContext'
+ },
+ reqData: {
+ displayName: 'logs.reqData'
+ },
+ req_self_id: {
+ displayName: 'logs.reqSelfId'
+ },
+ resType: {
+ displayName: 'logs.resType'
+ },
+ resource: {
+ displayName: 'logs.resource',
+ isDisplayed: true
+ },
+ result: {
+ displayName: 'logs.result',
+ isDisplayed: true
+ },
+ sess: {
+ displayName: 'logs.session'
+ },
+ text: {
+ displayName: 'logs.text'
+ },
+ type: {
+ displayName: 'logs.type'
+ },
+ ugi: {
+ displayName: 'logs.ugi'
+ },
+ reqUser: {
+ displayName: 'logs.user',
+ isDisplayed: true
+ },
+ ws_base_url: {
+ displayName: 'logs.baseUrl'
+ },
+ ws_command: {
+ displayName: 'logs.command'
+ },
+ ws_component: {
+ displayName: 'logs.component'
+ },
+ ws_details: {
+ displayName: 'logs.details'
+ },
+ ws_display_name: {
+ displayName: 'logs.displayName'
+ },
+ ws_os: {
+ displayName: 'logs.os'
+ },
+ ws_repo_id: {
+ displayName: 'logs.repoId'
+ },
+ ws_repo_version: {
+ displayName: 'logs.repoVersion'
+ },
+ ws_repositories: {
+ displayName: 'logs.repositories'
+ },
+ ws_request_id: {
+ displayName: 'logs.requestId'
+ },
+ ws_result_status: {
+ displayName: 'logs.resultStatus'
+ },
+ ws_roles: {
+ displayName: 'logs.roles'
+ },
+ ws_stack_version: {
+ displayName: 'logs.stackVersion'
+ },
+ ws_stack: {
+ displayName: 'logs.stack'
+ },
+ ws_status: {
+ displayName: 'logs.status'
+ },
+ ws_task_id: {
+ displayName: 'logs.taskId'
+ },
+ ws_version_note: {
+ displayName: 'logs.versionNote'
+ },
+ ws_version_number: {
+ displayName: 'logs.versionNumber'
+ },
+ tags: {
+ isAvailable: false
+ },
+ tags_str: {
+ isAvailable: false
+ },
+ seq_num: {
+ isAvailable: false
+ }
+};
+
+export class AuditLogField extends LogField {
+ constructor(name: string) {
+ super(name);
+ const preset = columnsNamesMap[this.name];
+ if (preset) {
+ Object.assign(this, preset);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/audit-log.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/audit-log.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/audit-log.ts
new file mode 100644
index 0000000..fbe0e46
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/audit-log.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/classes/models/log';
+
+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/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/bar-graph.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/bar-graph.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/bar-graph.ts
new file mode 100644
index 0000000..d872bd0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/bar-graph.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/classes/models/common-entry';
+
+export interface BarGraph {
+ dataCount: CommonEntry[];
+ name: string;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/common-entry.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/common-entry.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/common-entry.ts
new file mode 100644
index 0000000..dad82ab
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/common-entry.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/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/count.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/count.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/count.ts
new file mode 100644
index 0000000..02fc41c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/count.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/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/filter.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/filter.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/filter.ts
new file mode 100644
index 0000000..c7ff662
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/filter.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/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/graph.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/graph.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/graph.ts
new file mode 100644
index 0000000..be31f19
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/graph.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/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/log-field.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/log-field.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/log-field.ts
new file mode 100644
index 0000000..0e738ab
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/log-field.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.
+ */
+
+export class LogField {
+ constructor(name: string) {
+ this.name = name;
+ }
+ name: string;
+ displayName: string = this.name;
+ isDisplayed: boolean = false;
+ isAvailable: boolean = true;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/log.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/log.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/log.ts
new file mode 100644
index 0000000..c598e41
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/log.ts
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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;
+ line_number?: number;
+ message_md5: string;
+ cluster: string;
+ event_count: number;
+ event_md5: string;
+ event_dur_ms: number;
+ _ttl_: string;
+ _expire_at_: number;
+ _router_field_?: number;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/node.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/node.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/node.ts
new file mode 100644
index 0000000..a14e51a
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/node.ts
@@ -0,0 +1,30 @@
+/**
+ * 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/classes/models/common-entry';
+
+export interface Node {
+ name: string;
+ type?: string;
+ value: string;
+ isParent: boolean;
+ isRoot: boolean;
+ childs?: Node[];
+ logLevelCount?: CommonEntry[];
+ vNodeList?: CommonEntry[];
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/service-log-field.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/service-log-field.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/service-log-field.ts
new file mode 100644
index 0000000..0c1c23e
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/service-log-field.ts
@@ -0,0 +1,107 @@
+/**
+ * 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 {LogField} from '@app/classes/models/log-field';
+
+const columnsNamesMap = {
+ log_message: {
+ displayName: 'logs.message',
+ isDisplayed: true
+ },
+ bundle_id: {
+ displayName: 'logs.bundleId'
+ },
+ case_id: {
+ displayName: 'logs.caseId'
+ },
+ cluster: {
+ displayName: 'logs.cluster'
+ },
+ event_count: {
+ displayName: 'logs.eventCount'
+ },
+ file: {
+ displayName: 'logs.file'
+ },
+ host: {
+ displayName: 'logs.host'
+ },
+ id: {
+ displayName: 'logs.id'
+ },
+ ip: {
+ displayName: 'logs.ip'
+ },
+ level: {
+ displayName: 'logs.level',
+ isDisplayed: true
+ },
+ line_number: {
+ displayName: 'logs.lineNumber'
+ },
+ logtype: {
+ displayName: 'logs.logType'
+ },
+ logfile_line_number: {
+ displayName: 'logs.logfileLineNumber'
+ },
+ logger_name: {
+ displayName: 'logs.loggerName'
+ },
+ logtime: {
+ isDisplayed: true
+ },
+ method: {
+ displayName: 'logs.method'
+ },
+ path: {
+ displayName: 'logs.path'
+ },
+ rowtype: {
+ displayName: 'logs.rowType'
+ },
+ thread_name: {
+ displayName: 'logs.threadName'
+ },
+ type: {
+ displayName: 'logs.type',
+ isDisplayed: true
+ },
+ tags: {
+ isAvailable: false
+ },
+ text: {
+ isAvailable: false
+ },
+ message: {
+ isAvailable: false
+ },
+ seq_num: {
+ isAvailable: false
+ }
+};
+
+export class ServiceLogField extends LogField {
+ constructor(name: string) {
+ super(name);
+ const preset = columnsNamesMap[this.name];
+ if (preset) {
+ Object.assign(this, preset);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/service-log.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/service-log.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/service-log.ts
new file mode 100644
index 0000000..2ac026c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/service-log.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/classes/models/log';
+
+export interface ServiceLog extends Log {
+ path: string;
+ host: string;
+ level: string;
+ logtime: number;
+ ip: string;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/solr-collection-state.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/solr-collection-state.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/solr-collection-state.ts
new file mode 100644
index 0000000..0824dda
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/solr-collection-state.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/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/store.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/store.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/store.ts
new file mode 100644
index 0000000..c62d3ee
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/store.ts
@@ -0,0 +1,180 @@
+/**
+ * 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 {AppSettings} from '@app/classes/models/app-settings';
+import {AppState} from '@app/classes/models/app-state';
+import {AuditLog} from '@app/classes/models/audit-log';
+import {ServiceLog} from '@app/classes/models/service-log';
+import {BarGraph} from '@app/classes/models/bar-graph';
+import {Graph} from '@app/classes/models/graph';
+import {Node} from '@app/classes/models/node';
+import {UserConfig} from '@app/classes/models/user-config';
+import {Filter} from '@app/classes/models/filter';
+import {AuditLogField} from '@app/classes/models/audit-log-field';
+import {ServiceLogField} from '@app/classes/models/service-log-field';
+
+export const storeActions = {
+ 'ARRAY.ADD': 'ADD',
+ 'ARRAY.ADD.START': 'ADD_TO_START',
+ 'ARRAY.DELETE.PRIMITIVE': 'DELETE_PRIMITIVE',
+ 'ARRAY.DELETE.OBJECT': 'DELETE_OBJECT',
+ 'ARRAY.CLEAR': 'CLEAR',
+ 'ARRAY.MAP': 'MAP',
+
+ 'OBJECT.SET': 'SET'
+};
+
+export interface AppStore {
+ appSettings: AppSettings;
+ appState: AppState;
+ auditLogs: AuditLog[];
+ serviceLogs: ServiceLog[];
+ serviceLogsHistogramData: BarGraph[];
+ serviceLogsTruncated: ServiceLog[];
+ graphs: Graph[];
+ hosts: Node[];
+ userConfigs: UserConfig[];
+ filters: Filter[];
+ clusters: string[];
+ components: Node[];
+ serviceLogsFields: ServiceLogField[];
+ auditLogsFields: AuditLogField[];
+}
+
+export class ModelService {
+
+ constructor(modelName: string, store: Store<AppStore>) {
+ this.modelName = modelName;
+ this.store = store;
+ }
+
+ protected modelName: string;
+
+ protected store: Store<AppStore>;
+
+ getAll(): Observable<any> {
+ return this.store.select(this.modelName);
+ }
+
+}
+
+export class CollectionModelService extends ModelService {
+
+ addInstance(instance: any): void {
+ this.addInstances([instance]);
+ }
+
+ addInstances(instances: any[]): void {
+ this.store.dispatch({
+ type: `${storeActions['ARRAY.ADD']}_${this.modelName}`,
+ payload: instances
+ });
+ }
+
+ addInstancesToStart(instances: any[]): void {
+ this.store.dispatch({
+ type: `${storeActions['ARRAY.ADD.START']}_${this.modelName}`,
+ payload: instances
+ });
+ }
+
+ deleteObjectInstance(instance: any): void {
+ this.store.dispatch({
+ type: `${storeActions['ARRAY.DELETE.OBJECT']}_${this.modelName}`,
+ payload: instance
+ });
+ }
+
+ deletePrimitiveInstance(instance: any): void {
+ this.store.dispatch({
+ type: `${storeActions['ARRAY.DELETE.PRIMITIVE']}_${this.modelName}`,
+ payload: instance
+ });
+ }
+
+ clear(): void {
+ this.store.dispatch({
+ type: `${storeActions['ARRAY.CLEAR']}_${this.modelName}`
+ });
+ }
+
+ mapCollection(modifier: (item: any) => {}): void {
+ this.store.dispatch({
+ type: `${storeActions['ARRAY.MAP']}_${this.modelName}`,
+ payload: {
+ modifier: modifier
+ }
+ });
+ }
+
+}
+
+export class ObjectModelService extends ModelService {
+
+ getParameter(key: string): Observable<any> {
+ return this.store.select(this.modelName, key);
+ }
+
+ setParameter(key: string, value: any): void {
+ let payload = {};
+ payload[key] = value;
+ this.setParameters(payload);
+ }
+
+ setParameters(params: any): void {
+ this.store.dispatch({
+ type: `${storeActions['OBJECT.SET']}_${this.modelName}`,
+ payload: params
+ });
+ }
+
+}
+
+export function getCollectionReducer(modelName: string, defaultState: any = []): any {
+ return (state: any = defaultState, action: Action) => {
+ switch (action.type) {
+ case `${storeActions['ARRAY.ADD']}_${modelName}`:
+ return [...state, ...action.payload];
+ case `${storeActions['ARRAY.ADD.START']}_${modelName}`:
+ return [...action.payload, ...state];
+ case `${storeActions['ARRAY.DELETE.OBJECT']}_${modelName}`:
+ return state.filter(instance => instance.id !== action.payload.id);
+ case `${storeActions['ARRAY.DELETE.PRIMITIVE']}_${modelName}`:
+ return state.filter(item => item !== action.payload);
+ case `${storeActions['ARRAY.CLEAR']}_${modelName}`:
+ return [];
+ case `${storeActions['ARRAY.MAP']}_${modelName}`:
+ return state.map(action.payload.modifier);
+ default:
+ return state;
+ }
+ };
+}
+
+export function getObjectReducer(modelName: string, defaultState: any = {}) {
+ return (state: any = defaultState, action: Action): any => {
+ switch (action.type) {
+ case `${storeActions['OBJECT.SET']}_${modelName}`:
+ return Object.assign({}, state, action.payload);
+ default:
+ return state;
+ }
+ };
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/user-config.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/user-config.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/user-config.ts
new file mode 100644
index 0000000..f52761c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/user-config.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/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-query-params.class.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-query-params.class.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-query-params.class.ts
deleted file mode 100644
index 3727abb..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-query-params.class.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {QueryParams} from '@app/classes/queries/query-params.class';
-
-export const defaultParams = {
- page: '0',
- pageSize: '10'
-};
-
-export class AuditLogsQueryParams extends QueryParams {
- constructor(options: AuditLogsQueryParams) {
- let finalParams = Object.assign({}, defaultParams, options);
- const page = parseInt(finalParams.page),
- pageSize = parseInt(finalParams.pageSize);
- finalParams.startIndex = isNaN(page) || isNaN(pageSize) ? '' : (page * pageSize).toString();
- super(finalParams);
- }
- page: string;
- pageSize: string;
- startIndex: string;
- sortBy?: string;
- sortType?: 'asc' | 'desc';
- clusters?: string;
- mustBe?: string;
- mustNot?: string;
- includeQuery?: string;
- excludeQuery?: string;
- from?: string;
- to?: string;
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-query-params.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-query-params.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-query-params.ts
new file mode 100644
index 0000000..509fa04
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-query-params.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 {QueryParams} from '@app/classes/queries/query-params';
+
+export const defaultParams = {
+ page: '0',
+ pageSize: '10'
+};
+
+export class AuditLogsQueryParams extends QueryParams {
+ constructor(options: AuditLogsQueryParams) {
+ let finalParams = Object.assign({}, defaultParams, options);
+ const page = parseInt(finalParams.page),
+ pageSize = parseInt(finalParams.pageSize);
+ finalParams.startIndex = isNaN(page) || isNaN(pageSize) ? '' : (page * pageSize).toString();
+ super(finalParams);
+ }
+ page: string;
+ pageSize: string;
+ startIndex: string;
+ sortBy?: string;
+ sortType?: 'asc' | 'desc';
+ clusters?: string;
+ mustBe?: string;
+ mustNot?: string;
+ includeQuery?: string;
+ excludeQuery?: string;
+ from?: string;
+ to?: string;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/query-params.class.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/query-params.class.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/query-params.class.ts
deleted file mode 100644
index 83c3261..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/query-params.class.ts
+++ /dev/null
@@ -1,23 +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.
- */
-
-export class QueryParams {
- constructor(options: QueryParams) {
- Object.assign(this, options);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/query-params.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/query-params.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/query-params.ts
new file mode 100644
index 0000000..83c3261
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/query-params.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 class QueryParams {
+ constructor(options: QueryParams) {
+ Object.assign(this, options);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.class.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.class.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.class.spec.ts
deleted file mode 100644
index efa2459..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.class.spec.ts
+++ /dev/null
@@ -1,203 +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 {ServiceLogsHistogramQueryParams} from './service-logs-histogram-query-params.class';
-
-describe('ServiceLogsHistogramQueryParams', () => {
-
- describe('constructor', () => {
- const cases = [
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T00:00:00.100Z'
- },
- unit: '+100MILLISECOND',
- title: 'less than 1s'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T00:00:01Z'
- },
- unit: '+100MILLISECOND',
- title: '1s'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T00:00:20Z'
- },
- unit: '+500MILLISECOND',
- title: 'between 1s and 30s'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T00:00:20Z'
- },
- unit: '+500MILLISECOND',
- title: '30s'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T00:00:40Z'
- },
- unit: '+2SECOND',
- title: 'between 30s and 1m'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T00:01:00Z'
- },
- unit: '+2SECOND',
- title: '1m'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T00:20:00Z'
- },
- unit: '+1MINUTE',
- title: 'between 1m and 30m'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T00:30:00Z'
- },
- unit: '+2MINUTE',
- title: '30m'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T01:00:00Z'
- },
- unit: '+2MINUTE',
- title: 'between 30m and 2h'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T02:00:00Z'
- },
- unit: '+5MINUTE',
- title: '2h'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T04:00:00Z'
- },
- unit: '+5MINUTE',
- title: 'between 2h and 6h'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T06:00:00Z'
- },
- unit: '+10MINUTE',
- title: '6h'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T08:00:00Z'
- },
- unit: '+10MINUTE',
- title: 'between 6h and 10h'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T10:00:00Z'
- },
- unit: '+10MINUTE',
- title: '10h'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-01T22:00:00Z'
- },
- unit: '+1HOUR',
- title: 'between 10h and 1d'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-02T00:00:00Z'
- },
- unit: '+1HOUR',
- title: '1d'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-10T00:00:00Z'
- },
- unit: '+8HOUR',
- title: 'between 1d and 15d'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-01-16T00:00:00Z'
- },
- unit: '+1DAY',
- title: '15d'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-03-31T00:00:00Z'
- },
- unit: '+1DAY',
- title: 'between 15d and 3M'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-04-01T00:00:00Z'
- },
- unit: '+1DAY',
- title: '3M'
- },
- {
- options: {
- from: '2017-01-01T00:00:00Z',
- to: '2017-05-01T00:00:00Z'
- },
- unit: '+1MONTH',
- title: 'over 3M'
- }
- ];
-
- cases.forEach(test => {
- it(test.title, () => {
- const paramsObject = new ServiceLogsHistogramQueryParams(test.options);
- expect(paramsObject.unit).toEqual(test.unit);
- });
- });
- });
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.class.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.class.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.class.ts
deleted file mode 100644
index 2e2113f..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.class.ts
+++ /dev/null
@@ -1,70 +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 {QueryParams} from '@app/classes/queries/query-params.class';
-
-export class ServiceLogsHistogramQueryParams extends QueryParams {
- constructor(options: ServiceLogsHistogramQueryParams) {
- let unit;
- const diffTimeStamp = new Date(options.to).valueOf() - new Date(options.from).valueOf();
- switch (true) {
- case diffTimeStamp <= 1000:
- unit = '+100MILLISECOND';
- break;
- case diffTimeStamp <= 30000:
- unit = '+500MILLISECOND';
- break;
- case diffTimeStamp <= 60000:
- unit = '+2SECOND';
- break;
- case diffTimeStamp < 1800000:
- unit = '+1MINUTE';
- break;
- case diffTimeStamp < 7200000:
- unit = '+2MINUTE';
- break;
- case diffTimeStamp < 21600000:
- unit = '+5MINUTE';
- break;
- case diffTimeStamp <= 36000000:
- unit = '+10MINUTE';
- break;
- case diffTimeStamp <= 86400000:
- unit = '+1HOUR';
- break;
- case diffTimeStamp < 1296000000:
- unit = '+8HOUR';
- break;
- case diffTimeStamp <= 7776000000:
- unit = '+1DAY';
- break;
- default:
- unit = '+1MONTH';
- break;
- }
- options.unit = unit;
- super(options);
- }
- from: string;
- to: string;
- unit?: string;
- clusters?: string;
- level?: string;
- includeQuery?: string;
- excludeQuery?: string;
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.spec.ts
new file mode 100644
index 0000000..eb891ed
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.spec.ts
@@ -0,0 +1,203 @@
+/**
+ * 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 {ServiceLogsHistogramQueryParams} from './service-logs-histogram-query-params';
+
+describe('ServiceLogsHistogramQueryParams', () => {
+
+ describe('constructor', () => {
+ const cases = [
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T00:00:00.100Z'
+ },
+ unit: '+100MILLISECOND',
+ title: 'less than 1s'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T00:00:01Z'
+ },
+ unit: '+100MILLISECOND',
+ title: '1s'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T00:00:20Z'
+ },
+ unit: '+500MILLISECOND',
+ title: 'between 1s and 30s'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T00:00:20Z'
+ },
+ unit: '+500MILLISECOND',
+ title: '30s'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T00:00:40Z'
+ },
+ unit: '+2SECOND',
+ title: 'between 30s and 1m'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T00:01:00Z'
+ },
+ unit: '+2SECOND',
+ title: '1m'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T00:20:00Z'
+ },
+ unit: '+1MINUTE',
+ title: 'between 1m and 30m'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T00:30:00Z'
+ },
+ unit: '+2MINUTE',
+ title: '30m'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T01:00:00Z'
+ },
+ unit: '+2MINUTE',
+ title: 'between 30m and 2h'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T02:00:00Z'
+ },
+ unit: '+5MINUTE',
+ title: '2h'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T04:00:00Z'
+ },
+ unit: '+5MINUTE',
+ title: 'between 2h and 6h'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T06:00:00Z'
+ },
+ unit: '+10MINUTE',
+ title: '6h'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T08:00:00Z'
+ },
+ unit: '+10MINUTE',
+ title: 'between 6h and 10h'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T10:00:00Z'
+ },
+ unit: '+10MINUTE',
+ title: '10h'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-01T22:00:00Z'
+ },
+ unit: '+1HOUR',
+ title: 'between 10h and 1d'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-02T00:00:00Z'
+ },
+ unit: '+1HOUR',
+ title: '1d'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-10T00:00:00Z'
+ },
+ unit: '+8HOUR',
+ title: 'between 1d and 15d'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-01-16T00:00:00Z'
+ },
+ unit: '+1DAY',
+ title: '15d'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-03-31T00:00:00Z'
+ },
+ unit: '+1DAY',
+ title: 'between 15d and 3M'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-04-01T00:00:00Z'
+ },
+ unit: '+1DAY',
+ title: '3M'
+ },
+ {
+ options: {
+ from: '2017-01-01T00:00:00Z',
+ to: '2017-05-01T00:00:00Z'
+ },
+ unit: '+1MONTH',
+ title: 'over 3M'
+ }
+ ];
+
+ cases.forEach(test => {
+ it(test.title, () => {
+ const paramsObject = new ServiceLogsHistogramQueryParams(test.options);
+ expect(paramsObject.unit).toEqual(test.unit);
+ });
+ });
+ });
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.ts
new file mode 100644
index 0000000..148aa62
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-histogram-query-params.ts
@@ -0,0 +1,70 @@
+/**
+ * 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 {QueryParams} from '@app/classes/queries/query-params';
+
+export class ServiceLogsHistogramQueryParams extends QueryParams {
+ constructor(options: ServiceLogsHistogramQueryParams) {
+ let unit;
+ const diffTimeStamp = new Date(options.to).valueOf() - new Date(options.from).valueOf();
+ switch (true) {
+ case diffTimeStamp <= 1000:
+ unit = '+100MILLISECOND';
+ break;
+ case diffTimeStamp <= 30000:
+ unit = '+500MILLISECOND';
+ break;
+ case diffTimeStamp <= 60000:
+ unit = '+2SECOND';
+ break;
+ case diffTimeStamp < 1800000:
+ unit = '+1MINUTE';
+ break;
+ case diffTimeStamp < 7200000:
+ unit = '+2MINUTE';
+ break;
+ case diffTimeStamp < 21600000:
+ unit = '+5MINUTE';
+ break;
+ case diffTimeStamp <= 36000000:
+ unit = '+10MINUTE';
+ break;
+ case diffTimeStamp <= 86400000:
+ unit = '+1HOUR';
+ break;
+ case diffTimeStamp < 1296000000:
+ unit = '+8HOUR';
+ break;
+ case diffTimeStamp <= 7776000000:
+ unit = '+1DAY';
+ break;
+ default:
+ unit = '+1MONTH';
+ break;
+ }
+ options.unit = unit;
+ super(options);
+ }
+ from: string;
+ to: string;
+ unit?: string;
+ clusters?: string;
+ level?: string;
+ includeQuery?: string;
+ excludeQuery?: string;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-query-params.class.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-query-params.class.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-query-params.class.ts
deleted file mode 100644
index 864b689..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-query-params.class.ts
+++ /dev/null
@@ -1,30 +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 {AuditLogsQueryParams} from '@app/classes/queries/audit-logs-query-params.class';
-
-export class ServiceLogsQueryParams extends AuditLogsQueryParams {
- level?: string;
- file_name?: string;
- bundle_id?: string;
- hostList?: string;
- find?: string;
- sourceLogId?: string;
- keywordType?: string;
- token?: string;
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-query-params.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-query-params.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-query-params.ts
new file mode 100644
index 0000000..0700a98
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-query-params.ts
@@ -0,0 +1,30 @@
+/**
+ * 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 {AuditLogsQueryParams} from '@app/classes/queries/audit-logs-query-params';
+
+export class ServiceLogsQueryParams extends AuditLogsQueryParams {
+ level?: string;
+ file_name?: string;
+ bundle_id?: string;
+ hostList?: string;
+ find?: string;
+ sourceLogId?: string;
+ keywordType?: string;
+ token?: string;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-truncated-query-params.class.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-truncated-query-params.class.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-truncated-query-params.class.ts
deleted file mode 100644
index da05cee..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-truncated-query-params.class.ts
+++ /dev/null
@@ -1,36 +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 {QueryParams} from '@app/classes/queries/query-params.class';
-
-export const defaultParams = {
- numberRows: '10',
- scrollType: ''
-};
-
-export class ServiceLogsTruncatedQueryParams extends QueryParams {
- constructor(options: ServiceLogsTruncatedQueryParams) {
- const finalParams = Object.assign({}, defaultParams, options);
- super(finalParams);
- }
- id: string;
- host_name: string;
- component_name: string;
- numberRows: string;
- scrollType: 'before' | 'after' | '';
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-truncated-query-params.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-truncated-query-params.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-truncated-query-params.ts
new file mode 100644
index 0000000..6f9de16
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-truncated-query-params.ts
@@ -0,0 +1,36 @@
+/**
+ * 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 {QueryParams} from '@app/classes/queries/query-params';
+
+export const defaultParams = {
+ numberRows: '10',
+ scrollType: ''
+};
+
+export class ServiceLogsTruncatedQueryParams extends QueryParams {
+ constructor(options: ServiceLogsTruncatedQueryParams) {
+ const finalParams = Object.assign({}, defaultParams, options);
+ super(finalParams);
+ }
+ id: string;
+ host_name: string;
+ component_name: string;
+ numberRows: string;
+ scrollType: 'before' | 'after' | '';
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/service-log-context-entry.class.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/service-log-context-entry.class.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/service-log-context-entry.class.ts
deleted file mode 100644
index 15c05fb..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/service-log-context-entry.class.ts
+++ /dev/null
@@ -1,26 +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.
- */
-
-export interface ServiceLogContextEntry {
- id: string;
- time: number;
- level: string;
- message: string;
- fileName: string | null;
- lineNumber: number | null;
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/classes/service-log-context-entry.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/service-log-context-entry.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/service-log-context-entry.ts
new file mode 100644
index 0000000..15c05fb
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/service-log-context-entry.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 ServiceLogContextEntry {
+ id: string;
+ time: number;
+ level: string;
+ message: string;
+ fileName: string | null;
+ lineNumber: number | null;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts
index 43d79f8..0bf4422 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts
@@ -17,7 +17,7 @@
*/
import {Component, OnInit, Input} from '@angular/core';
-import {ListItem} from '@app/classes/list-item.class';
+import {ListItem} from '@app/classes/list-item';
import {ComponentActionsService} from '@app/services/component-actions.service';
import {UtilsService} from '@app/services/utils.service';
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4966c10/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.ts
index 656c901..ef185d0 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.ts
@@ -17,7 +17,7 @@
*/
import {Component, AfterViewInit, Input, Output, EventEmitter, ViewChildren, ViewContainerRef, QueryList} from '@angular/core';
-import {ListItem} from '@app/classes/list-item.class';
+import {ListItem} from '@app/classes/list-item';
import {ComponentGeneratorService} from '@app/services/component-generator.service';
import {ComponentActionsService} from '@app/services/component-actions.service';