GithubHelp home page GithubHelp logo

m-lab / mlab-vis-client Goto Github PK

View Code? Open in Web Editor NEW
11.0 16.0 12.0 2.34 MB

Measurement Lab Visualizations - Analyzing internet speeds worldwide.

License: MIT License

JavaScript 86.56% CSS 12.78% Shell 0.66%
website

mlab-vis-client's Introduction

M-Lab Visualizations

Build Status

This project contains the repository for the Measurement Lab visualizations web client - https://viz.measurementlab.net

mlab-vis-client is a NodeJS application using ReactJS.

General Development Practices

M-Lab follows this general development practice:

  • Fork the mlab-vis-client repository.
  • Develop in your fork's master or feature branches
  • Test and preview changes by deploying to the staging GAE service
  • Open a new pull request to merge changes from your fork to upstream master, and request or assign one or more reviewers to perform a code review
  • Make changes recommended in the code review
  • Merge and deploy the upstream master branch to the production GAE service

Development Environment Setup

  • Fork this repo, then clone to your local machine
  • Add a git remote for upstream
  • Initialize submodules by running git submodule init and git submodule update
  • Install NodeJS
  • Enter the directory where you've cloned your fork of mlab-vis-client and install dependenciesi: $ npm install

Development Server

We are using webpack's DllPlugin, so we need to build our DLL vendor package before running our standard webpack watch. To do so, run this once:

npm run webpack-dll

This puts all the vendor files in their own bundle so we don't need to scan them when rebuilding our files during development.

If you see the error below, you need to run npm run webpack-dll.

Error: Cannot find module '.../mlab-vis-client/static/dist/vendor-manifest.json'

Now to start the dev server, there are two options:

  • Web Server + Webpack Watch in one command: $ npm run dev
  • Web Server separate from Webpack Watch
    • Start the web server: $ npm run start-dev
    • Start webpack watch: $ npm run webpack-watch

If you are running against a local API server, you can overwrite the URL that will be used for the api server as part of your run command like so: $ APIROOT=//localhost:8080/ npm run dev. Note that the // and final / are required.

Caching with HardSourceWebpackPlugin

We are using HardSourceWebpackPlugin. If your webpack build is operating strangely, be sure to run:

npm run webpack-clean-cache

This plugin dramatically speeds up build times, but does require you to clean the cache occasionally (when problems arise).

If you see an error in your console similar to:

Uncaught TypeError: __webpack_require__(...) is not a function

Chances are you need to clean the cache. Run the command as described above.

Using webpack-dashboard

If you prefer to have webpack rendered in a dashboard, use two separate terminal windows.

  • In one terminal, run webpack with: $ npm run webpack-dashboard
  • And in another, run the web server with: $ npm run start-dev

Note that the dashboard adds roughly 500ms to the webpack rebuild time.

Testing

npm test

Building for Production

API_MODE can be sandbox|staging|production (which all are effectively a production build pointing at an API server within the same project) OR development (which is an actual development build.)

API_MODE=staging npm run build

To test whether your build runs as expected you can also run the following command which will also match what should be run by GAE.

API_MODE=staging npm run start

Deploying to Staging and Production GAE Services

M-Lab maintains separate GCP projects for hosting staging and production instances of the mlab-vis-client application.

Deploying to either staging or production requires the Google Cloud SDK to be installed on your development system, and your preferred Google account must be given rights to push to both projects.

Deploying Code to GAE

Deploying assumes that you have already built the files for the respective environment!

To deploy the site to GAE, call:

$ KEY_FILE=<your service key> ./deploy.sh -m sandbox|staging|production

The mlab-vis-client application is configured to deploy to the viz GAE service in the selected project.

mlab-vis-client's People

Contributors

iros avatar nkinkade avatar pbeshai avatar vlandham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mlab-vis-client's Issues

Add in generic `id` field to data objects

Locations should have location key as their id (e.g. nausmacambridge)
Client ISPs should have their asn_number as their id (e.g. AS3215)
Transit ISPs should have their keyed name as their id (e.g. ghanaixp)

This could happen at the API level or at the client transform level. We should use the id when it is available on the objects instead of keying in to their specific properties (e.g. meta.client_asn_number).

Adjust styling of small multiples time series

Currently:
image

I think it should have the names closer to the axis lines and the headers should be left aligned. Or maybe the names go above the charts. Not sure, but we should play around

Maintain colors for ISPs

First pass: keep lines consistent color in location page when adding / removing isps.

Eventual: keep consistent color for ISPS throughout site and between user sessions.

Consider giving search API calls their own LRU cache

Right now search calls use the same get and therefore the same LRU cache as all other API calls. This may be problematic in that search involves a ton of get calls as the user enters characters in the search bar, and thus it would quickly destroy the cache.

A solution would be to use a getSearch or similar that used a separate cache for search requests.

Add in caching for requests

We can use some LRU cache so we don't have to hit the API for recently requested calls. Do this at the request level so we can keep Redux/components unaware of it.

Improve search field labelling

Clear distinction needs to be made between location based searches and ISP based searches.

We also might consider adding location search to the top nav for easy access to location changing functionality.

CSV export for multi-series data

If we have more than one line in a time series, exporting the data as CSV becomes more challenging and the current implementation will not suffice.

Hourly chart

image

  • Loading status should be individual to each chart
  • Charts should have headers
  • Axis labels
  • X hover behavior should highlight count chart
  • Should have interactive behavior for within-hour
  • Should use standardized colors

Question: Height of small multiple

Should small multiple component be provided a height and constrain the rows of charts to fit within that height (as other components are implemented)?

or should the component grow and shrink given the number of clientISPs that are being displayed (as we originally envisioned)?

Current implementation follows the former option.

Setup Redux store for location page

Proposed store design

locationPage:
  locationId
  viewMetric (download, upload, RTT, retransmission rate)

  selectedClientIsps
    - clientIspId1
    - clientIspId2

  selectedLocations
    - locationId1
    - locationId2

  selectedTime:
    startDate
    endDate
    timeAggregation (day, month, year)

  chartOptions:
    showBaselines
    showRegionalValues

  fixed:
    timeFrame (lastWeek, lastMonth, lastYear)
    xMetric (download, upload, RTT, retransmission rate)
    yMetric (download, upload, RTT, retransmission rate)


locations:
  locationId:
    locationId
    name
    parentLocations

    time:
      startDate
      endDate
      timeAggregation
      timeSeries
      hourly

    fixed:
      lastWeek
      lastMonth
      lastYear
      distribution


clientIsps:
  clientIspId:
    clientIspId
    name

    locationTime:
      locationId
      startDate
      endDate
      timeAggregation
      timeSeries
      hourly

    fixed:
      lastWeek
      lastMonth
      lastYear
      distribution

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.