Skip to content

Commit a9509f4

Browse files
authored
Merge pull request #1376 from ds-wizard/release/4.19.0
Release 4.19.0
2 parents 84a169f + d380311 commit a9509f4

File tree

40 files changed

+1028
-130
lines changed

40 files changed

+1028
-130
lines changed

engine-shared/elm/Shared/Api.elm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module Shared.Api exposing
2626
, jwtPostFileWithData
2727
, jwtPostMultiPart
2828
, jwtPut
29+
, jwtPutEmpty
2930
, jwtPutString
3031
, wsUrl
3132
)
@@ -184,6 +185,15 @@ jwtPutString url contentType body appState toMsg =
184185
}
185186

186187

188+
jwtPutEmpty : String -> AbstractAppState b -> ToMsg () msg -> Cmd msg
189+
jwtPutEmpty url appState toMsg =
190+
Jwt.Http.put appState.session.token.token
191+
{ url = appState.apiUrl ++ url
192+
, body = Http.emptyBody
193+
, expect = expectWhatever toMsg
194+
}
195+
196+
187197
jwtFetchPut : String -> Decoder a -> E.Value -> AbstractAppState b -> ToMsg a msg -> Cmd msg
188198
jwtFetchPut url decoder body appState toMsg =
189199
Jwt.Http.put appState.session.token.token
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module Shared.Api.Tours exposing
2+
( putTour
3+
, resetTours
4+
)
5+
6+
import Shared.AbstractAppState exposing (AbstractAppState)
7+
import Shared.Api exposing (ToMsg, jwtDelete, jwtPutEmpty)
8+
9+
10+
putTour : String -> AbstractAppState a -> ToMsg () msg -> Cmd msg
11+
putTour tourId =
12+
jwtPutEmpty ("/users/current/tours/" ++ tourId)
13+
14+
15+
resetTours : AbstractAppState a -> ToMsg () msg -> Cmd msg
16+
resetTours =
17+
jwtDelete "/users/current/tours"

engine-shared/elm/Shared/Data/BootstrapConfig.elm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Shared.Data.BootstrapConfig exposing
22
( BootstrapConfig
3+
, addTour
34
, decoder
45
, default
56
)
@@ -38,6 +39,7 @@ type alias BootstrapConfig =
3839
, owl : OwlConfig
3940
, modules : List AppSwitcherItem
4041
, signalBridge : SignalBridgeConfig
42+
, tours : List String
4143
, user : Maybe UserInfo
4244
}
4345

@@ -58,6 +60,7 @@ default =
5860
, owl = OwlConfig.default
5961
, modules = []
6062
, signalBridge = SignalBridgeConfig.default
63+
, tours = []
6164
, user = Nothing
6265
}
6366

@@ -79,4 +82,17 @@ decoder =
7982
|> D.required "owl" OwlConfig.decoder
8083
|> D.required "modules" (D.list AppSwitcherItem.decoder)
8184
|> D.required "signalBridge" SignalBridgeConfig.decoder
85+
|> D.required "tours" (D.list D.string)
8286
|> D.required "user" (D.maybe UserInfo.decoder)
87+
88+
89+
addTour : String -> BootstrapConfig -> BootstrapConfig
90+
addTour tour config =
91+
{ config
92+
| tours =
93+
if List.member tour config.tours then
94+
config.tours
95+
96+
else
97+
tour :: config.tours
98+
}

engine-wizard/elm/Wizard/Common/Components/DetailNavigation.elm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import Shared.Html exposing (emptyNode)
1515
import Wizard.Common.AppState exposing (AppState)
1616
import Wizard.Common.Components.OnlineUser as OnlineUser
1717
import Wizard.Common.Html exposing (linkTo)
18-
import Wizard.Common.Html.Attribute exposing (dataCy)
18+
import Wizard.Common.Html.Attribute exposing (dataCy, dataTour)
1919
import Wizard.Routes
2020

2121

@@ -92,4 +92,4 @@ navLink appState cfg =
9292
navigation : AppState -> List (NavLinkConfig msg) -> Html msg
9393
navigation appState cfgs =
9494
row
95-
[ ul [ class "nav nav-underline-tabs" ] (List.map (navLink appState) cfgs) ]
95+
[ ul [ class "nav nav-underline-tabs", dataTour "navigation" ] (List.map (navLink appState) cfgs) ]

engine-wizard/elm/Wizard/Common/Components/Questionnaire.elm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ import Wizard.Common.Feature as Feature
122122
import Wizard.Common.FileDownloader as FileDownloader
123123
import Wizard.Common.FileIcon as FileIcon
124124
import Wizard.Common.Html exposing (illustratedMessage, resizableTextarea)
125-
import Wizard.Common.Html.Attribute exposing (dataCy, grammarlyAttributes, linkToAttributes, tooltip, tooltipLeft, tooltipRight)
125+
import Wizard.Common.Html.Attribute exposing (dataCy, dataTour, grammarlyAttributes, linkToAttributes, tooltip, tooltipLeft, tooltipRight)
126126
import Wizard.Common.IntegrationWidgetValue exposing (IntegrationWidgetValue)
127127
import Wizard.Common.Integrations as Integrations
128128
import Wizard.Common.LocalStorageData as LocalStorageData exposing (LocalStorageData)
@@ -1815,7 +1815,7 @@ view appState cfg ctx model =
18151815
, classList [ ( "toolbar-enabled", toolbarEnabled ) ]
18161816
]
18171817
[ toolbar
1818-
, div [ class "questionnaire__body" ]
1818+
, div [ class "questionnaire__body", dataTour "questionnaire_body" ]
18191819
[ SplitPane.view splitPaneConfig
18201820
(Html.map cfg.wrapMsg <| viewQuestionnaireLeftPanel appState cfg model)
18211821
(Html.map cfg.wrapMsg <| viewQuestionnaireContent appState cfg ctx model)
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
port module Wizard.Common.Driver exposing
2+
( DriverOptionsStep
3+
, TourConfig
4+
, TourId
5+
, addModalDelay
6+
, addStep
7+
, init
8+
, onTourDone
9+
, tourConfig
10+
, tourId
11+
)
12+
13+
import Gettext exposing (gettext)
14+
import Json.Encode as E
15+
import Json.Encode.Extra as E
16+
import Shared.Auth.Session as Session
17+
import String.Format as String
18+
import Wizard.Common.AppState exposing (AppState)
19+
20+
21+
type TourId
22+
= TourId String
23+
24+
25+
tourId : String -> TourId
26+
tourId =
27+
TourId
28+
29+
30+
type TourConfig
31+
= TourConfig TourConfigData
32+
33+
34+
type alias TourConfigData =
35+
{ tourId : String
36+
, loggedIn : Bool
37+
, completedTourIds : List String
38+
, locale : Gettext.Locale
39+
, steps : List DriverOptionsStep
40+
, delay : Int
41+
}
42+
43+
44+
tourConfig : TourId -> AppState -> TourConfig
45+
tourConfig (TourId id) appState =
46+
TourConfig
47+
{ tourId = id
48+
, loggedIn = Session.exists appState.session
49+
, completedTourIds = appState.config.tours
50+
, locale = appState.locale
51+
, steps = []
52+
, delay = 0
53+
}
54+
55+
56+
addStep : DriverOptionsStep -> TourConfig -> TourConfig
57+
addStep step (TourConfig config) =
58+
TourConfig { config | steps = config.steps ++ [ step ] }
59+
60+
61+
addDelay : Int -> TourConfig -> TourConfig
62+
addDelay delay (TourConfig config) =
63+
TourConfig { config | delay = delay }
64+
65+
66+
addModalDelay : TourConfig -> TourConfig
67+
addModalDelay =
68+
addDelay 200
69+
70+
71+
type alias DriverOptionsStep =
72+
{ element : Maybe String
73+
, popover :
74+
{ title : String
75+
, description : String
76+
}
77+
}
78+
79+
80+
skipTourStr : Gettext.Locale -> String
81+
skipTourStr =
82+
gettext "Are you sure you want to skip the tour?"
83+
84+
85+
skipTourHint : Gettext.Locale -> String
86+
skipTourHint =
87+
gettext "You can reset tours in user settings"
88+
89+
90+
encodeTour : TourConfigData -> E.Value
91+
encodeTour config =
92+
E.object
93+
[ ( "tourId", E.string config.tourId )
94+
, ( "steps", E.list encodeStep config.steps )
95+
, ( "skipTourStr", E.string (String.format "%s\n(%s)" [ skipTourStr config.locale, skipTourHint config.locale ]) )
96+
, ( "delay", E.int config.delay )
97+
]
98+
99+
100+
encodeStep : DriverOptionsStep -> E.Value
101+
encodeStep step =
102+
E.object
103+
[ ( "element", E.maybe E.string step.element )
104+
, ( "popover"
105+
, E.object
106+
[ ( "title", E.string step.popover.title )
107+
, ( "description", E.string step.popover.description )
108+
]
109+
)
110+
]
111+
112+
113+
init : TourConfig -> Cmd msg
114+
init (TourConfig config) =
115+
if not config.loggedIn || List.member config.tourId config.completedTourIds then
116+
Cmd.none
117+
118+
else
119+
drive (encodeTour config)
120+
121+
122+
port drive : E.Value -> Cmd msg
123+
124+
125+
port onTourDone : (String -> msg) -> Sub msg

engine-wizard/elm/Wizard/Common/Feature.elm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ module Wizard.Common.Feature exposing
7676
, userEditAppKeys
7777
, userEditLanguage
7878
, userEditSubmissionSettings
79+
, userEditTours
7980
, usersCreate
8081
, usersView
8182
)
@@ -474,6 +475,11 @@ userEditLanguage appState uuidOrCurrent =
474475
UuidOrCurrent.isCurrent uuidOrCurrent || UuidOrCurrent.matchUuid uuidOrCurrent (Maybe.unwrap Uuid.nil .uuid appState.config.user)
475476

476477

478+
userEditTours : AppState -> UuidOrCurrent -> Bool
479+
userEditTours appState uuidOrCurrent =
480+
UuidOrCurrent.isCurrent uuidOrCurrent || UuidOrCurrent.matchUuid uuidOrCurrent (Maybe.unwrap Uuid.nil .uuid appState.config.user)
481+
482+
477483
userEditApiKeys : AppState -> UuidOrCurrent -> Bool
478484
userEditApiKeys appState uuidOrCurrent =
479485
UuidOrCurrent.isCurrent uuidOrCurrent || UuidOrCurrent.matchUuid uuidOrCurrent (Maybe.unwrap Uuid.nil .uuid appState.config.user)

engine-wizard/elm/Wizard/Common/GuideLinks.elm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module Wizard.Common.GuideLinks exposing
99
, documentTemplatesUnsupportedMetamodel
1010
, integrationQuestionSecrets
1111
, kmEditorCreate
12+
, kmEditorIntegrationQuestion
1213
, kmEditorMigration
1314
, kmEditorPublish
1415
, kmEditorSettings
@@ -69,6 +70,7 @@ default =
6970
, ( "documentTemplatesUnsupportedMetamodel", "https://guide.ds-wizard.org/en/latest/more/self-hosted-dsw/faq-notes.html#document-templates-show-unsupported-metamodel-what-should-i-do" )
7071
, ( "integrationQuestionSecrets", "https://guide.ds-wizard.org/en/latest/more/development/integration-questions/integration-api.html#secrets-and-other-properties" )
7172
, ( "kmEditorCreate", "https://guide.ds-wizard.org/en/latest/application/knowledge-models/editors/create.html" )
73+
, ( "kmEditorIntegrationQuestion", "https://guide.ds-wizard.org/en/latest/more/development/integration-questions/index.html" )
7274
, ( "kmEditorMigration", "https://guide.ds-wizard.org/en/latest/application/knowledge-models/editors/migration.html" )
7375
, ( "kmEditorPublish", "https://guide.ds-wizard.org/en/latest/application/knowledge-models/editors/detail/publish.html" )
7476
, ( "kmEditorSettings", "https://guide.ds-wizard.org/en/latest/application/knowledge-models/editors/detail/settings.html" )
@@ -159,6 +161,11 @@ kmEditorCreate =
159161
get "kmEditorCreate"
160162

161163

164+
kmEditorIntegrationQuestion : GuideLinks -> String
165+
kmEditorIntegrationQuestion =
166+
get "kmEditorIntegrationQuestion"
167+
168+
162169
kmEditorMigration : GuideLinks -> String
163170
kmEditorMigration =
164171
get "kmEditorMigration"

engine-wizard/elm/Wizard/Common/Html/Attribute.elm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
module Wizard.Common.Html.Attribute exposing
22
( dataCy
3+
, dataTour
34
, detailClass
45
, grammarlyAttribute
56
, grammarlyAttributes
67
, linkToAttributes
78
, listClass
9+
, selectDataTour
810
, settingsClass
911
, tooltip
1012
, tooltipCustom
@@ -79,3 +81,13 @@ tooltipRight =
7981
tooltipCustom : String -> String -> List (Html.Attribute msg)
8082
tooltipCustom extraClass value =
8183
[ class "with-tooltip", class extraClass, attribute "data-tooltip" value ]
84+
85+
86+
dataTour : String -> Html.Attribute msg
87+
dataTour =
88+
attribute "data-tour"
89+
90+
91+
selectDataTour : String -> Maybe String
92+
selectDataTour tourId =
93+
Just ("[data-tour='" ++ tourId ++ "']")
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
module Wizard.Common.TourId exposing
2+
( dashboard
3+
, projectsCreate
4+
, projectsDetail
5+
, projectsDetailShareModal
6+
, projectsIndex
7+
, usersEditTours
8+
)
9+
10+
import Wizard.Common.Driver as Driver exposing (TourId)
11+
12+
13+
dashboard : TourId
14+
dashboard =
15+
Driver.tourId "dashboard"
16+
17+
18+
projectsCreate : TourId
19+
projectsCreate =
20+
Driver.tourId "projects_create"
21+
22+
23+
projectsDetail : TourId
24+
projectsDetail =
25+
Driver.tourId "projects_detail"
26+
27+
28+
projectsDetailShareModal : TourId
29+
projectsDetailShareModal =
30+
Driver.tourId "projects_detail_share-modal"
31+
32+
33+
projectsIndex : TourId
34+
projectsIndex =
35+
Driver.tourId "projects_index"
36+
37+
38+
usersEditTours : TourId
39+
usersEditTours =
40+
Driver.tourId "users_edit_tours"

0 commit comments

Comments
 (0)