Skip to content

Commit

Permalink
Add WIP for fix
Browse files Browse the repository at this point in the history
  • Loading branch information
EMaksy committed May 15, 2023
1 parent bee8a43 commit 9075970
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
10 changes: 10 additions & 0 deletions assets/js/components/ExecutionResults/ExecutionResults.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import HealthIcon from '@components/Health';
import Modal from '@components/Modal';
import PremiumPill from '@components/PremiumPill';
import Table from '@components/Table';
import LoadingBox from '@components/LoadingBox';
import {
getCatalogCategoryList,
getCheckResults,
Expand Down Expand Up @@ -116,6 +117,15 @@ function ExecutionResults({
onLastExecutionUpdate();
}
};
console.log(
'catalog length',
catalog.length,
'catalog loading',
catalogLoading
);
if (catalogLoading) {
return <LoadingBox text="Loading checks catalog" />;
}

const checksResults = getCheckResults(executionData);
const catalogCategoryList = getCatalogCategoryList(catalog, checksResults);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
RUNNING_STATES,
} from '@state/lastExecutions';
import ExecutionResults from './ExecutionResults';
import LoadingBox from '../LoadingBox';

function ExecutionResultsPage() {
const { clusterID } = useParams();
Expand Down Expand Up @@ -40,7 +41,7 @@ function ExecutionResultsPage() {
}, [cloudProvider]);

if (!cluster) {
return <div>Loading...</div>;
return <LoadingBox text="Loading ..." />;
}

return (
Expand Down
21 changes: 14 additions & 7 deletions assets/js/components/ExecutionResults/checksUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,20 @@ export const getCatalogCategoryList = (catalog, checksResults = []) => {
if (!catalog || catalog.length === 0 || !checksResults) {
return [];
}
return [
...new Set(
checksResults.map(
({ check_id }) => catalog.find((check) => check.id === check_id).group
)
),
].sort();
console.log(
'getCatalogCategoryList catalog ',
catalog,
'checksResults ',
checksResults
);
const uniqueGroups = checksResults
.map(({ check_id }) => {
const check = catalog.find((check) => check.id === check_id);
return check ? check.group : undefined;
})
.filter(Boolean);

return [...new Set(uniqueGroups)].sort();
};

export const getCheckDescription = (catalog, checkID) => {
Expand Down
1 change: 1 addition & 0 deletions assets/js/state/selectors/lastExecutions.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const getLastExecutionData = (groupID) => (state) => {
const clusterHosts = getClusterHosts(groupID)(state);
const cluster = getCluster(groupID)(state);
const catalog = getCatalog()(state);
console.log('catalog', catalog, 'catalog loading', catalog.loading);
const lastExecution = getLastExecution(groupID)(state) || null;

const enrichedExecution = lastExecution
Expand Down

0 comments on commit 9075970

Please sign in to comment.