--- /dev/null
+/* Copyright (c) 2019 AT&T Intellectual Property. #\r
+# #\r
+# Licensed under the Apache License, Version 2.0 (the "License"); #\r
+# you may not use this file except in compliance with the License. #\r
+# You may obtain a copy of the License at #\r
+# #\r
+# http://www.apache.org/licenses/LICENSE-2.0 #\r
+# #\r
+# Unless required by applicable law or agreed to in writing, software #\r
+# distributed under the License is distributed on an "AS IS" BASIS, #\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #\r
+# See the License for the specific language governing permissions and #\r
+# limitations under the License. #\r
+##############################################################################*/\r
+\r
+\r
+import { Component, OnInit, Input, ViewChild, ElementRef, Renderer2, NgModule, Compiler, ViewContainerRef, Inject, Sanitizer } from '@angular/core';\r
+import { FileTransferService } from 'app/shared/services/file-transfer.service';\r
+import { DomSanitizer } from '@angular/platform-browser'\r
+import * as $ from 'jquery';\r
+import 'codemirror/mode/xml/xml.js';\r
+\r
+\r
+\r
+@Component({\r
+ selector: 'app-robot-report',\r
+ templateUrl: './robot-report.component.pug',\r
+ styleUrls: ['./robot-report.component.scss'],\r
+})\r
+export class RobotReportComponent implements OnInit {\r
+\r
+ @Input() public response;\r
+\r
+ @ViewChild('srcipts') scripts: ElementRef;\r
+ @ViewChild('frame1') frame1: ElementRef;\r
+ @ViewChild('frame2') frame2: ElementRef;\r
+ @ViewChild('codeMirror') codeMirror: ElementRef;\r
+\r
+ @ViewChild('container', {read: ViewContainerRef}) public container;\r
+\r
+ public reports = {\r
+ log: null,\r
+ report: null,\r
+ output: null\r
+ };\r
+\r
+ public codeConfig = {\r
+ mode: "application/xml",\r
+ theme: "eclipse",\r
+ readonly: true,\r
+ lineNumbers: true\r
+ };\r
+\r
+ public isRefreshed = false;\r
+ public noClick = "<script>$(document).ready(function(){ $('div a').removeAttr('href');}); $(document).click(function(){$('div a').removeAttr('href');} )</script>";\r
+\r
+ constructor(private fileTransfer: FileTransferService, private compiler: Compiler, private sanitizer: DomSanitizer) { }\r
+\r
+ ngOnInit() {\r
+ if(this.response){\r
+ if(this.response.vthResponse && this.response.vthResponse.resultData){\r
+ let fileId = this.response.vthResponse.resultData.robotResultFileId;\r
+ if(fileId){\r
+ this.fileTransfer.get(fileId, {robot: true}).subscribe(result => {\r
+ this.reports.log = this.sanitizer.bypassSecurityTrustHtml(result['log.html'] + this.noClick);\r
+ this.reports.report = this.sanitizer.bypassSecurityTrustHtml(result['report.html'] + this.noClick);\r
+ this.reports.output = result['output.xml'];\r
+ });\r
+ }\r
+ }\r
+ }\r
+\r
+ }\r
+\r
+ refresh(){\r
+ this.isRefreshed = false;\r
+ setTimeout(() => {\r
+ this.isRefreshed = true;\r
+ }, 500);\r
+ }\r
+\r
+}\r