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

Resolving blank screen issue when "No data is available to generate recommendations" #222

Open
wants to merge 2 commits into
base: mvp_demo
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -233,46 +233,23 @@ const RecommendationTables = (props: {
setDay(value);
};

const renderNotifications = (notifications: any) => (
<AlertGroup>
{Object.keys(notifications || {}).map((key) => {
const notification = notifications[key];
const alertType = notification.type || 'info';
const Icon = alertIconMap[alertType];
let displayContent;

return (
<div key={notification.code} style={{ display: 'flex', alignItems: 'center', marginBottom: '10px' }}>
{Icon}
<span style={{ marginLeft: '8px', color: 'black', fontWeight: 'normal' }}>
{notification.message}
</span>
</div>
);
})}
</AlertGroup>
);

return (
<>
<PageSection variant={PageSectionVariants.light}>
<Stack hasGutter>
<StackItem>
<br />
<WorkloadDetails
experimentData={{
experiment_name: props.SREdata.experiment_name,
namespace: props.SREdata.namespace,
name: props.SREdata.name,
type: props.SREdata.type,
cluster_name: props.SREdata.cluster_name,
container_name: props.SREdata.container_name,
experiment_type: props.SREdata.experiment_type
}}
/>
</StackItem>
<StackItem>
<Stack hasGutter>
<Flex className="example-border">
let initialNotifications = props.notification.level1
if (initialNotifications.hasOwnProperty('120001')) {
let varient = initialNotifications['120001'].type;
let message = initialNotifications['120001'].message
displayContent = (
<>
<AlertGroup>
<Alert variant={varient} title={message} />
</AlertGroup>
</>
);
} else {
displayContent = (
<>
<Flex className="example-border">
<Flex>
<FlexItem>
<Split hasGutter>
Expand Down Expand Up @@ -348,7 +325,31 @@ const RecommendationTables = (props: {
boxPlotData={boxPlotTranslatedData}
/>
</StackItem>
</>
</>
);
}
return (
<Stack hasGutter>
<StackItem>
<br />
<WorkloadDetails
experimentData={{
experiment_name: props.SREdata.experiment_name,
namespace: props.SREdata.namespace,
name: props.SREdata.name,
type: props.SREdata.type,
cluster_name: props.SREdata.cluster_name,
container_name: props.SREdata.container_name,
experiment_type: props.SREdata.experiment_type
}}
/>
</StackItem>
<StackItem>
<Stack hasGutter>
{displayContent}
</Stack>
</StackItem>
</Stack>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ const UsecaseSelection = (props: { endTimeArray; setEndTimeArray; SREdata; setSR
level1: initialNotifications
});
const has111000 = initialNotifications.hasOwnProperty('111000');
props.setDisplayRecc(has111000);
const has120001 = initialNotifications.hasOwnProperty('120001');

props.setDisplayRecc(has111000 || has120001);
// console.log(initialNotifications)
// console.log(has111000)

var containerArray: any[] = [];
for (var i = 0; i < data[0].kubernetes_objects[0].containers.length; i++) {
Expand Down