packages feed

vega-view 0.3.0.5 → 0.3.1.0

raw patch · 4 files changed

+47/−11 lines, 4 files

Files

ChangeLog.md view
@@ -1,5 +1,12 @@ # Changelog for vega-view +## 0.3.1.0++The default port is 8082 but this can be changed by setting the PORT+environment variable before running the server. An invalid setting, or+one already in use, will cause the application to fail with a less-than+graceful error message.+ ## 0.3.0.5  Improved error handling when displaying Vega or Vega-Lite specifications,
README.md view
@@ -20,6 +20,8 @@  - and will list the files in a given directory and, when selected,    view them inline or on a separate page. +![A Vega-Lite specification being dragged from a file browser and dropped onto the index page of the vega-view web server](https://raw.githubusercontent.com/DougBurke/vega-view/master/images/vega-view-drag-n-drop.gif)+ ## License  This is released under a BSD3 license.@@ -28,10 +30,14 @@  The server - called `vega-view` - should be run from the directory containing the specifications to view. It then provides a web server-on port 8082 that can be used to view them at the URLs+on port 8082 (unless the `PORT` environment variable is set, in+which case this value is used instead) that can be used to view them+at the URLs      http://localhost:8082/     http://localhost:8082/display/++(where `8082` should be replaced by the value of `$PORT` if set).  The first page lets you drag-and-drop files onto the page to view them. Thse second lets you browse the visualizations that are present
app/Main.hs view
@@ -1,14 +1,30 @@ {-# LANGUAGE OverloadedStrings #-}  {--A very-basic viewer for Vega and Vega-Lite specfications. You-can browse from the current working directory, and view any-individual specification via Vega Embed (or an error if it isn't-a JSON file or some other issue). -A drag-and-drop page could be added, as could and endpoint to which-you post a specification.+Usage: +   ./vega-view++will create web pages at++  http://localhost:n/+  http://localhost:n/display/++where n is 8082 unless the PORT environment variable is set to an+integer, in which case that will be used.++The top-level page can be used to drag-and-drop specifications and+view them, and supports several modes:++  - add to start+  - add to end+  - only show the current visualization++whereas the display/ directory lets you view any Vega and Vega-Lite+specfications in the working directory (or sub-directories), either+"in line" (i.e. in the page) or as a separate page.+ The code could be refactored to be a SPA, but does it need to be?  -}@@ -33,6 +49,7 @@ import Data.Version (showVersion) import Network.HTTP.Types (status404) import System.Directory (doesDirectoryExist, listDirectory)+import System.Environment (lookupEnv) import System.FilePath ((</>), takeDirectory, takeFileName) import Text.Blaze.Html5 ((!)) import Text.Blaze.Html.Renderer.Text (renderHtml)@@ -751,4 +768,10 @@  -- for now assume current directory   main :: IO ()-main = scotty 8082 webapp+main = do+  mPortStr <- lookupEnv "PORT"+  let port = case read <$> mPortStr of+               Just n -> n+               _ -> 8082++  scotty port webapp
vega-view.cabal view
@@ -1,14 +1,14 @@ name:           vega-view-version:        0.3.0.5+version:        0.3.1.0 synopsis:       Easily view Vega or Vega-Lite visualizations. description:    A web server that is used to view all the Vega and Vega-Lite                 specifications in a directory, or sub-directory. It is similar                 in overall scope to the                 <https://github.com/vega/vega-desktop vega destkop>                 tool. Please see the README on GitHub at-                <https://github.com/DougBurke/vega-view#readme>+                <https://github.com/DougBurke/vega-view#vega-view> category:       Visualization-homepage:       https://github.com/DougBurke/vega-view#readme+homepage:       https://github.com/DougBurke/vega-view#vega-view bug-reports:    https://github.com/DougBurke/vega-view/issues author:         Douglas Burke maintainer:     dburke.gw@gmail.com