From 553ca9a98a2a736e4707b8637b413507926a7b4b Mon Sep 17 00:00:00 2001 From: Subbu Venkateswaran Date: Tue, 17 Dec 2024 16:55:05 -0800 Subject: [PATCH] Minor UI copy changes for maintainer token role auth flow --- ui/src/components/AuthPage/index.tsx | 38 +++++++++---------- ui/src/components/AuthPage/styles.ts | 5 --- ui/src/components/ConnectedPage/index.tsx | 4 +- .../IncomingWebhookSectionMessage.tsx | 9 ++++- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/ui/src/components/AuthPage/index.tsx b/ui/src/components/AuthPage/index.tsx index 9b09168..2a6a239 100644 --- a/ui/src/components/AuthPage/index.tsx +++ b/ui/src/components/AuthPage/index.tsx @@ -21,14 +21,7 @@ import { AuthErrorTypes, ErrorTypes } from '../../resolverTypes'; import { useAppContext } from '../../hooks/useAppContext'; import { IncomingWebhookSectionMessage } from '../IncomingWebhookSectionMessage'; import { GitLabRoles } from '../../types'; -import { - CopyIconWrapper, - FormWrapper, - ListItemContent, - ReloadButtonWrapper, - SectionMessageWrapper, - TokenRoleWrapper, -} from './styles'; +import { CopyIconWrapper, FormWrapper, ReloadButtonWrapper, SectionMessageWrapper, TokenRoleWrapper } from './styles'; const buildValidationMethod = (errorType: ErrorTypes) => { switch (errorType) { @@ -260,6 +253,7 @@ export const AuthPage = () => { }; const handleWebhookUrlCopy = useCallback(() => { + console.log('Copying webhook URL', webhookSetupConfig.triggerUrl); return navigator.clipboard .writeText(webhookSetupConfig.triggerUrl) .then(() => { @@ -271,7 +265,7 @@ export const AuthPage = () => { .catch(() => { console.log('Error copying webhook URL'); }); - }, []); + }, [webhookSetupConfig]); const ConnectionMessage = () => features.isGitlabMaintainerTokenEnabled && selectedRole === GitLabRoles.MAINTAINER ? ( @@ -324,11 +318,16 @@ export const AuthPage = () => { ); - const WebhookCopyIcon = () => ( - - - - + const WebhookCopyButton = () => ( + + ); @@ -341,9 +340,7 @@ export const AuthPage = () => { ); @@ -385,7 +385,7 @@ export const AuthPage = () => { )} - + )} diff --git a/ui/src/components/AuthPage/styles.ts b/ui/src/components/AuthPage/styles.ts index b28ad45..a429626 100644 --- a/ui/src/components/AuthPage/styles.ts +++ b/ui/src/components/AuthPage/styles.ts @@ -43,8 +43,3 @@ export const CopyIconWrapper = styled.button` color: ${token('color.icon')}; } `; - -export const ListItemContent = styled.span` - display: flex; - align-items: center; -`; diff --git a/ui/src/components/ConnectedPage/index.tsx b/ui/src/components/ConnectedPage/index.tsx index 9ea48ab..453328d 100644 --- a/ui/src/components/ConnectedPage/index.tsx +++ b/ui/src/components/ConnectedPage/index.tsx @@ -21,7 +21,7 @@ export const ConnectedPage = () => { const [groups, setGroups] = useState(); const navigate = useNavigate(); - const { getConnectedInfo, clearGroup } = useAppContext(); + const { features, getConnectedInfo, clearGroup } = useAppContext(); const { isImportInProgress } = useImportContext(); const handleDisconnectGroup = async (id: number) => { @@ -70,7 +70,7 @@ export const ConnectedPage = () => {

Connected group

You can connect only one GitLab group to Compass at a time, and you must be an owner of that group.


- +
{ +type Props = { + isMaintainerTokenEnabled?: boolean; +}; + +export const IncomingWebhookSectionMessage = ({ isMaintainerTokenEnabled = false }: Props) => { return (

- If you're not a group owner or use the self-managed version of GitLab, you can use{' '} + If you're not a group owner{isMaintainerTokenEnabled ? '/maintainer' : ''} or use the self-managed version of + GitLab, you can use{' '} incoming webhooks {' '}