@ -27,7 +27,7 @@ q-page.admin-mail
)
)
q - separator ( inset )
q - separator ( inset )
. row . q - pa - md . q - col - gutter - md
. row . q - pa - md . q - col - gutter - md
. col - auto
. col - 12. col - lg - auto
q - card . rounded - borders . bg - dark
q - card . rounded - borders . bg - dark
q - list (
q - list (
style = 'min-width: 350px;'
style = 'min-width: 350px;'
@ -35,8 +35,8 @@ q-page.admin-mail
dark
dark
)
)
q - item (
q - item (
v - for = 'str of combinedA ctiveStrategies'
v - for = 'str of state.a ctiveStrategies'
: key = 'str. key '
: key = 'str. id '
active - class = 'bg-primary text-white'
active - class = 'bg-primary text-white'
: active = 'state.selectedStrategy === str.id'
: active = 'state.selectedStrategy === str.id'
@ click = 'state.selectedStrategy = str.id'
@ click = 'state.selectedStrategy = str.id'
@ -77,20 +77,124 @@ q-page.admin-mail
. col
. col
q - card . q - pb - sm
q - card . q - pb - sm
q - card - section
q - card - section
. text - subtitle1 { { t ( 'admin.storage.contentTypes' ) } }
. text - subtitle1 { { t ( 'admin.auth.info' ) } }
. text - body2 . text - grey { { t ( 'admin.storage.contentTypesHint' ) } }
q - item
blueprint - icon ( icon = 'information' )
q - item - section
q - item - label { { t ( ` admin.auth.infoName ` ) } }
q - item - label ( caption ) { { t ( ` admin.auth.infoNameHint ` ) } }
q - item - section
q - input (
outlined
v - model = 'state.strategy.displayName'
dense
hide - bottom - space
: aria - label = 't(`admin.auth.infoName`)'
)
q - separator . q - my - sm ( inset )
q - item ( tag = 'label' )
blueprint - icon ( icon = 'shutdown' )
q - item - section
q - item - label { { t ( ` admin.auth.enabled ` ) } }
q - item - label ( caption ) { { t ( ` admin.auth.enabledHint ` ) } }
q - item - label . text - deep - orange ( v - if = 'state.strategy.strategy.key === `local`' , caption ) { { t ( ` admin.auth.enabledForced ` ) } }
q - item - section ( avatar )
q - toggle (
v - model = 'state.strategy.isEnabled'
: disable = 'state.strategy.strategy.key === `local`'
color = 'primary'
checked - icon = 'las la-check'
unchecked - icon = 'las la-times'
: aria - label = 't(`admin.auth.enabled`)'
)
q - separator . q - my - sm ( inset )
q - item ( tag = 'label' )
blueprint - icon ( icon = 'register' )
q - item - section
q - item - label { { t ( ` admin.auth.selfRegistration ` ) } }
q - item - label ( caption ) { { t ( ` admin.auth.selfRegistrationHint ` ) } }
q - item - section ( avatar )
q - toggle (
v - model = 'state.strategy.selfRegistration'
color = 'primary'
checked - icon = 'las la-check'
unchecked - icon = 'las la-times'
: aria - label = 't(`admin.auth.selfRegistration`)'
)
template ( v - if = 'state.strategy.selfRegistration' )
q - separator . q - my - sm ( inset )
q - item
blueprint - icon ( icon = 'team' )
q - item - section
q - item - label { { t ( ` admin.auth.autoEnrollGroups ` ) } }
q - item - label ( caption ) { { t ( ` admin.auth.autoEnrollGroupsHint ` ) } }
q - item - section
q - select (
outlined
: options = 'state.groups'
v - model = 'state.strategy.autoEnrollGroups'
multiple
map - options
emit - value
option - value = 'id'
option - label = 'name'
options - dense
dense
hide - bottom - space
: aria - label = 't(`admin.users.groups`)'
: loading = 'state.loadingGroups'
)
template ( v - slot : selected )
. text - caption ( v - if = 'state.strategy.autoEnrollGroups?.length > 1' )
i18n - t ( keypath = 'admin.users.groupsSelected' )
template ( # count )
strong { { state . strategy . autoEnrollGroups ? . length } }
. text - caption ( v - else - if = 'state.strategy.autoEnrollGroups?.length === 1' )
i18n - t ( keypath = 'admin.users.groupSelected' )
template ( # group )
strong { { selectedGroupName } }
span ( v - else )
template ( v - slot : option = '{ itemProps, opt, selected, toggleOption }' )
q - item (
v - bind = 'itemProps'
)
q - item - section ( side )
q - checkbox (
size = 'sm'
: model - value = 'selected'
@ update : model - value = 'toggleOption(opt)'
)
q - item - section
q - item - label { { opt . name } }
q - separator . q - my - sm ( inset )
q - item
blueprint - icon ( icon = 'private' )
q - item - section
q - item - label { { t ( ` admin.auth.domainsWhitelist ` ) } }
q - item - label ( caption ) { { t ( ` admin.auth.domainsWhitelistHint ` ) } }
q - item - section
q - input (
outlined
v - model = 'state.strategy.domainWhitelist'
dense
hide - bottom - space
: aria - label = 't(`admin.auth.domainsWhitelist`)'
prefix = '/'
suffix = '/'
)
/ / - - - - - - - - - - - - - - - - - - - - - - - -
/ / - - - - - - - - - - - - - - - - - - - - - - - -
/ / - C o n f i g u r a t i o n
/ / - C o n f i g u r a t i o n
/ / - - - - - - - - - - - - - - - - - - - - - - - -
/ / - - - - - - - - - - - - - - - - - - - - - - - -
q - card . q - pb - sm . q - mt - md
q - card . q - pb - sm . q - mt - md
q - card - section
q - card - section
. text - subtitle1 { { t ( 'admin.storage.config' ) } }
. text - subtitle1 { { t ( 'admin. auth.strategyConfiguration ') } }
q - banner . q - mt - md (
q - banner . q - mt - md (
v - if = '!state.strategy.config || Object.keys(state.strategy.config).length < 1'
v - if = '!state.strategy.config || Object.keys(state.strategy.config).length < 1'
rounded
rounded
: class = '$q.dark.isActive ? `bg-negative text-white` : `bg-grey-2 text-grey-7`'
: class = '$q.dark.isActive ? `bg-negative text-white` : `bg-grey-2 text-grey-7`'
) { { t ( 'admin.storage.noConfigOption' ) } }
) { { t ( 'admin. auth .noConfigOption') } }
template (
template (
v - for = '(cfg, cfgKey, idx) in state.strategy.config'
v - for = '(cfg, cfgKey, idx) in state.strategy.config'
)
)
@ -148,228 +252,62 @@ q-page.admin-mail
outlined
outlined
v - model = 'cfg.value'
v - model = 'cfg.value'
dense
dense
: type = 'cfg.multiline ? `textarea` : `input`'
: type = 'cfg.multiline ? `textarea` : (cfg.sensitive ? `password` : `input`) '
: aria - label = 'cfg.title'
: aria - label = 'cfg.title'
: disable = 'cfg.readOnly'
: disable = 'cfg.readOnly'
)
)
. col - auto ( v - if = 'state.selectedStrategy && state.strategy' )
/ / - - - - - - - - - - - - - - - - - - - - - - - -
/ / - - - - - - - - - - - - - - - - - - - - - - - -
/ / - In f o b o x
/ / - Re f e r e n c e s
/ / - - - - - - - - - - - - - - - - - - - - - - - -
/ / - - - - - - - - - - - - - - - - - - - - - - - -
q - card . rounded- borders . q - pb - md ( style = 'width: 350px; ')
q - card . q- pb - sm . q - mt - md ( v - if = 'strategyRefs.length > 0 ')
q - card - section
q - card - section
. text - subtitle1 { { state . strategy . strategy . title } }
. text - subtitle1 { { t ( 'admin.auth.configReference' ) } }
q - img . q - mt - sm . rounded - borders (
q - item ( v - for = 'strRef of strategyRefs' , : key = 'strRef.key' )
: src = 'state.strategy.strategy.logo'
blueprint - icon ( : icon = 'strRef.icon' , : hue - rotate = '-45' )
fit = 'contain'
no - spinner
style = 'height: 100px;'
)
. text - body2 . q - mt - md { { state . strategy . strategy . description } }
q - separator . q - mb - sm ( inset )
q - item
q - item - section
q - item - section
q - item - label . text - grey { { t ( ` admin.auth.vendor ` ) } }
q - item - label { { strRef . title } }
q - item - label { { state . strategy . strategy . vendor } }
q - item - label ( caption ) { { strRef . hint } }
q - separator . q - my - sm ( inset )
q - item
q - item - section
q - item - section
q - item - label . text - grey { { t ( ` admin.auth.vendorWebsite ` ) } }
q - input (
q - item - label : a ( : href = 'state.strategy.strategy.website' , target = '_blank' , rel = 'noreferrer' ) { { state . strategy . strategy . website } }
outlined
v - model = 'strRef.value'
dense
: aria - label = 'strRef.title'
readonly
)
/ / - - - - - - - - - - - - - - - - - - - - - - - -
/ / - - - - - - - - - - - - - - - - - - - - - - - -
/ / - S t a t u s
/ / - In f o b o x
/ / - - - - - - - - - - - - - - - - - - - - - - - -
/ / - - - - - - - - - - - - - - - - - - - - - - - -
q - card . rounded - borders . q - pb - md . q - mt - md ( style = 'width: 350px;' )
q - card . q - mt - md
q - card - section
q - card - section . text - center
. text - subtitle1 { { t ( ` admin.auth.status ` ) } }
q - img . rounded - borders (
q - item ( tag = 'label' )
: src = 'state.strategy.strategy.logo'
q - item - section
fit = 'contain'
q - item - label { { t ( ` admin.auth.enabled ` ) } }
no - spinner
q - item - label ( caption ) { { t ( ` admin.auth.enabledHint ` ) } }
style = 'height: 100px; max-width: 300px;'
q - item - label . text - deep - orange ( v - if = 'state.strategy.strategy.key === `local`' , caption ) { { t ( ` admin.auth.enabledForced ` ) } }
)
q - item - section ( avatar )
. text - subtitle2 . q - mt - sm { { state . strategy . strategy . title } }
q - toggle (
. text - caption . q - mt - sm { { state . strategy . strategy . description } }
v - model = 'state.strategy.isEnabled'
. text - caption . q - mt - sm : strong { { state . strategy . strategy . vendor } }
: disable = 'state.strategy.strategy.key === `local`'
. text - caption : a ( : href = 'state.strategy.strategy.website' , target = '_blank' , rel = 'noreferrer' ) { { state . strategy . strategy . website } }
color = 'primary'
checked - icon = 'las la-check'
unchecked - icon = 'las la-times'
: aria - label = 't(`admin.auth.enabled`)'
)
q - separator . q - my - sm ( inset )
q - item
q - item - section
q - btn . acrylic - btn (
icon = 'las la-trash-alt'
flat
color = 'negative'
: disable = 'state.strategy.strategy.key === `local`'
label = 'Delete Strategy'
)
/ / - v - f l e x ( x s 1 2 , l g 9 )
/ / - v - c a r d . a n i m a t e d . f a d e I n U p . w a i t - p 2 s
/ / - v - t o o l b a r ( c o l o r = ' p r i m a r y ' , d e n s e , f l a t , d a r k )
/ / - . s u b t i t l e - 1 { { s t r a t e g y . d i s p l a y N a m e } } # [ e m ( { { s t r a t e g y . s t r a t e g y . t i t l e } } ) ]
/ / - v - s p a c e r
/ / - v - b t n ( s m a l l , o u t l i n e d , d a r k , c o l o r = ' w h i t e ' , : d i s a b l e d = ' s t r a t e g y . k e y = = = ` l o c a l ` ' , @ c l i c k = ' d e l e t e S t r a t e g y ( ) ' )
/ / - v - i c o n ( l e f t ) m d i - c l o s e
/ / - s p a n { { $ t ( ' c o m m o n . a c t i o n s . d e l e t e ' ) } }
/ / - v - c a r d - i n f o ( c o l o r = ' b l u e ' )
/ / - d i v
/ / - s p a n { { s t r a t e g y . s t r a t e g y . d e s c r i p t i o n } }
/ / - . c a p t i o n : a ( : h r e f = ' s t r a t e g y . s t r a t e g y . w e b s i t e ' ) { { s t r a t e g y . s t r a t e g y . w e b s i t e } }
/ / - v - s p a c e r
/ / - . a d m i n - p r o v i d e r l o g o
/ / - i m g ( : s r c = ' s t r a t e g y . s t r a t e g y . l o g o ' , : a l t = ' s t r a t e g y . s t r a t e g y . t i t l e ' )
/ / - v - c a r d - t e x t
/ / - . r o w
/ / - . c o l - 8
/ / - v - t e x t - f i e l d (
/ / - o u t l i n e d
/ / - : l a b e l = ' $ t ( ` a d m i n . a u t h . d i s p l a y N a m e ` ) '
/ / - v - m o d e l = ' s t r a t e g y . d i s p l a y N a m e '
/ / - p r e p e n d - i c o n = ' m d i - f o r m a t - t i t l e '
/ / - : h i n t = ' $ t ( ` a d m i n . a u t h . d i s p l a y N a m e H i n t ` ) '
/ / - p e r s i s t e n t - h i n t
/ / - )
/ / - . c o l - 4
/ / - v - s w i t c h . m t - 1 (
/ / - : l a b e l = ' $ t ( ` a d m i n . a u t h . s t r a t e g y I s E n a b l e d ` ) '
/ / - v - m o d e l = ' s t r a t e g y . i s E n a b l e d '
/ / - c o l o r = ' p r i m a r y '
/ / - p r e p e n d - i c o n = ' m d i - p o w e r '
/ / - : h i n t = ' $ t ( ` a d m i n . a u t h . s t r a t e g y I s E n a b l e d H i n t ` ) '
/ / - p e r s i s t e n t - h i n t
/ / - i n s e t
/ / - : d i s a b l e d = ' s t r a t e g y . k e y = = = ` l o c a l ` '
/ / - )
/ / - t e m p l a t e ( v - i f = ' s t r a t e g y . c o n f i g & & O b j e c t . k e y s ( s t r a t e g y . c o n f i g ) . l e n g t h > 0 ' )
/ / - v - d i v i d e r
/ / - . o v e r l i n e . m y - 5 { { $ t ( ' a d m i n . a u t h . s t r a t e g y C o n f i g u r a t i o n ' ) } }
/ / - . p r - 3
/ / - t e m p l a t e ( v - f o r = ' c f g i n s t r a t e g y . c o n f i g ' )
/ / - v - s e l e c t . m b - 3 (
/ / - v - i f = ' c f g . v a l u e . t y p e = = = " s t r i n g " & & c f g . v a l u e . e n u m '
/ / - o u t l i n e d
/ / - : i t e m s = ' c f g . v a l u e . e n u m '
/ / - : k e y = ' c f g . k e y '
/ / - : l a b e l = ' c f g . v a l u e . t i t l e '
/ / - v - m o d e l = ' c f g . v a l u e . v a l u e '
/ / - p r e p e n d - i c o n = ' m d i - c o g - b o x '
/ / - : h i n t = ' c f g . v a l u e . h i n t ? c f g . v a l u e . h i n t : " " '
/ / - p e r s i s t e n t - h i n t
/ / - : c l a s s = ' c f g . v a l u e . h i n t ? " m b - 2 " : " " '
/ / - : s t y l e = ' c f g . v a l u e . m a x W i d t h > 0 ? ` m a x - w i d t h : ` + c f g . v a l u e . m a x W i d t h + ` p x ; ` : ` ` '
/ / - )
/ / - v - s w i t c h . m b - 6 (
/ / - v - e l s e - i f = ' c f g . v a l u e . t y p e = = = " b o o l e a n " '
/ / - : k e y = ' c f g . k e y '
/ / - : l a b e l = ' c f g . v a l u e . t i t l e '
/ / - v - m o d e l = ' c f g . v a l u e . v a l u e '
/ / - c o l o r = ' p r i m a r y '
/ / - p r e p e n d - i c o n = ' m d i - c o g - b o x '
/ / - : h i n t = ' c f g . v a l u e . h i n t ? c f g . v a l u e . h i n t : " " '
/ / - p e r s i s t e n t - h i n t
/ / - i n s e t
/ / - )
/ / - v - t e x t a r e a . m b - 3 (
/ / - v - e l s e - i f = ' c f g . v a l u e . t y p e = = = " s t r i n g " & & c f g . v a l u e . m u l t i l i n e '
/ / - o u t l i n e d
/ / - : k e y = ' c f g . k e y '
/ / - : l a b e l = ' c f g . v a l u e . t i t l e '
/ / - v - m o d e l = ' c f g . v a l u e . v a l u e '
/ / - p r e p e n d - i c o n = ' m d i - c o g - b o x '
/ / - : h i n t = ' c f g . v a l u e . h i n t ? c f g . v a l u e . h i n t : " " '
/ / - p e r s i s t e n t - h i n t
/ / - : c l a s s = ' c f g . v a l u e . h i n t ? " m b - 2 " : " " '
/ / - )
/ / - v - t e x t - f i e l d . m b - 3 (
/ / - v - e l s e
/ / - o u t l i n e d
/ / - : k e y = ' c f g . k e y '
/ / - : l a b e l = ' c f g . v a l u e . t i t l e '
/ / - v - m o d e l = ' c f g . v a l u e . v a l u e '
/ / - p r e p e n d - i c o n = ' m d i - c o g - b o x '
/ / - : h i n t = ' c f g . v a l u e . h i n t ? c f g . v a l u e . h i n t : " " '
/ / - p e r s i s t e n t - h i n t
/ / - : c l a s s = ' c f g . v a l u e . h i n t ? " m b - 2 " : " " '
/ / - : s t y l e = ' c f g . v a l u e . m a x W i d t h > 0 ? ` m a x - w i d t h : ` + c f g . v a l u e . m a x W i d t h + ` p x ; ` : ` ` '
/ / - )
/ / - v - d i v i d e r
/ / - . o v e r l i n e . m y - 5 { { $ t ( ' a d m i n . a u t h . r e g i s t r a t i o n ' ) } }
/ / - . p r - 3
/ / - v - s w i t c h . m l - 3 (
/ / - v - m o d e l = ' s t r a t e g y . s e l f R e g i s t r a t i o n '
/ / - : l a b e l = ' $ t ( ` a d m i n . a u t h . s e l f R e g i s t r a t i o n ` ) '
/ / - c o l o r = ' p r i m a r y '
/ / - : h i n t = ' $ t ( ` a d m i n . a u t h . s e l f R e g i s t r a t i o n H i n t ` ) '
/ / - p e r s i s t e n t - h i n t
/ / - i n s e t
/ / - )
/ / - v - c o m b o b o x . m l - 3 . m t - 5 (
/ / - : l a b e l = ' $ t ( ` a d m i n . a u t h . d o m a i n s W h i t e l i s t ` ) '
/ / - v - m o d e l = ' s t r a t e g y . d o m a i n W h i t e l i s t '
/ / - p r e p e n d - i c o n = ' m d i - e m a i l - c h e c k - o u t l i n e '
/ / - o u t l i n e d
/ / - : d i s a b l e d = ' ! s t r a t e g y . s e l f R e g i s t r a t i o n '
/ / - : h i n t = ' $ t ( ` a d m i n . a u t h . d o m a i n s W h i t e l i s t H i n t ` ) '
/ / - p e r s i s t e n t - h i n t
/ / - s m a l l - c h i p s
/ / - d e l e t a b l e - c h i p s
/ / - c l e a r a b l e
/ / - m u l t i p l e
/ / - c h i p s
/ / - )
/ / - v - a u t o c o m p l e t e . m t - 3 . m l - 3 (
/ / - o u t l i n e d
/ / - : d i s a b l e d = ' ! s t r a t e g y . s e l f R e g i s t r a t i o n '
/ / - : i t e m s = ' g r o u p s '
/ / - i t e m - t e x t = ' n a m e '
/ / - i t e m - v a l u e = ' i d '
/ / - : l a b e l = ' $ t ( ` a d m i n . a u t h . a u t o E n r o l l G r o u p s ` ) '
/ / - v - m o d e l = ' s t r a t e g y . a u t o E n r o l l G r o u p s '
/ / - p r e p e n d - i c o n = ' m d i - a c c o u n t - g r o u p '
/ / - : h i n t = ' $ t ( ` a d m i n . a u t h . a u t o E n r o l l G r o u p s H i n t ` ) '
/ / - s m a l l - c h i p s
/ / - p e r s i s t e n t - h i n t
/ / - d e l e t a b l e - c h i p s
/ / - c l e a r a b l e
/ / - m u l t i p l e
/ / - c h i p s
/ / - )
/ / - v - c a r d . m t - 4 . w i k i - f o r m . a n i m a t e d . f a d e I n U p . w a i t - p 4 s ( v - i f = ' s e l e c t e d S t r a t e g y ! = = ` l o c a l ` ' )
. flex . q - mt - md
/ / - v - t o o l b a r ( c o l o r = ' p r i m a r y ' , d e n s e , f l a t , d a r k )
. text - caption . text - grey ID : { { state . strategy . id } }
/ / - . s u b t i t l e - 1 { { $ t ( ' a d m i n . a u t h . c o n f i g R e f e r e n c e ' ) } }
q - space
/ / - v - c a r d - t e x t
q - btn . acrylic - btn (
/ / - . b o d y - 2 { { $ t ( ' a d m i n . a u t h . c o n f i g R e f e r e n c e S u b t i t l e ' ) } }
icon = 'las la-trash-alt'
/ / - v - a l e r t . m t - 3 . r a d i u s - 7 ( v - i f = ' h o s t . l e n g t h < 8 ' , c o l o r = ' r e d ' , o u t l i n e d , : v a l u e = ' t r u e ' , i c o n = ' m d i - a l e r t ' )
flat
/ / - i 1 8 n e x t ( p a t h = ' a d m i n . a u t h . s i t e U r l N o t S e t u p ' , t a g = ' s p a n ' )
color = 'negative'
/ / - s t r o n g ( p l a c e = ' s i t e U r l ' ) { { $ t ( ' a d m i n . g e n e r a l . s i t e U r l ' ) } }
: disable = 'state.strategy.strategy.key === `local`'
/ / - s t r o n g ( p l a c e = ' g e n e r a l ' ) { { $ t ( ' a d m i n . g e n e r a l . t i t l e ' ) } }
label = 'Delete Strategy'
/ / - . p a - 3 . m t - 3 . r a d i u s - 7 . g r e y ( v - e l s e , : c l a s s = ' $ v u e t i f y . t h e m e . d a r k ? ` d a r k e n - 3 - d 5 ` : ` l i g h t e n - 3 ` ' )
@ click = 'deleteStrategy(state.strategy.id)'
/ / - . b o d y - 2 : s t r o n g { { $ t ( ' a d m i n . a u t h . a l l o w e d W e b O r i g i n s ' ) } }
)
/ / - . b o d y - 2 { { h o s t } }
/ / - v - d i v i d e r . m y - 3
/ / - . b o d y - 2 : s t r o n g { { $ t ( ' a d m i n . a u t h . c a l l b a c k U r l ' ) } }
/ / - . b o d y - 2 { { h o s t } } / l o g i n / { { s t r a t e g y . k e y } } / c a l l b a c k
/ / - v - d i v i d e r . m y - 3
/ / - . b o d y - 2 : s t r o n g { { $ t ( ' a d m i n . a u t h . l o g i n U r l ' ) } }
/ / - . b o d y - 2 { { h o s t } } / l o g i n
/ / - v - d i v i d e r . m y - 3
/ / - . b o d y - 2 : s t r o n g { { $ t ( ' a d m i n . a u t h . l o g o u t U r l ' ) } }
/ / - . b o d y - 2 { { h o s t } }
/ / - v - d i v i d e r . m y - 3
/ / - . b o d y - 2 : s t r o n g { { $ t ( ' a d m i n . a u t h . t o k e n E n d p o i n t A u t h M e t h o d ' ) } }
/ / - . b o d y - 2 H T T P - P O S T
< / template >
< / template >
< script setup >
< script setup >
import gql from 'graphql-tag'
import gql from 'graphql-tag'
import { find, reject , transform } from 'lodash-es'
import { cloneDeep , find , reject , transform } from 'lodash-es'
import { v4 as uuid } from 'uuid'
import { v4 as uuid } from 'uuid'
import { useI18n } from 'vue-i18n'
import { useI18n } from 'vue-i18n'
@ -402,6 +340,7 @@ useMeta({
const state = reactive ( {
const state = reactive ( {
loading : 0 ,
loading : 0 ,
loadingGroups : true ,
groups : [ ] ,
groups : [ ] ,
strategies : [ ] ,
strategies : [ ] ,
activeStrategies : [ ] ,
activeStrategies : [ ] ,
@ -417,25 +356,26 @@ const state = reactive({
const availableStrategies = computed ( ( ) => {
const availableStrategies = computed ( ( ) => {
return state . strategies . filter ( str => str . key !== 'local' )
return state . strategies . filter ( str => str . key !== 'local' )
} )
} )
const selectedGroupName = computed ( ( ) => {
const combinedActiveStrategies = computed ( ( ) => {
return state . groups . filter ( g => g . id === state . strategy ? . autoEnrollGroups ? . [ 0 ] ) [ 0 ] ? . name
return state . activeStrategies . map ( str => ( {
} )
... str ,
const strategyRefs = computed ( ( ) => {
strategy : find ( state . strategies , [ 'key' , str . strategy ? . key ] ) || { }
if ( ! state . selectedStrategy ) { return [ ] }
} ) )
const str = find ( state . strategies , [ 'key' , state . strategy ? . strategy . key ] )
if ( ! str || ! str . refs ) { return [ ] }
return Object . entries ( str . refs ) . map ( ( [ k , v ] ) => {
return {
... v ,
key : k ,
value : v . value . replaceAll ( '{host}' , window . location . origin ) . replaceAll ( '{id}' , state . selectedStrategy )
}
} ) ? ? [ ]
} )
} )
/ / W A T C H E R S
/ / W A T C H E R S
watch ( ( ) => state . selectedStrategy , ( newValue , oldValue ) => {
watch ( ( ) => state . selectedStrategy , ( newValue , oldValue ) => {
const str = find ( combinedActiveStrategies . value , [ 'id' , newValue ] ) || { }
state . strategy = find ( state . activeStrategies , [ 'id' , newValue ] ) || { }
str . config = transform ( str . strategy . props , ( cfg , v , k ) => {
cfg [ k ] = {
... v ,
value : str . config [ k ]
}
} , { } )
state . strategy = str
} )
} )
watch ( ( ) => state . activeStrategies , ( newValue , oldValue ) => {
watch ( ( ) => state . activeStrategies , ( newValue , oldValue ) => {
state . selectedStrategy = newValue [ 0 ] ? . id
state . selectedStrategy = newValue [ 0 ] ? . id
@ -443,6 +383,25 @@ watch(() => state.activeStrategies, (newValue, oldValue) => {
/ / M E T H O D S
/ / M E T H O D S
async function loadGroups ( ) {
state . loading ++
state . loadingGroups = true
const resp = await APOLLO _CLIENT . query ( {
query : gql `
query getGroupsForAdminAuth {
groups {
id
name
}
}
` ,
fetchPolicy : 'network-only'
} )
state . groups = cloneDeep ( resp ? . data ? . groups ? . filter ( g => g . id !== '10000000-0000-4000-8000-000000000001' ) ? ? [ ] )
state . loadingGroups = false
state . loading --
}
async function load ( ) {
async function load ( ) {
state . loading ++
state . loading ++
$q . loading . show ( )
$q . loading . show ( )
@ -452,6 +411,7 @@ async function load () {
authStrategies {
authStrategies {
key
key
props
props
refs
title
title
description
description
isAvailable
isAvailable
@ -480,7 +440,33 @@ async function load () {
fetchPolicy : 'network-only'
fetchPolicy : 'network-only'
} )
} )
state . strategies = resp ? . data ? . authStrategies || [ ]
state . strategies = resp ? . data ? . authStrategies || [ ]
state . activeStrategies = resp ? . data ? . authActiveStrategies || [ ]
state . activeStrategies = ( cloneDeep ( resp ? . data ? . authActiveStrategies ) || [ ] ) . map ( a => {
const str = cloneDeep ( find ( state . strategies , [ 'key' , a . strategy . key ] ) ) || { }
a . strategy = str
a . config = transform ( str . props , ( r , v , k ) => {
r [ k ] = {
... v ,
value : a . config ? . [ k ] ,
... v . enum && {
enum : v . enum . map ( o => {
if ( o . indexOf ( '|' ) > 0 ) {
const oParsed = o . split ( '|' )
return {
value : oParsed [ 0 ] ,
label : oParsed [ 1 ]
}
} else {
return {
value : o ,
label : o
}
}
} )
}
}
} , { } )
return a
} )
$q . loading . hide ( )
$q . loading . hide ( )
state . loading --
state . loading --
}
}
@ -493,15 +479,32 @@ function configIfCheck (ifs) {
function addStrategy ( str ) {
function addStrategy ( str ) {
const newStr = {
const newStr = {
id : uuid ( ) ,
id : uuid ( ) ,
strategy : {
strategy : str ,
key : str . key
config : transform ( str . props , ( r , v , k ) => {
} ,
r [ k ] = {
config : transform ( str . props , ( cfg , v , k ) => {
... v ,
cfg [ k ] = v . default
value : v . default ,
... v . enum && {
enum : v . enum . map ( o => {
if ( o . indexOf ( '|' ) > 0 ) {
const oParsed = o . split ( '|' )
return {
value : oParsed [ 0 ] ,
label : oParsed [ 1 ]
}
} else {
return {
value : o ,
label : o
}
}
} )
}
}
} , { } ) ,
} , { } ) ,
isEnabled : false ,
isEnabled : tru e,
displayName : str . title ,
displayName : str . title ,
selfRegistration : false ,
selfRegistration : tru e,
domainWhitelist : [ ] ,
domainWhitelist : [ ] ,
autoEnrollGroups : [ ]
autoEnrollGroups : [ ]
}
}
@ -660,5 +663,6 @@ async function save () {
onMounted ( ( ) => {
onMounted ( ( ) => {
load ( )
load ( )
loadGroups ( )
} )
} )
< / script >
< / script >