Skip to content

Commit

Permalink
Merge pull request #1221 from ds-wizard/release/4.10.0
Browse files Browse the repository at this point in the history
Release 4.10.0
  • Loading branch information
janslifka authored Sep 3, 2024
2 parents 306b8f0 + cf5613c commit c648891
Show file tree
Hide file tree
Showing 95 changed files with 2,791 additions and 511 deletions.
10 changes: 9 additions & 1 deletion engine-registry/elm/Registry/Components/AboutModal.elm
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ import Gettext exposing (gettext)
import Html exposing (Html, a, button, code, div, em, h5, table, tbody, td, text, th, thead, tr)
import Html.Attributes exposing (class, classList, colspan, href, target)
import Html.Events exposing (onClick)
import Json.Decode as D
import Json.Decode.Extra as D
import Registry.Api.BuildInfo as BuildInfoApi
import Registry.Components.Page as Page
import Registry.Data.AppState exposing (AppState)
import Shared.Common.TimeUtils as TimeUtils
import Shared.Data.BuildInfo as BuildInfo exposing (BuildInfo)
import Shared.Error.ApiError as ApiError exposing (ApiError)

Expand Down Expand Up @@ -130,6 +133,11 @@ viewBuildInfo appState name buildInfo extra =
[ td [] [ text title ]
, td [] [ value ]
]

buildAtValue =
D.decodeString D.datetime ("\"" ++ buildInfo.builtAt ++ "\"")
|> Result.map (TimeUtils.toReadableDateTime appState.timeZone)
|> Result.withDefault buildInfo.builtAt
in
table [ class "table table-borderless table-build-info" ]
[ thead []
Expand All @@ -143,7 +151,7 @@ viewBuildInfo appState name buildInfo extra =
]
, tr []
[ td [] [ text (gettext "Built at" appState.locale) ]
, td [] [ em [] [ text buildInfo.builtAt ] ]
, td [] [ em [] [ text buildAtValue ] ]
]
]
++ List.map viewExtraRow extra
Expand Down
2 changes: 1 addition & 1 deletion engine-registry/elm/Registry/Pages/DocumentTemplates.elm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ viewDocumentTemplates appState documentTemplates =
let
documentTemplateView =
documentTemplates
|> List.sortBy (Time.toMillis appState.timeZone << .createdAt)
|> List.sortBy ((*) -1 << Time.posixToMillis << .createdAt)
|> List.map (ListItem.view appState { toRoute = Routes.documentTemplateDetail << .id })
|> div []
in
Expand Down
2 changes: 1 addition & 1 deletion engine-registry/elm/Registry/Pages/KnowledgeModels.elm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ viewKnowledgeModels appState knowledgeModels =
let
knowledgeModelsView =
knowledgeModels
|> List.sortBy (Time.toMillis appState.timeZone << .createdAt)
|> List.sortBy ((*) -1 << Time.posixToMillis << .createdAt)
|> List.map (ListItem.view appState { toRoute = Routes.knowledgeModelDetail << .id })
|> div []
in
Expand Down
2 changes: 1 addition & 1 deletion engine-registry/elm/Registry/Pages/Locales.elm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ viewLocales appState documentTemplates =
let
localeView =
documentTemplates
|> List.sortBy (Time.toMillis appState.timeZone << .createdAt)
|> List.sortBy ((*) -1 << Time.posixToMillis << .createdAt)
|> List.map (ListItem.view appState { toRoute = Routes.localeDetail << .id })
|> div []
in
Expand Down
10 changes: 0 additions & 10 deletions engine-shared/elm/Shared/Api/BookReferences.elm

This file was deleted.

22 changes: 0 additions & 22 deletions engine-shared/elm/Shared/Data/BookReference.elm

This file was deleted.

76 changes: 76 additions & 0 deletions engine-shared/elm/Shared/Data/Event.elm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import Shared.Data.Event.AddMetricEventData as AddMetricEventData exposing (AddM
import Shared.Data.Event.AddPhaseEventData as AddPhaseEventData exposing (AddPhaseEventData)
import Shared.Data.Event.AddQuestionEventData as AddQuestionEventData exposing (AddQuestionEventData)
import Shared.Data.Event.AddReferenceEventData as AddReferenceEventData exposing (AddReferenceEventData)
import Shared.Data.Event.AddResourceCollectionEventData as AddResourceCollectionEventData exposing (AddResourceCollectionEventData)
import Shared.Data.Event.AddResourcePageEventData as AddResourcePageEventData exposing (AddResourcePageEventData)
import Shared.Data.Event.AddTagEventData as AddTagEventData exposing (AddTagEventData)
import Shared.Data.Event.CommonEventData as CommonEventData exposing (CommonEventData)
import Shared.Data.Event.EditAnswerEventData as EditAnswerEventData exposing (EditAnswerEventData)
Expand All @@ -30,6 +32,8 @@ import Shared.Data.Event.EditMetricEventData as EditMetricEventData exposing (Ed
import Shared.Data.Event.EditPhaseEventData as EditPhaseEventData exposing (EditPhaseEventData)
import Shared.Data.Event.EditQuestionEventData as EditQuestionEventData exposing (EditQuestionEventData)
import Shared.Data.Event.EditReferenceEventData as EditReferenceEventData exposing (EditReferenceEventData)
import Shared.Data.Event.EditResourceCollectionEventData as EditResourceCollectionEventData exposing (EditResourceCollectionEventData)
import Shared.Data.Event.EditResourcePageEventData as EditResourcePageEventData exposing (EditResourcePageEventData)
import Shared.Data.Event.EditTagEventData as EditTagEventData exposing (EditTagEventData)
import Shared.Data.Event.EventField as EventField
import Shared.Data.Event.MoveEventData as MoveEventData exposing (MoveEventData)
Expand Down Expand Up @@ -68,6 +72,12 @@ type Event
| AddExpertEvent AddExpertEventData CommonEventData
| EditExpertEvent EditExpertEventData CommonEventData
| DeleteExpertEvent CommonEventData
| AddResourceCollectionEvent AddResourceCollectionEventData CommonEventData
| EditResourceCollectionEvent EditResourceCollectionEventData CommonEventData
| DeleteResourceCollectionEvent CommonEventData
| AddResourcePageEvent AddResourcePageEventData CommonEventData
| EditResourcePageEvent EditResourcePageEventData CommonEventData
| DeleteResourcePageEvent CommonEventData
| MoveQuestionEvent MoveEventData CommonEventData
| MoveAnswerEvent MoveEventData CommonEventData
| MoveChoiceEvent MoveEventData CommonEventData
Expand Down Expand Up @@ -180,6 +190,24 @@ decoderByType eventType =
"DeleteExpertEvent" ->
D.map DeleteExpertEvent CommonEventData.decoder

"AddResourceCollectionEvent" ->
D.map2 AddResourceCollectionEvent AddResourceCollectionEventData.decoder CommonEventData.decoder

"EditResourceCollectionEvent" ->
D.map2 EditResourceCollectionEvent EditResourceCollectionEventData.decoder CommonEventData.decoder

"DeleteResourceCollectionEvent" ->
D.map DeleteResourceCollectionEvent CommonEventData.decoder

"AddResourcePageEvent" ->
D.map2 AddResourcePageEvent AddResourcePageEventData.decoder CommonEventData.decoder

"EditResourcePageEvent" ->
D.map2 EditResourcePageEvent EditResourcePageEventData.decoder CommonEventData.decoder

"DeleteResourcePageEvent" ->
D.map DeleteResourcePageEvent CommonEventData.decoder

"MoveQuestionEvent" ->
D.map2 MoveQuestionEvent MoveEventData.decoder CommonEventData.decoder

Expand Down Expand Up @@ -300,6 +328,24 @@ encode event =
DeleteExpertEvent commonData ->
( [ ( "eventType", E.string "DeleteExpertEvent" ) ], CommonEventData.encode commonData )

AddResourceCollectionEvent eventData commonData ->
( AddResourceCollectionEventData.encode eventData, CommonEventData.encode commonData )

EditResourceCollectionEvent eventData commonData ->
( EditResourceCollectionEventData.encode eventData, CommonEventData.encode commonData )

DeleteResourceCollectionEvent commonData ->
( [ ( "eventType", E.string "DeleteResourceCollectionEvent" ) ], CommonEventData.encode commonData )

AddResourcePageEvent eventData commonData ->
( AddResourcePageEventData.encode eventData, CommonEventData.encode commonData )

EditResourcePageEvent eventData commonData ->
( EditResourcePageEventData.encode eventData, CommonEventData.encode commonData )

DeleteResourcePageEvent commonData ->
( [ ( "eventType", E.string "DeleteResourcePageEvent" ) ], CommonEventData.encode commonData )

MoveQuestionEvent eventData commonData ->
( MoveEventData.encode "MoveQuestionEvent" eventData, CommonEventData.encode commonData )

Expand Down Expand Up @@ -422,6 +468,24 @@ getCommonData event =
DeleteExpertEvent commonData ->
commonData

AddResourceCollectionEvent _ commonData ->
commonData

EditResourceCollectionEvent _ commonData ->
commonData

DeleteResourceCollectionEvent commonData ->
commonData

AddResourcePageEvent _ commonData ->
commonData

EditResourcePageEvent _ commonData ->
commonData

DeleteResourcePageEvent commonData ->
commonData

MoveQuestionEvent _ commonData ->
commonData

Expand Down Expand Up @@ -507,5 +571,17 @@ getEntityVisibleName event =
EditExpertEvent eventData _ ->
EventField.getValue eventData.name

AddResourceCollectionEvent eventData _ ->
Just eventData.title

EditResourceCollectionEvent eventData _ ->
EventField.getValue eventData.title

AddResourcePageEvent eventData _ ->
Just eventData.title

EditResourcePageEvent eventData _ ->
EventField.getValue eventData.title

_ ->
Nothing
28 changes: 21 additions & 7 deletions engine-shared/elm/Shared/Data/Event/AddQuestionEventData.elm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module Shared.Data.Event.AddQuestionEventData exposing
import Json.Decode as D exposing (Decoder)
import Json.Encode as E
import Shared.Data.Event.AddQuestionIntegrationEventData as AddQuestionIntegrationEventData exposing (AddQuestionIntegrationEventData)
import Shared.Data.Event.AddQuestionItemSelectEventData as AddQuestionItemSelectEventData exposing (AddQuestionItemSelectEventData)
import Shared.Data.Event.AddQuestionListEventData as AddQuestionListEventData exposing (AddQuestionListEventData)
import Shared.Data.Event.AddQuestionMultiChoiceEventData as AddQuestionMultiChoiceEventData exposing (AddQuestionMultiChoiceEventData)
import Shared.Data.Event.AddQuestionOptionsEventData as AddQuestionOptionsEventData exposing (AddQuestionOptionsEventData)
Expand All @@ -25,6 +26,7 @@ type AddQuestionEventData
| AddQuestionValueEvent AddQuestionValueEventData
| AddQuestionIntegrationEvent AddQuestionIntegrationEventData
| AddQuestionMultiChoiceEvent AddQuestionMultiChoiceEventData
| AddQuestionItemSelectEvent AddQuestionItemSelectEventData


decoder : Decoder AddQuestionEventData
Expand All @@ -48,6 +50,9 @@ decoder =
"MultiChoiceQuestion" ->
D.map AddQuestionMultiChoiceEvent AddQuestionMultiChoiceEventData.decoder

"ItemSelectQuestion" ->
D.map AddQuestionItemSelectEvent AddQuestionItemSelectEventData.decoder

_ ->
D.fail <| "Unknown question type: " ++ questionType
)
Expand All @@ -63,6 +68,7 @@ encode data =
AddQuestionValueEventData.encode
AddQuestionIntegrationEventData.encode
AddQuestionMultiChoiceEventData.encode
AddQuestionItemSelectEventData.encode
data
in
( "eventType", E.string "AddQuestionEvent" ) :: eventData
Expand Down Expand Up @@ -91,20 +97,24 @@ toQuestion questionUuid data =
AddQuestionMultiChoiceEvent eventData ->
AddQuestionMultiChoiceEventData.toQuestion questionUuid eventData

AddQuestionItemSelectEvent eventData ->
AddQuestionItemSelectEventData.toQuestion questionUuid eventData


getTypeString : AddQuestionEventData -> String
getTypeString =
map
(\_ -> "Options")
(\_ -> "List")
(\_ -> "Value")
(\_ -> "Integration")
(\_ -> "MultiChoice")
(always "Options")
(always "List")
(always "Value")
(always "Integration")
(always "MultiChoice")
(always "ItemSelect")


getEntityVisibleName : AddQuestionEventData -> Maybe String
getEntityVisibleName =
Just << map .title .title .title .title .title
Just << map .title .title .title .title .title .title


map :
Expand All @@ -113,9 +123,10 @@ map :
-> (AddQuestionValueEventData -> a)
-> (AddQuestionIntegrationEventData -> a)
-> (AddQuestionMultiChoiceEventData -> a)
-> (AddQuestionItemSelectEventData -> a)
-> AddQuestionEventData
-> a
map optionsQuestion listQuestion valueQuestion integrationQuestion multiChoiceQuestion question =
map optionsQuestion listQuestion valueQuestion integrationQuestion multiChoiceQuestion itemSelectQuestion question =
case question of
AddQuestionOptionsEvent data ->
optionsQuestion data
Expand All @@ -131,3 +142,6 @@ map optionsQuestion listQuestion valueQuestion integrationQuestion multiChoiceQu

AddQuestionMultiChoiceEvent data ->
multiChoiceQuestion data

AddQuestionItemSelectEvent data ->
itemSelectQuestion data
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
module Shared.Data.Event.AddQuestionItemSelectEventData exposing
( AddQuestionItemSelectEventData
, decoder
, encode
, toQuestion
)

import Json.Decode as D exposing (Decoder)
import Json.Decode.Pipeline as D
import Json.Encode as E
import Json.Encode.Extra as E
import Shared.Data.KnowledgeModel.Annotation as Annotation exposing (Annotation)
import Shared.Data.KnowledgeModel.Question exposing (Question(..))


type alias AddQuestionItemSelectEventData =
{ title : String
, text : Maybe String
, requiredPhaseUuid : Maybe String
, tagUuids : List String
, listQuestionUuid : Maybe String
, annotations : List Annotation
}


decoder : Decoder AddQuestionItemSelectEventData
decoder =
D.succeed AddQuestionItemSelectEventData
|> D.required "title" D.string
|> D.required "text" (D.nullable D.string)
|> D.required "requiredPhaseUuid" (D.nullable D.string)
|> D.required "tagUuids" (D.list D.string)
|> D.required "listQuestionUuid" (D.nullable D.string)
|> D.required "annotations" (D.list Annotation.decoder)


encode : AddQuestionItemSelectEventData -> List ( String, E.Value )
encode data =
[ ( "questionType", E.string "IntegrationQuestion" )
, ( "title", E.string data.title )
, ( "text", E.maybe E.string data.text )
, ( "requiredPhaseUuid", E.maybe E.string data.requiredPhaseUuid )
, ( "tagUuids", E.list E.string data.tagUuids )
, ( "listQuestionUuid", E.maybe E.string data.listQuestionUuid )
, ( "annotations", E.list Annotation.encode data.annotations )
]


toQuestion : String -> AddQuestionItemSelectEventData -> Question
toQuestion uuid data =
ItemSelectQuestion
{ uuid = uuid
, title = data.title
, text = data.text
, requiredPhaseUuid = data.requiredPhaseUuid
, tagUuids = data.tagUuids
, referenceUuids = []
, expertUuids = []
, annotations = data.annotations
}
{ listQuestionUuid = Nothing
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ toReference referenceUuid data =

getEntityVisibleName : AddReferenceEventData -> Maybe String
getEntityVisibleName =
Just << map .shortUuid .label .targetUuid
map .resourcePageUuid (Just << .label) (Just << .targetUuid)


map :
Expand Down
Loading

0 comments on commit c648891

Please sign in to comment.