Skip to content
This repository was archived by the owner on Mar 8, 2024. It is now read-only.

Iframe to test Angular app #154

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<div *ngIf="projectId" class="p-4 h-full bg-gray-100 flex-1 flex flex-col">
<iframe [src]="reactUrl" width="100%" height="100%" frameborder="0" allowfullscreen></iframe>

<!-- <div *ngIf="projectId" class="p-4 h-full bg-gray-100 flex-1 flex flex-col">
<ng-container *ngIf="knowledgeBases$ | async as knowledgeBases">
<div class="w-full ">
<div class="flex-shrink-0 block sm:flex justify-between items-center">
Expand Down Expand Up @@ -151,4 +153,4 @@ <h1 class="text-lg text-gray-900 mb-2">Warning</h1>
}}:</span>
<span class="whitespace-pre-line font-bold">{{lookuplistsModals.deleteSelected.selectionList}}</span>
</div>
</kern-modal>
</kern-modal> -->
15 changes: 14 additions & 1 deletion src/app/knowledge-bases/components/knowledge-bases.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Subscription } from 'rxjs';
import { UserManager } from 'src/app/util/user-manager';
import { CommentDataManager, CommentType } from 'src/app/base/components/comment/comment-helper';
import { createDefaultLookuplistsModals, LookuplistsModals } from './knowlegde-bases-helper';
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';

@Component({
selector: 'kern-knowledge-bases',
Expand All @@ -23,11 +24,14 @@ export class KnowledgeBasesComponent implements OnInit, OnDestroy {
subscriptions$: Subscription[] = [];
lookuplistsModals: LookuplistsModals = createDefaultLookuplistsModals();

reactUrl: SafeResourceUrl;

constructor(
private activatedRoute: ActivatedRoute,
private routeService: RouteService,
private knowledgeBaseApollo: KnowledgeBasesApolloService,
private router: Router
private router: Router,
private urlSanatizer: DomSanitizer,
) { }

ngOnDestroy(): void {
Expand All @@ -41,6 +45,15 @@ export class KnowledgeBasesComponent implements OnInit, OnDestroy {
this.routeService.updateActivatedRoute(this.activatedRoute);

this.projectId = this.activatedRoute.parent.snapshot.paramMap.get('projectId');
const saveUrl = 'http://localhost:7068/refinery/projects/' + this.projectId + '/lookup-lists';
this.reactUrl = this.urlSanatizer.bypassSecurityTrustResourceUrl(saveUrl);

window.addEventListener('message', function (event) {
if (event.origin === 'http://localhost:7068') {
window.location.href = event.data.newURL;
}
}.bind(this));

[this.knowledgeBasesQuery$, this.knowledgeBases$] = this.knowledgeBaseApollo.getKnowledgeBasesByProjectId(this.projectId);
NotificationService.subscribeToNotification(this, {
projectId: this.projectId,
Expand Down