Skip to content

Commit

Permalink
[Discover] Disable logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jughosta committed Jan 25, 2024
1 parent 9ece3ce commit fc2ec95
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,13 @@ export const useDiscoverHistogram = ({
}

const fetchStart = stateContainer.dataState.fetch$.subscribe((value) => {
console.log('fetchStart', value);
// console.log('fetchStart', value);
if (!skipRefetch.current) {
setIsSuggestionLoading(true);
}
});
const fetchComplete = textBasedFetchComplete$.subscribe((value) => {
console.log('fetchComplete', value);
// console.log('fetchComplete', value);
setIsSuggestionLoading(false);
});

Expand Down Expand Up @@ -332,7 +332,7 @@ export const useDiscoverHistogram = ({

const onVisContextChanged = useCallback(
(newVisContext: ExternalVisContext | undefined) => {
console.log('got new vis context from histogram', newVisContext);
// console.log('got new vis context from histogram', newVisContext);
stateContainer.appState.update({ visContext: newVisContext });
},
[stateContainer]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,6 @@ export function isEqualSavedSearch(savedSearchPrev: SavedSearch, savedSearchNext
const isSame = isEqual(prevValue, nextValue);

if (!isSame) {
console.log('changes to saved search detected', {
key,
before: prevSavedSearch[key],
after: nextSavedSearchWithoutSearchSource[key],
});

addLog('[savedSearch] difference between initial and changed version', {
key,
before: prevSavedSearch[key],
Expand Down Expand Up @@ -302,12 +296,6 @@ export function isEqualSavedSearch(savedSearchPrev: SavedSearch, savedSearchNext
: isEqual(prevValue, nextValue);

if (!isSame) {
console.log('[savedSearch] difference between initial and changed version', {
key,
before: prevValue,
after: nextValue,
});

addLog('[savedSearch] difference between initial and changed version', {
key,
before: prevValue,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/unified_histogram/public/chart/chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export function Chart({

const onSuggestionContextEdit = useCallback(
(editedSuggestionContext: UnifiedHistogramSuggestionContext | undefined) => {
console.log('suggestion context was edited', editedSuggestionContext);
// console.log('suggestion context was edited', editedSuggestionContext);
lensVisService.onSuggestionEdited({
editedSuggestionContext,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const UnifiedHistogramContainer = forwardRef<
}

return (visContext) => {
console.log('updating vis context', visContext);
// console.log('updating vis context', visContext);
onVisContextChanged(getStableVisContext(visContext));
};
}, [onVisContextChanged]);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/unified_histogram/public/layout/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export const UnifiedHistogramLayout = ({

useEffect(() => {
if (isChartLoading) {
console.log('chart is loading', requestParams.query, externalVisContext);
// console.log('chart is loading', requestParams.query, externalVisContext);
return;
}

Expand Down
30 changes: 16 additions & 14 deletions src/plugins/unified_histogram/public/services/lens_vis_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ export class LensVisService {
}) => {
const suggestionContextSelectedPreviously = this.state$.getValue().currentSuggestionContext;

console.log('recalculating chart', queryParams.query, externalVisContext);
// console.log('recalculating chart', queryParams.query, externalVisContext);

const allSuggestions = this.getAllSuggestions({ queryParams });

console.log('service allSuggestions', allSuggestions);
// console.log('service allSuggestions', allSuggestions);

const suggestionState = this.getCurrentSuggestionState({
suggestionContextSelectedPreviously,
Expand All @@ -160,7 +160,7 @@ export class LensVisService {
breakdownField,
});

console.log('service suggestionState', suggestionState);
// console.log('service suggestionState', suggestionState);

const lensAttributesState = this.getLensAttributesState({
currentSuggestionContext: suggestionState.currentSuggestionContext,
Expand All @@ -171,7 +171,7 @@ export class LensVisService {
breakdownField,
});

console.log('service lensAttributesState', lensAttributesState);
// console.log('service lensAttributesState', lensAttributesState);

if (suggestionState.shouldUpdateSelectedSuggestionDueToDepsChange) {
onSuggestionContextChange?.(suggestionState.currentSuggestionContext);
Expand All @@ -182,11 +182,11 @@ export class LensVisService {
(suggestionState.shouldUpdateSelectedSuggestionDueToDepsChange ||
lensAttributesState.shouldUpdateVisContextDueToIncompatibleSuggestion)
) {
console.log(
'forced to update selected suggestion and vis context',
suggestionState.currentSuggestionContext.suggestion,
lensAttributesState.lensAttributesContext
);
// console.log(
// 'forced to update selected suggestion and vis context',
// suggestionState.currentSuggestionContext.suggestion,
// lensAttributesState.lensAttributesContext
// );
onVisContextChanged?.(lensAttributesState.lensAttributesContext);
}

Expand Down Expand Up @@ -607,16 +607,18 @@ export class LensVisService {
suggestionType === externalVisContext?.suggestionType &&
isSuggestionAndVisContextCompatible(suggestion, externalVisContext)
) {
console.log('using the external lens attributes');
// console.log('using the external lens attributes');
// using the external lens attributes
return {
shouldUpdateVisContextDueToIncompatibleSuggestion: false,
lensAttributesContext: externalVisContext,
};
} else {
console.log('external vis is not compatible with the current suggestion');
console.log('query', currentQuery, externalVisContext.attributes?.state?.query);
console.log('timeInterval', timeInterval, externalVisContext?.requestData?.timeInterval);
console.log('suggestionType', suggestionType, externalVisContext?.suggestionType);
// console.log('external vis is not compatible with the current suggestion');
// console.log('query', currentQuery, externalVisContext.attributes?.state?.query);
// console.log('timeInterval', timeInterval, externalVisContext?.requestData?.timeInterval);
// console.log('suggestionType', suggestionType, externalVisContext?.suggestionType);
// external vis is not compatible with the current suggestion
shouldUpdateVisContextDueToIncompatibleSuggestion = true;
}
}
Expand Down

0 comments on commit fc2ec95

Please sign in to comment.