Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functionality to change order of filters. #117

Merged
merged 4 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const CookiesMatrix = ({
},
{
title: 'Number of Frames with Associated Cookies',
description: 'Frames that have cookies associated with them',
description: 'Frames that have cookies associated with them.',
count: framesWithCookies ? Object.keys(framesWithCookies).length : 0,
expand: isExpanded,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,47 @@ export const FILTER_MAPPING = [
keys: 'analytics.category',
default: 'Uncategorized',
sort: true,
order: 1,
},
{
name: 'Domain',
keys: 'parsedCookie.domain',
sort: true,
order: 3,
},
{
name: 'Platform',
keys: 'analytics.platform',
sort: true,
},
{
name: 'Path',
keys: 'parsedCookie.path',
name: 'HttpOnly',
keys: 'parsedCookie.httponly',
type: 'boolean',
order: 4,
},
{
name: 'Same Site',
keys: 'parsedCookie.samesite',
order: 5,
},
{
name: 'Secure',
keys: 'parsedCookie.secure',
type: 'boolean',
order: 6,
},
{
name: 'HttpOnly',
keys: 'parsedCookie.httponly',
type: 'boolean',
name: 'Path',
keys: 'parsedCookie.path',
order: 7,
},
{
name: 'Platform',
keys: 'analytics.platform',
sort: true,
order: 9,
},
{
name: 'Cookie Accepted',
keys: 'isCookieSet',
type: 'boolean',
order: 10,
},
];

Expand All @@ -61,6 +69,7 @@ export const CUSTOM_FILTER_MAPPING = {
name: 'Scope',
keys: 'isFirstParty',
filters: new Set(['First Party', 'Third Party']),
order: 2,
},
retentionPeriod: {
name: 'Retention Period',
Expand All @@ -72,5 +81,6 @@ export const CUSTOM_FILTER_MAPPING = {
'Long Term (1 week - 1 month)',
'Extended Term (> 1 month)',
]),
order: 8,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export interface Filter {
type?: string;
default?: string;
sort?: boolean;
order: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const getFilters = (cookies: CookieTableData[]): Filter[] => {

filters.push(...Object.values(CUSTOM_FILTER_MAPPING));

return filters;
return filters.sort((a: Filter, b: Filter) => a.order - b.order);
};

export default getFilters;