github-issue-tower-defence-management 1.189.0 → 1.189.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/bin/adapter/entry-points/console/consoleOperationApi.js +11 -0
- package/bin/adapter/entry-points/console/consoleOperationApi.js.map +1 -1
- package/bin/adapter/entry-points/console/ui-dist/assets/{index-CZ1NNzIm.js → index-B22eMy23.js} +1 -1
- package/bin/adapter/entry-points/console/ui-dist/index.html +1 -1
- package/package.json +1 -1
- package/src/adapter/entry-points/console/consoleOperationApi.test.ts +28 -0
- package/src/adapter/entry-points/console/consoleOperationApi.ts +17 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsoleTabList.stories.tsx +3 -3
- package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsoleTabList.test.tsx +9 -9
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOperations.test.ts +1 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOperations.ts +1 -0
- package/src/adapter/entry-points/console/ui-dist/assets/{index-CZ1NNzIm.js → index-B22eMy23.js} +1 -1
- package/src/adapter/entry-points/console/ui-dist/index.html +1 -1
- package/types/adapter/entry-points/console/consoleOperationApi.d.ts.map +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>TDPM Console</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-B22eMy23.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-CLHvrafO.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/package.json
CHANGED
|
@@ -292,6 +292,34 @@ describe('consoleOperationApi', () => {
|
|
|
292
292
|
expectRecordedAcrossTabs('PVTI_c');
|
|
293
293
|
});
|
|
294
294
|
|
|
295
|
+
it('closes a pull request and moves linked issue to Awaiting workspace when issueUrl is provided', async () => {
|
|
296
|
+
const response = await handleReview(context, {
|
|
297
|
+
pjcode: 'acme',
|
|
298
|
+
action: 'close',
|
|
299
|
+
prUrl: 'https://github.com/o/r/pull/1',
|
|
300
|
+
issueUrl: 'https://github.com/o/r/issues/7',
|
|
301
|
+
projectItemId: 'PVTI_c_totally_wrong',
|
|
302
|
+
commentBody: 'totally wrong',
|
|
303
|
+
});
|
|
304
|
+
expect(response.statusCode).toBe(200);
|
|
305
|
+
expect(issueRepository.closePullRequest).toHaveBeenCalledWith(
|
|
306
|
+
'https://github.com/o/r/pull/1',
|
|
307
|
+
);
|
|
308
|
+
expect(issueRepository.createCommentByUrl).toHaveBeenCalledWith(
|
|
309
|
+
'https://github.com/o/r/pull/1',
|
|
310
|
+
'totally wrong',
|
|
311
|
+
);
|
|
312
|
+
expect(issueRepository.updateStatus).toHaveBeenCalledWith(
|
|
313
|
+
project,
|
|
314
|
+
expect.objectContaining({
|
|
315
|
+
itemId: 'PVTI_c_totally_wrong',
|
|
316
|
+
url: 'https://github.com/o/r/issues/7',
|
|
317
|
+
}),
|
|
318
|
+
'status_aw',
|
|
319
|
+
);
|
|
320
|
+
expectRecordedAcrossTabs('PVTI_c_totally_wrong');
|
|
321
|
+
});
|
|
322
|
+
|
|
295
323
|
it('marks a pull request unnecessary by closing it, labelling the item chore and moving it to Awaiting workspace', async () => {
|
|
296
324
|
issueRepository.getIssueByUrl.mockResolvedValue({
|
|
297
325
|
...issue,
|
|
@@ -294,6 +294,23 @@ export const handleReview = async (
|
|
|
294
294
|
.resolveIssueRepository(prUrl)
|
|
295
295
|
.createCommentByUrl(prUrl, body.commentBody);
|
|
296
296
|
}
|
|
297
|
+
const issueUrl = body.issueUrl;
|
|
298
|
+
if (isNonEmptyString(issueUrl)) {
|
|
299
|
+
const binding = await context.resolveProject(pjcodeResult);
|
|
300
|
+
if (binding === null) {
|
|
301
|
+
return badRequest(`no project configured for pjcode "${pjcodeResult}"`);
|
|
302
|
+
}
|
|
303
|
+
const statusFailure = await updateStatusByName(
|
|
304
|
+
context.resolveIssueRepository(issueUrl),
|
|
305
|
+
binding.project,
|
|
306
|
+
issueUrl,
|
|
307
|
+
projectItemId,
|
|
308
|
+
AWAITING_WORKSPACE_STATUS_NAME,
|
|
309
|
+
);
|
|
310
|
+
if (statusFailure !== null) {
|
|
311
|
+
return statusFailure;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
297
314
|
recordDone(context, pjcodeResult, projectItemId);
|
|
298
315
|
return ok();
|
|
299
316
|
}
|
|
@@ -3,7 +3,7 @@ import { type ComponentProps, useEffect, useRef, useState } from 'react';
|
|
|
3
3
|
import type { ConsoleTabName } from '../../logic/types';
|
|
4
4
|
import { ConsoleTabList } from './ConsoleTabList';
|
|
5
5
|
|
|
6
|
-
const allPjcodes = ['
|
|
6
|
+
const allPjcodes = ['acme', 'beta', 'gamma', 'delta', 'epsilon'];
|
|
7
7
|
|
|
8
8
|
const meta: Meta<typeof ConsoleTabList> = {
|
|
9
9
|
title: 'Console/ConsoleTabList',
|
|
@@ -135,7 +135,7 @@ export const WithProjectSwitcherClosed: Story = {
|
|
|
135
135
|
args: {
|
|
136
136
|
activeTab: 'prs',
|
|
137
137
|
counts,
|
|
138
|
-
pjcode: '
|
|
138
|
+
pjcode: 'acme',
|
|
139
139
|
pjcodes: allPjcodes,
|
|
140
140
|
},
|
|
141
141
|
};
|
|
@@ -159,7 +159,7 @@ export const WithProjectSwitcherOpen: Story = {
|
|
|
159
159
|
args: {
|
|
160
160
|
activeTab: 'prs',
|
|
161
161
|
counts,
|
|
162
|
-
pjcode: '
|
|
162
|
+
pjcode: 'acme',
|
|
163
163
|
pjcodes: allPjcodes,
|
|
164
164
|
},
|
|
165
165
|
render: (args) => <DropdownOpen {...args} />,
|
|
@@ -14,7 +14,7 @@ const counts: Record<ConsoleTabName, number> = {
|
|
|
14
14
|
|
|
15
15
|
const baseProps = {
|
|
16
16
|
pjcode: 'acme',
|
|
17
|
-
pjcodes: ['
|
|
17
|
+
pjcodes: ['acme', 'beta', 'gamma', 'delta', 'epsilon'],
|
|
18
18
|
generatedAt: '2026-06-19T08:42:11.000Z',
|
|
19
19
|
fromCache: false,
|
|
20
20
|
tabHref: (tab: ConsoleTabName) => `/projects/acme/${tab}`,
|
|
@@ -195,11 +195,11 @@ describe('ConsoleTabList', () => {
|
|
|
195
195
|
baseElement.querySelectorAll('.console-tab-pjname-option'),
|
|
196
196
|
);
|
|
197
197
|
expect(options.map((o) => o.textContent)).toEqual([
|
|
198
|
-
'
|
|
199
|
-
'
|
|
200
|
-
'
|
|
201
|
-
'
|
|
202
|
-
'
|
|
198
|
+
'acme',
|
|
199
|
+
'beta',
|
|
200
|
+
'gamma',
|
|
201
|
+
'delta',
|
|
202
|
+
'epsilon',
|
|
203
203
|
]);
|
|
204
204
|
});
|
|
205
205
|
|
|
@@ -214,8 +214,8 @@ describe('ConsoleTabList', () => {
|
|
|
214
214
|
/>,
|
|
215
215
|
);
|
|
216
216
|
fireEvent.click(getByRole('button', { name: /acme/i }));
|
|
217
|
-
fireEvent.click(getByText('
|
|
218
|
-
expect(onSelectProject).toHaveBeenCalledWith('
|
|
217
|
+
fireEvent.click(getByText('gamma'));
|
|
218
|
+
expect(onSelectProject).toHaveBeenCalledWith('gamma');
|
|
219
219
|
});
|
|
220
220
|
|
|
221
221
|
it('closes the dropdown after a project option is selected', () => {
|
|
@@ -226,7 +226,7 @@ describe('ConsoleTabList', () => {
|
|
|
226
226
|
expect(
|
|
227
227
|
baseElement.querySelector('.console-tab-pjname-dropdown'),
|
|
228
228
|
).toBeInTheDocument();
|
|
229
|
-
fireEvent.click(getByText('
|
|
229
|
+
fireEvent.click(getByText('gamma'));
|
|
230
230
|
expect(
|
|
231
231
|
baseElement.querySelector('.console-tab-pjname-dropdown'),
|
|
232
232
|
).toBeNull();
|