1
0
mirror of https://github.com/bitwarden/web synced 2026-01-08 03:23:29 +00:00

event info

This commit is contained in:
Kyle Spearrin
2018-07-09 11:47:57 -04:00
parent 0294c2cb6d
commit b090de0da1
4 changed files with 427 additions and 25 deletions

View File

@@ -21,8 +21,11 @@
<table class="table table-hover" *ngIf="events && events.length">
<thead>
<tr>
<th class="border-top-0">{{'timestamp' | i18n}}</th>
<th class="border-top-0">{{'user' | i18n}}</th>
<th class="border-top-0" width="210">{{'timestamp' | i18n}}</th>
<th class="border-top-0" width="40">
<span class="sr-only">{{'device' | i18n}}</span>
</th>
<th class="border-top-0" width="150">{{'user' | i18n}}</th>
<th class="border-top-0">{{'event' | i18n}}</th>
</tr>
</thead>
@@ -30,11 +33,12 @@
<tr *ngFor="let e of events">
<td>{{e.date | date:'medium'}}</td>
<td>
{{e.userId}}
<i class="text-muted fa fa-lg {{e.appIcon}}" title="{{e.appName}}, {{e.ip}}"></i>
</td>
<td>
{{e.type}}
{{e.userName}}
</td>
<td [innerHTML]="e.message"></td>
</tr>
</tbody>
</table>

View File

@@ -8,6 +8,9 @@ import { ApiService } from 'jslib/abstractions/api.service';
import { EventService } from '../../services/event.service';
import { EventResponse } from 'jslib/models/response/eventResponse';
import { ListResponse } from 'jslib/models/response/listResponse';
@Component({
selector: 'app-org-events',
templateUrl: 'events.component.html',
@@ -56,6 +59,7 @@ export class EventsComponent implements OnInit {
}
this.loading = true;
let response: ListResponse<EventResponse>;
try {
const promise = this.apiService.getEventsOrganization(this.organizationId, dates[0], dates[1],
clearExisting ? null : this.continuationToken);
@@ -64,28 +68,30 @@ export class EventsComponent implements OnInit {
} else {
this.morePromise = promise;
}
const response = await promise;
this.continuationToken = response.continuationToken;
const events = response.data.map((r) => {
const userId = r.actingUserId == null ? r.userId : r.actingUserId;
const eventInfo: any = {};
const htmlMessage = '';
return {
message: htmlMessage,
appIcon: eventInfo.appIcon,
appName: eventInfo.appName,
userId: userId,
userName: userId != null ? 'user' : '-',
date: r.date,
ip: r.ipAddress,
};
});
if (!clearExisting && this.events != null && this.events.length > 0) {
this.events = this.events.concat(events);
} else {
this.events = events;
}
response = await promise;
} catch { }
this.continuationToken = response.continuationToken;
const events = response.data.map((r) => {
const userId = r.actingUserId == null ? r.userId : r.actingUserId;
const eventInfo = this.eventService.getEventInfo(r);
return {
message: eventInfo.message,
appIcon: eventInfo.appIcon,
appName: eventInfo.appName,
userId: userId,
userName: userId != null ? 'user' : '-',
date: r.date,
ip: r.ipAddress,
};
});
if (!clearExisting && this.events != null && this.events.length > 0) {
this.events = this.events.concat(events);
} else {
this.events = events;
}
this.loading = false;
this.morePromise = null;
this.refreshPromise = null;