Skip to content

Commit

Permalink
Changing names of variables
Browse files Browse the repository at this point in the history
  • Loading branch information
simianhacker committed Nov 10, 2023
1 parent 75748ff commit 08daad7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ interface Props {
initialBurnRate?: number;
errors?: string[];
onChange: (burnRate: number) => void;
longWindowInHours: number;
timeWindowInHours: number;
longLookbackWindowInHours: number;
sloTimeWindowInHours: number;
}

export function BudgetConsumed({
onChange,
initialBurnRate = 1,
longWindowInHours,
timeWindowInHours,
longLookbackWindowInHours,
sloTimeWindowInHours,
errors,
}: Props) {
const [budgetConsumed, setBudgetConsumed] = useState<number>(
((initialBurnRate * longWindowInHours) / timeWindowInHours) * 100
((initialBurnRate * longLookbackWindowInHours) / sloTimeWindowInHours) * 100
);
const hasError = errors !== undefined && errors.length > 0;

const onBudgetConsumedChanged = (event: ChangeEvent<HTMLInputElement>) => {
const value = Number(event.target.value);
setBudgetConsumed(value);
const burnRate = timeWindowInHours * (value / 100 / longWindowInHours);
const burnRate = sloTimeWindowInHours * (value / 100 / longLookbackWindowInHours);
onChange(burnRate);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ function Window({
return 'N/A';
};

const timeWindowInHours = Math.round(
const sloTimeWindowInHours = Math.round(
toMinutes(toDuration(slo?.timeWindow.duration ?? '30d')) / 60
);

const computeBudgetConsumed = () => {
if (slo && longWindow.value > 0 && burnRateThreshold > 0) {
return (burnRateThreshold * longWindow.value) / timeWindowInHours;
return (burnRateThreshold * longWindow.value) / sloTimeWindowInHours;
}
return 0;
};
Expand Down Expand Up @@ -157,8 +157,8 @@ function Window({
initialBurnRate={burnRateThreshold}
onChange={onBurnRateChange}
errors={errors.burnRateThreshold}
timeWindowInHours={timeWindowInHours}
longWindowInHours={longWindow.value}
sloTimeWindowInHours={sloTimeWindowInHours}
longLookbackWindowInHours={longWindow.value}
/>
</EuiFlexItem>
)}
Expand Down

0 comments on commit 08daad7

Please sign in to comment.