Skip to content

Commit

Permalink
Add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
hamzajaved-csiro committed Dec 17, 2024
1 parent 030bf4e commit b43c9de
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 6 deletions.
22 changes: 22 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cicd/frontend/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ALLOW_LISTED_IPS =
140.253.0.0/16,
119.18.1.71/32

VITE_API_BASEURL = https://${WS_SUB_DOMAIN}.${HOSTED_ZONE}
VITE_API_BASEURL = https://lists-ws.test.ala.org.au
VITE_AUTH_REDIRECT_URI=https://${UI_SUB_DOMAIN}.${HOSTED_ZONE}


Expand Down
2 changes: 1 addition & 1 deletion config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ CLOUDFRONT_CERTIFICATE = arn:aws:acm:us-east-1:748909248546:certificate/44fe9e04

REGOLITH_STACK_NAME = ala-regolith-cluster-testing

WS_SUB_DOMAIN = ${PRODUCT_NAME}-${CLEAN_BRANCH}-ws
WS_SUB_DOMAIN = ${PRODUCT_NAME}-ws
UI_SUB_DOMAIN = ${PRODUCT_NAME}-${CLEAN_BRANCH}

[testing]
Expand Down
2 changes: 1 addition & 1 deletion lists-ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,4 @@ yarn-error.log*
/.env.production
/.env.local
/dist/*
/dist
/dist
1 change: 1 addition & 0 deletions lists-ui/src/api/graphql/performGQLQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ async function performGQLQuery<T = any>(
);

const data = await response.json();
console.log('Response:', response, data);
if (response.ok) {
if (data.errors) {
// If errorData is populated, we've recieved an error from the GraphQL server
Expand Down
2 changes: 2 additions & 0 deletions lists-ui/src/api/graphql/useGQLQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ function useGQLQuery<T>(
useEffect(() => {
async function runQuery() {
if (data && options.clearDataOnUpdate) setData(null);
console.log('Running query:', query, variables);
try {
const queryData = await performGQLQuery<T>(
query,
variables,
options.token
);
console.log('Query result:', queryData);
setData(queryData);
setError(null);
} catch (queryError) {
Expand Down
12 changes: 9 additions & 3 deletions lists-ui/src/views/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,17 @@ function Home() {
size: size,
filters: [],
isPrivate: view === 'private',
...(isUser ? { userid: ala.userid } : {}),
...(ala.isAuthenticated ? { userid: ala.userid } : {}),
},
{ clearDataOnUpdate: false, token: ala.token }
);

useEffect(() => {
if (error) {
console.error('Elasticsearch Error:', error);
}
}, [error]);

// Destructure results & calculate the real page offset
const { totalElements, totalPages, content } = data?.lists || {};
const realPage = page + 1;
Expand All @@ -67,10 +73,10 @@ function Home() {
size,
filters,
isPrivate: view === 'private',
...(isUser ? { userid: ala.userid } : {}),
...(ala.isAuthenticated ? { userid: ala.userid } : {}),
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [page, size, searchQuery, filters, refresh, view, isUser]);
}, [page, size, searchQuery, filters, refresh, view]);

// Keep the current page in check
useEffect(() => {
Expand Down

0 comments on commit b43c9de

Please sign in to comment.