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

GH-1616: tracker list breakdown detailed view #394

Merged
merged 23 commits into from Jun 13, 2019
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
80c2ce9
Experiment with getGhosteryStats antitrack action
wlycdgr Apr 30, 2019
bc6fb22
Merge branch 'develop' into GH-1616/trackerListBreakdown-DetailedView
wlycdgr Apr 30, 2019
7dda522
Work on reconciling data returned by getGhosteryStats with our catego…
wlycdgr Apr 30, 2019
1e71dd2
Merge branch 'develop' into GH-1616/trackerListBreakdown-DetailedView
wlycdgr Jun 10, 2019
59663e0
Increase height of tracker header to accommodate new fingerprints and…
wlycdgr Jun 10, 2019
4810c57
Add color to fingerprints and cookies readouts
wlycdgr Jun 10, 2019
45c993d
Add svg badge icon for fingerprints and cookies readout in tracker list
wlycdgr Jun 10, 2019
9dc72c0
Tweak tracker header padding & line height
wlycdgr Jun 11, 2019
9d9a0f1
Tweak font styling for cookie and fingerprint count stats
wlycdgr Jun 11, 2019
f121a23
Tweak cliqz cookie and fingerprint counts spacing. Factor rendering o…
wlycdgr Jun 11, 2019
286f168
Implement conditional display and pluralization logic for cookie and …
wlycdgr Jun 11, 2019
99a535a
Implement passing of cookes and fingerprints ghostery stats from back…
wlycdgr Jun 11, 2019
8ed692e
Merge branch 'develop' into GH-1616/trackerListBreakdown-DetailedView
wlycdgr Jun 11, 2019
c81b781
Add ads cliqz stat to tracker detail view
wlycdgr Jun 11, 2019
fe70332
Document FoundBugs#getAppsById
wlycdgr Jun 11, 2019
e67dc1a
Ensure the panel does not break if a bug id returned by getGhosterySt…
wlycdgr Jun 11, 2019
31fd112
Add guards to getCliqzGhosteryStats to account for the case when anti…
wlycdgr Jun 12, 2019
f285940
Convert locale strings for Cliqz stats in tracker detail view to use …
wlycdgr Jun 12, 2019
7b388b7
Merge in develop
wlycdgr Jun 12, 2019
3199e95
Update getCliqzGhosteryStats guard for when anti-tracking is off
wlycdgr Jun 12, 2019
0b7856e
Implement slide out animation UI for Cliqz stats readout in tracker d…
wlycdgr Jun 13, 2019
1d4796f
Appease linter
wlycdgr Jun 13, 2019
c717553
Indentation fix
wlycdgr Jun 13, 2019
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Implement passing of cookes and fingerprints ghostery stats from back…

…ground to Tracker component and their display there
  • Loading branch information
wlycdgr committed Jun 11, 2019
commit 99a535aaa872e05f8bebb99f19a296530bdb3c49
@@ -216,14 +216,6 @@ class Blocking extends React.Component {
handlePortMessage(msg) {
if (msg.to !== 'blocking' || !msg.body) { return; }

if (msg.body.bugs) {
console.error('Cliqz Ghostery Stats received by Blocking component');
console.error(msg.body);
} else {
console.error('Categories array received by Blocking component:');
console.error(msg.body.categories);
}

this.props.actions.updateBlockingData(msg.body);
}

@@ -203,18 +203,19 @@ class Tracker extends React.Component {
}

_renderCliqzStatsContainer() {
const cookieCount = Math.floor(Math.random() * 3);
const fingerprintCount = Math.floor(Math.random() * 3);
const oneOrMoreCookies = cookieCount >= 1;
const oneOrMoreFingerprints = fingerprintCount >= 1;
const oneCookie = cookieCount === 1;
const oneFingerprint = fingerprintCount === 1;
const { tracker } = this.props;
const { cliqz_cookies, cliqz_fingerprints } = tracker;

const oneOrMoreCookies = cliqz_cookies >= 1;
const oneOrMoreFingerprints = cliqz_fingerprints >= 1;
const oneCookie = cliqz_cookies === 1;
const oneFingerprint = cliqz_fingerprints === 1;

return (
<div className="trk-cliqz-stats-container">
{(oneOrMoreCookies || oneOrMoreFingerprints) && <ReactSVG path="/app/images/panel/cookies-and-fingerprints-cliqz-badge.svg" className="trk-cliqz-stat-shield-badge-svg" />}
{oneOrMoreCookies && <span className="trk-cliqz-stat-cookies-count">{cookieCount} {oneCookie ? t('cookie') : t('cookies')}</span>}
{oneOrMoreFingerprints && <span className="trk-cliqz-stat-fingerprint-count">{fingerprintCount} {oneFingerprint ? t('fingerprint') : t('fingerprints')}</span>}
{oneOrMoreCookies && <span className="trk-cliqz-stat-cookies-count">{cliqz_cookies} {oneCookie ? t('cookie') : t('cookies')}</span>}
{oneOrMoreFingerprints && <span className="trk-cliqz-stat-fingerprint-count">{cliqz_fingerprints} {oneFingerprint ? t('fingerprint') : t('fingerprints')}</span>}
</div>
);
}
@@ -276,6 +276,16 @@ class FoundBugs {
return apps_arr;
}

getAppsById(tab_id) {
This conversation was marked as resolved by wlycdgr

This comment has been minimized.

@IAmThePan

IAmThePan Jun 11, 2019
Contributor

Please add a documentation comment for this function.

This comment has been minimized.

@wlycdgr

wlycdgr Jun 11, 2019
Author Member

Added

if (!this._ensure(tab_id)) {
return [];
}

const { appsById } = this._foundApps[tab_id];

return appsById;
}

/**
* Get the categories from BugsDb that match bugs found
* on a tab_id.
@@ -121,8 +121,6 @@ class PanelData {
case 'BlockingComponentDidMount':
this._mountedComponents.blocking = true;
this._setTrackerListAndCategories();
console.error(getCliqzGhosteryStats(tab.id));
this._postMessage('blocking', getCliqzGhosteryStats(tab.id));
this._postMessage('blocking', this._getBlockingData());
break;
case 'BlockingComponentWillUnmount':
@@ -246,7 +244,6 @@ class PanelData {
}

if (blocking) {
// this._postMessage('blocking', getCliqzGhosteryStats(this._activeTab.id));
this._postMessage('blocking', this._getDynamicBlockingData());
}

@@ -742,7 +739,7 @@ class PanelData {
*/
_buildTracker(tracker, trackerState, smartBlock) {
const {
id, name, cat, sources, hasCompatibilityIssue, hasInsecureIssue, hasLatencyIssue
id, name, cat, sources, hasCompatibilityIssue, hasInsecureIssue, hasLatencyIssue, cliqz_cookies, cliqz_fingerprints
} = tracker;
const { blocked, ss_allowed, ss_blocked } = trackerState;

@@ -759,7 +756,9 @@ class PanelData {
warningCompatibility: hasCompatibilityIssue,
warningInsecure: hasInsecureIssue,
warningSlow: hasLatencyIssue,
warningSmartBlock: (smartBlock.blocked.hasOwnProperty(id) && 'blocked') || (smartBlock.unblocked.hasOwnProperty(id) && 'unblocked') || false
warningSmartBlock: (smartBlock.blocked.hasOwnProperty(id) && 'blocked') || (smartBlock.unblocked.hasOwnProperty(id) && 'unblocked') || false,
cliqz_cookies,
cliqz_fingerprints,
};
}

@@ -811,7 +810,7 @@ class PanelData {
}

/**
* Store the tracker list and categories values to reduce code duplicdation between the blocking and summary data getters,
* Store the tracker list and categories values to reduce code duplication between the blocking and summary data getters,
* and since these values may be accessed 2+ times in a single updatePanelUI call
*/
_setTrackerListAndCategories() {
@@ -820,6 +819,23 @@ class PanelData {
const { id, url } = this._activeTab;

this._trackerList = foundBugs.getApps(id, false, url) || [];

const ghosteryStats = getCliqzGhosteryStats(id);

if (ghosteryStats && ghosteryStats.bugs) {
const gsBugs = ghosteryStats.bugs;
const bugsIds = Object.keys(gsBugs);
const appsById = foundBugs.getAppsById(id);

bugsIds.forEach((bugsId) => {
const trackerId = conf.bugs.bugs[bugsId];
const trackerListIndex = appsById[trackerId.aid];

this._trackerList[trackerListIndex].cliqz_cookies = gsBugs[bugsId].cookies;
this._trackerList[trackerListIndex].cliqz_fingerprints = gsBugs[bugsId].fingerprints;
});
}

this._categories = this._buildCategories();
}
// [/DATA SETTING]
ProTip! Use n and p to navigate between commits in a pull request.