aboutsummaryrefslogtreecommitdiff
path: root/webgui/src
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-02-26 00:35:57 +0000
committerGregor Kleen <gkleen@yggdrasil.li>2016-02-26 00:35:57 +0000
commit4affa4001afa5cad8ed2e8cd865fae21812badce (patch)
tree6aad35eb4b8f70451e35c6030b881c77ffbcb5cb /webgui/src
parent8640e03551a8da768291c4b02eb5eae8742e3b45 (diff)
downloadthermoprint-4affa4001afa5cad8ed2e8cd865fae21812badce.tar
thermoprint-4affa4001afa5cad8ed2e8cd865fae21812badce.tar.gz
thermoprint-4affa4001afa5cad8ed2e8cd865fae21812badce.tar.bz2
thermoprint-4affa4001afa5cad8ed2e8cd865fae21812badce.tar.xz
thermoprint-4affa4001afa5cad8ed2e8cd865fae21812badce.zip
View job contents
Diffstat (limited to 'webgui/src')
-rw-r--r--webgui/src/Main.hs22
1 files changed, 21 insertions, 1 deletions
diff --git a/webgui/src/Main.hs b/webgui/src/Main.hs
index 644c4f6..018e59b 100644
--- a/webgui/src/Main.hs
+++ b/webgui/src/Main.hs
@@ -361,7 +361,27 @@ setup Config{..} window (split -> (socketErr, dataUpdate)) = void $ do
361 let abortButton' = case status of 361 let abortButton' = case status of
362 Queued _ -> [abortButton] 362 Queued _ -> [abortButton]
363 _ -> [] 363 _ -> []
364 actions <- UI.td # set children abortButton' 364 viewJob = do
365 tabLinkList <- fatal' "Could not find tab link list" =<< getElementById window "tabLinks"
366 tabContainer <- fatal' "Could not find tab container" =<< getElementById window "tabContent"
367 content <- job rJId
368 let
369 text = cobbcode content
370 case text of
371 Left err -> emitError $ "Could not decode content of job #" ++ show jId ++ ": " ++ show err
372 Right (T.unpack -> text) -> void $ do
373 tabLink <- UI.a # set UI.href ("#viewJob" ++ show jId) # set UI.text ("Job #" ++ show jId)
374 tabLinkItem <- UI.li # set children [tabLink]
375 return tabLinkList #+ [ return tabLinkItem ]
376 closeLink <- UI.a # set UI.text "Close Tab" # set UI.class_ "close" # set UI.href "#printers"
377 tabContent <- UI.pre # set UI.text text
378 tab <- UI.new # set children [closeLink, tabContent] # set UI.id_ ("viewJob" ++ show jId) # set UI.class_ "tab"
379 return tabContainer #+ [ return tab ]
380 on UI.click closeLink . const $ mapM_ delete [tabLink, tabLinkItem, closeLink, tabContent, tab] >> runFunction (switchTab "printers")
381 runFunction . switchTab $ "viewJob" ++ show jId
382 viewButton <- UI.button # set UI.text "View"
383 on UI.click viewButton . const $ viewJob
384 actions <- UI.td # set children (viewButton : abortButton')
365 UI.tr # set UI.id_ ("job" ++ show jId) # set children [jPId, jId', time', jStatus', actions] # sink UI.class_ (bool "" "focused" . Set.member rJId <$> focusedJobs) 385 UI.tr # set UI.id_ ("job" ++ show jId) # set children [jPId, jId', time', jStatus', actions] # sink UI.class_ (bool "" "focused" . Set.member rJId <$> focusedJobs)
366 (:) <$> UI.tr # set children [pId', pFiller, pStatus', pSelect'] <*> mapM toLine jobs 386 (:) <$> UI.tr # set children [pId', pFiller, pStatus', pSelect'] <*> mapM toLine jobs
367 387