Skip to content

Commit 466f893

Browse files
authored
Revert "feat: wire Jira integration UI (#45)" (#46)
This reverts commit bc83a81.
1 parent bc83a81 commit 466f893

6 files changed

Lines changed: 36 additions & 96 deletions

File tree

src/app/components/workspace-integrations/workspace-integrations.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,16 @@ <h3>Jira connection</h3>
154154
<section class="selection-card" *ngIf="isJiraConnected">
155155
<div class="section-head">
156156
<div>
157-
<h3>Jira projects</h3>
158-
<p>Projects visible to the connected Jira account.</p>
157+
<h3>Jira Cloud Resources</h3>
158+
<p>Accessible Atlassian cloud sites.</p>
159159
</div>
160160
</div>
161161

162162
<div class="repo-list">
163-
<div class="repo-item" *ngFor="let project of jiraProjects">
163+
<div class="repo-item" *ngFor="let resource of jiraResources">
164164
<span>
165-
<strong>{{ project.key }} - {{ project.name }}</strong>
166-
<small>{{ project.siteName || project.siteUrl }}</small>
165+
<strong>{{ resource.name }}</strong>
166+
<small>{{ resource.url }}</small>
167167
</span>
168168
</div>
169169
</div>

src/app/components/workspace-integrations/workspace-integrations.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('WorkspaceIntegrationsComponent', () => {
5555

5656
mockIntegrationService.getJiraProjects.and.returnValue(of({
5757
connected: false,
58-
projects: [],
58+
resources: [],
5959
lastSyncAt: undefined
6060
}));
6161
mockIntegrationService.connectJira.and.returnValue(of(void 0));
@@ -70,8 +70,7 @@ describe('WorkspaceIntegrationsComponent', () => {
7070
provide: ActivatedRoute,
7171
useValue: {
7272
snapshot: {
73-
paramMap: convertToParamMap({ id: 'workspace-1' }),
74-
queryParamMap: convertToParamMap({})
73+
paramMap: convertToParamMap({ id: 'workspace-1' })
7574
}
7675
}
7776
}

src/app/components/workspace-integrations/workspace-integrations.ts

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ActivatedRoute, RouterLink } from '@angular/router';
44
import { IntegrationService } from '../../services/integration.service';
55
import { GitHubRepo, SyncStatus } from '../../models/github-integration.model';
66
import { SlackChannel } from '../../models/slack-integration.model';
7-
import { JiraProject, JiraSyncStatus } from '../../models/jira-integration.model';
7+
import { AtlassianResource, JiraSyncStatus } from '../../models/jira-integration.model';
88

99
@Component({
1010
selector: 'app-workspace-integrations',
@@ -41,33 +41,15 @@ export class WorkspaceIntegrationsComponent implements OnInit, OnDestroy {
4141
isSyncing = false;
4242

4343
isJiraConnected = false;
44-
jiraProjects: JiraProject[] = [];
44+
jiraResources: AtlassianResource[] = [];
4545
jiraLastSyncAt?: Date;
4646
jiraSyncStatus?: JiraSyncStatus;
4747
jiraFeedbackMessage = '';
4848
jiraErrorMessage = '';
4949
isJiraSyncing = false;
5050

5151
ngOnInit(): void {
52-
this.workspaceId = this.route.snapshot.paramMap.get('id') ||
53-
this.route.parent?.snapshot.paramMap.get('id') || '';
54-
55-
// Check for OAuth redirect results
56-
const queryParams = this.route.snapshot.queryParamMap;
57-
const jiraStatus = queryParams.get('jira');
58-
if (jiraStatus === 'connected') {
59-
this.jiraFeedbackMessage = 'Jira connected successfully!';
60-
} else if (jiraStatus === 'failed') {
61-
this.jiraErrorMessage = 'Failed to connect Jira.';
62-
}
63-
64-
const githubStatus = queryParams.get('github');
65-
if (githubStatus === 'connected') {
66-
this.githubFeedbackMessage = 'GitHub connected successfully!';
67-
} else if (githubStatus === 'failed') {
68-
this.githubErrorMessage = 'Failed to connect GitHub.';
69-
}
70-
52+
this.workspaceId = this.route.snapshot.paramMap.get('id') ?? '';
7153
this.loadAllIntegrations();
7254
window.addEventListener('focus', this.onWindowFocus);
7355
}
@@ -98,9 +80,6 @@ export class WorkspaceIntegrationsComponent implements OnInit, OnDestroy {
9880
this.slackErrorMessage = '';
9981
this.slackFeedbackMessage = 'Starting Slack connection...';
10082
this.integrationService.connectSlack(this.workspaceId).subscribe({
101-
next: () => {
102-
this.slackFeedbackMessage = '';
103-
},
10483
error: (error: Error) => {
10584
this.slackErrorMessage = error.message;
10685
this.slackFeedbackMessage = '';
@@ -119,9 +98,6 @@ export class WorkspaceIntegrationsComponent implements OnInit, OnDestroy {
11998
this.githubErrorMessage = '';
12099
this.githubFeedbackMessage = 'Starting GitHub connection...';
121100
this.integrationService.connectGitHub().subscribe({
122-
next: () => {
123-
this.githubFeedbackMessage = '';
124-
},
125101
error: (error: Error) => {
126102
this.githubErrorMessage = error.message;
127103
this.githubFeedbackMessage = '';
@@ -141,9 +117,6 @@ export class WorkspaceIntegrationsComponent implements OnInit, OnDestroy {
141117
this.jiraErrorMessage = '';
142118
this.jiraFeedbackMessage = 'Starting Jira connection...';
143119
this.integrationService.connectJira(this.workspaceId).subscribe({
144-
next: () => {
145-
this.jiraFeedbackMessage = '';
146-
},
147120
error: (error: Error) => {
148121
this.jiraErrorMessage = error.message;
149122
this.jiraFeedbackMessage = '';
@@ -289,7 +262,7 @@ export class WorkspaceIntegrationsComponent implements OnInit, OnDestroy {
289262
private loadJira(): void {
290263
this.integrationService.getJiraProjects(this.workspaceId).subscribe(response => {
291264
this.isJiraConnected = response.connected;
292-
this.jiraProjects = response.projects;
265+
this.jiraResources = response.resources;
293266
this.jiraLastSyncAt = response.lastSyncAt;
294267
});
295268
}

src/app/models/jira-integration.model.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ export interface JiraProject {
22
id: string;
33
key: string;
44
name: string;
5-
avatarUrl?: string;
6-
siteId: string;
7-
siteName: string;
8-
siteUrl: string;
5+
avatarUrl: string;
6+
}
7+
8+
export interface AtlassianResource {
9+
id: string;
10+
url: string;
11+
name: string;
12+
scopes: string[];
13+
avatarUrl: string;
914
}
1015

1116
export interface JiraSyncStatus {
@@ -16,6 +21,6 @@ export interface JiraSyncStatus {
1621

1722
export interface JiraIntegrationResponse {
1823
connected: boolean;
19-
projects: JiraProject[];
20-
lastSyncAt?: Date;
24+
resources: AtlassianResource[];
25+
lastSyncAt?: string;
2126
}

src/app/services/integration.service.ts

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { HttpClient, HttpParams } from '@angular/common/http';
22
import { Injectable, inject } from '@angular/core';
3-
import { catchError, map, Observable, of, switchMap, tap, throwError } from 'rxjs';
3+
import { catchError, map, Observable, of, switchMap, throwError } from 'rxjs';
44
import { GitHubConnectionState, GitHubRepo, SyncStatus } from '../models/github-integration.model';
5-
import { JiraIntegrationResponse, JiraProject, JiraSyncStatus } from '../models/jira-integration.model';
65
import { SlackConnectionState } from '../models/slack-integration.model';
76
import { toError } from './http-error';
87

@@ -38,10 +37,6 @@ interface GitHubSyncResponse {
3837
status: string;
3938
}
4039

41-
interface JiraSyncResponse {
42-
status: string;
43-
}
44-
4540
@Injectable({
4641
providedIn: 'root',
4742
})
@@ -61,7 +56,6 @@ export class IntegrationService {
6156
return this.getSlackAuthUrl(workspaceId).pipe(
6257
map(({ authUrl }) => {
6358
window.open(authUrl, '_blank');
64-
return;
6559
}),
6660
);
6761
}
@@ -131,7 +125,6 @@ export class IntegrationService {
131125
return this.getGitHubAuthUrl().pipe(
132126
map(({ authUrl }) => {
133127
window.open(authUrl, '_blank');
134-
return;
135128
}),
136129
);
137130
}
@@ -189,48 +182,38 @@ export class IntegrationService {
189182
);
190183
}
191184

192-
getJiraAuthUrl(workspaceId: string, redirectUrl?: string): Observable<{ authUrl: string }> {
193-
console.log('Fetching Jira Auth URL for workspace:', workspaceId);
194-
let params = new HttpParams().set('workspace_id', workspaceId);
195-
if (redirectUrl) {
196-
params = params.set('redirect_url', redirectUrl);
197-
}
185+
getJiraAuthUrl(workspaceId: string): Observable<{ authUrl: string }> {
186+
const params = new HttpParams().set('workspace_id', workspaceId);
198187
return this.http.get<OAuthResponse>(`${this.apiUrl}/jira/auth`, { params }).pipe(
199-
tap(resp => console.log('Jira Auth URL response:', resp)),
200188
map((response) => ({ authUrl: response.auth_url })),
201-
catchError((error) => {
202-
console.error('Jira Auth URL error:', error);
203-
return throwError(() => toError(error, 'Unable to start Jira connection.'));
204-
}),
189+
catchError((error) => throwError(() => toError(error, 'Unable to start Jira connection.'))),
205190
);
206191
}
207192

208193
connectJira(workspaceId: string): Observable<void> {
209-
const redirectUrl = window.location.origin + window.location.pathname;
210-
return this.getJiraAuthUrl(workspaceId, redirectUrl).pipe(
194+
return this.getJiraAuthUrl(workspaceId).pipe(
211195
map(({ authUrl }) => {
212-
window.location.href = authUrl;
213-
return;
196+
window.open(authUrl, '_blank');
214197
}),
215198
);
216199
}
217200

218-
getJiraProjects(workspaceId: string): Observable<JiraIntegrationResponse> {
201+
getJiraProjects(workspaceId: string): Observable<any> {
219202
return this.getIntegrations(workspaceId).pipe(
220203
switchMap((integrations) => {
221204
const jiraIntegration = integrations.find((integration) => integration.provider === 'jira');
222205
if (!jiraIntegration) {
223206
return of({
224207
connected: false,
225-
projects: [],
208+
resources: [],
226209
});
227210
}
228211

229212
const params = new HttpParams().set('workspace_id', workspaceId);
230-
return this.http.get<JiraProject[]>(`${this.apiUrl}/jira/projects`, { params }).pipe(
231-
map((projects) => ({
213+
return this.http.get<any[]>(`${this.apiUrl}/jira/projects`, { params }).pipe(
214+
map((resources) => ({
232215
connected: true,
233-
projects,
216+
resources: resources,
234217
lastSyncAt: jiraIntegration.updated_at ? new Date(jiraIntegration.updated_at) : undefined,
235218
})),
236219
);
@@ -246,13 +229,13 @@ export class IntegrationService {
246229
);
247230
}
248231

249-
syncJira(workspaceId: string): Observable<JiraSyncStatus> {
232+
syncJira(workspaceId: string): Observable<any> {
250233
const params = new HttpParams().set('workspace_id', workspaceId);
251-
return this.http.post<JiraSyncResponse>(`${this.apiUrl}/jira/sync`, {}, { params }).pipe(
234+
return this.http.post<any>(`${this.apiUrl}/jira/sync`, {}, { params }).pipe(
252235
map((response) => {
253236
return {
254237
status: response.status === 'sync_started' ? 'in_progress' : 'failed',
255-
} as JiraSyncStatus;
238+
};
256239
}),
257240
catchError((error) => throwError(() => toError(error, 'Unable to sync Jira.'))),
258241
);

src/app/services/signal.service.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,9 @@ interface SignalResponse {
2222
state?: 'open' | 'closed';
2323
labels?: string[];
2424
issueType?: string;
25-
issue_type?: string;
2625
priority?: string;
2726
projectKey?: string;
28-
project_key?: string;
29-
issueKey?: string;
30-
issue_key?: string;
31-
assigneeName?: string;
32-
assignee_name?: string;
3327
assignees?: string[];
34-
status?: string;
3528
};
3629
received_at?: string;
3730
}
@@ -98,19 +91,6 @@ export class SignalService {
9891
};
9992
}
10093

101-
if (signal.source_type === 'jira') {
102-
const metadata = signal.source_metadata ?? {};
103-
return {
104-
...metadata,
105-
issueType: metadata.issueType ?? metadata.issue_type,
106-
projectKey: metadata.projectKey ?? metadata.project_key,
107-
issueKey: metadata.issueKey ?? metadata.issue_key ?? signal.external_id,
108-
assignees: metadata.assigneeName || metadata.assignee_name
109-
? [String(metadata.assigneeName ?? metadata.assignee_name)]
110-
: [],
111-
};
112-
}
113-
11494
return {
11595
...(signal.source_metadata ?? {}),
11696
};

0 commit comments

Comments
 (0)