1 /* Copyright (c) 2019 AT&T Intellectual Property. #
\r
3 # Licensed under the Apache License, Version 2.0 (the "License"); #
\r
4 # you may not use this file except in compliance with the License. #
\r
5 # You may obtain a copy of the License at #
\r
7 # http://www.apache.org/licenses/LICENSE-2.0 #
\r
9 # Unless required by applicable law or agreed to in writing, software #
\r
10 # distributed under the License is distributed on an "AS IS" BASIS, #
\r
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
\r
12 # See the License for the specific language governing permissions and #
\r
13 # limitations under the License. #
\r
14 ##############################################################################*/
\r
17 import { Component, OnInit, Input, ViewChild, ElementRef, Renderer2, NgModule, Compiler, ViewContainerRef, Inject, Sanitizer } from '@angular/core';
\r
18 import { FileTransferService } from 'app/shared/services/file-transfer.service';
\r
19 import { DomSanitizer } from '@angular/platform-browser'
\r
20 import * as $ from 'jquery';
\r
21 import 'codemirror/mode/xml/xml.js';
\r
26 selector: 'app-robot-report',
\r
27 templateUrl: './robot-report.component.pug',
\r
28 styleUrls: ['./robot-report.component.scss'],
\r
30 export class RobotReportComponent implements OnInit {
\r
32 @Input() public response;
\r
34 @ViewChild('srcipts') scripts: ElementRef;
\r
35 @ViewChild('frame1') frame1: ElementRef;
\r
36 @ViewChild('frame2') frame2: ElementRef;
\r
37 @ViewChild('codeMirror') codeMirror: ElementRef;
\r
39 @ViewChild('container', {read: ViewContainerRef}) public container;
\r
47 public codeConfig = {
\r
48 mode: "application/xml",
\r
54 public isRefreshed = false;
\r
55 public noClick = "<script>$(document).ready(function(){ $('div a').removeAttr('href');}); $(document).click(function(){$('div a').removeAttr('href');} )</script>";
\r
57 constructor(private fileTransfer: FileTransferService, private compiler: Compiler, private sanitizer: DomSanitizer) { }
\r
61 if(this.response.vthResponse && this.response.vthResponse.resultData){
\r
62 let fileId = this.response.vthResponse.resultData.robotResultFileId;
\r
64 this.fileTransfer.get(fileId, {robot: true}).subscribe(result => {
\r
65 this.reports.log = this.sanitizer.bypassSecurityTrustHtml(result['log.html'] + this.noClick);
\r
66 this.reports.report = this.sanitizer.bypassSecurityTrustHtml(result['report.html'] + this.noClick);
\r
67 this.reports.output = result['output.xml'];
\r
76 this.isRefreshed = false;
\r
78 this.isRefreshed = true;
\r