Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/app/pages/monitor/monitor.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {HttpService, I18nService, SettingService} from '@app/services';
import {ActivatedRoute} from '@angular/router';
import {Session, Ticket, User} from '@app/model';
import {Asset, Session, Ticket, User} from '@app/model';
import {NzNotificationService} from 'ng-zorro-antd/notification';
import {getWaterMarkContent} from '@app/utils/common';

Expand Down Expand Up @@ -41,8 +41,18 @@ export class PagesMonitorComponent implements OnInit {
this.sessionID = params['sid'];
this.generateMonitorURL().then(async () => {
const sessionObj = this.sessionDetail;
const asset = await this._http.getAssetDetail(sessionObj.asset_id).toPromise();
const sessionUser = await this._http.getUserDetail(sessionObj.user_id);
let asset: any = null;
try {
asset = await this._http.getAssetDetail(sessionObj.asset_id).toPromise();
} catch (error) {
asset = new Asset();
}
let sessionUser: User = null;
try {
sessionUser = await this._http.getUserDetail(sessionObj.user_id);
} catch (error) {
sessionUser = new User();
}
const auditorUser = `${this._i18n.instant('Viewer')}: ${this.user.name}(${this.user.username})`;
const sessionContent = getWaterMarkContent(sessionUser, asset, this._settingSvc);
const content = `${auditorUser}\n${sessionContent}`;
Expand Down Expand Up @@ -108,7 +118,7 @@ export class PagesMonitorComponent implements OnInit {
const resumeTaskMsg = await this._i18n.t('Resume task has been send');
const session_ids = res['ok'];
const msg = this.isPaused ? resumeTaskMsg : pauseTaskMsg;
this._toastr.success(msg, '', { nzClass: 'custom-success-notification' });
this._toastr.success(msg, '', {nzClass: 'custom-success-notification'});
if (session_ids.indexOf(this.sessionID) !== -1) {

}
Expand Down
17 changes: 10 additions & 7 deletions src/app/pages/replay/replay.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { HttpService, I18nService, LogService, SettingService } from '@app/services';
import { Asset, Replay, Session, User } from '@app/model';
import { getWaterMarkContent } from '@app/utils/common';
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {HttpService, I18nService, LogService, SettingService} from '@app/services';
import {Asset, Replay, Session, User} from '@app/model';
import {getWaterMarkContent} from '@app/utils/common';

@Component({
standalone: false,
Expand Down Expand Up @@ -48,8 +48,11 @@ export class PagesReplayComponent implements OnInit {
} catch (error) {
this.asset = new Asset();
}

this.sessionUser = await this._http.getUserDetail(this.session.user_id);
try {
this.sessionUser = await this._http.getUserDetail(this.session.user_id);
} catch (error) {
this.sessionUser = new User();
}

const interval = setInterval(() => {
this._http.getReplay(sid).subscribe(
Expand Down