Merged in spark1538-risk-admin-cloning (pull request #79)
SPARK-1538: Spark Admin - Cloning Approved-by: Eric Harding <eric.harding@bluetradesys.com>
This commit is contained in:
commit
5b1cf890e8
3 files changed
+12
-25
No files matched your search
@@ -226,8 +226,8 @@ let update msg (model:Users.Types.Model) : Model * Cmd<Msg> =
|
||||
model, Cmd.Empty
|
||||
| UpdateField field ->
|
||||
{ model with scratchUser = applyUpdate field model.scratchUser; ConfirmModal = ("", Msg.SwitchTab model.currentTab) } , Cmd.Empty
|
||||
| Clone usr ->
|
||||
{ model with scratchUser = { usr with id = 0u; name = usr.name + "_copy" }}, Cmd.Empty
|
||||
| CloneUser ->
|
||||
{ model with PreviousScratchUser = model.scratchUser; scratchUser = { model.scratchUser with id = 0u; name = sprintf "%s_clone" model.scratchUser.name }; OptionsMenuOpen = ""}, Cmd.ofMsg (SwitchTab General)
|
||||
| CopyFrom (usrSrc, usrDest) ->
|
||||
let nusr = { usrSrc with
|
||||
id = usrDest.id
|
||||
|
||||
@@ -36,7 +36,7 @@ type Msg =
|
||||
| RpcResponse of string
|
||||
| UpdateAdminData of AdminData
|
||||
| UpdateField of UserField
|
||||
| Clone of BTSUser
|
||||
| CloneUser
|
||||
| CopyFrom of BTSUser * BTSUser
|
||||
| Delete of BTSUser
|
||||
| AddUser
|
||||
|
||||
@@ -178,27 +178,6 @@ let userControls (model:Model) (dispatch:Msg->Unit) =
|
||||
[
|
||||
saveButton model dispatch
|
||||
Button.button "Revert" "" "" (if dirty then Button.Enabled else Button.Disabled) (fun _ -> SwitchUser (currentUser) |> dispatch)
|
||||
(*p [ ClassName "control" ]
|
||||
[ a [ ClassName "button is-light"
|
||||
Title "Clone"
|
||||
OnClick (fun _ -> dispatch <| Clone currentUser)
|
||||
Disabled disabled
|
||||
]
|
||||
[ span [ ClassName "icon is-small" ]
|
||||
[ i [ ClassName "fa fa-clone" ]
|
||||
[ ] ]
|
||||
]
|
||||
]*)
|
||||
(*p [ ClassName "control" ]
|
||||
[ a [ ClassName "button is-light" ]
|
||||
[ span [ ClassName "icon is-small"
|
||||
Title "Copy from user 1 ..."
|
||||
OnClick (fun _ -> dispatch <| CopyFrom (usersList.Head, currentUser))
|
||||
]
|
||||
[ i [ ClassName "fa fa-copy" ]
|
||||
[ ] ]
|
||||
]
|
||||
]*)
|
||||
]
|
||||
|
||||
|
||||
@@ -276,7 +255,11 @@ let userSelectionGrid (usersList:BTSUser list) (currentUser:BTSUser) (dispatch:M
|
||||
|
||||
let menuItem (user:BTSUser) (selectedUser:BTSUser) model dispatch =
|
||||
a [ ClassName (isActiveUser user.id selectedUser)
|
||||
OnClick (fun _ -> SwitchUser user |> dispatch)
|
||||
OnClick (fun _ ->
|
||||
match user.name = model.OptionsMenuOpen with
|
||||
| false -> SwitchUser user |> dispatch
|
||||
| _ -> ()
|
||||
)
|
||||
] [
|
||||
span [] [ str user.name ]
|
||||
span [ Class "is-pulled-right menu-icon" ]
|
||||
@@ -305,6 +288,10 @@ let menuItem (user:BTSUser) (selectedUser:BTSUser) model dispatch =
|
||||
OnClick (fun _ -> dispatch <| Delete user)
|
||||
]
|
||||
[ str "Remove" ]
|
||||
a [ Class "dropdown-item"
|
||||
OnClick (fun _ -> dispatch <| CloneUser)
|
||||
]
|
||||
[ str "Clone" ]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user