Upgrade ps + halogen versions.

[?]
Feb 22, 2016, 1:15 AM
JXG3FCXYBDKMUD77DOM7RCIJYKB7BILC43OHHDZBE7YQRGAMUCCAC

Dependencies

  • [2] QQXR7DTO Rework login component to use more appropriate Bootstrap theme.
  • [3] RB2ETNIF Add skeletal PureScript client project.
  • [4] HO2PFRAB Client login now handles response correctly.
  • [5] ARX7SHY5 Begin work on login UI.
  • [6] EA5BFM5G Split Login component into its own module.
  • [*] ADMKQQGC Initial empty Snap project.
  • [*] PGZJ736C Update aftok.cfg.example and revise INSTALL instructions

Change contents

  • edit in .gitignore at line 6
    [9.33]
    [9.33]
    .stack-work
  • edit in client/.gitignore at line 8
    [3.31]
    .psc-package
  • replacement in client/bower.json at line 14
    [3.315][3.365:473]()
    "purescript-console": "^0.1.0",
    "purescript-halogen": "~0.5.14",
    "purescript-affjax": "~0.10.1"
    [3.315]
    [3.350]
    "purescript-halogen": "^1.2.1",
    "purescript-css": "^2.1.0",
    "purescript-halogen-css": "^5.0.0",
    "purescript-dom": "^3.7.0",
    "purescript-affjax": "^3.0.2",
    "purescript-now": "^2.0.0"
  • edit in client/dist/aftok.css at line 41
    [2.821]
    .tl-wrapper {
    height: 45px;
    width: 962px;
    margin-left: auto;
    margin-right: auto;
    }
  • file addition: package.json (----------)
    [3.1]
    {
    "devDependencies": {
    "pulp": "^10.0.0",
    "purescript": "^0.10.7",
    "purescript-psa": "^0.4.0",
    "rimraf": "^2.5.4"
    }
    }
  • edit in client/src/Aftok/Login.purs at line 2
    [3.46]
    [3.46]
    import Prelude (type (~>), Void, bind, pure, ($), ($>), (<$>), const)
  • edit in client/src/Aftok/Login.purs at line 5
    [3.47][3.47:62]()
    import Prelude
  • edit in client/src/Aftok/Login.purs at line 8
    [3.97]
    [3.97]
    import Data.Either (Either(..))
  • edit in client/src/Aftok/Login.purs at line 10
    [3.127][3.127:154]()
    import Data.Functor (($>))
  • replacement in client/src/Aftok/Login.purs at line 11
    [3.155][3.155:354]()
    import Halogen
    import Halogen.HTML.Core (className)
    import qualified Halogen.HTML.Indexed as H
    import qualified Halogen.HTML.Events.Indexed as E
    import qualified Halogen.HTML.Properties.Indexed as P
    [3.155]
    [3.354]
    import Halogen as H
    import Halogen.Aff (HalogenEffects)
    import Halogen.HTML.Core (ClassName(..))
    import Halogen.HTML as HH
    import Halogen.HTML.Events as E
    import Halogen.HTML.Properties as P
  • replacement in client/src/Aftok/Login.purs at line 19
    [3.399][3.399:459]()
    import Network.HTTP.Method
    import Network.HTTP.StatusCode
    [3.399]
    [3.459]
    import Data.HTTP.Method (Method(..))
    import Network.HTTP.StatusCode (StatusCode(..))
  • replacement in client/src/Aftok/Login.purs at line 37
    [3.886][3.886:997]()
    ui :: forall eff. Component LoginState LoginAction (Aff (LoginEffects eff))
    ui = component render eval
    where
    [3.886]
    [3.997]
    ui :: forall eff. H.Component HH.HTML LoginAction LoginState Void (Aff (LoginEffects eff))
    ui = H.component
    { initialState: const initialState
    , render
    , eval
    , receiver: const Nothing
    } where
  • replacement in client/src/Aftok/Login.purs at line 45
    [3.998][3.998:1050]()
    render :: LoginState -> ComponentHTML LoginAction
    [3.998]
    [3.1050]
    render :: LoginState -> H.ComponentHTML LoginAction
  • replacement in client/src/Aftok/Login.purs at line 47
    [3.1064][3.1064:1075](),[3.1075][2.2119:2482]()
    H.div
    [ P.classes (className <$> ["container"]) ]
    [ H.form
    [ P.classes [ className "form-signin" ] ]
    [ H.h2 [ P.classes [ className "form-signin-heading" ]] [ H.text "Aftok Login" ]
    , H.label [ P.for "inputUsername", P.classes [ className "sr-only" ]] [ H.text "username" ]
    , H.input
    [ P.inputType P.InputText
    [3.1064]
    [2.2482]
    HH.div
    [ P.classes (ClassName <$> ["container"]) ]
    [ HH.form
    [ P.classes [ ClassName "form-signin" ] ]
    [ HH.h2 [ P.classes [ ClassName "form-signin-heading" ]] [ HH.text "Aftok Login" ]
    , HH.label [ P.for "inputUsername", P.classes [ ClassName "sr-only" ]] [ HH.text "username" ]
    , HH.input
    [ P.type_ P.InputText
  • replacement in client/src/Aftok/Login.purs at line 56
    [2.2516][2.2516:2567]()
    , P.classes [ className "form-control" ]
    [2.2516]
    [2.2567]
    , P.classes [ ClassName "form-control" ]
  • replacement in client/src/Aftok/Login.purs at line 63
    [2.2754][2.2754:2912]()
    , H.label [ P.for "inputPassword", P.classes [ className "sr-only" ]] [ H.text "username" ]
    , H.input
    [ P.inputType P.InputPassword
    [2.2754]
    [2.2912]
    , HH.label [ P.for "inputPassword", P.classes [ ClassName "sr-only" ]] [ HH.text "username" ]
    , HH.input
    [ P.type_ P.InputPassword
  • replacement in client/src/Aftok/Login.purs at line 67
    [2.2946][2.2946:2997]()
    , P.classes [ className "form-control" ]
    [2.2946]
    [2.2997]
    , P.classes [ ClassName "form-control" ]
  • replacement in client/src/Aftok/Login.purs at line 73
    [2.3155][2.3155:3235]()
    , H.button
    [ P.classes (className <$> ["btn", "btn-primary"])
    [2.3155]
    [2.3235]
    , HH.button
    [ P.classes (ClassName <$> ["btn", "btn-primary"])
  • replacement in client/src/Aftok/Login.purs at line 77
    [2.3313][2.3313:3344]()
    [ H.text "Sign in" ]
    [2.3313]
    [3.2120]
    [ HH.text "Sign in" ]
  • replacement in client/src/Aftok/Login.purs at line 81
    [3.2139][3.2139:2376]()
    eval :: Natural LoginAction (ComponentDSL LoginState LoginAction (Aff (LoginEffects eff)))
    eval (SetUsername user next) = modify (_ { username = user }) $> next
    eval (SetPassword pass next) = modify (_ { password = pass }) $> next
    [3.2139]
    [3.2376]
    eval :: LoginAction ~> H.ComponentDSL LoginState LoginAction Void (Aff (LoginEffects eff))
    eval (SetUsername user next) = H.modify (_ { username = user }) $> next
    eval (SetPassword pass next) = H.modify (_ { password = pass }) $> next
  • replacement in client/src/Aftok/Login.purs at line 85
    [3.2411][3.2411:2452]()
    result <- liftAff' (login user pass)
    [3.2411]
    [3.2452]
    result <- H.liftAff (login user pass)
  • replacement in client/src/Aftok/Login.purs at line 96
    [3.2736][3.2736:2772]()
    result <- affjax $ { method: POST
    [3.2736]
    [3.2772]
    result <- affjax $ { method: Left POST
  • edit in client/src/Aftok/Login.purs at line 102
    [3.2986]
    [3.2986]
    , withCredentials: true
  • file addition: Timeline.purs (----------)
    [3.1]
    module Aftok.Timeline where
    import Prelude
    import Control.Monad.Eff (Eff())
    import Control.Monad.Eff.Class (liftEff)
    import Control.Monad.Eff.Now (NOW, nowDateTime, now)
    import Control.Monad.Aff (Aff())
    import Control.Alt ((<|>))
    import Data.Array (cons)
    --import Data.Bounded (bottom)
    --import Data.Date (Date(..), day, month, year)
    import Data.DateTime (DateTime(..), date, adjust)
    import Data.DateTime.Instant (Instant, unInstant, fromDateTime)
    import Data.DateTime.Locale (LocalValue(..))
    import Data.Int (toNumber)
    import Data.Time.Duration (Milliseconds(..), Days(..))
    import Data.Maybe (Maybe(..), maybe)
    import Math (abs)
    import CSS.Display (position, absolute)
    import CSS.Geometry (left) --, width, top, height)
    import CSS.Size (px)
    import Halogen as H
    import Halogen.Aff (HalogenEffects)
    import Halogen.HTML.CSS as CSS
    import Halogen.HTML as HH
    -- import Halogen.HTML.Events as E
    import Halogen.HTML.Properties as P
    type Interval =
    { start :: Instant
    , end :: Instant
    }
    type TimelineLimits =
    { start :: Instant
    , current :: Instant
    , end :: Instant
    }
    type TimelineConfig =
    { width :: Number
    }
    type TimelineState =
    { limits :: TimelineLimits
    , history :: Array Interval
    , active :: Maybe Interval
    }
    data TimelineAction a
    = Start a
    | Stop a
    | Refresh a
    -- | Open a
    -- | Close a
    type TimelineEffects eff = HalogenEffects (now :: NOW | eff)
    initialState :: forall eff. Eff (now :: NOW | eff) TimelineState
    initialState = do
    LocalValue l t <- nowDateTime
    let startOfDay = DateTime (date t) bottom
    endOfDay = adjust (Days (toNumber 1)) startOfDay
    startInstant = fromDateTime startOfDay
    limits =
    { start: startInstant
    , current: fromDateTime t
    , end: maybe startInstant fromDateTime endOfDay
    }
    pure $ { limits : limits
    , history : []
    , active : Nothing
    }
    ui :: forall eff. TimelineConfig -> TimelineState -> H.Component HH.HTML TimelineAction TimelineState Void (Aff (TimelineEffects eff))
    ui conf s = H.component
    { initialState: const s
    , render
    , eval
    , receiver: const Nothing
    } where
    intervalHtml :: forall f. TimelineLimits -> Interval -> H.ComponentHTML f
    intervalHtml limits i =
    let offset = ((ilen limits.start i.start) / (ilen limits.start limits.end)) * conf.width
    in HH.div
    [ CSS.style do
    position absolute
    left (px offset)
    ]
    [ HH.div
    [ P.classes (H.ClassName <$> ["center"]) ]
    []
    ]
    -- <div style="position: absolute; left: 582.268px; width: 92.4619px; top: 6px; height: 33px;" class="TimelineElement Element ui-resizable ui-draggable" data-original-title=""><div class="center" style="background-color: rgb(255, 0, 0);"></div><div class="ui-resizable-w ui-resizable-handle"></div><div class="ui-draggable-pad"></div><div class="ui-resizable-e ui-resizable-handle"></div></div>
    render :: TimelineState -> H.ComponentHTML TimelineAction
    render st =
    HH.div
    [ P.classes (H.ClassName <$> ["container"]) ]
    [ HH.div
    [ P.classes (H.ClassName <$> ["tl-wrapper"]) ]
    (intervalHtml st.limits <$> st.history)
    ]
    eval :: TimelineAction ~> H.ComponentDSL TimelineState TimelineAction Void (Aff (TimelineEffects eff))
    -- The user has requested to start the clock.
    eval (Start next) = do
    t <- liftEff now
    H.modify (start t)
    pure next
    -- The user has requested to stop the clock
    eval (Stop next) = do
    t <- liftEff now
    H.modify (stop t)
    pure next
    -- The runtime system renders a clock tick
    eval (Refresh next) = do
    t <- liftEff now
    H.modify (refresh t)
    pure next
    -- The user has requested to open a new interval beginning at a
    -- specific point on the timeline (mouse down)
    -- The user has requested to close the currently open interval
    -- at a specific point on the timeline (mouse up)
    --
    start :: Instant -> TimelineState -> TimelineState
    start t s =
    { limits: s.limits
    , history: s.history
    , active: s.active <|> Just { start: t, end: t }
    }
    stop :: Instant -> TimelineState -> TimelineState
    stop t s =
    { limits: s.limits
    , history: maybe s.history (\st -> cons { start: st.start, end: t } s.history) s.active
    , active: Nothing
    }
    refresh :: Instant -> TimelineState -> TimelineState
    refresh t s =
    { limits: s.limits
    , history: s.history
    , active: map (\a -> { start: a.start, end: t }) s.active
    }
    ilen :: Instant -> Instant -> Number
    ilen d d' =
    let n (Milliseconds x) = x
    in abs $ n (unInstant d) - n (unInstant d')
  • replacement in client/src/Main.purs at line 3
    [3.477][3.477:492]()
    import Prelude
    [3.477]
    [3.492]
    import Prelude (Unit, bind, ($))
  • edit in client/src/Main.purs at line 6
    [3.594][3.594:646]()
    import Control.Monad.Eff.Exception (throwException)
  • edit in client/src/Main.purs at line 7
    [3.3248][3.3248:3282]()
    import Control.Monad.Aff (runAff)
  • replacement in client/src/Main.purs at line 8
    [3.809][3.809:867](),[3.867][3.3283:3360]()
    import Halogen
    import Halogen.Util (appendToBody, onLoad)
    import Halogen.Util (appendToBody, onLoad)
    import qualified Aftok.Login as L
    [3.647]
    [3.1094]
    import Halogen.Aff (HalogenEffects)
    import Halogen.VDom.Driver (runUI)
    import Halogen.Aff as HA
    import Aftok.Login as L
  • replacement in client/src/Main.purs at line 18
    [3.3548][3.3548:3602](),[3.3602][3.3398:3433](),[3.3433][3.3633:3666](),[3.3633][3.3633:3666]()
    main = runAff throwException (const (pure unit)) $ do
    app <- runUI L.ui L.initialState
    onLoad $ appendToBody app.node
    [3.3548]
    main = HA.runHalogenAff $ do
    body <- HA.awaitBody
    runUI L.ui L.initialState body