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

refactor(coral): Use new property hasOpenRequestOnEnyEnv for Claim Banners #1811

Merged
merged 3 commits into from
Oct 5, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions coral/src/app/features/components/ClaimBanner.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const testProps = {
claimEntity: mockClaimEntity,
isError: false,
hasOpenClaimRequest: false,
hasOpenRequest: false,
hasOpenRequestOnAnyEnv: false,
entityOwner: "teamname",
};

Expand Down Expand Up @@ -70,7 +70,7 @@ describe("ClaimBanner", () => {
<ClaimBanner
{...testProps}
entityType={"topic"}
hasOpenRequest={true}
hasOpenRequestOnAnyEnv={true}
/>
);
});
Expand All @@ -92,7 +92,7 @@ describe("ClaimBanner", () => {
<ClaimBanner
{...testProps}
entityType={"connector"}
hasOpenRequest={true}
hasOpenRequestOnAnyEnv={true}
/>
);
});
Expand All @@ -115,7 +115,7 @@ describe("ClaimBanner", () => {
{...testProps}
entityType={"topic"}
hasOpenClaimRequest={true}
hasOpenRequest={true}
hasOpenRequestOnAnyEnv={true}
/>,
{
memoryRouter: true,
Expand Down Expand Up @@ -151,7 +151,7 @@ describe("ClaimBanner", () => {
{...testProps}
entityType={"connector"}
hasOpenClaimRequest={true}
hasOpenRequest={true}
hasOpenRequestOnAnyEnv={true}
/>,
{
memoryRouter: true,
Expand Down
8 changes: 4 additions & 4 deletions coral/src/app/features/components/ClaimBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import illustration from "src/app/images/topic-details-banner-Illustration.svg";
interface ClaimBannerProps {
entityType: "topic" | "connector";
entityName: string;
hasOpenRequest: boolean;
hasOpenRequestOnAnyEnv: boolean;
hasOpenClaimRequest: boolean;
claimEntity: () => void;
isError: boolean;
Expand All @@ -17,14 +17,14 @@ const ClaimBanner = ({
entityType,
entityName,
hasOpenClaimRequest,
hasOpenRequest,
hasOpenRequestOnAnyEnv,
claimEntity,
isError,
errorMessage,
entityOwner,
}: ClaimBannerProps) => {
// if there is an open claim request, hasOpenRequest is true, too
if (hasOpenRequest && !hasOpenClaimRequest) {
// if there is an open claim request, hasOpenRequestOnAnyEnv is true, too
if (hasOpenRequestOnAnyEnv && !hasOpenClaimRequest) {
// We do not render an InternalLinkButton to the Requests page for this state...
// .. because a user cannot see the requests opened by members of other teams
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ function ConnectorDetails(props: ConnectorOverviewProps) {
connectorData?.connectorInfo.hasOpenClaimRequest
}
entityOwner={connectorData.connectorInfo.teamName}
hasOpenRequest={connectorData?.connectorInfo.hasOpenRequest}
hasOpenRequestOnAnyEnv={
connectorData?.connectorInfo.hasOpenRequestOnAnyEnv
}
claimEntity={() => setShowClaimModal(true)}
isError={isErrorCreateClaimConnectorRequest}
errorMessage={claimErrorMessage}
Expand Down
4 changes: 3 additions & 1 deletion coral/src/app/features/topics/details/TopicDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ function TopicDetails(props: TopicOverviewProps) {
entityName={topicName}
hasOpenClaimRequest={topicData?.topicInfo.hasOpenClaimRequest}
entityOwner={topicData.topicInfo.teamname}
hasOpenRequest={topicData?.topicInfo.hasOpenRequest}
hasOpenRequestOnAnyEnv={
topicData?.topicInfo.hasOpenRequestOnAnyEnv
}
claimEntity={() => setShowClaimModal(true)}
isError={createClaimTopicRequestIsError}
errorMessage={claimErrorMessage}
Expand Down
Loading