Skip to content

Commit

Permalink
refactor(coral): Use new property hasOpenRequestOnEnyEnv for Claim …
Browse files Browse the repository at this point in the history
…Banners (#1811)

* Update ClaimBanner

Signed-off-by: Mirjam Aulbach <[email protected]>

* Use new property when using ClaimBanner

Signed-off-by: Mirjam Aulbach <[email protected]>

---------

Signed-off-by: Mirjam Aulbach <[email protected]>
  • Loading branch information
programmiri authored Oct 5, 2023
1 parent 6c9a7c1 commit 8acd3fc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
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

0 comments on commit 8acd3fc

Please sign in to comment.