Skip to content

Commit b039c60

Browse files
Implemented Documentation And Feedback Tab for Project Ignite and bug fixed for Authenticated window reload slow(AST-141054) (#1479)
* Made code chnages for Doc And Feedback tab * Made code chnages to fix slow reload authentication window. * Correct the position
1 parent 36995d1 commit b039c60

7 files changed

Lines changed: 56 additions & 13 deletions

File tree

packages/checkmarx/src/views/checkmarxAuthViewProvider.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export class CheckmarxAuthViewProvider implements vscode.WebviewViewProvider {
2525
private isAuthenticated: boolean = false;
2626
private isUpdating: boolean = false;
2727
private pendingUpdate: boolean = false;
28+
private isFirstLoad: boolean = true;
2829

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

50-
// Check initial auth state and update content
51-
this.checkAuthStateAndUpdate();
51+
if (this.isFirstLoad) {
52+
// First load: auth state unknown, must validate before rendering
53+
this.isFirstLoad = false;
54+
this.checkAuthStateAndUpdate();
55+
} else {
56+
// Re-show: render instantly with known auth state, then validate in background
57+
this.updateWebviewContent();
58+
this.refreshTenantDisplay();
59+
this.checkAuthStateAndUpdate();
60+
}
5261

5362
// Listen for configuration changes
5463
vscode.workspace.onDidChangeConfiguration(async (e) => {

packages/core/src/activate/activateCxOne.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export async function activateCxOne(context: vscode.ExtensionContext, logs: Logs
165165
const scaResultsProvider = new SCAResultsProvider(context, logs, statusBarItem, diagnosticCollection);
166166

167167
// Documentation & Feedback view
168-
const docAndFeedback = new DocAndFeedbackView();
168+
const docAndFeedback = new DocAndFeedbackView(DOC_LINKS.checkmarxOne);
169169

170170
const docAndFeedbackTree = vscode.window.createTreeView(commands.docAndFeedback, {
171171
treeDataProvider: docAndFeedback,

packages/core/src/activate/activateProjectIgnite.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { IacScannerCommand } from '../realtimeScanners/scanners/iac/iacScannerCo
1818
import { AscaScannerCommand } from '../realtimeScanners/scanners/asca/ascaScannerCommand';
1919
import { ContainersScannerCommand } from '../realtimeScanners/scanners/containers/containersScannerCommand';
2020
import { WebViewCommand } from '../commands/webViewCommand';
21+
import { DocAndFeedbackView } from '../views/docsAndFeedbackView/docAndFeedbackView';
2122

2223
/**
2324
* Activate Checkmarx Developer Assist specific features
@@ -177,6 +178,23 @@ function registerAssistView(context: vscode.ExtensionContext, ignoreFileManager:
177178
context.subscriptions.push(
178179
vscode.window.registerWebviewViewProvider(commands.astCxDevAssist, cxOneAssistProvider),
179180
);
181+
182+
// Documentation & Feedback view
183+
const docAndFeedback = new DocAndFeedbackView(DOC_LINKS.devAssist);
184+
const docAndFeedbackTree = vscode.window.createTreeView(commands.docAndFeedback, {
185+
treeDataProvider: docAndFeedback,
186+
});
187+
docAndFeedbackTree.onDidChangeSelection((event) => {
188+
const selectedItem = event.selection[0];
189+
if (selectedItem) {
190+
const url = docAndFeedback.getUrl(selectedItem);
191+
if (url) {
192+
vscode.env.openExternal(vscode.Uri.parse(url));
193+
}
194+
}
195+
});
196+
context.subscriptions.push(docAndFeedbackTree);
197+
180198
return cxOneAssistProvider;
181199
}
182200

packages/core/src/constants/documentation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ export const DOC_LINKS = {
22
checkmarxOne: "https://checkmarx.com/resource/documents/en/34965-68742-checkmarx-one-vs-code-extension--plugin-.html",
33
devAssist: "https://docs.checkmarx.com/en/34965-405960-checkmarx-one-developer-assist.html",
44
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",
5-
devAssistHelpLoginUrl: "https://docs.checkmarx.com/en/34965-549178-installation-and-initial-setup.html#UUID-b1540a08-d6cd-0894-262c-526dedf11c6d_id_RemediationToolEli-Step1-InstallingandConfiguringthePlugin"
5+
devAssistHelpLoginUrl: "https://docs.checkmarx.com/en/34965-549178-installation-and-initial-setup.html#UUID-b1540a08-d6cd-0894-262c-526dedf11c6d_id_RemediationToolEli-Step1-InstallingandConfiguringthePlugin",
6+
feedback: "https://github.com/Checkmarx/ast-vscode-extension/issues/new/choose"
67
};

packages/core/src/views/docsAndFeedbackView/docAndFeedbackView.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
import * as vscode from "vscode";
22
import { TreeItem } from "../../utils/tree/treeItem";
33
import { constants } from "../../utils/common/constants";
4-
5-
const feedbackUrl = "https://github.com/Checkmarx/ast-vscode-extension/issues/new/choose";
6-
const documentationUrl = "https://checkmarx.com/resource/documents/en/34965-68742-checkmarx-one-vs-code-extension--plugin-.html";
4+
import { DOC_LINKS } from "../../constants/documentation";
75

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

12-
private treeItems: Map<TreeItem, string> = new Map<TreeItem, string>([
13-
[new TreeItem(constants.documentation, constants.bookItem, undefined), documentationUrl],
14-
[new TreeItem(constants.feedback, constants.mailItem, undefined), feedbackUrl],
15-
]);
10+
private treeItems: Map<TreeItem, string>;
11+
12+
constructor(documentationUrl: string) {
13+
this.treeItems = new Map<TreeItem, string>([
14+
[new TreeItem(constants.documentation, constants.bookItem, undefined), documentationUrl],
15+
[new TreeItem(constants.feedback, constants.mailItem, undefined), DOC_LINKS.feedback],
16+
]);
17+
}
1618

1719
getTreeItem(element: TreeItem): vscode.TreeItem {
1820
return element;

packages/project-ignite/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@
9696
"id": "cx-dev-assist.cxDevAssist",
9797
"type": "webview",
9898
"name": "Checkmarx Developer Assist"
99+
},
100+
{
101+
"id": "docAndFeedback",
102+
"type": "tree",
103+
"name": "Documentation & Feedback"
99104
}
100105
]
101106
},

packages/project-ignite/src/views/igniteAuthViewProvider.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export class IgniteAuthViewProvider implements vscode.WebviewViewProvider {
1717
private isAuthenticated: boolean = false;
1818
private isUpdating: boolean = false;
1919
private pendingUpdate: boolean = false;
20+
private isFirstLoad: boolean = true;
2021

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

42-
// Check initial auth state and update content
43-
this.checkAuthStateAndUpdate();
43+
if (this.isFirstLoad) {
44+
// First load: auth state unknown, must validate before rendering
45+
this.isFirstLoad = false;
46+
this.checkAuthStateAndUpdate();
47+
} else {
48+
// Re-show: render instantly with known auth state, then validate in background
49+
this.updateWebviewContent();
50+
this.checkAuthStateAndUpdate();
51+
}
4452

4553
// Listen for theme changes to refresh images
4654
vscode.window.onDidChangeActiveColorTheme(() => {

0 commit comments

Comments
 (0)