-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into chrome-extension
- Loading branch information
Showing
7 changed files
with
111 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,42 @@ | ||
<!-- Modal --> | ||
<div class="modal fade" id="resultModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
<h4 class="modal-title" id="myModalLabel">Query Result | ||
<span *ngIf="result_time_taken !== null"> | ||
({{result_time_taken}} ms) | ||
</span> | ||
</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<!-- <div class="loading" *ngIf="mapping.isWatching"> | ||
<i class="fa fa-spinner fa-pulse fa-3x fa-fw margin-bottom"></i> | ||
Loading, please wait... | ||
</div> --> | ||
<div class="result_block"> | ||
<textarea | ||
class="form-control m-b15" | ||
name="responseBlock" | ||
id="responseBlock" cols="30" rows="10"> | ||
</textarea> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
<h4 class="modal-title" id="myModalLabel">Query Results | ||
<span *ngIf="result_time_taken !== null"> | ||
({{result_time_taken}} ms) | ||
</span> | ||
</h4> | ||
</div> | ||
<div class="modal-body" id="resultTabs"> | ||
<!-- <div class="loading" *ngIf="mapping.isWatching"> | ||
<i class="fa fa-spinner fa-pulse fa-3x fa-fw margin-bottom"></i> | ||
Loading, please wait... | ||
</div> --> | ||
<!-- Nav tabs --> | ||
<ul class="nav nav-tabs" role="tablist"> | ||
<li role="presentation" class="active"><a href="#resultJson" aria-controls="resultJson" role="tab" data-toggle="tab"> <i class="fa fa-terminal"></i> JSON</a></li> | ||
<li role="presentation"><a href="#resultTable" aria-controls="resultTable" role="tab" data-toggle="tab"> <i class="fa fa-table"></i> Tabular</a></li> | ||
</ul> | ||
|
||
<!-- Tab panes --> | ||
<div class="tab-content"> | ||
<div role="tabpanel" class="tab-pane active" id="resultJson"> | ||
<div class="result_block"> | ||
<textarea class="form-control m-b15" name="responseBlock" id="responseBlock" cols="30" rows="10"> | ||
</textarea> | ||
</div> | ||
</div> | ||
<div role="tabpanel" class="tab-pane" id="resultTable"> | ||
<iframe *ngIf="urlAvailable" width="100%" height="100%" [src]="url" frameborder="0"></iframe> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,60 @@ | ||
import { Component, OnInit } from "@angular/core"; | ||
import { Component, OnInit, OnChanges, Input, Output } from "@angular/core"; | ||
import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser'; | ||
declare var $: any; | ||
|
||
@Component({ | ||
selector: 'query-result', | ||
templateUrl: './app/result/result.component.html', | ||
inputs: ['mapping', 'config', 'responseHookHelp', 'result_time_taken', 'types', 'selectedTypes', 'result', 'config', 'responseHookHelp', 'result_time_taken'] | ||
inputs: ['mapping', 'config', 'editorHookHelp', 'urlShare', 'responseHookHelp', 'result_time_taken', 'result_random_token', 'types', 'result', 'config', 'responseHookHelp', 'result_time_taken'] | ||
}) | ||
|
||
export class ResultComponent implements OnInit { | ||
export class ResultComponent implements OnInit, OnChanges { | ||
public mapping: any; | ||
public config: any; | ||
public responseHookHelp: any; | ||
public url: SafeResourceUrl; | ||
public urlShare: any; | ||
public editorHookHelp: any; | ||
public urlAvailable: boolean = false; | ||
@Input() selectedTypes: any; | ||
// public dejavuDomain: string = 'http://localhost:1358/'; | ||
public dejavuDomain: string = window.location.protocol+'//opensource.appbase.io/dejavu/live/'; | ||
|
||
constructor(private sanitizer: DomSanitizer) {} | ||
|
||
ngOnInit() { | ||
this.responseHookHelp.applyEditor({ readOnly: true }); | ||
} | ||
|
||
ngOnChanges(changes) { | ||
if(changes && changes['result_random_token']) { | ||
var prev = changes['result_random_token'].previousValue; | ||
var current = changes['result_random_token'].currentValue; | ||
if(current && prev !== current && this.editorHookHelp) { | ||
var getQuery = this.editorHookHelp.getValue(); | ||
if(getQuery) { | ||
console.log(this.selectedTypes); | ||
getQuery = getQuery.trim(); | ||
getQuery = JSON.parse(getQuery); | ||
var queryObj = { | ||
query: getQuery, | ||
type: this.selectedTypes | ||
}; | ||
this.url = this.sanitizeUrl(this.dejavuDomain); | ||
setTimeout(function() { | ||
var url = this.dejavuDomain+'#?input_state='+this.urlShare.url; | ||
url = url+'&hf=false&sidebar=false&subscribe=false&query='+JSON.stringify(queryObj); | ||
this.url = this.sanitizeUrl(url); | ||
console.log(this.url); | ||
}.bind(this), 300); | ||
this.urlAvailable = true; | ||
} | ||
} | ||
} | ||
} | ||
|
||
sanitizeUrl(url) { | ||
return this.sanitizer.bypassSecurityTrustResourceUrl(url); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters