Skip to content

Commit

Permalink
Revert "Switch from toast to callout for integration set up failures (o…
Browse files Browse the repository at this point in the history
  • Loading branch information
mengweieric committed Nov 8, 2023
1 parent 612eb13 commit 999dd68
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
"type": "",
}
}
setupCallout={
Object {
"show": false,
}
}
updateConfig={[Function]}
>
<EuiForm>
Expand All @@ -65,11 +60,6 @@ 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 @@ -695,7 +685,6 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
loadingProgress={0}
setLoading={[Function]}
setProgress={[Function]}
setSetupCallout={[Function]}
>
<EuiBottomBar>
<EuiPortal>
Expand All @@ -718,11 +707,11 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButtonEmpty euiButtonEmpty--text"
class="euiButton euiButton--secondary"
type="button"
>
<span
class="euiButtonContent euiButtonEmpty__content"
class="euiButtonContent euiButton__content"
>
<svg
aria-hidden="true"
Expand All @@ -735,7 +724,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
xmlns="http://www.w3.org/2000/svg"
/>
<span
class="euiButtonEmpty__text"
class="euiButton__text"
>
Discard
</span>
Expand Down Expand Up @@ -817,66 +806,81 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
<div
className="euiFlexItem euiFlexItem--flexGrowZero"
>
<EuiButtonEmpty
color="text"
<EuiButton
color="secondary"
iconType="cross"
onClick={[Function]}
>
<button
className="euiButtonEmpty euiButtonEmpty--text"
<EuiButtonDisplay
baseClassName="euiButton"
color="secondary"
disabled={false}
element="button"
iconType="cross"
isDisabled={false}
onClick={[Function]}
type="button"
>
<EuiButtonContent
className="euiButtonEmpty__content"
iconSide="left"
iconSize="m"
iconType="cross"
textProps={
<button
className="euiButton euiButton--secondary"
disabled={false}
onClick={[Function]}
style={
Object {
"className": "euiButtonEmpty__text",
"minWidth": undefined,
}
}
type="button"
>
<span
className="euiButtonContent euiButtonEmpty__content"
<EuiButtonContent
className="euiButton__content"
iconSide="left"
iconType="cross"
textProps={
Object {
"className": "euiButton__text",
}
}
>
<EuiIcon
className="euiButtonContent__icon"
color="inherit"
size="m"
type="cross"
<span
className="euiButtonContent euiButton__content"
>
<EuiIconEmpty
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiButtonContent__icon"
focusable="false"
role="img"
style={null}
<EuiIcon
className="euiButtonContent__icon"
color="inherit"
size="m"
type="cross"
>
<svg
<EuiIconEmpty
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="euiButtonEmpty__text"
>
Discard
>
<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>
</span>
</span>
</EuiButtonContent>
</button>
</EuiButtonEmpty>
</EuiButtonContent>
</button>
</EuiButtonDisplay>
</EuiButton>
</div>
</EuiFlexItem>
<EuiFlexItem
Expand Down Expand Up @@ -1025,11 +1029,6 @@ exports[`Integration Setup Page Renders the form as expected 1`] = `
"version": "2.0.0",
}
}
setupCallout={
Object {
"show": false,
}
}
updateConfig={[Function]}
>
<EuiForm>
Expand All @@ -1048,11 +1047,6 @@ 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,7 +30,6 @@ 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: unknown;
components: Array<{ name: string }>;
displayAssets: unknown[];
statics: any;
components: any[];
displayAssets: any[];
}

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

0 comments on commit 999dd68

Please sign in to comment.