diff --git a/packages/checkmarx/src/views/checkmarxAuthViewProvider.ts b/packages/checkmarx/src/views/checkmarxAuthViewProvider.ts index bbb8887f..2de11410 100644 --- a/packages/checkmarx/src/views/checkmarxAuthViewProvider.ts +++ b/packages/checkmarx/src/views/checkmarxAuthViewProvider.ts @@ -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; @@ -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) => { diff --git a/packages/core/src/activate/activateCxOne.ts b/packages/core/src/activate/activateCxOne.ts index 5d9d36c8..bb979ec4 100644 --- a/packages/core/src/activate/activateCxOne.ts +++ b/packages/core/src/activate/activateCxOne.ts @@ -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, diff --git a/packages/core/src/activate/activateProjectIgnite.ts b/packages/core/src/activate/activateProjectIgnite.ts index 0035cb1b..4221bbc1 100644 --- a/packages/core/src/activate/activateProjectIgnite.ts +++ b/packages/core/src/activate/activateProjectIgnite.ts @@ -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 @@ -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; } diff --git a/packages/core/src/constants/documentation.ts b/packages/core/src/constants/documentation.ts index b2419746..f55f9e2c 100644 --- a/packages/core/src/constants/documentation.ts +++ b/packages/core/src/constants/documentation.ts @@ -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" }; diff --git a/packages/core/src/views/docsAndFeedbackView/docAndFeedbackView.ts b/packages/core/src/views/docsAndFeedbackView/docAndFeedbackView.ts index 6f9281c8..17641ec9 100644 --- a/packages/core/src/views/docsAndFeedbackView/docAndFeedbackView.ts +++ b/packages/core/src/views/docsAndFeedbackView/docAndFeedbackView.ts @@ -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 { private _onDidChangeTreeData: vscode.EventEmitter = new vscode.EventEmitter(); readonly onDidChangeTreeData: vscode.Event = this._onDidChangeTreeData.event; - private treeItems: Map = new Map([ - [new TreeItem(constants.documentation, constants.bookItem, undefined), documentationUrl], - [new TreeItem(constants.feedback, constants.mailItem, undefined), feedbackUrl], - ]); + private treeItems: Map; + + constructor(documentationUrl: string) { + this.treeItems = new Map([ + [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; diff --git a/packages/project-ignite/package.json b/packages/project-ignite/package.json index 2a6dc634..d7f46766 100644 --- a/packages/project-ignite/package.json +++ b/packages/project-ignite/package.json @@ -96,6 +96,11 @@ "id": "cx-dev-assist.cxDevAssist", "type": "webview", "name": "Checkmarx Developer Assist" + }, + { + "id": "docAndFeedback", + "type": "tree", + "name": "Documentation & Feedback" } ] }, diff --git a/packages/project-ignite/src/views/igniteAuthViewProvider.ts b/packages/project-ignite/src/views/igniteAuthViewProvider.ts index b818cff2..e4b6dc74 100644 --- a/packages/project-ignite/src/views/igniteAuthViewProvider.ts +++ b/packages/project-ignite/src/views/igniteAuthViewProvider.ts @@ -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; @@ -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(() => {