Skip to content

Commit

Permalink
login page update + better error on boot for bad srv config
Browse files Browse the repository at this point in the history
  • Loading branch information
dadleyy committed Jan 3, 2024
1 parent 11b2d80 commit 4853b93
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/beetle-srv/env.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ interval_delay_ms = 500
active_device_chunk_size = 10
device_schedule_refresh_interval_seconds = 15

[registrar.analytics_configuration]
kind = ""
content = { api_key = "", account_id = "" }
# [registrar.analytics_configuration]
# kind = ""
# content = { api_key = "", account_id = "" }

[web]
cookie_domain = ""
session_secret = ""
session_cookie = ""
temp_file_storage = ".tmp"
ui_redirect = ""

[google]
Expand Down
4 changes: 3 additions & 1 deletion src/beetle-srv/src/api/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ impl Worker {
let mongo = mongodb::Client::with_options(mongo_options)
.map_err(|error| Error::new(ErrorKind::Other, format!("failed mongodb connection - {error}")))?;

let redis = crate::redis::connect(&config.redis).await?;
let redis = crate::redis::connect(&config.redis)
.await
.map_err(|error| Error::new(ErrorKind::Other, format!("unable to connect to redis - {error}")))?;

let redis_pool = Arc::new(Mutex::new(Some(redis)));

Expand Down
4 changes: 4 additions & 0 deletions src/beetle-ui/src/Icon.elm
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ type Icon
| Send
| Refresh
| EllipsisH
| Google


view : Icon -> Html.Html a
view icon =
case icon of
Google ->
Html.i [ A.class "icon-google" ] []

Refresh ->
Html.i [ A.class "icon-refresh" ] []

Expand Down
10 changes: 8 additions & 2 deletions src/beetle-ui/src/Route.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Html
import Html.Attributes
import Html.Parser
import Html.Parser.Util as HTP
import Icon
import Route.Account
import Route.Device
import Route.DeviceRegistration
Expand Down Expand Up @@ -292,10 +293,15 @@ renderLogin env returnState =
[ Html.Attributes.href env.configuration.loginUrl
, Html.Attributes.rel "noopener"
, Html.Attributes.target "_self"
, Html.Attributes.class "google-login"
]
[ Html.div [ Html.Attributes.class "flex items-center" ]
[ Icon.view Icon.Google
, Html.span [ Html.Attributes.class "block ml-3" ] [ Html.text "Sign in with Google" ]
]
]
[ Html.text "Login" ]
]
]
, Html.div [ Html.Attributes.class "lg:flex-1 lg:pr-3 flex-1 flex flex-col h-full relative" ]
, Html.div [ Html.Attributes.class "lg:pr-3 flex-2 flex flex-col h-full relative" ]
loginContentDom
]
5 changes: 3 additions & 2 deletions src/beetle-ui/src/boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Environment = {
};

const REPO_URL = 'https://github.com/dadleyy/orient-beetle';
const DEMO_URL = 'https://www.youtube.com/embed/Fgkh3P7V6Mo?si=eSraH7IkpJrTcb_x';

// TODO: incorporate this into the project somewhere else. Would probably require some additional
// build tooling. Skimping on that for now.
Expand All @@ -36,8 +37,8 @@ const LOCALIZATION = [
<iframe
height="100%"
width="100%"
src="https://www.youtube.com/embed/SwGfOSLR5tA"
title="YouTube video player"
src="${DEMO_URL}"
title="Orient Beetle Latest Demo"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
Expand Down
11 changes: 11 additions & 0 deletions src/beetle-ui/src/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ button:disabled {
@apply opacity-50;
}

.flex-2 {
flex: 2;
}

input {
@apply flex-1;
}
Expand Down Expand Up @@ -135,3 +139,10 @@ table.info-table {
.dropdown-item:first-child {
@apply border-t;
}

.google-login {
@apply border px-3 py-2 rounded inline-block border-white;
background-color: rgb(40,40,40);
color: rgb(225,225,225);
border-color: rgb(225,225,225);
}

0 comments on commit 4853b93

Please sign in to comment.