diff options
Diffstat (limited to 'webgui/src')
-rw-r--r-- | webgui/src/Main.hs | 22 |
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 | ||