-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show the error and function tab link in the entity card [FUS-97] (
#1803) * feat: show the error and function tab link in the entity card * chore: fix unit test * chore: make error simple red text * test: function invocation error card * chore: cleanup function invocation error card
- Loading branch information
1 parent
5744bed
commit 2b52dfd
Showing
7 changed files
with
271 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
packages/reference/src/components/ResourceEntityErrorCard/FunctionInvocationErrorCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import * as React from 'react'; | ||
|
||
import { Flex, Text, TextLink } from '@contentful/f36-components'; | ||
|
||
import { MissingEntityCard } from '..'; | ||
|
||
import { ErrorCircleOutlineIcon, ExternalLinkIcon } from '@contentful/f36-icons'; | ||
|
||
import { useResourceProvider } from '../../common/EntityStore'; | ||
|
||
type FunctionInvocationErrorCardProps = { | ||
isSelected?: boolean; | ||
isDisabled?: boolean; | ||
organizationId: string; | ||
appDefinitionId: string; | ||
onRemove?: Function; | ||
providerName?: string; | ||
}; | ||
|
||
export function FunctionInvocationErrorCard({ | ||
providerName = 'Source', | ||
organizationId, | ||
appDefinitionId, | ||
isDisabled, | ||
isSelected, | ||
onRemove, | ||
}: FunctionInvocationErrorCardProps) { | ||
const { status, data } = useResourceProvider(organizationId, appDefinitionId); | ||
|
||
const functionId = data?.function.sys.id; | ||
const functionLink = `/account/organizations/${organizationId}/apps/definitions/${appDefinitionId}/functions/${functionId}/logs`; | ||
|
||
return ( | ||
<MissingEntityCard | ||
as="div" | ||
providerName={providerName} | ||
isDisabled={isDisabled} | ||
isSelected={isSelected} | ||
onRemove={onRemove} | ||
customMessage={''} | ||
testId="cf-ui-function-invocation-error-card" | ||
> | ||
<Flex justifyContent="left" alignItems="center"> | ||
<ErrorCircleOutlineIcon variant="negative" /> | ||
<Text fontColor="colorNegative"> Function invocation error.</Text> | ||
{status === 'success' && functionId && ( | ||
<Text fontColor="colorNegative"> | ||
For more information, go to | ||
<TextLink | ||
testId="cf-ui-function-invocation-log-link" | ||
icon={<ExternalLinkIcon />} | ||
alignIcon="end" | ||
href={functionLink} | ||
> | ||
function logs | ||
</TextLink> | ||
</Text> | ||
)} | ||
</Flex> | ||
</MissingEntityCard> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.