Skip to content

Commit

Permalink
Merge pull request #1120 from ds-wizard/hotfix/4.5.1
Browse files Browse the repository at this point in the history
Hotfix 4.5.1
  • Loading branch information
janslifka committed Apr 5, 2024
2 parents ed3cbd7 + 6e18ee0 commit a0a2842
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ module Shared.Data.BootstrapConfig.LookAndFeelConfig exposing
, defaultRegistryUrl
, getAppTitle
, getAppTitleShort
, getIllustrationsColor
, getLogoUrl
, getPrimaryColor
, getTheme
, isCustomTheme
)

import Color exposing (Color)
Expand All @@ -22,6 +22,7 @@ import Json.Decode.Color as D
import Json.Decode.Pipeline as D
import Maybe.Extra as Maybe
import Shared.Data.BootstrapConfig.LookAndFeelConfig.CustomMenuLink as CustomMenuLink exposing (CustomMenuLink)
import Shared.Utils.Theme exposing (Theme)


type alias LookAndFeelConfig =
Expand Down Expand Up @@ -104,6 +105,18 @@ getIllustrationsColor config =
|> Maybe.withDefault defaultIllustrationsColor


isCustomTheme : LookAndFeelConfig -> Bool
isCustomTheme config =
config.primaryColor /= Nothing || config.illustrationsColor /= Nothing


getTheme : LookAndFeelConfig -> Theme
getTheme config =
Theme
(getPrimaryColor config)
(getIllustrationsColor config)


getLogoUrl : LookAndFeelConfig -> String
getLogoUrl config =
Maybe.withDefault defaultLogoUrl config.logoUrl
Expand Down
3 changes: 2 additions & 1 deletion engine-wizard/docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ echo -n "};" >>${config}
headExtraFile=/src/head-extra.html
if [ -f "$headExtraFile" ]; then
headExtraBlock=$(cat $headExtraFile)
sed -i "s~</head>~$headExtraBlock</head>~g" /usr/share/nginx/html/wizard/index.html
index=/usr/share/nginx/html/wizard/index.html
awk -v r="$headExtraBlock" '{gsub(/<\/head>/, r"</head>")}1' /usr/share/nginx/html/wizard/index.html > $index.tmp && mv $index.tmp $index
fi

# start nginx
Expand Down
10 changes: 9 additions & 1 deletion engine-wizard/elm/Wizard.elm
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,18 @@ init flags location key =

route =
routeIfAllowed appState originalRoute

setThemeCmd =
case appState.theme of
Just theme ->
Theme.setTheme theme

Nothing ->
Cmd.none
in
Cmd.batch
[ decideInitialRoute model location route originalRoute
, Theme.setTheme appState.theme
, setThemeCmd
, Time.getTime
, Time.getTimeZone
]
Expand Down
12 changes: 7 additions & 5 deletions engine-wizard/elm/Wizard/Common/AppState.elm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Shared.Common.Navigator exposing (Navigator)
import Shared.Data.BootstrapConfig exposing (BootstrapConfig)
import Shared.Data.BootstrapConfig.LookAndFeelConfig as LookAndFeelConfig
import Shared.Provisioning as Provisioning exposing (Provisioning)
import Shared.Utils.Theme as Theme exposing (Theme)
import Shared.Utils.Theme exposing (Theme)
import Time
import Wizard.Common.Flags as Flags
import Wizard.Common.Provisioning.DefaultIconSet as DefaultIconSet
Expand Down Expand Up @@ -54,7 +54,7 @@ type alias AppState =
, locale : Gettext.Locale
, selectedLocale : Maybe String
, sessionExpiresSoonModalHidden : Bool
, theme : Theme
, theme : Maybe Theme
}


Expand Down Expand Up @@ -96,9 +96,11 @@ init flagsValue key =
]

theme =
Theme.Theme
(LookAndFeelConfig.getPrimaryColor flags.config.lookAndFeel)
(LookAndFeelConfig.getIllustrationsColor flags.config.lookAndFeel)
if LookAndFeelConfig.isCustomTheme flags.config.lookAndFeel then
Just <| LookAndFeelConfig.getTheme flags.config.lookAndFeel

else
Nothing
in
( { route = Routes.NotFoundRoute
, seed = Random.initialSeed flags.seed
Expand Down
5 changes: 3 additions & 2 deletions engine-wizard/elm/Wizard/Common/Components/Questionnaire.elm
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import Shared.Api.TypeHints as TypeHintsApi
import Shared.Common.TimeUtils as TimeUtils
import Shared.Components.Badge as Badge
import Shared.Copy as Copy
import Shared.Data.BootstrapConfig.LookAndFeelConfig as LookAndFeel
import Shared.Data.Event exposing (Event)
import Shared.Data.KnowledgeModel as KnowledgeModel exposing (KnowledgeModel)
import Shared.Data.KnowledgeModel.Answer exposing (Answer)
Expand Down Expand Up @@ -692,7 +693,7 @@ update msg wrapMsg mbSetFullscreenMsg appState ctx model =
( model
, Integrations.openIntegrationWidget
{ url = requestUrl
, theme = appState.theme
, theme = Maybe.withDefault (LookAndFeel.getTheme appState.config.lookAndFeel) appState.theme
, data = { path = path }
}
)
Expand Down Expand Up @@ -906,7 +907,7 @@ update msg wrapMsg mbSetFullscreenMsg appState ctx model =
( model
, Integrations.openAction
{ url = questionnaireAction.url
, theme = appState.theme
, theme = Maybe.withDefault (LookAndFeel.getTheme appState.config.lookAndFeel) appState.theme
, data =
{ projectUuid = model.uuid
, userToken = String.toMaybe appState.session.token.token
Expand Down
3 changes: 2 additions & 1 deletion engine-wizard/elm/Wizard/Projects/Import/Update.elm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Random exposing (Seed)
import Shared.Api.KnowledgeModels as KnowledgeModelsApi
import Shared.Api.QuestionnaireImporters as QuestionnaireImportersApi
import Shared.Api.Questionnaires as QuestionnairesApi
import Shared.Data.BootstrapConfig.LookAndFeelConfig as LookAndFeel
import Shared.Data.QuestionnaireDetail.QuestionnaireEvent as QuestionnaireEvent
import Shared.Data.QuestionnaireDetail.QuestionnaireEvent.SetReplyData as SetReplyData
import Shared.Error.ApiError as ApiError
Expand Down Expand Up @@ -43,7 +44,7 @@ update wrapMsg msg appState model =
( Success knowledgeModelString, Success importer ) ->
Integrations.openImporter
{ url = importer.url
, theme = appState.theme
, theme = Maybe.withDefault (LookAndFeel.getTheme appState.config.lookAndFeel) appState.theme
, data =
{ knowledgeModel = knowledgeModelString
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "engine-frontend",
"version": "4.5.0",
"version": "4.5.1",
"repository": "https://github.com/ds-wizard/engine-frontend",
"license": "Apache-2.0",
"scripts": {
Expand Down

0 comments on commit a0a2842

Please sign in to comment.