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

Use fastpath scores to render WhatsApp msmt page #405

Merged
merged 3 commits into from
Feb 22, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions components/measurement/AccessPointStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ import { FormattedMessage } from 'react-intl'
import styled from 'styled-components'

const StatusText = styled(Text)`
color: ${props => props.ok && props.theme.colors.yellow9}
color: ${props => props.ok === false ? props.theme.colors.yellow9 : 'unset'}
`

const AccessPointStatus = ({ icon, label, ok , content, color, ...props}) => {
if (content === undefined) {
if (ok) {
if (ok === true) {
content = <FormattedMessage id='Measurement.Details.Endpoint.Status.Okay' />
} else {
} else if (ok === false){
content = <FormattedMessage id='Measurement.Details.Endpoint.Status.Failed' />
} else {
content = <FormattedMessage id='Measurement.Details.Endpoint.Status.Unknown' />
}
}

Expand All @@ -23,7 +25,7 @@ const AccessPointStatus = ({ icon, label, ok , content, color, ...props}) => {
{icon}
<Text fontWeight='bold' fontSize={0}>{label}</Text>
<StatusText
ok={!ok}
ok={ok}
fontSize={3}
fontWeight={200}
color={color}
Expand Down
36 changes: 12 additions & 24 deletions components/measurement/nettests/WhatsApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,25 @@ import MdPersonAdd from 'react-icons/lib/md/person-add'

import AccessPointStatus from '../AccessPointStatus'

const WhatsAppDetails = ({ measurement, render }) => {
const WhatsAppDetails = ({ isAnomaly, scores, measurement, render }) => {
const testKeys = measurement.test_keys
const tcp_connect = testKeys.tcp_connect
const registrationServerBlocked = testKeys.registration_server_status === 'blocked'
const webBlocked = testKeys.whatsapp_web_status === 'blocked'
const endpointsBlocked = testKeys.whatsapp_endpoints_status === 'blocked'
const registrationServerAccessible = scores.analysis.registration_server_accessible
const webAccessible = scores.analysis.whatsapp_web_accessible
const endpointsAccessible = scores.analysis.whatsapp_endpoints_accessible
sarathms marked this conversation as resolved.
Show resolved Hide resolved

const possibleCensorship = (
testKeys.whatsapp_endpoints_status === 'blocked' ||
testKeys.whatsapp_web_status === 'blocked' ||
testKeys.facebook_tcp_blocking === true ||
testKeys.registration_server_status === 'blocked')

const working = (
testKeys.registration_server_status === 'ok' &&
testKeys.whatsapp_web_status === 'ok' &&
testKeys.registration_server_status === 'ok'
)

const isFailed = (working === false && possibleCensorship === false)
let status = 'reachable'
let info = <FormattedMessage id='Measurement.Details.Hint.WhatsApp.Reachable' />
let summaryText = 'Measurement.Details.SummaryText.WhatsApp.Reachable'
if (possibleCensorship || !working) {

if (isAnomaly) {
status = 'anomaly'
info = <FormattedMessage id='Measurement.Status.Hint.WhatsApp.Blocked' />
if (endpointsBlocked) {
if (!endpointsAccessible) {
summaryText = 'Measurement.Details.SummaryText.WhatsApp.AppFailure'
} else if (webBlocked) {
} else if (!webAccessible) {
summaryText = 'Measurement.Details.SummaryText.WhatsApp.DesktopFailure'
} else if (endpointsBlocked && webBlocked) {
} else if (!endpointsAccessible && !webAccessible) {
summaryText = 'Measurement.Details.SummaryText.WhatsApp.DesktopAndAppFailure'
}
}
Expand All @@ -61,21 +49,21 @@ const WhatsAppDetails = ({ measurement, render }) => {
<AccessPointStatus
icon={<MdPhoneAndroid />}
label={<FormattedMessage id='Measurement.Details.WhatsApp.Endpoint.Label.Mobile' />}
ok={!endpointsBlocked}
ok={endpointsAccessible}
/>
</Box>
<Box width={1/3}>
<AccessPointStatus
icon={<MdWebAsset />}
label={<FormattedMessage id='Measurement.Details.WhatsApp.Endpoint.Label.Web' />}
ok={!webBlocked}
ok={webAccessible}
/>
</Box>
<Box width={1/3}>
<AccessPointStatus
icon={<MdPersonAdd />}
label={<FormattedMessage id='Measurement.Details.WhatsApp.Endpoint.Label.Registration' />}
ok={!registrationServerBlocked}
ok={registrationServerAccessible}
/>
</Box>
</Flex>
Expand Down
5 changes: 5 additions & 0 deletions static/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"Measurement.Details.Telegram.Endpoint.Label.Web": "Telegram Web",
"Measurement.Details.Endpoint.Status.Okay": "Okay",
"Measurement.Details.Endpoint.Status.Failed": "Failed",
"Measurement.Details.Endpoint.Status.Unknown": "Unknown",
"Measurement.Details.Telegram.Endpoint.Status.Heading": "Endpoint Status",
"Measurement.Details.Telegram.Endpoint.ConnectionTo.Failed": "Connection to {destination} failed.",
"Measurement.Details.Telegram.Endpoint.ConnectionTo.Successful": "Connection to {destination} was successful.",
Expand Down Expand Up @@ -279,6 +280,10 @@
"Country.Overview.FeaturedResearch": "Research Reports",
"Country.Overview.FeaturedResearch.None": "We haven't published a research report based on OONI data from this country yet. \n\nWe encourage you to use OONI data for your research!",
"Country.Overview.SummaryTextTemplate": "Since **{startDate}**, OONI Probe users in **{countryName}** have collected **{measurementCount}** measurements from **{networkCovered}** local networks.\n\nExplore the data below to check the accessibility and/or blocking of sites and services.",
"Country.Overview.NoData.Title": "Let's collect more data!",
"Country.Overview.NoData.CallToAction": "We don\u2019t have enough measurements for **{country}** to show a chart. If you are in {country} or know people there, tell them to run OONI Probe to collect more measurements.",
"Country.Overview.NoData.Button.InstallProbe": "Install OONI Probe",
"Country.Overview.NoData.Button.OoniRunLink": "Create OONI Run Link",
"Country.PeriodFilter.Label": "Show results from",
"Country.PeriodFilter.Option.30Days": "Last 30 Days",
"Country.PeriodFilter.Option.2Months": "Last 2 Months",
Expand Down
2 changes: 1 addition & 1 deletion static/lang/translations.js

Large diffs are not rendered by default.