Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mds bug fixs #914

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions public/pages/Dashboard/Container/DashboardOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,18 @@ export function DashboardOverview(props: OverviewProps) {
};

const intializeDetectors = async () => {
dispatch(
getDetectorList(
getAllDetectorsQueryParamsWithDataSourceId(
MDSOverviewState.selectedDataSourceId
// wait until selected data source is ready before doing dispatch calls if mds is enabled
if (!dataSourceEnabled || (MDSOverviewState.selectedDataSourceId && MDSOverviewState.selectedDataSourceId !== "")) {
dispatch(
getDetectorList(
getAllDetectorsQueryParamsWithDataSourceId(
MDSOverviewState.selectedDataSourceId
)
)
)
);
dispatch(getIndices('', MDSOverviewState.selectedDataSourceId));
dispatch(getAliases('', MDSOverviewState.selectedDataSourceId));
);
dispatch(getIndices('', MDSOverviewState.selectedDataSourceId));
dispatch(getAliases('', MDSOverviewState.selectedDataSourceId));
}
};

useEffect(() => {
Expand Down
13 changes: 8 additions & 5 deletions public/pages/DetectorsList/containers/List/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,14 @@ export const DetectorList = (props: ListProps) => {
}, [confirmModalState.isRequestingToClose, isLoading]);

const getUpdatedDetectors = async () => {
dispatch(
getDetectorList(
getAllDetectorsQueryParamsWithDataSourceId(state.selectedDataSourceId)
)
);
// wait until selected data source is ready before doing dispatch calls if mds is enabled
if (!dataSourceEnabled || (state.selectedDataSourceId && state.selectedDataSourceId !== "")) {
dispatch(
getDetectorList(
getAllDetectorsQueryParamsWithDataSourceId(state.selectedDataSourceId)
)
);
}
};

const handlePageChange = (pageNumber: number) => {
Expand Down
33 changes: 18 additions & 15 deletions public/pages/Overview/containers/AnomalyDetectionOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,23 +155,26 @@ export function AnomalyDetectionOverview(props: AnomalyDetectionOverviewProps) {

// fetch smaple detectors and sample indices
const fetchData = async () => {
await dispatch(
getDetectorList(
getSampleDetectorsQueryParamsWithDataSouceId(
// wait until selected data source is ready before doing dispatch calls if mds is enabled
if (!dataSourceEnabled || (MDSOverviewState.selectedDataSourceId && MDSOverviewState.selectedDataSourceId !== "")) {
await dispatch(
getDetectorList(
getSampleDetectorsQueryParamsWithDataSouceId(
MDSOverviewState.selectedDataSourceId
)
)
).catch((error: any) => {
console.error('Error getting sample detectors: ', error);
});
await dispatch(
getIndices(
GET_SAMPLE_INDICES_QUERY,
MDSOverviewState.selectedDataSourceId
)
)
).catch((error: any) => {
console.error('Error getting sample detectors: ', error);
});
await dispatch(
getIndices(
GET_SAMPLE_INDICES_QUERY,
MDSOverviewState.selectedDataSourceId
)
).catch((error: any) => {
console.error('Error getting sample indices: ', error);
});
).catch((error: any) => {
console.error('Error getting sample indices: ', error);
});
}
};

// Create and populate sample index, create and start sample detector
Expand Down
2 changes: 1 addition & 1 deletion public/redux/reducers/ad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ export const getDetector = (
export const getDetectorList = (
queryParams: GetDetectorsQueryParams
): APIAction => {
const dataSourceId = queryParams.dataSourceId || '';
const dataSourceId = queryParams.dataSourceId;

const baseUrl = `${AD_NODE_API.DETECTOR}/_list`;
const url = dataSourceId
Expand Down
4 changes: 3 additions & 1 deletion public/redux/reducers/previewAnomalies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ const reducer = handleActions<PreviewAnomalies>(
initialDetectorsState
);

export const previewDetector = (requestBody: any, dataSourceId: string = ''): APIAction => {
export const previewDetector = (requestBody: any): APIAction => {
const dataSourceId = requestBody.dataSourceId;

const baseUrl = `..${AD_NODE_API.DETECTOR}/preview`;
const url = dataSourceId ? `${baseUrl}/${dataSourceId}` : baseUrl;

Expand Down
Loading