Skip to content

Commit

Permalink
ARC-2911 let all share page content show the same thing
Browse files Browse the repository at this point in the history
  • Loading branch information
anshengxu committed Feb 29, 2024
1 parent bfad609 commit 567068c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,7 @@ const ServerManagement = (): JSX.Element => {
Connect a new Jenkins server
</Button>
<SharePage
analyticsScreenEventNameEnum={AnalyticsScreenEventsEnum.ServerManagementScreenName}
moduleKey={moduleKey}/>
analyticsScreenEventNameEnum={AnalyticsScreenEventsEnum.ServerManagementScreenName}/>
</ButtonGroup>
);

Expand Down
22 changes: 8 additions & 14 deletions app/jenkins-for-jira-ui/src/components/SharePage/SharePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { JenkinsModal } from '../JenkinsServerList/ConnectedServer/JenkinsModal'
import { shareModalInstruction } from '../ServerManagement/ServerManagement.styles';

import { fetchGlobalPageUrl } from '../../api/fetchGlobalPageUrl';
import { CONFIG_PAGE } from '../../common/constants';

const analyticsClient = new AnalyticsClient();

Expand All @@ -28,13 +27,7 @@ export const getSiteNameFromUrl = (url: string): string => {
}
};

const getSharePageMessage = (globalPageUrl: string, moduleKey?: string): string => {
const versionRequirementMessage = moduleKey === CONFIG_PAGE
? `
Not a member of this Jira site? You can follow the instructions here instead:
https://support.atlassian.com/jira-cloud-administration/docs/how-jenkins-for-jira-works/` : '';

const getSharePageMessage = (globalPageUrl: string): string => {
return `Hi there,
Jenkins for Jira is now installed and connected on ${getSiteNameFromUrl(globalPageUrl)}.
Expand All @@ -44,19 +37,20 @@ To set up what build and deployment events Jenkins send to Jira, follow the set
${globalPageUrl}
You'll need to follow the set up guide for each connected server.
${versionRequirementMessage}`;
Not a member of this Jira site? You can follow the instructions here instead:
https://support.atlassian.com/jira-cloud-administration/docs/how-jenkins-for-jira-works/`;
};

type SharePageProps = {
analyticsScreenEventNameEnum: AnalyticsScreenEventsEnum;
buttonAppearance?: string;
moduleKey?: string;
};

export const SharePage = ({
analyticsScreenEventNameEnum,
buttonAppearance,
moduleKey
buttonAppearance
}:SharePageProps): JSX.Element => {
const textAreaRef = useRef<HTMLTextAreaElement>(null);
const [isCopiedToClipboard, setIsCopiedToClipboard] = useState(false);
Expand All @@ -77,8 +71,8 @@ export const SharePage = ({
};

await fetchData();
setSharePageMessage(getSharePageMessage(globalPageUrl, moduleKey));
}, [globalPageUrl, moduleKey]);
setSharePageMessage(getSharePageMessage(globalPageUrl));
}, [globalPageUrl]);

useEffect(() => {
constructSharePageMessage();
Expand Down

0 comments on commit 567068c

Please sign in to comment.