Skip to content

Commit

Permalink
Merge pull request #1239 from ds-wizard/release/4.11.0
Browse files Browse the repository at this point in the history
Release 4.11.0
  • Loading branch information
vknaisl authored Oct 1, 2024
2 parents d8d97f7 + b8819b8 commit f2b6039
Show file tree
Hide file tree
Showing 43 changed files with 1,409 additions and 737 deletions.
14 changes: 13 additions & 1 deletion engine-shared/elm/Shared/Api/Prefabs.elm
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module Shared.Api.Prefabs exposing (getIntegrationPrefabs, getOpenIDPrefabs)
module Shared.Api.Prefabs exposing (getDocumentTemplateFormatPrefabs, getDocumentTemplateFormatStepPrefabs, getIntegrationPrefabs, getOpenIDPrefabs)

import Json.Decode as D
import Shared.AbstractAppState exposing (AbstractAppState)
import Shared.Api exposing (ToMsg, jwtGet)
import Shared.Data.DocumentTemplate.DocumentTemplateFormatStep as DocumentTemplateFormatStep exposing (DocumentTemplateFormatStep)
import Shared.Data.DocumentTemplateDraft.DocumentTemplateFormatDraft as DocumentTemplateFormatDraft exposing (DocumentTemplateFormatDraft)
import Shared.Data.EditableConfig.EditableAuthenticationConfig.EditableOpenIDServiceConfig as EditableOpenIDServiceConfig exposing (EditableOpenIDServiceConfig)
import Shared.Data.KnowledgeModel.Integration as Integration exposing (Integration)
import Shared.Data.Prefab as Prefab exposing (Prefab)
Expand All @@ -16,3 +18,13 @@ getIntegrationPrefabs =
getOpenIDPrefabs : AbstractAppState a -> ToMsg (List (Prefab EditableOpenIDServiceConfig)) msg -> Cmd msg
getOpenIDPrefabs =
jwtGet "/prefabs?type=open-id" (D.list (Prefab.decoder EditableOpenIDServiceConfig.decoder))


getDocumentTemplateFormatPrefabs : AbstractAppState a -> ToMsg (List (Prefab DocumentTemplateFormatDraft)) msg -> Cmd msg
getDocumentTemplateFormatPrefabs =
jwtGet "/prefabs?type=document-template-format" (D.list (Prefab.decoder DocumentTemplateFormatDraft.decoder))


getDocumentTemplateFormatStepPrefabs : AbstractAppState a -> ToMsg (List (Prefab DocumentTemplateFormatStep)) msg -> Cmd msg
getDocumentTemplateFormatStepPrefabs =
jwtGet "/prefabs?type=document-template-format-step" (D.list (Prefab.decoder DocumentTemplateFormatStep.decoder))
18 changes: 14 additions & 4 deletions engine-shared/elm/Shared/Auth/Session.elm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Shared.Auth.Session exposing
, expiresSoon
, init
, setFullscreen
, setRightPanelCollapsed
, setSidebarCollapsed
, setToken
)
Expand All @@ -22,19 +23,21 @@ import Time
type alias Session =
{ token : Token
, sidebarCollapsed : Bool
, rightPanelCollapsed : Bool
, fullscreen : Bool
, apiUrl : String
, v8 : Bool
, v9 : Bool
}


init : String -> Session
init apiUrl =
{ token = Token.empty
, sidebarCollapsed = False
, rightPanelCollapsed = True
, fullscreen = False
, apiUrl = apiUrl
, v8 = True
, v9 = True
}


Expand All @@ -48,6 +51,11 @@ setSidebarCollapsed session collapsed =
{ session | sidebarCollapsed = collapsed }


setRightPanelCollapsed : Session -> Bool -> Session
setRightPanelCollapsed session collapsed =
{ session | rightPanelCollapsed = collapsed }


setFullscreen : Session -> Bool -> Session
setFullscreen session fullscreen =
{ session | fullscreen = fullscreen }
Expand All @@ -58,19 +66,21 @@ decoder =
D.succeed Session
|> D.required "token" Token.decoder
|> D.optional "sidebarCollapsed" D.bool False
|> D.optional "rightPanelCollapsed" D.bool True
|> D.optional "fullscreen" D.bool False
|> D.required "apiUrl" D.string
|> D.required "v8" D.bool
|> D.required "v9" D.bool


encode : Session -> E.Value
encode session =
E.object
[ ( "token", Token.encode session.token )
, ( "sidebarCollapsed", E.bool session.sidebarCollapsed )
, ( "rightPanelCollapsed", E.bool session.rightPanelCollapsed )
, ( "fullscreen", E.bool session.fullscreen )
, ( "apiUrl", E.string session.apiUrl )
, ( "v8", E.bool session.v8 )
, ( "v9", E.bool session.v9 )
]


Expand Down
2 changes: 1 addition & 1 deletion engine-shared/elm/Shared/Form/Validate.elm
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ uuid =

organizationId : Validation FormError String
organizationId =
regex RegexPatterns.organizationId "Organization ID can only contain alphanumeric characters, hyphens, and dots. It must start and end with an alphanumeric character."
regex RegexPatterns.organizationId "Organization ID can only contain alphanumeric characters and dots. It must start and end with an alphanumeric character."


kmId : Validation FormError String
Expand Down
12 changes: 11 additions & 1 deletion engine-shared/elm/Shared/Markdown.elm
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
module Shared.Markdown exposing (toHtml, toString)
module Shared.Markdown exposing
( sanitizeHtml
, toHtml
, toString
)

import Html exposing (Html, text)
import Html.Attributes as Attr
Expand All @@ -8,6 +12,12 @@ import Markdown.Parser as Markdown
import Markdown.Renderer


sanitizeHtml : String -> String
sanitizeHtml html =
html
|> String.replace "<" "&lt;"


toHtml : List (Html.Attribute msg) -> String -> Html msg
toHtml attrs markdownInput =
let
Expand Down
2 changes: 1 addition & 1 deletion engine-shared/elm/Shared/RegexPatterns.elm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ url =

organizationId : Regex
organizationId =
fromString "^^(?![-.])(?!.*[-.]$)[a-zA-Z0-9-.]+$"
fromString "^^(?![.])(?!.*[.]$)[a-zA-Z0-9.]+$"


kmId : Regex
Expand Down
12 changes: 11 additions & 1 deletion engine-wizard/elm/Wizard.elm
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ module Wizard exposing (main)
import Browser
import Browser.Navigation exposing (Key)
import Json.Decode exposing (Value)
import Shared.Utils exposing (dispatch)
import Shared.Data.BootstrapConfig.Admin as Admin
import Shared.Utils as Taks exposing (dispatch)
import Shared.Utils.Theme as Theme
import Url exposing (Url)
import Wizard.Common.AppState as AppState
import Wizard.Common.Components.AIAssistant as AIAssistant
import Wizard.Common.Time as Time
import Wizard.KnowledgeModels.Routes as KnowledgeModelsRoute
import Wizard.Models exposing (Model, initLocalModel, initialModel, userLoggedIn)
Expand Down Expand Up @@ -48,10 +50,18 @@ init flags location key =

Nothing ->
Cmd.none

aiAssistantCmd =
if Admin.isEnabled appState.config.admin then
Taks.dispatch (Wizard.Msgs.AIAssistantMsg AIAssistant.init)

else
Cmd.none
in
Cmd.batch
[ decideInitialRoute model location route originalRoute
, setThemeCmd
, aiAssistantCmd
, Time.getTime
, Time.getTimeZone
]
Expand Down
6 changes: 6 additions & 0 deletions engine-wizard/elm/Wizard/Common/AppState.elm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Wizard.Common.AppState exposing
( AppState
, acceptCookies
, getAIAssistantApiUrl
, getClientUrlRoot
, getUserRole
, init
Expand Down Expand Up @@ -206,3 +207,8 @@ sessionRemainingTime appState =
|> String.padLeft 2 '0'
in
timeLeftMin ++ ":" ++ timeLeftSec


getAIAssistantApiUrl : AppState -> String
getAIAssistantApiUrl appState =
String.replace "/wizard" "/ai-assistant" appState.apiUrl
Loading

0 comments on commit f2b6039

Please sign in to comment.