Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO-NOT-MERGE - This is a CI trigger #209

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ snykTask/coverage
.eslintcache
.ops
ops/deploy/dist
.dccache
build/
.vscode/
22 changes: 21 additions & 1 deletion ui/enhancer/snyk-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,27 @@ export class SnykReportTab extends Controls.BaseControl {
};

private fillReportIFrameContent = (content: string): void => {
(document.getElementById('iframeID') as HTMLDivElement).innerHTML = content;
// Remove existing iframe and create a fresh one to avoid JS variable redeclaration issues
const oldIframe = document.getElementById('snyk-report');
if (oldIframe?.parentNode) {
oldIframe.parentNode.removeChild(oldIframe);
}

// Create new iframe
const newIframe = document.createElement('iframe');
newIframe.id = 'snyk-report';
newIframe.className = 'content';

// Add the new iframe to the document
document.body.appendChild(newIframe);

// Write content to the fresh iframe
const doc = newIframe.contentDocument || newIframe.contentWindow?.document;
if (doc) {
doc.open();
doc.write(content);
doc.close();
}
};
}

Expand Down
17 changes: 11 additions & 6 deletions ui/snyk-report-tab.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
height: 100%;
overflow: auto;
}
.iframeContainer {
.content {
overflow: auto;
min-width: 100%;
min-height: 100%;
}
.list {
Expand Down Expand Up @@ -84,11 +85,15 @@
<script type="text/javascript">
VSS.init();
</script>
<h2>Reports:</h2>
<ul id="reportList" class="list"></ul>
<div class="iframeContainer">
<div id="iframeID" class="iframe"></div>
<div class="header">
<h2>Reports:</h2>
</div>
<div id="snyk-report" class="container"></div>
<ul id="reportList" class="list"></ul>
<iframe
id="snyk-report"
class="content"
sandbox="allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-presentation"
src="about:blank"
></iframe>
</body>
</html>