ui: streamline top status info
This commit is contained in:
		
							parent
							
								
									08cc807e49
								
							
						
					
					
						commit
						e6392b3d46
					
				| @ -173,19 +173,12 @@ asDraw UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} | |||||||
| 
 | 
 | ||||||
|         toplabel = |         toplabel = | ||||||
|               withAttr ("border" <> "filename") files |               withAttr ("border" <> "filename") files | ||||||
|           -- <+> withAttr ("border" <> "query") (str (if flat_ ropts then " flat" else "")) |           <+> toggles | ||||||
|           <+> nonzero |           <+> str (" account " ++ if ishistorical then "balances" else "changes") | ||||||
|           <+> str (if ishistorical then " accounts" else " account changes") |  | ||||||
|           -- <+> str (if ishistorical then " balances" else " changes") |  | ||||||
|           <+> borderPeriodStr (if ishistorical then "at end of" else "in") (period_ ropts) |           <+> borderPeriodStr (if ishistorical then "at end of" else "in") (period_ ropts) | ||||||
|           <+> borderQueryStr querystr |           <+> borderQueryStr querystr | ||||||
|           <+> togglefilters |  | ||||||
|           <+> borderDepthStr mdepth |           <+> borderDepthStr mdepth | ||||||
|           <+> str " (" |           <+> str (" ("++curidx++"/"++totidx++")") | ||||||
|           <+> cur |  | ||||||
|           <+> str "/" |  | ||||||
|           <+> total |  | ||||||
|           <+> str ")" |  | ||||||
|           <+> (if ignore_assertions_ $ inputopts_ copts |           <+> (if ignore_assertions_ $ inputopts_ copts | ||||||
|                then withAttr ("border" <> "query") (str " ignoring balance assertions") |                then withAttr ("border" <> "query") (str " ignoring balance assertions") | ||||||
|                else str "") |                else str "") | ||||||
| @ -195,22 +188,20 @@ asDraw UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} | |||||||
|                            f:_ -> str $ takeFileName f |                            f:_ -> str $ takeFileName f | ||||||
|                            -- [f,_:[]] -> (withAttr ("border" <> "bold") $ str $ takeFileName f) <+> str " (& 1 included file)" |                            -- [f,_:[]] -> (withAttr ("border" <> "bold") $ str $ takeFileName f) <+> str " (& 1 included file)" | ||||||
|                            -- f:fs  -> (withAttr ("border" <> "bold") $ str $ takeFileName f) <+> str (" (& " ++ show (length fs) ++ " included files)") |                            -- f:fs  -> (withAttr ("border" <> "bold") $ str $ takeFileName f) <+> str (" (& " ++ show (length fs) ++ " included files)") | ||||||
|  |             toggles = withAttr ("border" <> "query") $ str $ unwords $ concat [ | ||||||
|  |                [""] | ||||||
|  |               ,if empty_ ropts then [] else ["nonzero"] | ||||||
|  |               ,uiShowStatus copts $ statuses_ ropts | ||||||
|  |               ,if real_ ropts then ["real"] else [] | ||||||
|  |               ] | ||||||
|             querystr = query_ ropts |             querystr = query_ ropts | ||||||
|             mdepth = depth_ ropts |             mdepth = depth_ ropts | ||||||
|             togglefilters = |             curidx = case _asList s ^. listSelectedL of | ||||||
|               case concat [ |                        Nothing -> "-" | ||||||
|                    uiShowStatus copts $ statuses_ ropts |                        Just i -> show (i + 1) | ||||||
|                   ,if real_ ropts then ["real"] else [] |             totidx = show $ V.length nonblanks  | ||||||
|                   ] of |               where | ||||||
|                 [] -> str "" |                 nonblanks = V.takeWhile (not . T.null . asItemAccountName) $ s ^. asList . listElementsL | ||||||
|                 fs -> str " from " <+> withAttr ("border" <> "query") (str $ intercalate ", " fs) <+> str " txns" |  | ||||||
|             nonzero | empty_ ropts = str "" |  | ||||||
|                     | otherwise    = withAttr ("border" <> "query") (str " nonzero") |  | ||||||
|             cur = str (case _asList s ^. listSelectedL of |  | ||||||
|                         Nothing -> "-" |  | ||||||
|                         Just i -> show (i + 1)) |  | ||||||
|             total = str $ show $ V.length nonblanks  |  | ||||||
|             nonblanks = V.takeWhile (not . T.null . asItemAccountName) $ s ^. asList . listElementsL |  | ||||||
| 
 | 
 | ||||||
|         bottomlabel = case mode of |         bottomlabel = case mode of | ||||||
|                         Minibuffer ed -> minibuffer ed |                         Minibuffer ed -> minibuffer ed | ||||||
|  | |||||||
| @ -165,7 +165,7 @@ borderQueryStr qry = str " matching " <+> withAttr ("border" <> "query") (str qr | |||||||
| 
 | 
 | ||||||
| borderDepthStr :: Maybe Int -> Widget Name | borderDepthStr :: Maybe Int -> Widget Name | ||||||
| borderDepthStr Nothing  = str "" | borderDepthStr Nothing  = str "" | ||||||
| borderDepthStr (Just d) = str " to " <+> withAttr ("border" <> "query") (str $ "depth "++show d) | borderDepthStr (Just d) = str " to depth " <+> withAttr ("border" <> "query") (str $ show d) | ||||||
| 
 | 
 | ||||||
| borderPeriodStr :: String -> Period -> Widget Name | borderPeriodStr :: String -> Period -> Widget Name | ||||||
| borderPeriodStr _           PeriodAll = str "" | borderPeriodStr _           PeriodAll = str "" | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user