Skip to content

Commit e142fa7

Browse files
committed
Removed user caching and important css flag
Signed-off-by: James Cocker <james.s.earth@gmail.com>
1 parent 32ebed6 commit e142fa7

File tree

4 files changed

+6
-28
lines changed

4 files changed

+6
-28
lines changed

galasa-ui/src/actions/runsAction.ts

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,9 @@ import { ResultArchiveStoreAPIApi, TagsAPIApi } from '@/generated/galasaapi';
99
import { createAuthenticatedApiConfiguration } from '@/utils/api';
1010
import { fetchRunDetailLogs } from '@/utils/testRuns';
1111
import { CLIENT_API_VERSION } from '@/utils/constants/common';
12-
import { Configuration } from '@/generated/galasaapi';
13-
14-
// Cache for API configuration to avoid multiple cookie accesses in the same request
15-
let cachedApiConfig: Configuration | null = null;
16-
17-
const getCachedApiConfiguration = (): Configuration => {
18-
if (!cachedApiConfig) {
19-
cachedApiConfig = createAuthenticatedApiConfiguration();
20-
}
21-
return cachedApiConfig;
22-
};
23-
24-
// Reset the cached API configuration (useful for testing)
25-
export const resetApiConfigCache = (): void => {
26-
cachedApiConfig = null;
27-
};
2812

2913
export const downloadArtifactFromServer = async (runId: string, artifactUrl: string) => {
30-
const apiConfig = getCachedApiConfiguration();
14+
const apiConfig = createAuthenticatedApiConfiguration();
3115
const rasApiClient = new ResultArchiveStoreAPIApi(apiConfig);
3216

3317
const artifactFile = await rasApiClient.getRasRunArtifactByPath(
@@ -69,7 +53,7 @@ export const downloadArtifactFromServer = async (runId: string, artifactUrl: str
6953

7054
export const updateRunTags = async (runId: string, tags: string[]) => {
7155
try {
72-
const apiConfig = getCachedApiConfiguration();
56+
const apiConfig = createAuthenticatedApiConfiguration();
7357
const rasApiClient = new ResultArchiveStoreAPIApi(apiConfig);
7458

7559
// Note: Tags are already unique from the Set in the frontend, but is checked again by the rest api.
@@ -89,7 +73,7 @@ export const updateRunTags = async (runId: string, tags: string[]) => {
8973

9074
export const getExistingTagObjects = async () => {
9175
try {
92-
const apiConfig = getCachedApiConfiguration();
76+
const apiConfig = createAuthenticatedApiConfiguration();
9377
const tagsApiClient = new TagsAPIApi(apiConfig);
9478

9579
const tagsResponse = await tagsApiClient.getTags();

galasa-ui/src/components/test-runs/test-run-details/3270Tab/TableOfScreenshots.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export default function TableOfScreenshots({
287287
getRowProps: (options: any) => TableRowProps;
288288
getTableProps: () => TableBodyProps;
289289
}) => (
290-
<Table stickyHeader {...getTableProps()} className={styles.innerScreenshotTable}>
290+
<Table stickyHeader {...getTableProps()} id={styles.innerScreenshotTable}>
291291
<TableHead>
292292
<TableRow>
293293
{headers.map((header) => (

galasa-ui/src/styles/test-runs/test-run-details/Tab3270.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
cursor: pointer;
1313
}
1414

15-
.innerScreenshotTable {
15+
#innerScreenshotTable {
1616
/* Override Carbon's max-height for the Table component */
1717
max-height: min(calc(100vh - 450px), 550px) !important;
1818
overflow-y: auto;

galasa-ui/src/tests/actions/runActions.test.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
*
44
* SPDX-License-Identifier: EPL-2.0
55
*/
6-
import {
7-
downloadArtifactFromServer,
8-
updateRunTags,
9-
resetApiConfigCache,
10-
} from '@/actions/runsAction';
6+
import { downloadArtifactFromServer, updateRunTags } from '@/actions/runsAction';
117
import * as apiUtils from '@/utils/api';
128
import * as galasaapi from '@/generated/galasaapi';
139
import { CLIENT_API_VERSION } from '@/utils/constants/common';
@@ -34,7 +30,6 @@ describe('downloadArtifactFromServer', () => {
3430

3531
afterEach(() => {
3632
jest.resetAllMocks();
37-
resetApiConfigCache();
3833
});
3934

4035
it('parses valid JSON payload', async () => {
@@ -127,7 +122,6 @@ describe('updateRunTags', () => {
127122

128123
afterEach(() => {
129124
jest.resetAllMocks();
130-
resetApiConfigCache();
131125
});
132126

133127
it('successfully updates tags', async () => {

0 commit comments

Comments
 (0)