SPARK-1428, SPARK-1430
This commit is contained in:
1 parent
12db326f1d
commit
669ccd5ffc
5 files changed
+56
-53
No files matched your search
@@ -56,9 +56,29 @@ body {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.is-main-control-bar {
|
||||
width:100%;
|
||||
height:$tabs-height;
|
||||
background:$grey-lighter;
|
||||
overflow: hidden;
|
||||
.is-light {
|
||||
background:$grey-lighter;
|
||||
border-right: 1px solid $grey-light;
|
||||
&:hover {
|
||||
background:$grey-light;
|
||||
}
|
||||
}
|
||||
.is-danger-hover {
|
||||
&:hover {
|
||||
background: $red;
|
||||
color: $white;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.is-tab-content {
|
||||
padding-left:3rem;
|
||||
height: calc(100% - #{$tabs-height} - 1.5rem );
|
||||
height: calc(100% - #{$tabs-height} - #{$tabs-height} - 1.6rem);
|
||||
overflow: auto;
|
||||
input[type=text], input[type=password] {
|
||||
max-width: 43rem;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
module Accounts.Types
|
||||
|
||||
open bts.api.admin
|
||||
open Fable.Core
|
||||
open bts.api
|
||||
open bts.api.orderman
|
||||
open JSMap
|
||||
@@ -9,8 +8,8 @@ open bts.co2
|
||||
|
||||
type Tab =
|
||||
| General
|
||||
| ClipLimitsTab
|
||||
| PositionLimitsTab
|
||||
//| ClipLimitsTab
|
||||
| LimitsTab
|
||||
| CreditLimitsTab
|
||||
| ExchangeSettingsTab
|
||||
| ConnectionsTab
|
||||
|
||||
@@ -208,9 +208,9 @@ let clipLimitsView model dispatch =
|
||||
div []
|
||||
[
|
||||
div [ ClassName "columns" ][
|
||||
h1 [ ClassName "is-size-4 column is-narrow" ][str "Clip Limits" ]
|
||||
div [ ClassName "column is-size-7 has-text-grey-mid" ]
|
||||
[str "Clip limits can be set for one security, for all securities in a product (by selecting \"All\" for securities), or for all products within a security type (by selecting \"All\" for both symbol and security)"]
|
||||
div [ ClassName "column" ][]
|
||||
]
|
||||
TableControl.createDataTable (Some headerRow) rws
|
||||
span [ClassName "is-pulled-right"] [ Button.button "Add" "" "plus" Button.Enabled addRow ]
|
||||
@@ -482,8 +482,9 @@ let securityLimits model dispatch =
|
||||
|
||||
]
|
||||
|
||||
let positionLimitsView model dispatch =
|
||||
let LimitsView model dispatch =
|
||||
div [] [
|
||||
clipLimitsView model dispatch
|
||||
productLimits model dispatch
|
||||
securityLimits model dispatch
|
||||
]
|
||||
@@ -546,27 +547,30 @@ let tabContent model dispatch =
|
||||
div [Key (string model.scratch.id); ClassName "is-tab-content"] [
|
||||
(match model.tab with
|
||||
| General -> generalView model dispatch
|
||||
| ClipLimitsTab -> clipLimitsView model dispatch
|
||||
| PositionLimitsTab -> positionLimitsView model dispatch
|
||||
//| ClipLimitsTab -> clipLimitsView model dispatch
|
||||
| LimitsTab -> LimitsView model dispatch
|
||||
| ConnectionsTab -> ConnectionsView model dispatch
|
||||
| CreditLimitsTab -> creditLimitsView model dispatch
|
||||
| ExchangeSettingsTab -> exchangeSettings model dispatch)
|
||||
]
|
||||
|
||||
|
||||
let accountControls selected (dispatch:Msg->unit) =
|
||||
let accountControls model selected (dispatch:Msg->unit) =
|
||||
let remButton =
|
||||
match selected with
|
||||
| None -> Button.button "Remove" "" "times" Disabled ignore
|
||||
| Some acc -> Button.button "Remove" "" "times" Enabled (fun _ -> dispatch <| DeleteAccount acc)
|
||||
| None -> Button.button "Remove Account" "is-light is-danger-hover" "times" Disabled ignore
|
||||
| Some acc -> Button.button "Remove Account" "is-light is-danger-hover" "times" Enabled (fun _ -> dispatch <| DeleteAccount acc)
|
||||
let revertFun =
|
||||
match (selectedAccount model) with
|
||||
| Some acc -> fun _ -> (dispatch <| SelectAccount acc)
|
||||
| None -> ignore
|
||||
|
||||
div [ClassName "is-clearfix"] [
|
||||
p [ ClassName "" ][
|
||||
Button.button "Add" "" "plus" Enabled (fun _ -> dispatch AddAccount)
|
||||
//nbsp.element
|
||||
br []
|
||||
|
||||
div [ClassName "is-main-control-bar"] [
|
||||
saveButton model dispatch
|
||||
Button.button "Revert" "is-light" "" (if isDirty model then Enabled else Disabled) revertFun
|
||||
Button.button "Add Account" "is-light" "plus" Enabled (fun _ -> dispatch AddAccount)
|
||||
remButton
|
||||
]
|
||||
]
|
||||
|
||||
let isActive account = function
|
||||
@@ -590,7 +594,6 @@ let accountsMenu (accounts:BTSAccount[]) selectedAccount dispatch =
|
||||
str account.name]
|
||||
]
|
||||
]
|
||||
accountControls selectedAccount dispatch
|
||||
]
|
||||
]
|
||||
|
||||
@@ -625,8 +628,6 @@ let accountSelectionGrid (accountList:BTSAccount list) (currentAccount:BTSAccoun
|
||||
]
|
||||
div[][
|
||||
TableControl.createSelectorTable (Some headerRow) rws
|
||||
accountControls (Some currentAccount) dispatch
|
||||
//userControls usersList currentUser dispatch (not (State.userIsSelected currentUser State.defaultScratchUser))
|
||||
]
|
||||
|
||||
|
||||
@@ -672,12 +673,11 @@ let NavRoot (accounts:BTSAccount[]) selectedAccount dispatch =
|
||||
]
|
||||
]
|
||||
]
|
||||
accountControls selectedAccount dispatch
|
||||
]
|
||||
|
||||
let tabName = function
|
||||
| ClipLimitsTab -> "Clip Limits"
|
||||
| PositionLimitsTab -> "Position Limits"
|
||||
//| ClipLimitsTab -> "Clip Limits"
|
||||
| LimitsTab -> "Limits"
|
||||
| CreditLimitsTab -> "Credit Limits"
|
||||
| ConnectionsTab -> "Connections"
|
||||
| ExchangeSettingsTab -> "Exchange Settings"
|
||||
@@ -689,11 +689,6 @@ let tabHeader tab currentTab dispatch =
|
||||
]
|
||||
|
||||
let root (model:Model) dispatch =
|
||||
let revertFun =
|
||||
match (selectedAccount model) with
|
||||
| Some acc -> fun _ -> (dispatch <| SelectAccount acc)
|
||||
| None -> ignore
|
||||
|
||||
match model.adminData with
|
||||
| None -> div[][str "Loading account list..."]
|
||||
| Some data ->
|
||||
@@ -705,17 +700,14 @@ let root (model:Model) dispatch =
|
||||
div [ ClassName "tabs is-boxed" ] [
|
||||
ul [] [
|
||||
tabHeader General model.tab dispatch
|
||||
tabHeader ClipLimitsTab model.tab dispatch
|
||||
tabHeader PositionLimitsTab model.tab dispatch
|
||||
//tabHeader ClipLimitsTab model.tab dispatch
|
||||
tabHeader LimitsTab model.tab dispatch
|
||||
tabHeader ConnectionsTab model.tab dispatch
|
||||
// tabHeader CreditLimits model.tab dispatch
|
||||
tabHeader ExchangeSettingsTab model.tab dispatch
|
||||
]
|
||||
]
|
||||
div [ ClassName "pull-right" ] [
|
||||
yield saveButton model dispatch
|
||||
yield Button.button "Revert" "is-light" "" (if isDirty model then Enabled else Disabled) revertFun
|
||||
]
|
||||
tabContent model dispatch
|
||||
accountControls model (selectedAccount model) dispatch
|
||||
]
|
||||
]
|
||||
@@ -116,7 +116,7 @@ let getCurrentOrFirstUser (model:Model) (userList:BTSUser list) =
|
||||
| Some cu, _ -> cu
|
||||
| None, Some pu -> pu
|
||||
| None, None -> getFirstUser userList
|
||||
| None, None -> defaultScratchUser
|
||||
//| None, None -> defaultScratchUser
|
||||
|
||||
let getCurrentUser (model:Model) = getCurrentOrFirstUser model model.userList
|
||||
|
||||
|
||||
@@ -161,14 +161,16 @@ let tabContent (model:Model) (dispatch:Msg->Unit) =
|
||||
| Tab.OrderRouting, true -> orderRoutingTabContent model dispatch)
|
||||
]
|
||||
|
||||
let userControls (usersList:BTSUser list) (currentUser:BTSUser) (dispatch:Msg->Unit) (disabled:bool)=
|
||||
div [ ClassName "is-pulled-right is-clearfix"; Style [Margin "1rem 2.5rem"] ]
|
||||
let userControls (model:Model) (dispatch:Msg->Unit) =
|
||||
let currentUser = State.getCurrentUser model
|
||||
let dirty = State.userIsdirty State.defaultScratchUser model.scratchUser (State.getCurrentUser model)
|
||||
|
||||
div [ ClassName "is-main-control-bar" ]
|
||||
[
|
||||
p [ ClassName "" ][
|
||||
Button.button "Add" "" "plus" Button.Enabled (fun _ -> dispatch <| AddUser)
|
||||
//nbsp.element
|
||||
//Button.button "Remove" "" "times" Button.Enabled (fun _ -> dispatch <| Delete currentUser)
|
||||
]
|
||||
saveButton model dispatch
|
||||
Button.button "Revert" "is-light" "" (if dirty then Button.Enabled else Button.Disabled) (fun _ -> SwitchUser (currentUser) |> dispatch)
|
||||
Button.button "Add User" "is-light" "plus" Button.Enabled (fun _ -> dispatch <| AddUser)
|
||||
Button.button "Remove User" "is-light is-danger-hover" "times" Button.Enabled (fun _ -> dispatch <| Delete currentUser)
|
||||
(*p [ ClassName "control" ]
|
||||
[ a [ ClassName "button is-light"
|
||||
Title "Clone"
|
||||
@@ -217,7 +219,6 @@ let usersMenu (usersList:BTSUser list) (currentUser:BTSUser) (dispatch:Msg->Unit
|
||||
|
||||
]
|
||||
]
|
||||
userControls usersList currentUser dispatch (not (State.userIsSelected currentUser State.defaultScratchUser))
|
||||
]
|
||||
]
|
||||
|
||||
@@ -252,7 +253,6 @@ let userSelectionGrid (usersList:BTSUser list) (currentUser:BTSUser) (dispatch:M
|
||||
]
|
||||
div[][
|
||||
TableControl.createSelectorTable (Some headerRow) rws
|
||||
userControls usersList currentUser dispatch (not (State.userIsSelected currentUser State.defaultScratchUser))
|
||||
]
|
||||
|
||||
|
||||
@@ -277,7 +277,6 @@ let NavRoot (usersList:BTSUser list) (currentUser:BTSUser) (dispatch:Msg->Unit)
|
||||
]
|
||||
]
|
||||
]
|
||||
userControls usersList currentUser dispatch (not (State.userIsSelected currentUser State.defaultScratchUser))
|
||||
]
|
||||
|
||||
let selectionPageContent (model:Model) (dispatch:Msg->Unit) =
|
||||
@@ -298,8 +297,6 @@ let selectionPageContent (model:Model) (dispatch:Msg->Unit) =
|
||||
|
||||
let root (model:Model) (dispatch:Msg->Unit) =
|
||||
|
||||
let dirty = State.userIsdirty State.defaultScratchUser model.scratchUser (State.getCurrentUser model)
|
||||
|
||||
(match model.adminData with
|
||||
| None -> div[][str "Loading user list..."]
|
||||
| Some data ->
|
||||
@@ -325,13 +322,8 @@ let root (model:Model) (dispatch:Msg->Unit) =
|
||||
[ str "Order Routing" ] ]
|
||||
]
|
||||
]
|
||||
div [ ClassName "pull-right" ]
|
||||
[
|
||||
yield saveButton model dispatch
|
||||
yield Button.button "Revert" "is-light" "" (if dirty then Button.Enabled else Button.Disabled) (fun _ -> SwitchUser (State.getCurrentUser model) |> dispatch)
|
||||
]
|
||||
tabContent model dispatch
|
||||
|
||||
userControls model dispatch
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
Reference in new issue
Block a user