@@ -41,6 +41,7 @@ import IHP.Pagination.Types
4141import qualified Database.PostgreSQL.Simple.Types as PG
4242import qualified Database.PostgreSQL.Simple.FromField as PG
4343import qualified Database.PostgreSQL.Simple.ToField as PG
44+ import qualified Network.Wai as Wai
4445import Network.Wai (requestMethod )
4546import Network.HTTP.Types.Method (methodPost )
4647
@@ -112,32 +113,32 @@ class ( job ~ GetModelByTableName (GetTableName job)
112113-- so you'll get a compile error if you try and include a type that is not a job.
113114class JobsDashboard (jobs :: [Type ]) where
114115 -- | Creates the entire dashboard by recursing on the type list and calling 'makeDashboardSection' on each type.
115- makeDashboard :: (? context :: ControllerContext , ? modelContext :: ModelContext ) => IO SomeView
116+ makeDashboard :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? request :: Wai. Request ) => IO SomeView
116117
117118 includedJobTables :: [Text ]
118119
119120 -- | Renders the index page, which is the view returned from 'makeDashboard'.
120- indexPage :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond ) => IO ()
121+ indexPage :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond , ? request :: Wai. Request ) => IO ()
121122
122- listJob :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond ) => Text -> IO ()
123- listJob' :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond ) => Bool -> IO ()
123+ listJob :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond , ? request :: Wai. Request ) => Text -> IO ()
124+ listJob' :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond , ? request :: Wai. Request ) => Bool -> IO ()
124125
125126 -- | Renders the detail view page. Rescurses on the type list to find a type with the
126127 -- same table name as the "tableName" query parameter.
127- viewJob :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond ) => Text -> UUID -> IO ()
128- viewJob' :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond ) => Bool -> IO ()
128+ viewJob :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond , ? request :: Wai. Request ) => Text -> UUID -> IO ()
129+ viewJob' :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond , ? request :: Wai. Request ) => Bool -> IO ()
129130
130131 -- | If performed in a POST request, creates a new job depending on the "tableName" query parameter.
131132 -- If performed in a GET request, renders the new job from depending on said parameter.
132- newJob :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond ) => Text -> IO ()
133- newJob' :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond ) => Bool -> IO ()
133+ newJob :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond , ? request :: Wai. Request ) => Text -> IO ()
134+ newJob' :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond , ? request :: Wai. Request ) => Bool -> IO ()
134135
135136 -- | Deletes a job from the database.
136- deleteJob :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond ) => Text -> UUID -> IO ()
137- deleteJob' :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond ) => Bool -> IO ()
137+ deleteJob :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond , ? request :: Wai. Request ) => Text -> UUID -> IO ()
138+ deleteJob' :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond , ? request :: Wai. Request ) => Bool -> IO ()
138139
139- retryJob :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond ) => Text -> UUID -> IO ()
140- retryJob' :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond ) => IO ()
140+ retryJob :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond , ? request :: Wai. Request ) => Text -> UUID -> IO ()
141+ retryJob' :: (? context :: ControllerContext , ? modelContext :: ModelContext , ? respond :: Respond , ? request :: Wai. Request ) => IO ()
141142
142143-- If no types are passed, try to get all tables dynamically and render them as BaseJobs
143144instance JobsDashboard '[] where
@@ -347,7 +348,7 @@ extractText = \(Only t) -> t
347348getNotIncludedTableNames includedNames = map extractText <$> sqlQuery
348349 " SELECT table_name FROM information_schema.tables WHERE table_name LIKE '%_jobs' AND table_name NOT IN ?"
349350 (Only $ In $ includedNames)
350- buildBaseJobTable :: (? modelContext :: ModelContext , ? context :: ControllerContext ) => Text -> IO SomeView
351+ buildBaseJobTable :: (? modelContext :: ModelContext , ? context :: ControllerContext , ? request :: Wai. Request ) => Text -> IO SomeView
351352buildBaseJobTable tableName = do
352353 baseJobs <- sqlQuery (PG. Query $ cs $ queryString) (Only tableName)
353354 baseJobs
0 commit comments