Skip to content

Commit 7a6cfbf

Browse files
authoredMar 4, 2025
Axon 137 sidebar UI new sidebar view for jq ls (#154)
* AXON-137: implement new tree view with simpler flow * AXON-137: add logger * AXON-137: fix imports * AXON-17: add new actions * AXON-137: added statusCategory tag to issue tree item * AXON-137: add FG and put new view behind FG * AXON-137: add issue searchability accross explorers + tests for customjqlviewprovider merge * AXON-137: fix dependecy error * Delete resources/lozenge.svg * AXON-137: remove duplicates of search items * AXON-137: refactor FFC init implementation + remove AA exp for future PR merge 2 * AXON-137: fix e2e tests * AXON-137: revert * AXON-137: fix refresh bug and add login to jira button
1 parent cbb33ca commit 7a6cfbf

12 files changed

+481
-39
lines changed
 

‎e2e/tests/auth.test.ts

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
/* eslint-disable no-unused-expressions */
2-
import { expect } from 'chai';
3-
import { before, after, EditorView, Workbench, By, ActivityBar, SideBarView } from 'vscode-extension-tester';
2+
import { before, after, EditorView, Workbench, ActivityBar, SideBarView } from 'vscode-extension-tester';
43

54
describe('Auth User', async () => {
65
let activityBar: ActivityBar;
76
let sideBarView: SideBarView;
8-
7+
const originalEnv = process.env;
98
before(async () => {
9+
process.env = {
10+
...originalEnv,
11+
ATLASCODE_FX3_TARGET_APP: 'some-app',
12+
ATLASCODE_FX3_API_KEY: 'some-key',
13+
ATLASCODE_FX3_ENVIRONMENT: 'Production',
14+
ATLASCODE_FX3_TIMEOUT: '2000',
15+
};
1016
await new EditorView().closeAllEditors();
1117
await new Workbench().executeCommand('Atlassian: Test Login');
1218
await new Promise((res) => {
@@ -24,15 +30,8 @@ describe('Auth User', async () => {
2430
});
2531
});
2632

27-
after(async () => {});
28-
29-
it('in SideBarView should see Create issue... button', async () => {
30-
const atlasDrawer = sideBarView.findElement(By.id('workbench.view.extension.atlascode-drawer'));
31-
expect(atlasDrawer).to.not.be.undefined;
32-
33-
const createIssueButton = atlasDrawer.findElement(By.css('[aria-label="Create issue..."]'));
34-
expect(createIssueButton).to.not.be.undefined;
35-
expect(await createIssueButton.getText()).to.equal('Create issue...');
33+
after(async () => {
34+
process.env = originalEnv;
3635
});
3736

3837
it('in SideBarView should see a assigned JIRA issues', async () => {});

‎e2e/tests/no-auth.test.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable no-unused-expressions */
22
import { expect } from 'chai';
3-
import { before, ActivityBar, after, SideBarView, By, EditorView, Workbench } from 'vscode-extension-tester';
3+
import { before, ActivityBar, after, SideBarView, EditorView, Workbench, By } from 'vscode-extension-tester';
44

55
describe('Atlassian Extension Activity Bar', async () => {
66
let activityBar: ActivityBar;
@@ -23,8 +23,16 @@ describe('Atlassian Extension Activity Bar', async () => {
2323
describe('Atlassian Extension SideBar', async () => {
2424
let activityBar: ActivityBar;
2525
let sideBarView: SideBarView;
26+
const originalEnv = process.env;
2627

2728
before(async () => {
29+
process.env = {
30+
...originalEnv,
31+
ATLASCODE_FX3_TARGET_APP: 'some-app',
32+
ATLASCODE_FX3_API_KEY: 'some-key',
33+
ATLASCODE_FX3_ENVIRONMENT: 'Production',
34+
ATLASCODE_FX3_TIMEOUT: '2000',
35+
};
2836
activityBar = new ActivityBar();
2937
(await activityBar.getViewControl('Atlassian'))?.openView();
3038
sideBarView = new SideBarView();
@@ -38,7 +46,9 @@ describe('Atlassian Extension SideBar', async () => {
3846
await new Workbench().executeCommand('Atlassian: Test Logout');
3947
});
4048

41-
after(async () => {});
49+
after(async () => {
50+
process.env = originalEnv;
51+
});
4252

4353
it('should have a login action suggestion', async () => {
4454
const atlasDrawer = sideBarView.findElement(By.id('workbench.view.extension.atlascode-drawer'));

‎package.json

+55-3
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@
110110
{
111111
"command": "atlascode.jira.searchIssues",
112112
"title": "Search Jira Issue Results",
113+
"icon": {
114+
"dark": "resources/dark/search.svg",
115+
"light": "resources/light/search.svg"
116+
},
113117
"category": "Atlassian"
114118
},
115119
{
@@ -201,6 +205,25 @@
201205
},
202206
"category": "Atlassian"
203207
},
208+
{
209+
"command": "atlascode.jira.createNewJql",
210+
"title": "Create new JQL filter",
211+
"category": "Atlassian"
212+
},
213+
{
214+
"command": "atlascode.jira.removeFromSidebar",
215+
"title": "Remove from sidebar",
216+
"category": "Atlassian"
217+
},
218+
{
219+
"command": "atlascode.jira.refreshCustomJqlExplorer",
220+
"title": "Refresh Custom JQL Filters",
221+
"icon": {
222+
"dark": "resources/dark/refresh.svg",
223+
"light": "resources/light/refresh.svg"
224+
},
225+
"category": "Atlassian"
226+
},
204227
{
205228
"command": "atlascode.jira.showJiraIssueSettings",
206229
"title": "Jira Issue Settings",
@@ -440,6 +463,11 @@
440463
"name": "Jira Issues",
441464
"when": "atlascode:jiraExplorerEnabled && config.atlascode.jira.enabled"
442465
},
466+
{
467+
"id": "atlascode.views.jira.customJqlTreeView",
468+
"name": "Custom Jql Filters",
469+
"when": "config.atlascode.jira.enabled && atlascode:customJQLExplorerEnabled"
470+
},
443471
{
444472
"id": "atlascode.views.bb.pullrequestsTreeView",
445473
"name": "Bitbucket pull requests",
@@ -532,14 +560,32 @@
532560
},
533561
{
534562
"command": "atlascode.jira.refreshExplorer",
535-
"when": "view =~ /(atlascode.views.jira.customJql)/ && atlascode:isJiraAuthenticated",
563+
"when": "view == atlascode.views.jira.customJql && atlascode:isJiraAuthenticated",
536564
"group": "navigation@2"
537565
},
538566
{
539-
"command": "atlascode.jira.showJiraIssueSettings",
540-
"when": "view =~ /(atlascode.views.jira.customJql)/",
567+
"command": "atlascode.jira.searchIssues",
568+
"when": "view == atlascode.views.jira.customJqlTreeView && atlascode:isJiraAuthenticated",
541569
"group": "navigation@3"
542570
},
571+
{
572+
"command": "atlascode.jira.refreshCustomJqlExplorer",
573+
"when": "view == atlascode.views.jira.customJqlTreeView && atlascode:isJiraAuthenticated",
574+
"group": "navigation@2"
575+
},
576+
{
577+
"command": "atlascode.jira.removeFromSidebar",
578+
"when": "view =~ /(atlascode.views.jira.customJqlTreeView)/ && atlascode:isJiraAuthenticated"
579+
},
580+
{
581+
"command": "atlascode.jira.createNewJql",
582+
"when": "view =~ /(atlascode.views.jira.customJqlTreeView)/ && atlascode:isJiraAuthenticated"
583+
},
584+
{
585+
"command": "atlascode.jira.showJiraIssueSettings",
586+
"when": "view == atlascode.views.jira.customJql",
587+
"group": "navigation@4"
588+
},
543589
{
544590
"command": "atlascode.bb.createPullRequest",
545591
"when": "atlascode:isBBAuthenticated && atlascode:bitbucketExplorerEnabled && view == atlascode.views.bb.pullrequestsTreeView",
@@ -939,6 +985,12 @@
939985
"description": "Enables the Jira Issue Explorer",
940986
"scope": "window"
941987
},
988+
"atlascode.jira.explorer.showCustomJql": {
989+
"type": "boolean",
990+
"default": false,
991+
"description": "Enables Custom Jql Explorer",
992+
"scope": "window"
993+
},
942994
"atlascode.jira.explorer.showOpenIssues": {
943995
"type": "boolean",
944996
"default": true,

‎src/commandContext.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { commands } from 'vscode';
22

33
export enum CommandContext {
44
JiraExplorer = 'atlascode:jiraExplorerEnabled',
5+
CustomJQLExplorer = 'atlascode:customJQLExplorerEnabled',
56
BitbucketExplorer = 'atlascode:bitbucketExplorerEnabled',
67
PipelineExplorer = 'atlascode:pipelineExplorerEnabled',
78
BitbucketIssuesExplorer = 'atlascode:bitbucketIssuesExplorerEnabled',

‎src/commands.ts

+13
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { ConfigSection, ConfigSubSection } from './lib/ipc/models/config';
2424
import { AbstractBaseNode } from './views/nodes/abstractBaseNode';
2525
import { IssueNode } from './views/nodes/issueNode';
2626
import { PipelineNode } from './views/pipelines/PipelinesTree';
27+
import { CommandContext, setCommandContext } from './commandContext';
2728

2829
export enum Commands {
2930
BitbucketSelectContainer = 'atlascode.bb.selectContainer',
@@ -54,6 +55,7 @@ export enum Commands {
5455
EditThisFile = 'atlascode.bb.editThisFile',
5556
CreateIssue = 'atlascode.jira.createIssue',
5657
RefreshJiraExplorer = 'atlascode.jira.refreshExplorer',
58+
RefreshCustomJqlExplorer = 'atlascode.jira.refreshCustomJqlExplorer',
5759
ShowJiraIssueSettings = 'atlascode.jira.showJiraIssueSettings',
5860
ShowPullRequestSettings = 'atlascode.bb.showPullRequestSettings',
5961
ShowPipelineSettings = 'atlascode.bb.showPipelineSettings',
@@ -92,10 +94,21 @@ export enum Commands {
9294
WorkbenchOpenWorkspace = 'atlascode.workbenchOpenWorkspace',
9395
CloneRepository = 'atlascode.cloneRepository',
9496
DisableHelpExplorer = 'atlascode.disableHelpExplorer',
97+
CreateNewJql = 'atlascode.jira.createNewJql',
98+
RemoveFromSidebar = 'atlascode.jira.removeFromSidebar',
9599
}
96100

97101
export function registerCommands(vscodeContext: ExtensionContext) {
98102
vscodeContext.subscriptions.push(
103+
commands.registerCommand(Commands.RemoveFromSidebar, () =>
104+
setCommandContext(CommandContext.CustomJQLExplorer, false),
105+
),
106+
commands.registerCommand(Commands.CreateNewJql, () =>
107+
Container.settingsWebviewFactory.createOrShow({
108+
section: ConfigSection.Jira,
109+
subSection: ConfigSubSection.Issues,
110+
}),
111+
),
99112
commands.registerCommand(Commands.ShowConfigPage, () =>
100113
Container.settingsWebviewFactory.createOrShow({
101114
section: ConfigSection.Jira,

‎src/container.ts

+40-18
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ import { AtlascodeUriHandler } from './uriHandler';
7171
import { CheckoutHelper } from './bitbucket/interfaces';
7272
import { ProductJira } from './atlclients/authInfo';
7373
import { ATLASCODE_TEST_USER_EMAIL, ATLASCODE_TEST_HOST } from './constants';
74+
import { CustomJQLViewProvider } from './views/jira/treeViews/customJqlViewProvider';
75+
import { Logger } from './logger';
76+
import { SearchJiraHelper } from './views/jira/searchJiraHelper';
7477

7578
const isDebuggingRegex = /^--(debug|inspect)\b(-brk\b|(?!-))=?/;
7679
const ConfigTargetKey = 'configurationTarget';
@@ -184,29 +187,22 @@ export class Container {
184187

185188
this._loginManager = new LoginManager(this._credentialManager, this._siteManager, this._analyticsClient);
186189
this._bitbucketHelper = new BitbucketCheckoutHelper(context.globalState);
187-
188-
if (config.jira.explorer.enabled) {
189-
context.subscriptions.push((this._jiraExplorer = new JiraContext()));
190-
} else {
191-
const disposable = configuration.onDidChange((e) => {
192-
if (configuration.changed(e, 'jira.explorer.enabled')) {
193-
disposable.dispose();
194-
context.subscriptions.push((this._jiraExplorer = new JiraContext()));
195-
}
196-
});
197-
}
198-
199-
context.subscriptions.push((this._helpExplorer = new HelpExplorer()));
200-
201190
FeatureFlagClient.initialize({
202191
analyticsClient: this._analyticsClient,
203192
identifiers: {
204193
analyticsAnonymousId: env.machineId,
205194
},
206195
eventBuilder: new EventBuilder(),
207-
}).then(() => {
208-
this.initializeUriHandler(context, this._analyticsApi, this._bitbucketHelper);
209-
});
196+
})
197+
.catch((err) => {
198+
Logger.error(Error(`Failed to initialize feature flags: ${err}`));
199+
})
200+
.finally(() => {
201+
this.initializeUriHandler(context, this._analyticsApi, this._bitbucketHelper);
202+
this.initializeNewSidebarView(context, config);
203+
});
204+
205+
context.subscriptions.push((this._helpExplorer = new HelpExplorer()));
210206
}
211207

212208
static getAnalyticsEnable(): boolean {
@@ -220,13 +216,34 @@ export class Container {
220216
bitbucketHelper: CheckoutHelper,
221217
) {
222218
if (FeatureFlagClient.featureGates[Features.EnableNewUriHandler]) {
223-
console.log('Using new URI handler');
219+
Logger.debug('Using new URI handler');
224220
context.subscriptions.push(AtlascodeUriHandler.create(analyticsApi, bitbucketHelper));
225221
} else {
226222
context.subscriptions.push(new LegacyAtlascodeUriHandler(analyticsApi, bitbucketHelper));
227223
}
228224
}
225+
static initializeNewSidebarView(context: ExtensionContext, config: IConfig) {
226+
if (FeatureFlagClient.featureGates[Features.NewSidebarTreeView]) {
227+
Logger.debug('Using new custom JQL view');
228+
SearchJiraHelper.initialize();
229+
context.subscriptions.push((this._customJqlViewProvider = new CustomJQLViewProvider()));
230+
} else {
231+
this.initializeLegacySidebarView(context, config);
232+
}
233+
}
229234

235+
static initializeLegacySidebarView(context: ExtensionContext, config: IConfig) {
236+
if (config.jira.explorer.enabled) {
237+
context.subscriptions.push((this._jiraExplorer = new JiraContext()));
238+
} else {
239+
const disposable = configuration.onDidChange((e) => {
240+
if (configuration.changed(e, 'jira.explorer.enabled')) {
241+
disposable.dispose();
242+
context.subscriptions.push((this._jiraExplorer = new JiraContext()));
243+
}
244+
});
245+
}
246+
}
230247
static initializeBitbucket(bbCtx: BitbucketContext) {
231248
this._bitbucketContext = bbCtx;
232249
this._pipelinesExplorer = new PipelinesExplorer(bbCtx);
@@ -528,4 +545,9 @@ export class Container {
528545
static get bitbucketHelper() {
529546
return this._bitbucketHelper;
530547
}
548+
549+
private static _customJqlViewProvider: CustomJQLViewProvider;
550+
static get customJqlViewProvider() {
551+
return this._customJqlViewProvider;
552+
}
531553
}

‎src/util/featureFlags/features.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export enum Features {
22
EnableNewUriHandler = 'atlascode-enable-new-uri-handler',
33
EnableAuthUI = 'atlascode-enable-auth-ui',
4+
NewSidebarTreeView = 'atlascode-new-sidebar-treeview',
45
}
56

67
export enum Experiments {

0 commit comments

Comments
 (0)
Failed to load comments.