jackson/components/dsync/CreateDirectory.tsx

64 lines
2.1 KiB
TypeScript
Raw Normal View History

Setup Link Feature (#628) * Share setup link related changes 1. Setup link creation for saml connection 2. Setup link creation for Directory sync 3. Regeneration of Setup link 4. Ability to open setup link without login 5. Setup link opens up SAML connection page 6. Saml Connection page hides Tenant & Product fields * Saving SAML and OIDC configuration * showing the connection list on setup page * Connections CRUD * UI changes for Setup layout * semantics changes connection -> sso-connection * directory sync support for share link * showing only current tenant product directories * fixes mentioned in commnets by Aswin * prettier formatting * fixed route * minor fixes * Fix the layout rendering for the /setup routes * minor fixes * review changes * package lock changes * package json and lock changes * removed xmlbuilder * package lock changes * removed api call from ConnectionList component * Back button link fix * intermediate changes for Setup link list feature * setup link list related changes * UI fixes and actions * removed unwanted import * setup link list action hooked with correct functions * path rewrites, styling changes, toast regenerate & delete setup links * fixes for mutate * minor tweaks to clipboard icon * updated package-lock * formatting changes * removed console log * Added cusor pointer for action for LinkList component Removed unused variable & validation of empty token Removed redundent validation code linting fixes * Auto redirect in setup link page for sso-connection create form Delete icon on setup link list page on hover red color & tooltips * removed redirect and used isValidating * fixes for router replace * toast for setup links * fixes for dsync apis * redirect related change * removing redirect for sso-connection * fallback to error.message Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com> Co-authored-by: Kiran <kiran@boxyhq.com>
2022-12-13 21:41:27 +00:00
import { useTranslation } from 'next-i18next';
import { useRouter } from 'next/router';
import React from 'react';
import { errorToast, successToast } from '@components/Toaster';
Cleanup duplicate locale and components (#2493) * Tweak sdk style import order * WIP * Override SDK styles * Cleanup and pass props to component * Cleanup setup link related code as it's handled via setup-link instructions * Cleanup locale * Fix e2e tests * Fix selectors in e2e test * Add select dropdown style override * Use component from SDK * Cleanup locale * Use Edit DSync from SDK * Remove default webhook props from setup token page * Ability to set default webhook secret * Tweak header text * Revert sdk style import order - app styles should be latest * Override default SDK focus style * Update locale * Use Edit component from SDK * Allow patching oidcMetadata fields * Tweak return data format * Route change on edit success and other fixes * Fix button styles * Fix data access from API * Fix focus styling for error btn * Sync lock file * Cleanup unused files * Set `displayInfo` to false for setup link and fix exclude fields for SAML under setup link * Allow forceAuthn in setup links * Only update forceAuthn if its a boolean value coming from body * Cleanup and hideSave only for setup link * Update UI SDK * Cleanup locales * Fix failing e2e * cleaned up dups * cleaned up dups * cleanup of components * more cleanup * cleanup * locale cleanup * dup cleanup * Reuse styles * Set min value for expiry field to 1 * Validate expiry before using * Update SDK and set idpMetadata display to true * cleaned up unused code, added formik as dep * clean unused locale strings * cleaned up ErrorMessage component --------- Co-authored-by: Aswin V <vaswin91@gmail.com>
2024-03-28 13:21:59 +00:00
import { LinkBack } from '@boxyhq/internal-ui';
import { CreateDirectory as CreateDSync } from '@boxyhq/react-ui/dsync';
import { BOXYHQ_UI_CSS } from '@components/styles';
Setup Link Feature (#628) * Share setup link related changes 1. Setup link creation for saml connection 2. Setup link creation for Directory sync 3. Regeneration of Setup link 4. Ability to open setup link without login 5. Setup link opens up SAML connection page 6. Saml Connection page hides Tenant & Product fields * Saving SAML and OIDC configuration * showing the connection list on setup page * Connections CRUD * UI changes for Setup layout * semantics changes connection -> sso-connection * directory sync support for share link * showing only current tenant product directories * fixes mentioned in commnets by Aswin * prettier formatting * fixed route * minor fixes * Fix the layout rendering for the /setup routes * minor fixes * review changes * package lock changes * package json and lock changes * removed xmlbuilder * package lock changes * removed api call from ConnectionList component * Back button link fix * intermediate changes for Setup link list feature * setup link list related changes * UI fixes and actions * removed unwanted import * setup link list action hooked with correct functions * path rewrites, styling changes, toast regenerate & delete setup links * fixes for mutate * minor tweaks to clipboard icon * updated package-lock * formatting changes * removed console log * Added cusor pointer for action for LinkList component Removed unused variable & validation of empty token Removed redundent validation code linting fixes * Auto redirect in setup link page for sso-connection create form Delete icon on setup link list page on hover red color & tooltips * removed redirect and used isValidating * fixes for router replace * toast for setup links * fixes for dsync apis * redirect related change * removing redirect for sso-connection * fallback to error.message Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com> Co-authored-by: Kiran <kiran@boxyhq.com>
2022-12-13 21:41:27 +00:00
interface CreateDirectoryProps {
setupLinkToken?: string;
defaultWebhookEndpoint?: string;
defaultWebhookSecret?: string;
}
const CreateDirectory = ({
setupLinkToken,
defaultWebhookEndpoint,
defaultWebhookSecret,
}: CreateDirectoryProps) => {
Setup Link Feature (#628) * Share setup link related changes 1. Setup link creation for saml connection 2. Setup link creation for Directory sync 3. Regeneration of Setup link 4. Ability to open setup link without login 5. Setup link opens up SAML connection page 6. Saml Connection page hides Tenant & Product fields * Saving SAML and OIDC configuration * showing the connection list on setup page * Connections CRUD * UI changes for Setup layout * semantics changes connection -> sso-connection * directory sync support for share link * showing only current tenant product directories * fixes mentioned in commnets by Aswin * prettier formatting * fixed route * minor fixes * Fix the layout rendering for the /setup routes * minor fixes * review changes * package lock changes * package json and lock changes * removed xmlbuilder * package lock changes * removed api call from ConnectionList component * Back button link fix * intermediate changes for Setup link list feature * setup link list related changes * UI fixes and actions * removed unwanted import * setup link list action hooked with correct functions * path rewrites, styling changes, toast regenerate & delete setup links * fixes for mutate * minor tweaks to clipboard icon * updated package-lock * formatting changes * removed console log * Added cusor pointer for action for LinkList component Removed unused variable & validation of empty token Removed redundent validation code linting fixes * Auto redirect in setup link page for sso-connection create form Delete icon on setup link list page on hover red color & tooltips * removed redirect and used isValidating * fixes for router replace * toast for setup links * fixes for dsync apis * redirect related change * removing redirect for sso-connection * fallback to error.message Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com> Co-authored-by: Kiran <kiran@boxyhq.com>
2022-12-13 21:41:27 +00:00
const { t } = useTranslation('common');
const router = useRouter();
const backUrl = setupLinkToken ? `/setup/${setupLinkToken}/directory-sync` : '/admin/directory-sync';
Setup Link Feature (#628) * Share setup link related changes 1. Setup link creation for saml connection 2. Setup link creation for Directory sync 3. Regeneration of Setup link 4. Ability to open setup link without login 5. Setup link opens up SAML connection page 6. Saml Connection page hides Tenant & Product fields * Saving SAML and OIDC configuration * showing the connection list on setup page * Connections CRUD * UI changes for Setup layout * semantics changes connection -> sso-connection * directory sync support for share link * showing only current tenant product directories * fixes mentioned in commnets by Aswin * prettier formatting * fixed route * minor fixes * Fix the layout rendering for the /setup routes * minor fixes * review changes * package lock changes * package json and lock changes * removed xmlbuilder * package lock changes * removed api call from ConnectionList component * Back button link fix * intermediate changes for Setup link list feature * setup link list related changes * UI fixes and actions * removed unwanted import * setup link list action hooked with correct functions * path rewrites, styling changes, toast regenerate & delete setup links * fixes for mutate * minor tweaks to clipboard icon * updated package-lock * formatting changes * removed console log * Added cusor pointer for action for LinkList component Removed unused variable & validation of empty token Removed redundent validation code linting fixes * Auto redirect in setup link page for sso-connection create form Delete icon on setup link list page on hover red color & tooltips * removed redirect and used isValidating * fixes for router replace * toast for setup links * fixes for dsync apis * redirect related change * removing redirect for sso-connection * fallback to error.message Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com> Co-authored-by: Kiran <kiran@boxyhq.com>
2022-12-13 21:41:27 +00:00
return (
<div>
<LinkBack href={backUrl} />
<h2 className='mb-5 mt-5 font-bold text-gray-700 md:text-xl'>{t('create_dsync_connection')}</h2>
<div className='min-w-[28rem] rounded border border-gray-200 bg-white p-6 dark:border-gray-700 dark:bg-gray-800'>
<CreateDSync
displayHeader={false}
defaultWebhookEndpoint={defaultWebhookEndpoint}
defaultWebhookSecret={defaultWebhookSecret}
classNames={BOXYHQ_UI_CSS}
successCallback={({ connection }) => {
successToast(t('directory_created_successfully'));
connection?.id &&
router.replace(
setupLinkToken
? `/setup/${setupLinkToken}/directory-sync/${connection.id}`
: `/admin/directory-sync/${connection.id}`
);
}}
errorCallback={(errorMessage) => {
errorToast(errorMessage);
}}
excludeFields={
setupLinkToken
? ['name', 'tenant', 'product', 'webhook_url', 'webhook_secret', 'log_webhook_events']
: undefined
}
urls={{
post: setupLinkToken
? `/api/setup/${setupLinkToken}/directory-sync`
: '/api/admin/directory-sync',
}}
/>
Setup Link Feature (#628) * Share setup link related changes 1. Setup link creation for saml connection 2. Setup link creation for Directory sync 3. Regeneration of Setup link 4. Ability to open setup link without login 5. Setup link opens up SAML connection page 6. Saml Connection page hides Tenant & Product fields * Saving SAML and OIDC configuration * showing the connection list on setup page * Connections CRUD * UI changes for Setup layout * semantics changes connection -> sso-connection * directory sync support for share link * showing only current tenant product directories * fixes mentioned in commnets by Aswin * prettier formatting * fixed route * minor fixes * Fix the layout rendering for the /setup routes * minor fixes * review changes * package lock changes * package json and lock changes * removed xmlbuilder * package lock changes * removed api call from ConnectionList component * Back button link fix * intermediate changes for Setup link list feature * setup link list related changes * UI fixes and actions * removed unwanted import * setup link list action hooked with correct functions * path rewrites, styling changes, toast regenerate & delete setup links * fixes for mutate * minor tweaks to clipboard icon * updated package-lock * formatting changes * removed console log * Added cusor pointer for action for LinkList component Removed unused variable & validation of empty token Removed redundent validation code linting fixes * Auto redirect in setup link page for sso-connection create form Delete icon on setup link list page on hover red color & tooltips * removed redirect and used isValidating * fixes for router replace * toast for setup links * fixes for dsync apis * redirect related change * removing redirect for sso-connection * fallback to error.message Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com> Co-authored-by: Kiran <kiran@boxyhq.com>
2022-12-13 21:41:27 +00:00
</div>
</div>
);
};
export default CreateDirectory;