Safe Haskell | None |
---|
Synopsis
- data BaseJob = BaseJob {}
- data JobsDashboardController (authType :: k) (jobs :: [Type])
- = ListJobsAction
- | ListJobAction {
- jobTableName :: Text
- page :: Int
- | ViewJobAction {
- jobTableName :: Text
- jobId :: UUID
- | CreateJobAction {
- jobTableName :: Text
- | DeleteJobAction {
- jobTableName :: Text
- jobId :: UUID
- | RetryJobAction {
- jobTableName :: Text
- jobId :: UUID
- | ListJobAction'
- | ViewJobAction'
- | CreateJobAction'
- | DeleteJobAction'
- | RetryJobAction'
- class TableViewable a where
- tableTitle :: Text
- modelTableName :: Text
- tableHeaders :: [Text]
- renderTableRow :: a -> Html
- newJobLink :: Html
- getIndex :: IO [a]
- getPage :: Int -> Int -> IO [a]
- newtype IncludeWrapper (id :: Symbol) job = IncludeWrapper (Include id job)
Documentation
data JobsDashboardController (authType :: k) (jobs :: [Type]) 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
(Typeable authType, Typeable k, Typeable jobs) => Data (JobsDashboardController authType jobs) Source # | |
Defined in IHP.Job.Dashboard.Types 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 # | |
Defined in IHP.Job.Dashboard.Types showsPrec :: Int -> JobsDashboardController authType jobs -> ShowS # show :: JobsDashboardController authType jobs -> String showList :: [JobsDashboardController authType jobs] -> ShowS # | |
Eq (JobsDashboardController authType jobs) Source # | |
Defined in IHP.Job.Dashboard.Types (==) :: JobsDashboardController authType jobs -> JobsDashboardController authType jobs -> Bool # (/=) :: JobsDashboardController authType jobs -> JobsDashboardController authType jobs -> Bool # | |
(JobsDashboard jobs, AuthenticationMethod authType) => Controller (JobsDashboardController authType jobs) Source # | |
Defined in IHP.Job.Dashboard beforeAction :: IO () Source # action :: JobsDashboardController authType jobs -> IO () Source # | |
CanRoute (JobsDashboardController authType jobs) Source # | |
Defined in IHP.Job.Dashboard.Types parseRoute' :: Parser (JobsDashboardController authType jobs) Source # | |
HasPath (JobsDashboardController authType jobs) Source # | |
Defined in IHP.Job.Dashboard.Types pathTo :: JobsDashboardController authType jobs -> Text Source # |
class TableViewable a where Source #
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
Gets records for displaying in the dashboard index page
getPage :: 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)
IncludeWrapper (Include id job) |