IHP Api Reference
Safe HaskellSafe-Inferred

IHP.Job.Dashboard.Types

Description

 
Synopsis

Documentation

data BaseJob Source #

Instances

Instances details
Show BaseJob Source # 
Instance details

Defined in IHP.Job.Dashboard.Types

Methods

showsPrec :: Int -> BaseJob -> ShowS #

show :: BaseJob -> String

showList :: [BaseJob] -> ShowS #

FromRow BaseJob Source # 
Instance details

Defined in IHP.Job.Dashboard.Types

Methods

fromRow :: RowParser BaseJob

data JobsDashboardController authType (jobs :: [*]) Source #

Defines controller actions for acting on a dashboard made of some list of types. Later functions and typeclasses introduce constraints on the types in this list, so you'll get a compile error if you try and include a type that is not a job.

Instances

Instances details
(Typeable authType, Typeable k, Typeable jobs) => Data (JobsDashboardController authType jobs) Source # 
Instance details

Defined in IHP.Job.Dashboard.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> JobsDashboardController authType jobs -> c (JobsDashboardController authType jobs) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (JobsDashboardController authType jobs) #

toConstr :: JobsDashboardController authType jobs -> Constr #

dataTypeOf :: JobsDashboardController authType jobs -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (JobsDashboardController authType jobs)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (JobsDashboardController authType jobs)) #

gmapT :: (forall b. Data b => b -> b) -> JobsDashboardController authType jobs -> JobsDashboardController authType jobs #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JobsDashboardController authType jobs -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JobsDashboardController authType jobs -> r #

gmapQ :: (forall d. Data d => d -> u) -> JobsDashboardController authType jobs -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> JobsDashboardController authType jobs -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> JobsDashboardController authType jobs -> m (JobsDashboardController authType jobs) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> JobsDashboardController authType jobs -> m (JobsDashboardController authType jobs) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> JobsDashboardController authType jobs -> m (JobsDashboardController authType jobs) #

Show (JobsDashboardController authType jobs) Source # 
Instance details

Defined in IHP.Job.Dashboard.Types

Methods

showsPrec :: Int -> JobsDashboardController authType jobs -> ShowS #

show :: JobsDashboardController authType jobs -> String

showList :: [JobsDashboardController authType jobs] -> ShowS #

Eq (JobsDashboardController authType jobs) Source # 
Instance details

Defined in IHP.Job.Dashboard.Types

Methods

(==) :: JobsDashboardController authType jobs -> JobsDashboardController authType jobs -> Bool #

(/=) :: JobsDashboardController authType jobs -> JobsDashboardController authType jobs -> Bool #

(JobsDashboard jobs, AuthenticationMethod authType) => Controller (JobsDashboardController authType jobs) Source # 
Instance details

Defined in IHP.Job.Dashboard

Methods

beforeAction :: IO () Source #

action :: JobsDashboardController authType jobs -> IO () Source #

CanRoute (JobsDashboardController authType jobs) Source # 
Instance details

Defined in IHP.Job.Dashboard.Types

Methods

parseRoute' :: Parser (JobsDashboardController authType jobs) Source #

HasPath (JobsDashboardController authType jobs) Source # 
Instance details

Defined in IHP.Job.Dashboard.Types

Methods

pathTo :: JobsDashboardController authType jobs -> Text Source #

class TableViewable a where Source #

Methods

tableTitle :: Text Source #

Human readable title displayed on the table

modelTableName :: Text Source #

Database table backing the view

tableHeaders :: [Text] Source #

renderTableRow :: a -> Html Source #

newJobLink :: Html Source #

Link used in the table to send user to new job form

getIndex :: (?context :: ControllerContext, ?modelContext :: ModelContext) => IO [a] Source #

Gets records for displaying in the dashboard index page

getPage :: (?context :: ControllerContext, ?modelContext :: ModelContext) => Int -> Int -> IO [a] Source #

Gets paginated records for displaying in the list page

newtype IncludeWrapper (id :: Symbol) job Source #

Often, jobs are related to some model type. These relations are modeled through the type system. For example, the type 'Include "userId" UpdateUserJob' models an UpdateUserJob type that can access the User it belongs to through the userId field. For some reason, GHC doesn't allow us to create implementations of type family applications, so the following doesn't work:

instance DisplayableJob (Include "userId" UpdateUserJob) where

However, if we wrap this in a concrete type, it works fine. That's what this wrapper is for. To get the same behavior as above, just define

instance DisplayableJob (IncludeWrapper "userId" UpdateUserJob) where

and wrap the values as so:

jobsWithUsers <- query @UpdateUserJob
   |> fetch
   >>= mapM (fetchRelated #userId)
   >>= pure . map (IncludeWrapper @"userId" @UpdateUserJob)

Constructors

IncludeWrapper (Include id job)