File tree 5 files changed +32
-7
lines changed
5 files changed +32
-7
lines changed Original file line number Diff line number Diff line change @@ -52,12 +52,15 @@ export default function CreateDirectory(props: CreateDirectoryProps) {
52
52
get classes ( ) {
53
53
return {
54
54
fieldContainer : cssClassAssembler ( props . classNames ?. fieldContainer , defaultClasses . fieldContainer ) ,
55
- label : cssClassAssembler ( props . classNames ?. label , defaultClasses . label ) ,
56
55
inputField : {
57
56
label : props . classNames ?. label ,
58
57
input : props . classNames ?. input ,
59
58
container : props . classNames ?. fieldContainer ,
60
59
} ,
60
+ select : {
61
+ label : props . classNames ?. label ,
62
+ select : props . classNames ?. select ,
63
+ } ,
61
64
} ;
62
65
} ,
63
66
get shouldDisplayHeader ( ) {
@@ -133,6 +136,7 @@ export default function CreateDirectory(props: CreateDirectoryProps) {
133
136
< div class = { state . classes . fieldContainer } >
134
137
< Select
135
138
label = 'Directory provider'
139
+ classNames = { state . classes . select }
136
140
options = { state . providers }
137
141
selectedValue = { state . directory . type }
138
142
handleChange = { state . setProvider }
Original file line number Diff line number Diff line change @@ -39,9 +39,14 @@ export default function DirectoriesWrapper(props: DirectoriesWrapperProps) {
39
39
switchToCreateView ( ) {
40
40
state . view = 'CREATE' ;
41
41
} ,
42
- switchToEditView ( action : 'edit' | 'view' , directory : any ) {
43
- state . view = 'EDIT' ;
44
- state . directoryToEdit = directory ;
42
+ handleActionClick ( action : 'edit' | 'view' , directory : any ) {
43
+ if ( action === 'edit' ) {
44
+ state . view = 'EDIT' ;
45
+ state . directoryToEdit = directory ;
46
+ } else {
47
+ typeof props . componentProps ?. directoryList ?. handleActionClick === 'function' &&
48
+ props . componentProps . directoryList . handleActionClick ( 'view' , directory ) ;
49
+ }
45
50
} ,
46
51
switchToListView ( ) {
47
52
state . view = 'LIST' ;
@@ -79,7 +84,7 @@ export default function DirectoriesWrapper(props: DirectoriesWrapperProps) {
79
84
< DirectoryList
80
85
{ ...props . componentProps ?. directoryList }
81
86
urls = { { get : props . urls . get } }
82
- handleActionClick = { state . switchToEditView }
87
+ handleActionClick = { state . handleActionClick }
83
88
handleListFetchComplete = { state . handleListFetchComplete }
84
89
tenant = { props . tenant }
85
90
product = { props . product } > </ DirectoryList >
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ export default function DirectoryList(props: DirectoryListProps) {
35
35
} ,
36
36
get actions ( ) : TableProps [ 'actions' ] {
37
37
return [
38
+ {
39
+ icon : 'EyeIcon' ,
40
+ label : 'View' ,
41
+ handleClick : ( directory : Directory ) => props . handleActionClick ( 'view' , directory ) ,
42
+ } ,
38
43
{
39
44
icon : 'PencilIcon' ,
40
45
label : 'Edit' ,
@@ -129,7 +134,12 @@ export default function DirectoryList(props: DirectoryListProps) {
129
134
</ Show >
130
135
} >
131
136
< div class = { state . classes . tableContainer } >
132
- < Table cols = { state . colsToDisplay } data = { state . directoryListData } actions = { state . actions } />
137
+ < Table
138
+ cols = { state . colsToDisplay }
139
+ data = { state . directoryListData }
140
+ actions = { state . actions }
141
+ classNames = { { iconSpan : defaultClasses . iconSpan } }
142
+ />
133
143
</ div >
134
144
</ Show >
135
145
</ LoadingContainer >
Original file line number Diff line number Diff line change 1
1
.tableContainer {
2
2
border-width : 1px ;
3
3
}
4
+
5
+ .iconSpan : not (: first-child ) {
6
+ margin-left : 0.5rem ;
7
+ }
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ export interface CreateDirectoryProps {
13
13
classNames ?: {
14
14
fieldContainer ?: string ;
15
15
input ?: string ;
16
+ select ?: string ;
16
17
label ?: string ;
17
18
button ?: { ctoa ?: string } ;
18
19
} ;
@@ -92,12 +93,13 @@ export interface DirectoriesWrapperProps {
92
93
button ?: { ctoa ?: string ; destructive ?: string } ;
93
94
input ?: string ;
94
95
textarea ?: string ;
96
+ select ?: string ;
95
97
confirmationPrompt ?: ConfirmationPromptProps [ 'classNames' ] ;
96
98
secretInput ?: string ;
97
99
section ?: string ;
98
100
} ;
99
101
componentProps ?: {
100
- directoryList ?: Partial < Omit < DirectoryListProps , 'handleActionClick' > > ;
102
+ directoryList ?: Partial < DirectoryListProps > ;
101
103
createDirectory ?: Partial < CreateDirectoryProps > ;
102
104
editDirectory ?: Partial < EditDirectoryProps > ;
103
105
} ;
You can’t perform that action at this time.
0 commit comments