You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2017/09/20 14:33:49 UTC
ambari git commit: AMBARI-22006 Log Search UI: implement grouping of
service logs by day. (ababiichuk)
Repository: ambari
Updated Branches:
refs/heads/trunk 56c3da784 -> 0f1099b9a
AMBARI-22006 Log Search UI: implement grouping of service logs by day. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0f1099b9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0f1099b9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0f1099b9
Branch: refs/heads/trunk
Commit: 0f1099b9a9887c3a6b05753a00ce88c9d9c4f497
Parents: 56c3da7
Author: ababiichuk <ab...@hortonworks.com>
Authored: Wed Sep 20 17:07:36 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Wed Sep 20 17:37:42 2017 +0300
----------------------------------------------------------------------
.../logs-list/logs-list.component.html | 52 +++++++++++---------
.../logs-list/logs-list.component.less | 1 -
.../components/logs-list/logs-list.component.ts | 11 ++++-
.../ambari-logsearch-web/src/app/mock-data.ts | 2 +-
.../src/app/services/filtering.service.ts | 28 -----------
.../src/app/services/utils.service.ts | 7 +++
.../src/assets/i18n/en.json | 4 --
7 files changed, 46 insertions(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/0f1099b9/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html
index 888c524..29a85c5 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html
@@ -25,30 +25,36 @@
<div class="col-md-11">{{'logs.details' | translate}}</div>
</div>
</div>
-<accordion-panel *ngFor="let log of logs; let i = index" [toggleId]="'details-' + i" class="col-md-12">
- <ng-template>
- <div *ngIf="isColumnDisplayed('level')" [ngClass]="'hexagon ' + log.className"></div>
- <div *ngIf="isColumnDisplayed('level')" [ngClass]="'col-md-1 log-status ' + log.className">{{log.level}}</div>
- <div *ngIf="isColumnDisplayed('type') || isColumnDisplayed('logtime')" class="col-md-3">
- <div *ngIf="isColumnDisplayed('type')" class="log-type">{{log.type}}</div>
- <time *ngIf="isColumnDisplayed('logtime')" class="log-time">
- {{log.logtime | amTz: timeZone | amDateFormat: timeFormat}}
- </time>
- </div>
- <div class="col-md-6 log-content-wrapper">
- <div class="collapse log-actions" attr.id="details-{{i}}">
- <span class="action-icon fa fa-search"></span>
- <span class="action-icon fa fa-external-link"></span>
- <span class="action-icon fa fa-bullseye"></span>
+<div *ngFor="let log of logs; let i = index">
+ <div *ngIf="i === 0 || isDifferentDates(log.logtime, logs[i - 1].logtime)" class="col-md-12">
+ <div class="logs-header">{{log.logtime | amTz: timeZone | amDateFormat: dateFormat}}</div>
+ </div>
+ <accordion-panel [toggleId]="'details-' + i" class="col-md-12">
+ <ng-template>
+ <div *ngIf="isColumnDisplayed('level')" [ngClass]="'hexagon ' + log.className"></div>
+ <div *ngIf="isColumnDisplayed('level')" [ngClass]="'col-md-1 log-status ' + log.className">{{log.level}}</div>
+ <div *ngIf="isColumnDisplayed('type') || isColumnDisplayed('logtime')" class="col-md-3">
+ <div *ngIf="isColumnDisplayed('type')" class="log-type">{{log.type}}</div>
+ <time *ngIf="isColumnDisplayed('logtime')" class="log-time">
+ {{log.logtime | amTz: timeZone | amDateFormat: timeFormat}}
+ </time>
+ </div>
+ <div class="col-md-6 log-content-wrapper">
+ <div class="collapse log-actions" attr.id="details-{{i}}">
+ <span class="action-icon fa fa-search"></span>
+ <span class="action-icon fa fa-external-link"></span>
+ <span class="action-icon fa fa-crosshairs"></span>
+ </div>
+ <div class="log-content-inner-wrapper">
+ <div class="log-content" *ngIf="isColumnDisplayed('log_message')">{{log.log_message}}</div>
+ </div>
</div>
- <div class="log-content-inner-wrapper">
- <div class="log-content" *ngIf="isColumnDisplayed('log_message')">{{log.log_message}}</div>
+ <div *ngFor="let column of displayedColumns">
+ <div *ngIf="customStyledColumns.indexOf(column.name) === -1" [innerHTML]="log[column.name]"
+ class="col-md-1"></div>
</div>
- </div>
- <div *ngFor="let column of displayedColumns">
- <div *ngIf="customStyledColumns.indexOf(column.name) === -1" [innerHTML]="log[column.name]" class="col-md-1"></div>
- </div>
- </ng-template>
-</accordion-panel>
+ </ng-template>
+ </accordion-panel>
+</div>
<pagination class="col-md-12" *ngIf="logs && logs.length" [totalCount]="totalCount" [filtersForm]="filtersForm"
[filterInstance]="filters.pageSize" [currentCount]="logs.length"></pagination>
http://git-wip-us.apache.org/repos/asf/ambari/blob/0f1099b9/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less
index 91d796f..584c1a7 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less
@@ -23,7 +23,6 @@
padding: 5px 0;
background-color: @list-header-background-color; // TODO implement actual color
overflow: hidden;
- text-transform: uppercase;
}
/deep/ filter-dropdown {
http://git-wip-us.apache.org/repos/asf/ambari/blob/0f1099b9/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.ts
index 6d73dcb..a081e1b 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.ts
@@ -19,6 +19,7 @@ import {Component, Input} from '@angular/core';
import {FormGroup} from '@angular/forms';
import 'rxjs/add/operator/map';
import {FilteringService} from '@app/services/filtering.service';
+import {UtilsService} from '@app/services/utils.service';
@Component({
selector: 'logs-list',
@@ -27,7 +28,7 @@ import {FilteringService} from '@app/services/filtering.service';
})
export class LogsListComponent {
- constructor(private filtering: FilteringService) {
+ constructor(private filtering: FilteringService, private utils: UtilsService) {
}
@Input()
@@ -41,7 +42,9 @@ export class LogsListComponent {
readonly customStyledColumns = ['level', 'type', 'logtime', 'log_message'];
- timeFormat: string = 'DD/MM/YYYY HH:mm:ss';
+ readonly dateFormat: string = 'dddd, MMMM Do';
+
+ readonly timeFormat: string = 'h:mm:ss A';
get timeZone(): string {
return this.filtering.timeZone;
@@ -55,6 +58,10 @@ export class LogsListComponent {
return this.filtering.filtersForm;
}
+ isDifferentDates(dateA, dateB): boolean {
+ return this.utils.isDifferentDates(dateA, dateB, this.timeZone);
+ }
+
isColumnDisplayed(key: string): boolean {
return this.displayedColumns.some(column => column.name === key);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/0f1099b9/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts b/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
index f23139b..4325f5b 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
@@ -322,7 +322,7 @@ export const mockData = {
path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
host: 'h1',
level: 'ERROR',
- logtime: moment().subtract(2, 'd'),
+ logtime: moment().subtract(2, 'd').valueOf(),
ip: '192.168.0.2',
type: 'ams_collector',
_version_: 14,
http://git-wip-us.apache.org/repos/asf/ambari/blob/0f1099b9/ambari-logsearch/ambari-logsearch-web/src/app/services/filtering.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/filtering.service.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/filtering.service.ts
index 2d3f640..718149e 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/filtering.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/filtering.service.ts
@@ -360,34 +360,6 @@ export class FilteringService {
label: 'sorting.title',
options: [
{
- label: 'sorting.level.asc',
- value: {
- key: 'level',
- type: 'asc'
- }
- },
- {
- label: 'sorting.level.desc',
- value: {
- key: 'level',
- type: 'desc'
- }
- },
- {
- label: 'sorting.component.asc',
- value: {
- key: 'type',
- type: 'asc'
- }
- },
- {
- label: 'sorting.component.desc',
- value: {
- key: 'type',
- type: 'desc'
- }
- },
- {
label: 'sorting.time.asc',
value: {
key: 'logtime',
http://git-wip-us.apache.org/repos/asf/ambari/blob/0f1099b9/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts
index 0f90ba3..773172b 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts
@@ -17,6 +17,7 @@
*/
import {Injectable} from '@angular/core';
+import * as moment from 'moment-timezone';
@Injectable()
export class UtilsService {
@@ -47,4 +48,10 @@ export class UtilsService {
return event.keyCode === 13;
}
+ isDifferentDates(dateA, dateB, timeZone): boolean {
+ const momentA = moment(dateA).tz(timeZone),
+ momentB = moment(dateB).tz(timeZone);
+ return !momentA.isSame(momentB, 'day');
+ }
+
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/0f1099b9/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json b/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
index e7126f0..e3f4c69 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
+++ b/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
@@ -68,10 +68,6 @@
"levels.unknown": "Unknown",
"sorting.title": "Sort By",
- "sorting.level.asc": "Ascending Level",
- "sorting.level.desc": "Descending Level",
- "sorting.component.asc": "Ascending Component",
- "sorting.component.desc": "Descending Component",
"sorting.time.asc": "Ascending Time",
"sorting.time.desc": "Descending Time",