Skip to content

Commit

Permalink
Add toast for load failure in acc flyout
Browse files Browse the repository at this point in the history
Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>
  • Loading branch information
ps48 committed Oct 25, 2023
1 parent 984defc commit 9504505
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
ACCELERATION_INDEX_TYPES,
ACC_INDEX_TYPE_DOCUMENTATION_URL,
} from '../../../../common/constants';
import { useToast } from '../../../../common/toast';
import {
AccelerationIndexType,
CreateAccelerationForm,
Expand All @@ -36,6 +37,7 @@ export const IndexTypeSelector = ({
accelerationFormData,
setAccelerationFormData,
}: IndexTypeSelectorProps) => {
const { setToast } = useToast();
const [selectedIndexType, setSelectedIndexType] = useState<EuiComboBoxOptionOption<string>[]>([
ACCELERATION_INDEX_TYPES[0],
]);
Expand Down Expand Up @@ -68,6 +70,7 @@ export const IndexTypeSelector = ({
}
if (data.status === 'FAILED') {
setLoading(false);
setToast(`ERROR: failed to load table columns`, 'danger');
}
});
});
Expand Down
5 changes: 5 additions & 0 deletions public/components/acceleration/selectors/source_selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { EuiComboBox, EuiComboBoxOptionOption, EuiFormRow, EuiSpacer, EuiText }
import producer from 'immer';
import React, { useEffect, useState } from 'react';
import { CoreStart } from '../../../../../../src/core/public';
import { useToast } from '../../../../common/toast';
import { CreateAccelerationForm } from '../../../../common/types';
import { getJobId, pollQueryStatus } from '../../../../common/utils/async_query_helpers';
import { hasError, validateDataSource } from '../create/utils';
Expand All @@ -24,6 +25,7 @@ export const AccelerationDataSourceSelector = ({
setAccelerationFormData,
selectedDatasource,
}: AccelerationDataSourceSelectorProps) => {
const { setToast } = useToast();
const [dataConnections, setDataConnections] = useState<EuiComboBoxOptionOption<string>[]>([]);
const [selectedDataConnection, setSelectedDataConnection] = useState<
EuiComboBoxOptionOption<string>[]
Expand Down Expand Up @@ -52,6 +54,7 @@ export const AccelerationDataSourceSelector = ({
})
.catch((err) => {
console.error(err);
setToast(`ERROR: failed to load datasources`, 'danger');
});
setLoadingComboBoxes({ ...loadingComboBoxes, dataSource: false });
};
Expand All @@ -74,6 +77,7 @@ export const AccelerationDataSourceSelector = ({
}
if (data.status === 'FAILED') {
setLoadingComboBoxes({ ...loadingComboBoxes, database: false });
setToast(`ERROR: failed to load databases`, 'danger');
}
});
});
Expand All @@ -97,6 +101,7 @@ export const AccelerationDataSourceSelector = ({
}
if (data.status === 'FAILED') {
setLoadingComboBoxes({ ...loadingComboBoxes, dataTable: false });
setToast(`ERROR: failed to load tables`, 'danger');
}
});
});
Expand Down

0 comments on commit 9504505

Please sign in to comment.