Skip to content
Merged
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
13 changes: 11 additions & 2 deletions packages/checkmarx/src/views/checkmarxAuthViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class CheckmarxAuthViewProvider implements vscode.WebviewViewProvider {
private isAuthenticated: boolean = false;
private isUpdating: boolean = false;
private pendingUpdate: boolean = false;
private isFirstLoad: boolean = true;

constructor(context: vscode.ExtensionContext, _webViewCommand: WebViewCommand, logs: Logs) {
this.context = context;
Expand All @@ -46,8 +47,16 @@ export class CheckmarxAuthViewProvider implements vscode.WebviewViewProvider {
// Set up message handling first (before content is rendered)
this.setupMessageHandling();

// Check initial auth state and update content
this.checkAuthStateAndUpdate();
if (this.isFirstLoad) {
// First load: auth state unknown, must validate before rendering
this.isFirstLoad = false;
this.checkAuthStateAndUpdate();
} else {
// Re-show: render instantly with known auth state, then validate in background
this.updateWebviewContent();
this.refreshTenantDisplay();
this.checkAuthStateAndUpdate();
}

// Listen for configuration changes
vscode.workspace.onDidChangeConfiguration(async (e) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/activate/activateCxOne.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export async function activateCxOne(context: vscode.ExtensionContext, logs: Logs
const scaResultsProvider = new SCAResultsProvider(context, logs, statusBarItem, diagnosticCollection);

// Documentation & Feedback view
const docAndFeedback = new DocAndFeedbackView();
const docAndFeedback = new DocAndFeedbackView(DOC_LINKS.checkmarxOne);

const docAndFeedbackTree = vscode.window.createTreeView(commands.docAndFeedback, {
treeDataProvider: docAndFeedback,
Expand Down
18 changes: 18 additions & 0 deletions packages/core/src/activate/activateProjectIgnite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { IacScannerCommand } from '../realtimeScanners/scanners/iac/iacScannerCo
import { AscaScannerCommand } from '../realtimeScanners/scanners/asca/ascaScannerCommand';
import { ContainersScannerCommand } from '../realtimeScanners/scanners/containers/containersScannerCommand';
import { WebViewCommand } from '../commands/webViewCommand';
import { DocAndFeedbackView } from '../views/docsAndFeedbackView/docAndFeedbackView';

/**
* Activate Checkmarx Developer Assist specific features
Expand Down Expand Up @@ -177,6 +178,23 @@ function registerAssistView(context: vscode.ExtensionContext, ignoreFileManager:
context.subscriptions.push(
vscode.window.registerWebviewViewProvider(commands.astCxDevAssist, cxOneAssistProvider),
);

// Documentation & Feedback view
const docAndFeedback = new DocAndFeedbackView(DOC_LINKS.devAssist);
const docAndFeedbackTree = vscode.window.createTreeView(commands.docAndFeedback, {
treeDataProvider: docAndFeedback,
});
docAndFeedbackTree.onDidChangeSelection((event) => {
const selectedItem = event.selection[0];
if (selectedItem) {
const url = docAndFeedback.getUrl(selectedItem);
if (url) {
vscode.env.openExternal(vscode.Uri.parse(url));
}
}
});
context.subscriptions.push(docAndFeedbackTree);

return cxOneAssistProvider;
}

Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/constants/documentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export const DOC_LINKS = {
checkmarxOne: "https://checkmarx.com/resource/documents/en/34965-68742-checkmarx-one-vs-code-extension--plugin-.html",
devAssist: "https://docs.checkmarx.com/en/34965-405960-checkmarx-one-developer-assist.html",
checkmarxOneHelpLoginUrl: "https://docs.checkmarx.com/en/34965-123549-installing-and-setting-up-the-checkmarx-vs-code-extension.html#UUID-b74024dd-5f0e-cac7-668c-94049b9d8566_section-idm235062431428611",
devAssistHelpLoginUrl: "https://docs.checkmarx.com/en/34965-549178-installation-and-initial-setup.html#UUID-b1540a08-d6cd-0894-262c-526dedf11c6d_id_RemediationToolEli-Step1-InstallingandConfiguringthePlugin"
devAssistHelpLoginUrl: "https://docs.checkmarx.com/en/34965-549178-installation-and-initial-setup.html#UUID-b1540a08-d6cd-0894-262c-526dedf11c6d_id_RemediationToolEli-Step1-InstallingandConfiguringthePlugin",
feedback: "https://github.com/Checkmarx/ast-vscode-extension/issues/new/choose"
};
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import * as vscode from "vscode";
import { TreeItem } from "../../utils/tree/treeItem";
import { constants } from "../../utils/common/constants";

const feedbackUrl = "https://github.com/Checkmarx/ast-vscode-extension/issues/new/choose";
const documentationUrl = "https://checkmarx.com/resource/documents/en/34965-68742-checkmarx-one-vs-code-extension--plugin-.html";
import { DOC_LINKS } from "../../constants/documentation";

export class DocAndFeedbackView implements vscode.TreeDataProvider<TreeItem> {
private _onDidChangeTreeData: vscode.EventEmitter<TreeItem | undefined> = new vscode.EventEmitter<TreeItem | undefined>();
readonly onDidChangeTreeData: vscode.Event<TreeItem | undefined> = this._onDidChangeTreeData.event;

private treeItems: Map<TreeItem, string> = new Map<TreeItem, string>([
[new TreeItem(constants.documentation, constants.bookItem, undefined), documentationUrl],
[new TreeItem(constants.feedback, constants.mailItem, undefined), feedbackUrl],
]);
private treeItems: Map<TreeItem, string>;

constructor(documentationUrl: string) {
this.treeItems = new Map<TreeItem, string>([
[new TreeItem(constants.documentation, constants.bookItem, undefined), documentationUrl],
[new TreeItem(constants.feedback, constants.mailItem, undefined), DOC_LINKS.feedback],
]);
}

getTreeItem(element: TreeItem): vscode.TreeItem {
return element;
Expand Down
5 changes: 5 additions & 0 deletions packages/project-ignite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@
"id": "cx-dev-assist.cxDevAssist",
"type": "webview",
"name": "Checkmarx Developer Assist"
},
{
"id": "docAndFeedback",
"type": "tree",
"name": "Documentation & Feedback"
}
]
},
Expand Down
12 changes: 10 additions & 2 deletions packages/project-ignite/src/views/igniteAuthViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class IgniteAuthViewProvider implements vscode.WebviewViewProvider {
private isAuthenticated: boolean = false;
private isUpdating: boolean = false;
private pendingUpdate: boolean = false;
private isFirstLoad: boolean = true;

constructor(context: vscode.ExtensionContext, _webViewCommand: WebViewCommand, logs: Logs) {
this.context = context;
Expand All @@ -39,8 +40,15 @@ export class IgniteAuthViewProvider implements vscode.WebviewViewProvider {
// Set up message handling first (before content is rendered)
this.setupMessageHandling();

// Check initial auth state and update content
this.checkAuthStateAndUpdate();
if (this.isFirstLoad) {
// First load: auth state unknown, must validate before rendering
this.isFirstLoad = false;
this.checkAuthStateAndUpdate();
} else {
// Re-show: render instantly with known auth state, then validate in background
this.updateWebviewContent();
this.checkAuthStateAndUpdate();
}

// Listen for theme changes to refresh images
vscode.window.onDidChangeActiveColorTheme(() => {
Expand Down
Loading