Skip to content

Commit

Permalink
Switch from toast to callout for integration set up failures (opensea…
Browse files Browse the repository at this point in the history
  • Loading branch information
Swiddis authored Oct 23, 2023
1 parent 2c94e9e commit 095bdfa
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
"type": "",
}
}
setupCallout={
Object {
"show": false,
}
}
updateConfig={[Function]}
>
<EuiForm>
Expand All @@ -60,6 +65,11 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
className="euiSpacer euiSpacer--l"
/>
</EuiSpacer>
<EuiSpacer>
<div
className="euiSpacer euiSpacer--l"
/>
</EuiSpacer>
<EuiText>
<div
className="euiText euiText--medium"
Expand Down Expand Up @@ -685,6 +695,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
loadingProgress={0}
setLoading={[Function]}
setProgress={[Function]}
setSetupCallout={[Function]}
>
<EuiBottomBar>
<EuiPortal>
Expand All @@ -707,11 +718,11 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--secondary"
class="euiButtonEmpty euiButtonEmpty--text"
type="button"
>
<span
class="euiButtonContent euiButton__content"
class="euiButtonContent euiButtonEmpty__content"
>
<svg
aria-hidden="true"
Expand All @@ -724,7 +735,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
xmlns="http://www.w3.org/2000/svg"
/>
<span
class="euiButton__text"
class="euiButtonEmpty__text"
>
Discard
</span>
Expand Down Expand Up @@ -805,81 +816,66 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
<div
className="euiFlexItem euiFlexItem--flexGrowZero"
>
<EuiButton
color="secondary"
<EuiButtonEmpty
color="text"
iconType="cross"
onClick={[Function]}
>
<EuiButtonDisplay
baseClassName="euiButton"
color="secondary"
<button
className="euiButtonEmpty euiButtonEmpty--text"
disabled={false}
element="button"
iconType="cross"
isDisabled={false}
onClick={[Function]}
type="button"
>
<button
className="euiButton euiButton--secondary"
disabled={false}
onClick={[Function]}
style={
<EuiButtonContent
className="euiButtonEmpty__content"
iconSide="left"
iconSize="m"
iconType="cross"
textProps={
Object {
"minWidth": undefined,
"className": "euiButtonEmpty__text",
}
}
type="button"
>
<EuiButtonContent
className="euiButton__content"
iconSide="left"
iconType="cross"
textProps={
Object {
"className": "euiButton__text",
}
}
<span
className="euiButtonContent euiButtonEmpty__content"
>
<span
className="euiButtonContent euiButton__content"
<EuiIcon
className="euiButtonContent__icon"
color="inherit"
size="m"
type="cross"
>
<EuiIcon
className="euiButtonContent__icon"
color="inherit"
size="m"
type="cross"
<EuiIconEmpty
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiButtonContent__icon"
focusable="false"
role="img"
style={null}
>
<EuiIconEmpty
<svg
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiButtonContent__icon"
focusable="false"
height={16}
role="img"
style={null}
>
<svg
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiButtonContent__icon"
focusable="false"
height={16}
role="img"
style={null}
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
/>
</EuiIconEmpty>
</EuiIcon>
<span
className="euiButton__text"
>
Discard
</span>
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
/>
</EuiIconEmpty>
</EuiIcon>
<span
className="euiButtonEmpty__text"
>
Discard
</span>
</EuiButtonContent>
</button>
</EuiButtonDisplay>
</EuiButton>
</span>
</EuiButtonContent>
</button>
</EuiButtonEmpty>
</div>
</EuiFlexItem>
<EuiFlexItem
Expand Down Expand Up @@ -1027,6 +1023,11 @@ exports[`Integration Setup Page Renders the form as expected 1`] = `
"version": "2.0.0",
}
}
setupCallout={
Object {
"show": false,
}
}
updateConfig={[Function]}
>
<EuiForm>
Expand All @@ -1045,6 +1046,11 @@ exports[`Integration Setup Page Renders the form as expected 1`] = `
className="euiSpacer euiSpacer--l"
/>
</EuiSpacer>
<EuiSpacer>
<div
className="euiSpacer euiSpacer--l"
/>
</EuiSpacer>
<EuiText>
<div
className="euiText euiText--medium"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('Integration Setup Page', () => {
config={TEST_INTEGRATION_SETUP_INPUTS}
updateConfig={() => {}}
integration={TEST_INTEGRATION_CONFIG}
setupCallout={{ show: false }}
/>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export interface AvailableIntegrationType {
version?: string | undefined;
displayName?: string;
integrationType: string;
statics: any;
components: any[];
displayAssets: any[];
statics: unknown;
components: Array<{ name: string }>;
displayAssets: unknown[];
}

export interface AvailableIntegrationsTableProps {
Expand Down Expand Up @@ -183,7 +183,11 @@ export function AvailableIntegrationOverviewPage(props: AvailableIntegrationOver
? AvailableIntegrationsCardView({
data: {
hits: data.hits.filter((hit) =>
helper.every((compon) => hit.components.map((x) => x.name).includes(compon))
helper.every((compon) =>
hit.components
.map((x) => x.name.split('_').findLast(() => true))
.includes(compon)
)
),
},
isCardView,
Expand All @@ -197,7 +201,11 @@ export function AvailableIntegrationOverviewPage(props: AvailableIntegrationOver
loading: false,
data: {
hits: data.hits.filter((hit) =>
helper.every((compon) => hit.components.map((x) => x.name).includes(compon))
helper.every((compon) =>
hit.components
.map((x) => x.name.split('_').findLast(() => true))
.includes(compon)
)
),
},
isCardView,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,13 @@ export async function addIntegrationRequest(
.post(`${INTEGRATIONS_BASE}/store/${templateName}`, {
body: JSON.stringify({ name, dataSource }),
})
.then((_res) => {
.then((res) => {
setToast(`${name} integration successfully added!`, 'success');
window.location.hash = `#/installed/${_res.data?.id}`;
window.location.hash = `#/installed/${res.data?.id}`;
return true;
})
.catch((_err) => {
setToast(
'Failed to load integration. Check Added Integrations table for more details',
'danger'
);
.catch((err) => {
setToast('Failed to load integration', 'danger', err.message);
return false;
});
if (!addSample || !response) {
Expand All @@ -333,7 +330,7 @@ export async function addIntegrationRequest(
.then((res) => res.data)
.catch((err) => {
console.error(err);
setToast('The sample data could not be retrieved', 'danger');
setToast('Failed to load integration', 'danger', 'The sample data could not be retrieved.');
return { sampleData: [] };
});
const requestBody =
Expand Down
Loading

0 comments on commit 095bdfa

Please sign in to comment.