X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=it%2Fotf.git;a=blobdiff_plain;f=otf-frontend%2Fclient%2Fsrc%2Fapp%2Flayout%2Frobot-report%2Frobot-report.component.ts;fp=otf-frontend%2Fclient%2Fsrc%2Fapp%2Flayout%2Frobot-report%2Frobot-report.component.ts;h=a790fd626733df0c7282e6f85e0dc3ba9fda7079;hp=0000000000000000000000000000000000000000;hb=14f6f95c84a4a1fa8774190db4a03fd0214ec55f;hpb=f49bd1efeaaddd4891c1f329b18d8cfb28b3e75b diff --git a/otf-frontend/client/src/app/layout/robot-report/robot-report.component.ts b/otf-frontend/client/src/app/layout/robot-report/robot-report.component.ts new file mode 100644 index 0000000..a790fd6 --- /dev/null +++ b/otf-frontend/client/src/app/layout/robot-report/robot-report.component.ts @@ -0,0 +1,82 @@ +/* Copyright (c) 2019 AT&T Intellectual Property. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +##############################################################################*/ + + +import { Component, OnInit, Input, ViewChild, ElementRef, Renderer2, NgModule, Compiler, ViewContainerRef, Inject, Sanitizer } from '@angular/core'; +import { FileTransferService } from 'app/shared/services/file-transfer.service'; +import { DomSanitizer } from '@angular/platform-browser' +import * as $ from 'jquery'; +import 'codemirror/mode/xml/xml.js'; + + + +@Component({ + selector: 'app-robot-report', + templateUrl: './robot-report.component.pug', + styleUrls: ['./robot-report.component.scss'], +}) +export class RobotReportComponent implements OnInit { + + @Input() public response; + + @ViewChild('srcipts') scripts: ElementRef; + @ViewChild('frame1') frame1: ElementRef; + @ViewChild('frame2') frame2: ElementRef; + @ViewChild('codeMirror') codeMirror: ElementRef; + + @ViewChild('container', {read: ViewContainerRef}) public container; + + public reports = { + log: null, + report: null, + output: null + }; + + public codeConfig = { + mode: "application/xml", + theme: "eclipse", + readonly: true, + lineNumbers: true + }; + + public isRefreshed = false; + public noClick = ""; + + constructor(private fileTransfer: FileTransferService, private compiler: Compiler, private sanitizer: DomSanitizer) { } + + ngOnInit() { + if(this.response){ + if(this.response.vthResponse && this.response.vthResponse.resultData){ + let fileId = this.response.vthResponse.resultData.robotResultFileId; + if(fileId){ + this.fileTransfer.get(fileId, {robot: true}).subscribe(result => { + this.reports.log = this.sanitizer.bypassSecurityTrustHtml(result['log.html'] + this.noClick); + this.reports.report = this.sanitizer.bypassSecurityTrustHtml(result['report.html'] + this.noClick); + this.reports.output = result['output.xml']; + }); + } + } + } + + } + + refresh(){ + this.isRefreshed = false; + setTimeout(() => { + this.isRefreshed = true; + }, 500); + } + +}