|
1 | 1 | import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; |
2 | 2 | import {HttpService, I18nService, SettingService} from '@app/services'; |
3 | 3 | import {ActivatedRoute} from '@angular/router'; |
4 | | -import {Session, Ticket, User} from '@app/model'; |
| 4 | +import {Asset, Session, Ticket, User} from '@app/model'; |
5 | 5 | import {NzNotificationService} from 'ng-zorro-antd/notification'; |
6 | 6 | import {getWaterMarkContent} from '@app/utils/common'; |
7 | 7 |
|
@@ -41,8 +41,18 @@ export class PagesMonitorComponent implements OnInit { |
41 | 41 | this.sessionID = params['sid']; |
42 | 42 | this.generateMonitorURL().then(async () => { |
43 | 43 | const sessionObj = this.sessionDetail; |
44 | | - const asset = await this._http.getAssetDetail(sessionObj.asset_id).toPromise(); |
45 | | - const sessionUser = await this._http.getUserDetail(sessionObj.user_id); |
| 44 | + let asset: any = null; |
| 45 | + try { |
| 46 | + asset = await this._http.getAssetDetail(sessionObj.asset_id).toPromise(); |
| 47 | + } catch (error) { |
| 48 | + asset = new Asset(); |
| 49 | + } |
| 50 | + let sessionUser: User = null; |
| 51 | + try { |
| 52 | + sessionUser = await this._http.getUserDetail(sessionObj.user_id); |
| 53 | + } catch (error) { |
| 54 | + sessionUser = new User(); |
| 55 | + } |
46 | 56 | const auditorUser = `${this._i18n.instant('Viewer')}: ${this.user.name}(${this.user.username})`; |
47 | 57 | const sessionContent = getWaterMarkContent(sessionUser, asset, this._settingSvc); |
48 | 58 | const content = `${auditorUser}\n${sessionContent}`; |
@@ -108,7 +118,7 @@ export class PagesMonitorComponent implements OnInit { |
108 | 118 | const resumeTaskMsg = await this._i18n.t('Resume task has been send'); |
109 | 119 | const session_ids = res['ok']; |
110 | 120 | const msg = this.isPaused ? resumeTaskMsg : pauseTaskMsg; |
111 | | - this._toastr.success(msg, '', { nzClass: 'custom-success-notification' }); |
| 121 | + this._toastr.success(msg, '', {nzClass: 'custom-success-notification'}); |
112 | 122 | if (session_ids.indexOf(this.sessionID) !== -1) { |
113 | 123 |
|
114 | 124 | } |
|
0 commit comments