Skip to content

Commit

Permalink
Fixes #22883: Update elm dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
VinceMacBuche committed Jun 14, 2023
1 parent 2fbc644 commit f42ea8d
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 109 deletions.
4 changes: 3 additions & 1 deletion auth-backends/src/main/elm/elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
"elm/browser": "1.0.2",
"elm/core": "1.0.5",
"elm/html": "1.0.0",
"elm/http": "1.0.0",
"elm/http": "2.0.0",
"elm/json": "1.1.3",
"elm/url": "1.0.0",
"elm-community/list-extra": "8.7.0",
"pablen/toasty": "1.2.0"
},
"indirect": {
"elm/bytes": "1.0.8",
"elm/file": "1.0.5",
"elm/random": "1.0.0",
"elm/regex": "1.0.0",
"elm/time": "1.0.0",
Expand Down
19 changes: 6 additions & 13 deletions auth-backends/src/main/elm/sources/AuthBackends.elm
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ getTargets model =
, headers = []
, url = url
, body = emptyBody
, expect = expectJson decodeApiCurrentAuthConf
, expect = expectJson GetCurrentAuthConfig decodeApiCurrentAuthConf
, timeout = Nothing
, withCredentials = False
, tracker = Nothing
}
in
send GetCurrentAuthConfig req
req



Expand Down Expand Up @@ -428,15 +428,8 @@ getErrorMessage e =
let
errMessage =
case e of
Http.BadStatus b ->
let
status =
b.status

message =
status.message
in
"Code " ++ String.fromInt status.code ++ " : " ++ message
Http.BadStatus status ->
"Code " ++ String.fromInt status

Http.BadUrl str ->
"Invalid API url"
Expand All @@ -447,7 +440,7 @@ getErrorMessage e =
Http.NetworkError ->
"Network error"

Http.BadPayload str rstr ->
Http.BadBody str ->
str
in
errMessage
Expand Down
2 changes: 1 addition & 1 deletion branding/src/main/elm/elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"elm/core": "1.0.5",
"elm/file": "1.0.5",
"elm/html": "1.0.0",
"elm/http": "1.0.0",
"elm/http": "2.0.0",
"elm/json": "1.1.3",
"elm/url": "1.0.0",
"pablen/toasty": "1.2.0",
Expand Down
15 changes: 6 additions & 9 deletions branding/src/main/elm/sources/ApiCall.elm
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,18 @@ getSettings model =
url =
model.contextPath ++ "/secure/api/branding"

headers =
[]

req =
request
{ method = "GET"
, headers = []
, url = url
, body = emptyBody
, expect = expectJson decodeApiSettings
, expect = expectJson GetSettings decodeApiSettings
, timeout = Nothing
, withCredentials = False
, tracker = Nothing
}
in
send GetSettings req
req


saveSettings : Model -> Cmd Msg
Expand All @@ -38,9 +35,9 @@ saveSettings model =
, headers = []
, url = model.contextPath ++ "/secure/api/branding"
, body = jsonBody (encodeSettings model.settings)
, expect = expectJson decodeApiSettings
, expect = expectJson SaveSettings decodeApiSettings
, timeout = Nothing
, withCredentials = False
, tracker = Nothing
}
in
send SaveSettings req
req
13 changes: 3 additions & 10 deletions branding/src/main/elm/sources/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,8 @@ getErrorMessage e =
let
errMessage =
case e of
Http.BadStatus b ->
let
status =
b.status

message =
status.message
in
"Code " ++ String.fromInt status.code ++ " : " ++ message
Http.BadStatus status ->
"Code " ++ String.fromInt status

Http.BadUrl str ->
"Invalid API url"
Expand All @@ -316,7 +309,7 @@ getErrorMessage e =
Http.NetworkError ->
"Network error"

Http.BadPayload str rstr ->
Http.BadBody str ->
str
in
errMessage
Expand Down
2 changes: 1 addition & 1 deletion ci/plugins.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG JDK_VERSION=17
FROM maven:3-openjdk-${JDK_VERSION}
FROM maven:3-amazoncorretto-${JDK_VERSION}-debian

ARG USER_ID=1000
COPY ci/user.sh .
Expand Down
4 changes: 3 additions & 1 deletion user-management/src/main/elm/elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
"elm/browser": "1.0.2",
"elm/core": "1.0.5",
"elm/html": "1.0.0",
"elm/http": "1.0.0",
"elm/http": "2.0.0",
"elm/json": "1.1.3",
"elm-community/list-extra": "8.7.0",
"pablen/toasty": "1.2.0"
},
"indirect": {
"elm/bytes": "1.0.8",
"elm/file": "1.0.5",
"elm/random": "1.0.0",
"elm/regex": "1.0.0",
"elm/time": "1.0.0",
Expand Down
100 changes: 37 additions & 63 deletions user-management/src/main/elm/sources/ApiCalls.elm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module ApiCalls exposing (..)


import DataTypes exposing (AddUserForm, Authorization, Model, Msg(..), User)
import Http exposing (emptyBody, expectJson, jsonBody, request, send)
import Http exposing (emptyBody, expectJson, jsonBody, request, get, post)
import JsonDecoder exposing (decodeApiAddUserResult, decodeApiCurrentUsersConf, decodeApiDeleteUserResult, decodeApiReloadResult, decodeApiRoleCoverage, decodeApiUpdateUserResult, decodeGetRoleApiResult)
import JsonEncoder exposing (encodeAddUser, encodeAuthorization)

Expand All @@ -19,111 +19,85 @@ getUsersConf : Model -> Cmd Msg
getUsersConf model =
let
req =
request
{ method = "GET"
, headers = []
, url = getUrl model "/usermanagement/users"
, body = emptyBody
, expect = expectJson decodeApiCurrentUsersConf
, timeout = Nothing
, withCredentials = False
get
{ url = getUrl model "/usermanagement/users"
, expect = expectJson GetUserInfo decodeApiCurrentUsersConf
}
in
send GetUserInfo req
req


postReloadConf : Model -> Cmd Msg
postReloadConf model =
let
req =
request
{ method = "POST"
, headers = []
, url = getUrl model "/usermanagement/users/reload"
, body = emptyBody
, expect = expectJson decodeApiReloadResult
, timeout = Nothing
, withCredentials = False
post
{ url = getUrl model "/usermanagement/users/reload"
, body = emptyBody
, expect = expectJson PostReloadUserInfo decodeApiReloadResult
}
in
send PostReloadUserInfo req
req

computeRoleCoverage : Model -> Authorization -> Cmd Msg
computeRoleCoverage model authorizations =
let
req =
request
{ method = "POST"
, headers = []
, url = getUrl model "/usermanagement/coverage"
, body = jsonBody (encodeAuthorization authorizations)
, expect = expectJson decodeApiRoleCoverage
, timeout = Nothing
, withCredentials = False
post
{ url = getUrl model "/usermanagement/coverage"
, body = jsonBody (encodeAuthorization authorizations)
, expect = expectJson ComputeRoleCoverage decodeApiRoleCoverage
}
in
send ComputeRoleCoverage req
req

addUser : Model -> AddUserForm -> Cmd Msg
addUser model userForm =
let
req =
request
{ method = "POST"
, headers = []
, url = getUrl model "/usermanagement"
, body = jsonBody (encodeAddUser userForm)
, expect = expectJson decodeApiAddUserResult
, timeout = Nothing
, withCredentials = False
post
{ url = getUrl model "/usermanagement"
, body = jsonBody (encodeAddUser userForm)
, expect = expectJson AddUser decodeApiAddUserResult
}
in
send AddUser req
req

deleteUser : String -> Model -> Cmd Msg
deleteUser username model =
let
req =
request
{ method = "DELETE"
, headers = []
, url = getUrl model ("/usermanagement/" ++ username)
, body = emptyBody
, expect = expectJson decodeApiDeleteUserResult
, timeout = Nothing
, withCredentials = False
{ method = "DELETE"
, headers = []
, url = getUrl model ("/usermanagement/" ++ username)
, body = emptyBody
, expect = expectJson DeleteUser decodeApiDeleteUserResult
, timeout = Nothing
, tracker = Nothing
}
in
send DeleteUser req
req

updateUser : Model -> String -> AddUserForm -> Cmd Msg
updateUser model toUpdate userForm =
let
req =
request
{ method = "POST"
, headers = []
, url = getUrl model ("/usermanagement/update/" ++ toUpdate)
, body = jsonBody (encodeAddUser userForm)
, expect = expectJson decodeApiUpdateUserResult
, timeout = Nothing
, withCredentials = False
post
{ url = getUrl model ("/usermanagement/update/" ++ toUpdate)
, body = jsonBody (encodeAddUser userForm)
, expect = expectJson UpdateUser decodeApiUpdateUserResult
}
in
send UpdateUser req
req

getRoleConf : Model -> Cmd Msg
getRoleConf model =
let
req =
request
{ method = "GET"
, headers = []
, url = getUrl model "/usermanagement/roles"
, body = emptyBody
, expect = expectJson decodeGetRoleApiResult
, timeout = Nothing
, withCredentials = False
get
{ url = getUrl model "/usermanagement/roles"
, expect = expectJson GetRoleConf decodeGetRoleApiResult
}
in
send GetRoleConf req
req
13 changes: 3 additions & 10 deletions user-management/src/main/elm/sources/Init.elm
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,8 @@ getErrorMessage e =
let
errMessage =
case e of
Http.BadStatus b ->
let
status =
b.status

message =
status.message
in
"Code " ++ String.fromInt status.code ++ " : " ++ message
Http.BadStatus status ->
"Code " ++ String.fromInt status

Http.BadUrl str ->
"Invalid API url"
Expand All @@ -53,7 +46,7 @@ getErrorMessage e =
Http.NetworkError ->
"Network error"

Http.BadPayload str rstr ->
Http.BadBody str ->
str
in
errMessage
Expand Down

0 comments on commit f42ea8d

Please sign in to comment.