Skip to content

Commit 82767fe

Browse files
authored
Merge pull request #1348 from ds-wizard/release/4.17.0
Release 4.17.0
2 parents aa4e165 + 98bc597 commit 82767fe

File tree

79 files changed

+963
-1019
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+963
-1019
lines changed

elm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"leojpod/elm-keyboard-shortcut": "1.0.1",
4343
"myrho/elm-round": "1.0.5",
4444
"noahzgordon/elm-color-extra": "1.0.2",
45-
"pablohirafuji/elm-syntax-highlight": "3.6.0",
45+
"pablohirafuji/elm-syntax-highlight": "3.7.0",
4646
"rtfeldman/elm-iso8601-date-strings": "1.1.4",
4747
"rundis/elm-bootstrap": "5.2.0",
4848
"simonh1000/elm-jwt": "7.1.1",

engine-registry/elm/Registry.elm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ init flags url key =
107107
, locales = Locales.initialModel
108108
, localesDetail = LocalesDetail.initialModel
109109
, login = Login.initialModel
110-
, signup = Signup.initialModel
110+
, signup = Signup.initialModel appState
111111
, signupConfirmation = SignupConfirmation.initialModel
112112
, forgottenToken = ForgottenToken.initialModel
113113
, forgottenTokenConfirmation = ForgottenTokenConfirmation.initialModel
@@ -444,7 +444,7 @@ initPage model =
444444
pages =
445445
model.pages
446446
in
447-
( { model | pages = { pages | signup = Signup.initialModel } }
447+
( { model | pages = { pages | signup = Signup.initialModel model.appState } }
448448
, Cmd.none
449449
)
450450

engine-registry/elm/Registry/Data/Forms/SignupForm.elm

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Form.Error as Error exposing (Error, ErrorValue(..))
55
import Form.Field as Field exposing (Field)
66
import Form.Validate as V exposing (Validation)
77
import Json.Encode as E
8+
import Registry.Data.AppState exposing (AppState)
89
import Shared.Form.FormError exposing (FormError)
910
import Shared.Form.Validate as V
1011

@@ -18,15 +19,15 @@ type alias SignupForm =
1819
}
1920

2021

21-
init : Form FormError SignupForm
22-
init =
23-
Form.initial [] validation
22+
init : AppState -> Form FormError SignupForm
23+
init appState =
24+
Form.initial [] (validation appState)
2425

2526

26-
validation : Validation FormError SignupForm
27-
validation =
27+
validation : AppState -> Validation FormError SignupForm
28+
validation appState =
2829
V.succeed SignupForm
29-
|> V.andMap (V.field "organizationId" V.organizationId)
30+
|> V.andMap (V.field "organizationId" (V.organizationId appState))
3031
|> V.andMap (V.field "name" V.string)
3132
|> V.andMap (V.field "email" V.email)
3233
|> V.andMap (V.field "description" V.string)

engine-registry/elm/Registry/Pages/Signup.elm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ type alias Model =
3434
}
3535

3636

37-
initialModel : Model
38-
initialModel =
39-
{ form = SignupForm.init
37+
initialModel : AppState -> Model
38+
initialModel appState =
39+
{ form = SignupForm.init appState
4040
, signingUp = ActionResult.Unset
4141
}
4242

@@ -57,7 +57,7 @@ update appState msg model =
5757
)
5858

5959
_ ->
60-
( { model | form = Form.update SignupForm.validation formMsg model.form }
60+
( { model | form = Form.update (SignupForm.validation appState) formMsg model.form }
6161
, Cmd.none
6262
)
6363

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Form.Error as Error
99
import Form.Field as Field exposing (Field)
1010
import Form.Validate as V exposing (Validation)
1111
import Gettext exposing (gettext)
12+
import List.Extra as List
1213

1314

1415
type QuestionnairePermission
@@ -55,9 +56,19 @@ field =
5556
toString >> Field.string
5657

5758

58-
formOptions : { a | locale : Gettext.Locale } -> List ( String, String )
59-
formOptions appState =
60-
[ ( "view", gettext "view" appState.locale )
61-
, ( "comment", gettext "comment" appState.locale )
62-
, ( "edit", gettext "edit" appState.locale )
63-
]
59+
formOptions : { a | locale : Gettext.Locale } -> Maybe String -> List ( String, String )
60+
formOptions appState mbFilterPerm =
61+
let
62+
drop ( perm, _ ) =
63+
case mbFilterPerm of
64+
Just filterPerm ->
65+
perm /= filterPerm
66+
67+
Nothing ->
68+
False
69+
in
70+
List.dropWhile drop
71+
[ ( "view", gettext "view" appState.locale )
72+
, ( "comment", gettext "comment" appState.locale )
73+
, ( "edit", gettext "edit" appState.locale )
74+
]

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module Shared.Data.TenantState exposing
55
, toReadableString
66
)
77

8-
import Gettext exposing (gettext)
98
import Json.Decode as D exposing (Decoder)
109
import Maybe.Extra as Maybe
1110

@@ -67,26 +66,26 @@ fromString state =
6766
Nothing
6867

6968

70-
filterOptions : { a | locale : Gettext.Locale } -> List ( String, String )
71-
filterOptions appState =
69+
filterOptions : List ( String, String )
70+
filterOptions =
7271
let
7372
toOption state =
74-
( toString state, toReadableString appState state )
73+
( toString state, toReadableString state )
7574
in
7675
List.map toOption all
7776

7877

79-
toReadableString : { a | locale : Gettext.Locale } -> TenantState -> String
80-
toReadableString { locale } state =
78+
toReadableString : TenantState -> String
79+
toReadableString state =
8180
case state of
8281
NotSeeded ->
83-
gettext "Not seeded" locale
82+
"Not seeded"
8483

8584
PendingHousekeeping ->
86-
gettext "Pending housekeeping" locale
85+
"Pending housekeeping"
8786

8887
HousekeepingInProgress ->
89-
gettext "Housekeeping in progress" locale
88+
"Housekeeping in progress"
9089

9190
ReadyForUse ->
92-
gettext "Ready for use" locale
91+
"Ready for use"

engine-shared/elm/Shared/Error/ServerError.elm

Lines changed: 74 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ messageToReadable appState message =
116116
case message.code of
117117
-- Shared
118118
"error.validation.km_id_uniqueness" ->
119-
Just <| gettext "Knowledge Model ID is already used." appState.locale
119+
Just <| gettext "Knowledge model ID is already used." appState.locale
120120

121121
"error.validation.pkg_id_uniqueness" ->
122-
Just <| gettext "Knowledge Model already exists." appState.locale
122+
Just <| gettext "Knowledge model already exists." appState.locale
123123

124124
"error.validation.pkg_unsupported_metamodel_version" ->
125-
Just <| gettext "Knowledge Model metamodel version is not supported." appState.locale
125+
Just <| gettext "Knowledge model metamodel version is not supported." appState.locale
126126

127127
"error.validation.tml_id_uniqueness" ->
128128
Just <| gettext "Document template already exists." appState.locale
@@ -168,14 +168,76 @@ messageToReadable appState message =
168168
Just <| gettext "A hash query param has to be provided." appState.locale
169169

170170
-- Wizard
171+
"error.database.entity_not_found" ->
172+
case List.head message.params of
173+
Just "branch" ->
174+
Just <| gettext "Knowledge model editor not found." appState.locale
175+
176+
Just "document" ->
177+
Just <| gettext "Document not found." appState.locale
178+
179+
Just "document_template" ->
180+
Just <| gettext "Document template not found." appState.locale
181+
182+
Just "document_template_draft" ->
183+
Just <| gettext "Document template draft not found." appState.locale
184+
185+
Just "document_template_asset" ->
186+
Just <| gettext "Document template asset not found." appState.locale
187+
188+
Just "document_template_file" ->
189+
Just <| gettext "Document template file not found." appState.locale
190+
191+
Just "knowledge_model_migration" ->
192+
Just <| gettext "Knowledge model migration not found." appState.locale
193+
194+
Just "locale" ->
195+
Just <| gettext "Locale not found." appState.locale
196+
197+
Just "package" ->
198+
Just <| gettext "Knowledge model not found." appState.locale
199+
200+
Just "questionnaire" ->
201+
Just <| gettext "Project not found." appState.locale
202+
203+
Just "questionnaire_action" ->
204+
Just <| gettext "Project action not found." appState.locale
205+
206+
Just "questionnaire_comment" ->
207+
Just <| gettext "Comment not found." appState.locale
208+
209+
Just "questionnaire_comment_thread" ->
210+
Just <| gettext "Comment thread not found." appState.locale
211+
212+
Just "questionnaire_file" ->
213+
Just <| gettext "Project file not found." appState.locale
214+
215+
Just "questionnaire_importer" ->
216+
Just <| gettext "Project importer not found." appState.locale
217+
218+
Just "questionnaire_migration" ->
219+
Just <| gettext "Project migration not found." appState.locale
220+
221+
Just "questionnaire_version" ->
222+
Just <| gettext "Project version not found." appState.locale
223+
224+
Just "user_entity" ->
225+
Just <| gettext "User not found." appState.locale
226+
227+
Just "user_group" ->
228+
Just <| gettext "User group not found." appState.locale
229+
230+
_ ->
231+
Just <| gettext "Not found." appState.locale
232+
171233
"error.validation.app_id_uniqueness" ->
172234
Just <| gettext "App ID is already used." appState.locale
173235

174236
"error.validation.doc_tml_file_or_asset_uniqueness" ->
175237
Just <| gettext "File with this name already exists." appState.locale
176238

177239
"error.validation.openid_code_absence" ->
178-
Just <| gettext "Authentication Code is not provided." appState.locale
240+
Just <| gettext "Authentication code is not provided." appState.locale
179241

180242
"error.validation.openid_profile_info_absence" ->
181243
Just <| gettext "Profile Information from OpenID service is missing." appState.locale
@@ -195,7 +257,7 @@ messageToReadable appState message =
195257
in
196258
Just <|
197259
String.format
198-
(gettext "Limit of %s reached (current: %s, limit: %s)" appState.locale)
260+
(gettext "Limit of %s reached (current: %s, limit: %s)." appState.locale)
199261
[ gettext "storage" appState.locale, parseBytes current, parseBytes limit ]
200262

201263
what :: current :: limit :: [] ->
@@ -232,10 +294,10 @@ messageToReadable appState message =
232294
_ ->
233295
what
234296
in
235-
Just <| String.format (gettext "Limit of %s reached (current: %s, limit: %s)" appState.locale) [ whatTranslated, current, limit ]
297+
Just <| String.format (gettext "Limit of %s reached (current: %s, limit: %s)." appState.locale) [ whatTranslated, current, limit ]
236298

237299
_ ->
238-
Just <| String.format (gettext "Limit of %s reached (current: %s, limit: %s)" appState.locale) message.params
300+
Just <| String.format (gettext "Limit of %s reached (current: %s, limit: %s)." appState.locale) message.params
239301

240302
"error.service.lb.missing_locale_json" ->
241303
Just <| gettext "\"locale.json\" was not found in archive." appState.locale
@@ -247,13 +309,13 @@ messageToReadable appState message =
247309
Just <| String.format (gettext "File \"%s\" was not found in archive." appState.locale) message.params
248310

249311
"error.service.lb.pull_non_existing_locale" ->
250-
Just <| gettext "The locale not found in Registry" appState.locale
312+
Just <| gettext "The locale not found in Registry." appState.locale
251313

252314
"error.service.pkg.pkg_cant_be_deleted_because_it_is_used_by_some_other_entity" ->
253-
Just <| gettext "Knowledge Model cannot be deleted because it is used in some Projects or Knowledge Model Editors." appState.locale
315+
Just <| gettext "Knowledge model cannot be deleted because it is used in some projects or knowledge model editors." appState.locale
254316

255317
"error.service.pb.pull_non_existing_pkg" ->
256-
Just <| gettext "The Knowledge Model was not found in the Registry." appState.locale
318+
Just <| gettext "The knowledge model was not found in the Registry." appState.locale
257319

258320
"error.service.qtn.qtn_cant_be_deleted_because_it_is_used_in_migration" ->
259321
Just <| gettext "Project cannot be deleted because it is used in some project migration." appState.locale
@@ -262,10 +324,10 @@ messageToReadable appState message =
262324
Just <| gettext "The document template was not found in the Registry." appState.locale
263325

264326
"error.service.token.incorrect_email_or_password" ->
265-
Just <| gettext "Incorrect email or password" appState.locale
327+
Just <| gettext "Incorrect email or password." appState.locale
266328

267329
"error.service.token.incorrect_code" ->
268-
Just <| gettext "Incorrect authentication code" appState.locale
330+
Just <| gettext "Incorrect authentication code." appState.locale
269331

270332
"error.service.token.account_is_not_activated" ->
271333
Just <| gettext "The account is not activated." appState.locale

engine-shared/elm/Shared/Form/Validate.elm

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
module Shared.Form.Validate exposing
22
( confirmation
33
, dict
4+
, documentTemplateId
45
, ifElse
56
, kmId
7+
, localeId
68
, maybeString
79
, optionalInt
810
, optionalString
@@ -121,14 +123,24 @@ uuid =
121123
|> V.map Uuid.fromUuidString
122124

123125

124-
organizationId : Validation FormError String
125-
organizationId =
126-
regex RegexPatterns.organizationId "Organization ID can only contain alphanumeric characters and dots. It must start and end with an alphanumeric character."
126+
organizationId : { a | locale : Gettext.Locale } -> Validation FormError String
127+
organizationId appState =
128+
regex RegexPatterns.organizationId (gettext "Fill in a valid organization ID." appState.locale)
127129

128130

129-
kmId : Validation FormError String
130-
kmId =
131-
regex RegexPatterns.kmId "Knowledge Model ID can only contain alphanumeric characters and hyphens. It must start and end with an alphanumeric character."
131+
kmId : { a | locale : Gettext.Locale } -> Validation FormError String
132+
kmId appState =
133+
regex RegexPatterns.kmId (gettext "Fill in a valid knowledge model ID." appState.locale)
134+
135+
136+
documentTemplateId : { a | locale : Gettext.Locale } -> Validation FormError String
137+
documentTemplateId appState =
138+
regex RegexPatterns.documentTemplateId (gettext "Fill in a valid document template ID." appState.locale)
139+
140+
141+
localeId : { a | locale : Gettext.Locale } -> Validation FormError String
142+
localeId appState =
143+
regex RegexPatterns.localeId (gettext "Fill in a valid locale ID." appState.locale)
132144

133145

134146
projectTag : { a | locale : Gettext.Locale } -> Validation FormError String

engine-shared/elm/Shared/RegexPatterns.elm

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module Shared.RegexPatterns exposing (color, date, datetime, doi, email, fromString, kmId, orcid, organizationId, projectTag, time, url, uuid)
1+
module Shared.RegexPatterns exposing (color, date, datetime, documentTemplateId, doi, email, fromString, kmId, localeId, orcid, organizationId, projectTag, time, url, uuid)
22

33
import Regex exposing (Regex)
44

@@ -15,7 +15,7 @@ uuid =
1515

1616
url : Regex
1717
url =
18-
fromString "^(https:\\/\\/www\\.|http:\\/\\/www\\.|https:\\/\\/|http:\\/\\/)?[a-zA-Z]{2,}(\\.[a-zA-Z]{2,})(\\.[a-zA-Z]{2,})?\\/[a-zA-Z0-9]{2,}|((https:\\/\\/www\\.|http:\\/\\/www\\.|https:\\/\\/|http:\\/\\/)?[a-zA-Z]{2,}(\\.[a-zA-Z]{2,})(\\.[a-zA-Z]{2,})?)|(https:\\/\\/www\\.|http:\\/\\/www\\.|https:\\/\\/|http:\\/\\/)?[a-zA-Z0-9]{2,}\\.[a-zA-Z0-9]{2,}\\.[a-zA-Z0-9]{2,}(\\.[a-zA-Z0-9]{2,})?"
18+
fromString "^(?:(?:https?|ftp):\\/\\/)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:\\/\\S*)?$"
1919

2020

2121
orcid : Regex
@@ -30,12 +30,22 @@ doi =
3030

3131
organizationId : Regex
3232
organizationId =
33-
fromString "^^(?![.])(?!.*[.]$)[a-zA-Z0-9.]+$"
33+
fromString "^[A-Za-z0-9-_.]+$"
3434

3535

3636
kmId : Regex
3737
kmId =
38-
fromString "^^(?![-])(?!.*[-]$)[a-zA-Z0-9-]+$"
38+
fromString "^[A-Za-z0-9-_.]+$"
39+
40+
41+
documentTemplateId : Regex
42+
documentTemplateId =
43+
fromString "^[A-Za-z0-9-_.]+$"
44+
45+
46+
localeId : Regex
47+
localeId =
48+
fromString "^[A-Za-z0-9-_.]+$"
3949

4050

4151
projectTag : Regex

engine-wizard/elm/Wizard.elm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ init flags location key =
2929
AppState.init flags key
3030

3131
model =
32-
initLocalModel <| initialModel appState
32+
initLocalModel appState <| initialModel appState
3333

3434
cmd =
3535
if appState.invalidSession then

0 commit comments

Comments
 (0)