Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion monoscope.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ library
Pages.Dashboards
Pages.Endpoints
Pages.GitSync
Pages.Hardware
Pages.LogExplorer.Log
Pages.LogExplorer.LogItem
Pages.Monitors
Expand Down Expand Up @@ -549,7 +550,7 @@ executable monoscope-server
TypeFamilies
UndecidableInstances
ViewPatterns
ghc-options: -fwrite-ide-info -threaded -Weverything -Werror -fno-defer-typed-holes -Wno-error=deprecations -Wno-error=unused-packages -Wno-error=implicit-lift -Wno-error=missing-poly-kind-signatures -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-missing-safe-haskell-mode -Wno-partial-fields -Wno-prepositive-qualified-module -Wno-missing-export-lists -Wno-orphans -Wno-missing-deriving-strategies -Wno-missing-role-annotations -Wno-unused-matches -Wno-missing-kind-signatures -Wno-type-defaults -Wno-unused-top-binds -Wno-unused-imports -Wno-error=incomplete-record-selectors -Wno-ambiguous-fields -threaded -fplugin AutoInstrument -rtsopts "-with-rtsopts=-N8 -M14G -A32m -I5 -Fd2"
ghc-options: -fwrite-ide-info -threaded -Weverything -Werror -fno-defer-typed-holes -Wno-error=deprecations -Wno-error=unused-packages -Wno-error=implicit-lift -Wno-error=missing-poly-kind-signatures -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-missing-safe-haskell-mode -Wno-partial-fields -Wno-prepositive-qualified-module -Wno-missing-export-lists -Wno-orphans -Wno-missing-deriving-strategies -Wno-missing-role-annotations -Wno-unused-matches -Wno-missing-kind-signatures -Wno-type-defaults -Wno-unused-top-binds -Wno-unused-imports -Wno-error=incomplete-record-selectors -Wno-ambiguous-fields -threaded -fplugin AutoInstrument -rtsopts "-with-rtsopts=-N8 -M14G -A32m -I5 -Iw60 -Fd2"
build-tool-depends:
proto-lens-protoc:proto-lens-protoc
build-depends:
Expand Down Expand Up @@ -779,6 +780,7 @@ test-suite test-dev
Pages.Dashboards
Pages.Endpoints
Pages.GitSync
Pages.Hardware
Pages.LogExplorer.Log
Pages.LogExplorer.LogItem
Pages.Monitors
Expand Down
1 change: 1 addition & 0 deletions src/Pages/BodyWrapper.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ menu lang pid =
, (I18n.t lang "nav.issues", "/p/" <> pid.toText <> "/issues", "bug")
, (I18n.t lang "nav.monitors", "/p/" <> pid.toText <> "/monitors", "list-check")
, (I18n.t lang "nav.reports", "/p/" <> pid.toText <> "/reports", "chart-simple")
, ("Hardware", "/p/" <> pid.toText <> "/hardware", "objects-column")
]


Expand Down
31 changes: 31 additions & 0 deletions src/Pages/Hardware.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module Pages.Hardware (hardwareGetH, HardwareGet (..)) where

import Lucid
import Models.Projects.Projects qualified as Projects
import Pages.BodyWrapper (BWConfig (..), PageCtx (..), mkPageCtx)
import Relude
import System.Types (ATAuthCtx, RespHeaders, addRespHeaders)


-- | Hardware / digital-twin viewer page. Mounts the <hardware-monitor>
-- custom element which owns the 3D scene, 2D fallback, scrubber, and rail.
newtype HardwareGet = HardwareGet {project :: Projects.Project}
deriving stock (Generic, Show)


instance ToHtml HardwareGet where
toHtmlRaw = toHtml
toHtml (HardwareGet project) =
div_ [class_ "w-full bg-bgBase", style_ "height:calc(100vh - 56px)"]
$ term
"hardware-monitor"
[ data_ "project-id" project.id.toText
, class_ "block w-full h-full"
]
""


hardwareGetH :: Projects.ProjectId -> ATAuthCtx (RespHeaders (PageCtx HardwareGet))
hardwareGetH pid = do
(_, project, bw) <- mkPageCtx pid
addRespHeaders $ PageCtx bw{pageTitle = "Hardware", menuItem = Just "Hardware"} (HardwareGet project)
5 changes: 5 additions & 0 deletions src/Web/Routes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ import Pages.Charts.Charts qualified as Charts
import Pages.Dashboards qualified as Dashboards
import Pages.Endpoints qualified as ApiCatalog
import Pages.GitSync qualified as GitSync
import Pages.Hardware qualified as Hardware
import Pages.LogExplorer.Log qualified as Log
import Pages.LogExplorer.LogItem qualified as LogItem
import Pages.Monitors qualified as Alerts
Expand Down Expand Up @@ -418,6 +419,8 @@ data CookieProtectedRoutes mode = CookieProtectedRoutes
, -- Command palette
commandPaletteGet :: mode :- "p" :> ProjectId :> "command-palette" :> Get '[HTML] (RespHeaders (Html ())) -- dynamic items only
, commandPaletteRecentPost :: mode :- "p" :> ProjectId :> "command-palette" :> "recents" :> ReqBody '[FormUrlEncoded] CommandPalette.RecentForm :> Post '[HTML] (RespHeaders NoContent)
, -- Hardware / digital twin
hardwareGet :: mode :- "p" :> ProjectId :> "hardware" :> Get '[HTML] (RespHeaders (PageCtx Hardware.HardwareGet))
, -- Device auth
deviceApprove :: mode :- "device" :> QPT "code" :> QPT "action" :> Get '[HTML] (RespHeaders (Html ()))
, -- Sub-route groups
Expand Down Expand Up @@ -783,6 +786,8 @@ cookieProtectedServer =
, -- Command palette
commandPaletteGet = CommandPalette.commandPaletteItemsH
, commandPaletteRecentPost = CommandPalette.commandPaletteRecentPostH
, -- Hardware
hardwareGet = Hardware.hardwareGetH
, -- Device auth
deviceApprove = Auth.deviceApproveH
, -- Sub-route handlers
Expand Down
83 changes: 63 additions & 20 deletions web-components/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
"@rrweb/replay": "^2.0.0",
"@rrweb/types": "^2.0.0-alpha.18",
"@types/lodash": "^4.17.24",
"ansi-up": "^1.0.0",
"@types/three": "^0.184.1",
"ansi_up": "^6.0.6",
"ansi-up": "^1.0.0",
"clsx": "^2.1.1",
"date-fns": "^4.3.0",
"echarts": "^6.1.0",
Expand All @@ -32,6 +33,7 @@
"lit": "^3.3.3",
"lodash": "^4.17.23",
"monaco-editor": "^0.55.1",
"three": "^0.184.0",
"vite": "^8.0.14"
},
"devDependencies": {
Expand Down
Loading
Loading