Skip to content

Commit aeb4140

Browse files
authored
Restore dsync user/group links (#903)
* Align select dropdown styles in create directory * Add the view action * Handle the action click in wrapper by using callback to effect route change * Fix spacing between action buttons
1 parent 29654fc commit aeb4140

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

src/dsync/CreateDirectory/index.lite.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,15 @@ export default function CreateDirectory(props: CreateDirectoryProps) {
5252
get classes() {
5353
return {
5454
fieldContainer: cssClassAssembler(props.classNames?.fieldContainer, defaultClasses.fieldContainer),
55-
label: cssClassAssembler(props.classNames?.label, defaultClasses.label),
5655
inputField: {
5756
label: props.classNames?.label,
5857
input: props.classNames?.input,
5958
container: props.classNames?.fieldContainer,
6059
},
60+
select: {
61+
label: props.classNames?.label,
62+
select: props.classNames?.select,
63+
},
6164
};
6265
},
6366
get shouldDisplayHeader() {
@@ -133,6 +136,7 @@ export default function CreateDirectory(props: CreateDirectoryProps) {
133136
<div class={state.classes.fieldContainer}>
134137
<Select
135138
label='Directory provider'
139+
classNames={state.classes.select}
136140
options={state.providers}
137141
selectedValue={state.directory.type}
138142
handleChange={state.setProvider}

src/dsync/DirectoriesWrapper/index.lite.tsx

+9-4
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,14 @@ export default function DirectoriesWrapper(props: DirectoriesWrapperProps) {
3939
switchToCreateView() {
4040
state.view = 'CREATE';
4141
},
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+
}
4550
},
4651
switchToListView() {
4752
state.view = 'LIST';
@@ -79,7 +84,7 @@ export default function DirectoriesWrapper(props: DirectoriesWrapperProps) {
7984
<DirectoryList
8085
{...props.componentProps?.directoryList}
8186
urls={{ get: props.urls.get }}
82-
handleActionClick={state.switchToEditView}
87+
handleActionClick={state.handleActionClick}
8388
handleListFetchComplete={state.handleListFetchComplete}
8489
tenant={props.tenant}
8590
product={props.product}></DirectoryList>

src/dsync/DirectoryList/index.lite.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ export default function DirectoryList(props: DirectoryListProps) {
3535
},
3636
get actions(): TableProps['actions'] {
3737
return [
38+
{
39+
icon: 'EyeIcon',
40+
label: 'View',
41+
handleClick: (directory: Directory) => props.handleActionClick('view', directory),
42+
},
3843
{
3944
icon: 'PencilIcon',
4045
label: 'Edit',
@@ -129,7 +134,12 @@ export default function DirectoryList(props: DirectoryListProps) {
129134
</Show>
130135
}>
131136
<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+
/>
133143
</div>
134144
</Show>
135145
</LoadingContainer>
+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
.tableContainer {
22
border-width: 1px;
33
}
4+
5+
.iconSpan:not(:first-child) {
6+
margin-left: 0.5rem;
7+
}

src/dsync/types.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface CreateDirectoryProps {
1313
classNames?: {
1414
fieldContainer?: string;
1515
input?: string;
16+
select?: string;
1617
label?: string;
1718
button?: { ctoa?: string };
1819
};
@@ -92,12 +93,13 @@ export interface DirectoriesWrapperProps {
9293
button?: { ctoa?: string; destructive?: string };
9394
input?: string;
9495
textarea?: string;
96+
select?: string;
9597
confirmationPrompt?: ConfirmationPromptProps['classNames'];
9698
secretInput?: string;
9799
section?: string;
98100
};
99101
componentProps?: {
100-
directoryList?: Partial<Omit<DirectoryListProps, 'handleActionClick'>>;
102+
directoryList?: Partial<DirectoryListProps>;
101103
createDirectory?: Partial<CreateDirectoryProps>;
102104
editDirectory?: Partial<EditDirectoryProps>;
103105
};

0 commit comments

Comments
 (0)