Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore dsync user/group links #903

Merged
merged 5 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/dsync/CreateDirectory/index.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,15 @@ export default function CreateDirectory(props: CreateDirectoryProps) {
get classes() {
return {
fieldContainer: cssClassAssembler(props.classNames?.fieldContainer, defaultClasses.fieldContainer),
label: cssClassAssembler(props.classNames?.label, defaultClasses.label),
inputField: {
label: props.classNames?.label,
input: props.classNames?.input,
container: props.classNames?.fieldContainer,
},
select: {
label: props.classNames?.label,
select: props.classNames?.select,
},
};
},
get shouldDisplayHeader() {
Expand Down Expand Up @@ -133,6 +136,7 @@ export default function CreateDirectory(props: CreateDirectoryProps) {
<div class={state.classes.fieldContainer}>
<Select
label='Directory provider'
classNames={state.classes.select}
options={state.providers}
selectedValue={state.directory.type}
handleChange={state.setProvider}
Expand Down
13 changes: 9 additions & 4 deletions src/dsync/DirectoriesWrapper/index.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ export default function DirectoriesWrapper(props: DirectoriesWrapperProps) {
switchToCreateView() {
state.view = 'CREATE';
},
switchToEditView(action: 'edit' | 'view', directory: any) {
state.view = 'EDIT';
state.directoryToEdit = directory;
handleActionClick(action: 'edit' | 'view', directory: any) {
if (action === 'edit') {
state.view = 'EDIT';
state.directoryToEdit = directory;
} else {
typeof props.componentProps?.directoryList?.handleActionClick === 'function' &&
props.componentProps.directoryList.handleActionClick('view', directory);
}
},
switchToListView() {
state.view = 'LIST';
Expand Down Expand Up @@ -79,7 +84,7 @@ export default function DirectoriesWrapper(props: DirectoriesWrapperProps) {
<DirectoryList
{...props.componentProps?.directoryList}
urls={{ get: props.urls.get }}
handleActionClick={state.switchToEditView}
handleActionClick={state.handleActionClick}
handleListFetchComplete={state.handleListFetchComplete}
tenant={props.tenant}
product={props.product}></DirectoryList>
Expand Down
12 changes: 11 additions & 1 deletion src/dsync/DirectoryList/index.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export default function DirectoryList(props: DirectoryListProps) {
},
get actions(): TableProps['actions'] {
return [
{
icon: 'EyeIcon',
label: 'View',
handleClick: (directory: Directory) => props.handleActionClick('view', directory),
},
{
icon: 'PencilIcon',
label: 'Edit',
Expand Down Expand Up @@ -129,7 +134,12 @@ export default function DirectoryList(props: DirectoryListProps) {
</Show>
}>
<div class={state.classes.tableContainer}>
<Table cols={state.colsToDisplay} data={state.directoryListData} actions={state.actions} />
<Table
cols={state.colsToDisplay}
data={state.directoryListData}
actions={state.actions}
classNames={{ iconSpan: defaultClasses.iconSpan }}
/>
</div>
</Show>
</LoadingContainer>
Expand Down
4 changes: 4 additions & 0 deletions src/dsync/DirectoryList/index.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.tableContainer {
border-width: 1px;
}

.iconSpan:not(:first-child) {
margin-left: 0.5rem;
}
4 changes: 3 additions & 1 deletion src/dsync/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface CreateDirectoryProps {
classNames?: {
fieldContainer?: string;
input?: string;
select?: string;
label?: string;
button?: { ctoa?: string };
};
Expand Down Expand Up @@ -92,12 +93,13 @@ export interface DirectoriesWrapperProps {
button?: { ctoa?: string; destructive?: string };
input?: string;
textarea?: string;
select?: string;
confirmationPrompt?: ConfirmationPromptProps['classNames'];
secretInput?: string;
section?: string;
};
componentProps?: {
directoryList?: Partial<Omit<DirectoryListProps, 'handleActionClick'>>;
directoryList?: Partial<DirectoryListProps>;
createDirectory?: Partial<CreateDirectoryProps>;
editDirectory?: Partial<EditDirectoryProps>;
};
Expand Down