Skip to content

Commit 6e070a9

Browse files
committed
update code and added queries
1 parent fb70d24 commit 6e070a9

File tree

14 files changed

+185
-91
lines changed

14 files changed

+185
-91
lines changed

backend/.env.example

Lines changed: 0 additions & 22 deletions
This file was deleted.

backend/apps/github/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ github-add-related-repositories:
55
github-enrich-issues:
66
@echo "Enriching GitHub issues"
77
@CMD="python manage.py github_enrich_issues" $(MAKE) exec-backend-command
8-
8+
99
github-update-owasp-organization:
1010
@echo "Updating OWASP GitHub organization"
1111
@CMD="python manage.py github_update_owasp_organization" $(MAKE) exec-backend-command

backend/apps/github/api/internal/nodes/issue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"created_at",
1616
"number",
1717
"state",
18-
"summary",
18+
"body",
1919
"title",
2020
"url",
2121
],

frontend/__tests__/unit/components/CardDetailsPage.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ describe('CardDetailsPage', () => {
494494
organizationName: 'test-org',
495495
projectName: 'Test Project',
496496
projectUrl: 'https://github.com/test/project',
497-
summary: 'Issue summary',
497+
body: 'Issue summary',
498498
title: 'Test Issue',
499499
updatedAt: Date.now(),
500500
url: 'https://github.com/test/project/issues/123',
@@ -524,7 +524,7 @@ describe('CardDetailsPage', () => {
524524
organizationName: 'test-org',
525525
title: 'Add new feature',
526526
url: 'https://github.com/test/project/pull/456',
527-
state: 'open',
527+
state: 'merged',
528528
mergedAt: new Date(Date.now() - 86400000).toISOString(),
529529
},
530530
]

frontend/src/app/my/mentorship/programs/[programKey]/modules/[moduleKey]/issues/[issueId]/page.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,19 @@ const ModuleIssueDetailsPage = () => {
8989
<h1 className="text-2xl font-bold sm:text-3xl">
9090
<span className="break-words">{issue.title}</span>
9191
</h1>
92-
<div className="mt-1 text-sm text-gray-500">
93-
{issue.organizationName}/{issue.repositoryName} • #{issue.number}
92+
<div className="mt-1 flex items-center gap-2 text-sm text-gray-500">
93+
<span>
94+
{issue.organizationName}/{issue.repositoryName} • #{issue.number}
95+
</span>
96+
<span
97+
className={`rounded-full px-2 py-1 text-xs font-medium ${
98+
issue.state === 'open'
99+
? 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200'
100+
: 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200'
101+
}`}
102+
>
103+
{issue.state === 'open' ? 'Open' : 'Closed'}
104+
</span>
94105
</div>
95106
</div>
96107
<ActionButton url={issue.url} tooltipLabel="View on GitHub">
@@ -100,7 +111,7 @@ const ModuleIssueDetailsPage = () => {
100111

101112
<SecondaryCard title={<AnchorTitle title="Description" />}>
102113
<div className="prose dark:prose-invert line-clamp-[15] max-w-none">
103-
<Markdown content={issue.summary || 'No description.'} />
114+
<Markdown content={issue.body || 'No description.'} />
104115
</div>
105116
</SecondaryCard>
106117

@@ -241,22 +252,18 @@ const ModuleIssueDetailsPage = () => {
241252
</div>
242253
<div className="flex items-center gap-2">
243254
{pr.state === 'closed' && pr.mergedAt ? (
244-
<span className="rounded-full bg-green-100 px-2 py-1 text-xs font-medium text-green-800 dark:bg-green-900 dark:text-green-200">
255+
<span className="rounded-full bg-purple-100 px-2 py-1 text-xs font-medium text-purple-800 dark:bg-purple-900 dark:text-purple-200">
245256
Merged
246257
</span>
247258
) : pr.state === 'closed' ? (
248259
<span className="rounded-full bg-red-100 px-2 py-1 text-xs font-medium text-red-800 dark:bg-red-900 dark:text-red-200">
249260
Closed
250261
</span>
251262
) : (
252-
<span className="rounded-full bg-blue-100 px-2 py-1 text-xs font-medium text-blue-800 dark:bg-blue-900 dark:text-blue-200">
263+
<span className="rounded-full bg-green-100 px-2 py-1 text-xs font-medium text-green-800 dark:bg-green-900 dark:text-green-200">
253264
Open
254265
</span>
255266
)}
256-
<ActionButton url={pr.url} tooltipLabel="View PR">
257-
<FontAwesomeIcon icon={faLink} />
258-
<span className="hidden sm:inline">View PR</span>
259-
</ActionButton>
260267
</div>
261268
</div>
262269
))

frontend/src/app/my/mentorship/programs/[programKey]/modules/[moduleKey]/issues/page.tsx

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { useQuery } from '@apollo/client'
44
import { Select, SelectItem } from '@heroui/select'
5+
import { Tooltip } from '@heroui/tooltip'
56
import Image from 'next/image'
67
import { useParams, useRouter, useSearchParams } from 'next/navigation'
78
import { useEffect, useMemo, useState } from 'react'
@@ -10,7 +11,6 @@ import { GET_MODULE_ISSUES } from 'server/queries/moduleQueries'
1011
import type { Issue } from 'types/issue'
1112
import LoadingSpinner from 'components/LoadingSpinner'
1213
import Pagination from 'components/Pagination'
13-
import { TruncatedText } from 'components/TruncatedText'
1414

1515
const LABEL_ALL = 'all'
1616
const ITEMS_PER_PAGE = 20
@@ -52,8 +52,9 @@ const IssuesPage = () => {
5252
projectUrl: '',
5353
repository: undefined,
5454
repositoryLanguages: [],
55-
summary: '',
55+
body: i.body || '',
5656
title: i.title,
57+
state: i.state,
5758
updatedAt: i.createdAt,
5859
url: i.url,
5960
objectID: i.id,
@@ -146,6 +147,12 @@ const IssuesPage = () => {
146147
>
147148
Title
148149
</th>
150+
<th
151+
scope="col"
152+
className="px-6 py-3 text-left text-xs font-medium tracking-wider text-gray-500 uppercase dark:text-gray-400"
153+
>
154+
Status
155+
</th>
149156
<th
150157
scope="col"
151158
className="px-6 py-3 text-left text-xs font-medium tracking-wider text-gray-500 uppercase dark:text-gray-400"
@@ -164,15 +171,33 @@ const IssuesPage = () => {
164171
{moduleIssues.map((issue) => (
165172
<tr key={issue.objectID} className="hover:bg-gray-50 dark:hover:bg-[#2a2e33]">
166173
<td className="px-6 py-4 text-sm font-medium whitespace-nowrap text-blue-600 dark:text-blue-400">
167-
<button
168-
type="button"
169-
onClick={() => handleIssueClick(Number(issue.number))}
170-
className="block max-w-xl cursor-pointer text-left hover:underline"
174+
<Tooltip
175+
closeDelay={100}
176+
delay={100}
177+
showArrow
178+
content={issue.title}
179+
placement="bottom"
180+
isDisabled={issue.title.length > 50 ? false : true}
181+
>
182+
<button
183+
type="button"
184+
onClick={() => handleIssueClick(Number(issue.number))}
185+
className="block max-w-md cursor-pointer truncate text-left hover:underline"
186+
>
187+
{issue.title}
188+
</button>
189+
</Tooltip>
190+
</td>
191+
<td className="px-6 py-4 text-sm whitespace-nowrap">
192+
<span
193+
className={`rounded px-2 py-1 text-xs font-medium ${
194+
issue.state === 'open'
195+
? 'bg-green-50 text-green-700 dark:bg-green-900/30 dark:text-green-300'
196+
: 'bg-red-50 text-red-700 dark:bg-red-900/30 dark:text-red-300'
197+
}`}
171198
>
172-
<TruncatedText
173-
text={`${issue.title.slice(0, 50)}${issue.title.length > 50 ? '…' : ''}`}
174-
/>
175-
</button>
199+
{issue.state === 'open' ? 'Open' : 'Closed'}
200+
</span>
176201
</td>
177202
<td className="px-6 py-4">
178203
<div className="flex flex-wrap gap-2">
@@ -220,9 +245,7 @@ const IssuesPage = () => {
220245
</div>
221246
)}
222247
</div>
223-
) : (
224-
<span className="text-gray-400">Unassigned</span>
225-
))(
248+
) : null)(
226249
(data?.getModule?.issues || []).find((i) => i.id === issue.objectID)
227250
?.assignees
228251
)}
@@ -232,7 +255,7 @@ const IssuesPage = () => {
232255
{moduleIssues.length === 0 && (
233256
<tr>
234257
<td
235-
colSpan={3}
258+
colSpan={4}
236259
className="px-6 py-8 text-center text-sm text-gray-500 dark:text-gray-400"
237260
>
238261
No issues found for the selected filter.

frontend/src/server/queries/issueQueries.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,11 @@ export const GET_MODULE_ISSUE_VIEW = gql`
1010
id
1111
number
1212
title
13-
summary
13+
body
1414
url
1515
state
16-
createdAt
1716
organizationName
1817
repositoryName
19-
author {
20-
id
21-
login
22-
name
23-
avatarUrl
24-
}
2518
assignees {
2619
id
2720
login

frontend/src/server/queries/moduleQueries.ts

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -86,43 +86,20 @@ export const GET_MODULE_ISSUES = gql`
8686
$label: String
8787
) {
8888
getModule(moduleKey: $moduleKey, programKey: $programKey) {
89-
id
9089
name
91-
key
9290
issuesCount(label: $label)
9391
availableLabels
9492
issues(limit: $limit, offset: $offset, label: $label) {
9593
id
9694
number
97-
createdAt
9895
title
99-
summary
100-
url
101-
author {
102-
id
103-
avatarUrl
104-
login
105-
name
106-
}
96+
state
97+
labels
10798
assignees {
108-
id
10999
avatarUrl
110100
login
111101
name
112102
}
113-
labels
114-
pullRequests {
115-
id
116-
title
117-
url
118-
createdAt
119-
author {
120-
id
121-
login
122-
name
123-
avatarUrl
124-
}
125-
}
126103
}
127104
}
128105
}

0 commit comments

Comments
 (0)