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 2c26d93
Show file tree
Hide file tree
Showing 15 changed files with 204 additions and 7 deletions.
18 changes: 18 additions & 0 deletions .idea/compiler.xml

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

6 changes: 6 additions & 0 deletions .idea/encodings.xml

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

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

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

35 changes: 35 additions & 0 deletions .idea/jarRepositories.xml

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

15 changes: 15 additions & 0 deletions .idea/misc.xml

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

8 changes: 8 additions & 0 deletions .idea/modules.xml

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

9 changes: 9 additions & 0 deletions .idea/species-lists.iml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

83 changes: 83 additions & 0 deletions .idea/workspace.xml

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

Original file line number Diff line number Diff line change
Expand Up @@ -850,9 +850,11 @@ public List<Facet> facetSpeciesLists(
}

Query aggQuery = builder.build();
logger.info(aggQuery.toString());
SearchHits<SpeciesListIndex> results =
elasticsearchOperations.search(aggQuery, SpeciesListIndex.class);

logger.info(Objects.requireNonNull(results.getAggregations()).toString());
ElasticsearchAggregations agg = (ElasticsearchAggregations) results.getAggregations();

List<Facet> facets = new ArrayList<>();
Expand Down
6 changes: 3 additions & 3 deletions lists-service/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ collectory.api.url=https://collections-test.ala.org.au
# validation constraints
constraints.file=/data/lists-service/config/constraints.json

#logging.level.tracer=TRACE
#logging.level.org.springframework=TRACE
#logging.level.com.baeldung=TRACE
logging.level.tracer=TRACE
logging.level.org.springframework=TRACE
logging.level.com.baeldung=TRACE
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 2c26d93

Please sign in to comment.