mirror of
https://github.com/Graylog2/graylog2-server.git
synced 2026-03-13 09:32:21 +08:00
Running lint --fix & prettier (#25152)
Co-authored-by: Dr. Lint-a-lot <garybot2@graylog.com>
This commit is contained in:
committed by
GitHub
parent
0c17237804
commit
779b963495
@@ -92,8 +92,8 @@ const StyledListGroupItem = styled(BootstrapListGroupItem)(
|
||||
color: ${theme.colors.variant.darkest.default};
|
||||
}
|
||||
|
||||
&:hover:not(.disabled):not(.active),
|
||||
&:focus:not(.disabled):not(.active) {
|
||||
&:hover:not(.disabled, .active),
|
||||
&:focus:not(.disabled, .active) {
|
||||
color: inherit;
|
||||
background-color: ${theme.utils.colorLevel(theme.colors.global.contentBackground, 10)};
|
||||
|
||||
|
||||
@@ -79,11 +79,29 @@ const useFilterValueSuggestions = (
|
||||
}
|
||||
|
||||
const { data, isInitialLoading } = useQuery({
|
||||
queryKey: ['filters', 'suggestions', collection, collectionProperty, relatedIdentifier, identifierType, searchParams, displayFields, displayTemplate],
|
||||
queryKey: [
|
||||
'filters',
|
||||
'suggestions',
|
||||
collection,
|
||||
collectionProperty,
|
||||
relatedIdentifier,
|
||||
identifierType,
|
||||
searchParams,
|
||||
displayFields,
|
||||
displayTemplate,
|
||||
],
|
||||
|
||||
queryFn: () =>
|
||||
defaultOnError(
|
||||
fetchFilterValueSuggestions(collection, searchParams, relatedIdentifier, displayFields, displayTemplate, identifierType, collectionProperty),
|
||||
fetchFilterValueSuggestions(
|
||||
collection,
|
||||
searchParams,
|
||||
relatedIdentifier,
|
||||
displayFields,
|
||||
displayTemplate,
|
||||
identifierType,
|
||||
collectionProperty,
|
||||
),
|
||||
'Loading suggestions for filter failed with status',
|
||||
'Could not load filter suggestions',
|
||||
),
|
||||
|
||||
@@ -37,12 +37,14 @@ type CollectionsByAttributeId = {
|
||||
};
|
||||
|
||||
type IdentifierMetaByAttributeId = {
|
||||
[attributeId: string]: {
|
||||
identifier_field?: string;
|
||||
identifier_type?: string;
|
||||
display_fields?: string[];
|
||||
display_template?: string;
|
||||
} | undefined;
|
||||
[attributeId: string]:
|
||||
| {
|
||||
identifier_field?: string;
|
||||
identifier_type?: string;
|
||||
display_fields?: string[];
|
||||
display_template?: string;
|
||||
}
|
||||
| undefined;
|
||||
};
|
||||
|
||||
type RequestedFilterTitles = Array<{
|
||||
@@ -65,21 +67,24 @@ const _collectionsByAttributeId = (attributesMetaData: Attributes) =>
|
||||
}, {});
|
||||
|
||||
const _identifierMetaByAttributeId = (attributesMetaData: Attributes): IdentifierMetaByAttributeId =>
|
||||
attributesMetaData?.reduce((col, { id, related_collection, related_identifier, type, related_display_fields, related_display_template }) => {
|
||||
if (!related_collection) {
|
||||
return col;
|
||||
}
|
||||
attributesMetaData?.reduce(
|
||||
(col, { id, related_collection, related_identifier, type, related_display_fields, related_display_template }) => {
|
||||
if (!related_collection) {
|
||||
return col;
|
||||
}
|
||||
|
||||
return {
|
||||
...col,
|
||||
[id]: {
|
||||
identifier_field: related_identifier,
|
||||
identifier_type: related_identifier ? type : undefined,
|
||||
display_fields: related_display_fields,
|
||||
display_template: related_display_template,
|
||||
},
|
||||
};
|
||||
}, {});
|
||||
return {
|
||||
...col,
|
||||
[id]: {
|
||||
identifier_field: related_identifier,
|
||||
identifier_type: related_identifier ? type : undefined,
|
||||
display_fields: related_display_fields,
|
||||
display_template: related_display_template,
|
||||
},
|
||||
};
|
||||
},
|
||||
{},
|
||||
);
|
||||
|
||||
const _urlQueryFiltersWithoutTitle = (filters: UrlQueryFilters, collectionsByAttributeId: CollectionsByAttributeId) =>
|
||||
filters.entrySeq().reduce((col, [attributeId, filterValues]) => {
|
||||
@@ -215,7 +220,11 @@ const useFiltersWithTitle = (
|
||||
const collectionsByAttributeId = _collectionsByAttributeId(attributesMetaData);
|
||||
const identifierMetaByAttributeId = _identifierMetaByAttributeId(attributesMetaData);
|
||||
const urlQueryFiltersWithoutTitle = _urlQueryFiltersWithoutTitle(urlQueryFilters, collectionsByAttributeId);
|
||||
const payload = filtersWithoutTitlePayload(urlQueryFiltersWithoutTitle, collectionsByAttributeId, identifierMetaByAttributeId);
|
||||
const payload = filtersWithoutTitlePayload(
|
||||
urlQueryFiltersWithoutTitle,
|
||||
collectionsByAttributeId,
|
||||
identifierMetaByAttributeId,
|
||||
);
|
||||
const { data, isInitialLoading, isError } = useQuery({
|
||||
queryKey: ['entity_titles', payload],
|
||||
|
||||
@@ -240,7 +249,11 @@ const useFiltersWithTitle = (
|
||||
const onChange = useCallback(
|
||||
(newFiltersWithTitle: Filters, newUrlQueryFilters: UrlQueryFilters) => {
|
||||
const newURLQueryFiltersWithoutTitle = _urlQueryFiltersWithoutTitle(newUrlQueryFilters, collectionsByAttributeId);
|
||||
const newPayload = filtersWithoutTitlePayload(newURLQueryFiltersWithoutTitle, collectionsByAttributeId, identifierMetaByAttributeId);
|
||||
const newPayload = filtersWithoutTitlePayload(
|
||||
newURLQueryFiltersWithoutTitle,
|
||||
collectionsByAttributeId,
|
||||
identifierMetaByAttributeId,
|
||||
);
|
||||
const newResponse = filtersWithTitleToResponse(newFiltersWithTitle, attributesMetaData);
|
||||
|
||||
queryClient.setQueryData(['entity_titles', newPayload], { entities: newResponse });
|
||||
|
||||
Reference in New Issue
Block a user