in src/desktop/ci/security_finding_controller.ts [57:97]
async createOrUpdateWebview(
finding: GqlSecurityFinding,
projectInRepository: ProjectInRepository,
existingPanel?: SecurityFindingWebviewPanel,
): Promise<SecurityFindingWebviewPanel> {
assert(this.#context);
const panel = existingPanel ?? this.#createEmptyPanel();
if (!finding) {
return panel;
}
const { title } = finding;
panel.title = title;
panel.iconPath = vscode.Uri.file(
path.join(this.#context?.extensionPath, 'assets', 'images', 'dark', 'vulnerabilities.svg'),
);
panel.webview.html = await prepareWebviewSource(
panel.webview,
this.#context,
'security_finding',
);
panel.repositoryRoot = projectInRepository.pointer.repository.rootFsPath;
const data = await getGitLabService(projectInRepository).fetchFromApi(
getSecurityFinding(projectInRepository.project, finding.foundByPipelineIid, finding.uuid),
);
const securityReportFinding = data?.project.pipeline.securityReportFinding;
await panel.webview.postMessage({
type: 'findingDetails',
finding: securityReportFinding,
instanceUrl: projectInRepository.account?.instanceUrl,
});
return panel;
}