Standardise loading state naming across dashboard hooks
This commit is contained in:
@@ -200,7 +200,7 @@ export const BanTrendChart = memo(function BanTrendChart({
|
||||
source = "fail2ban",
|
||||
}: BanTrendChartProps): React.JSX.Element {
|
||||
const styles = useStyles();
|
||||
const { buckets, isLoading, error, reload } = useBanTrend(timeRange, origin, source);
|
||||
const { buckets, loading, error, reload } = useBanTrend(timeRange, origin, source);
|
||||
|
||||
const isEmpty = buckets.every((b) => b.count === 0);
|
||||
const entries = buildEntries(buckets, timeRange);
|
||||
@@ -227,7 +227,7 @@ export const BanTrendChart = memo(function BanTrendChart({
|
||||
|
||||
return (
|
||||
<ChartStateWrapper
|
||||
isLoading={isLoading}
|
||||
isLoading={loading}
|
||||
error={error}
|
||||
onRetry={reload}
|
||||
isEmpty={isEmpty}
|
||||
|
||||
@@ -134,7 +134,7 @@ export const JailDistributionChart = memo(function JailDistributionChart({
|
||||
origin,
|
||||
}: JailDistributionChartProps): React.JSX.Element {
|
||||
const styles = useStyles();
|
||||
const { jails, isLoading, error, reload } = useJailDistribution(timeRange, origin);
|
||||
const { jails, loading, error, reload } = useJailDistribution(timeRange, origin);
|
||||
|
||||
const entries = buildEntries(jails);
|
||||
const chartHeight = Math.max(entries.length * BAR_HEIGHT_PX, MIN_CHART_HEIGHT);
|
||||
@@ -149,7 +149,7 @@ export const JailDistributionChart = memo(function JailDistributionChart({
|
||||
|
||||
return (
|
||||
<ChartStateWrapper
|
||||
isLoading={isLoading}
|
||||
isLoading={loading}
|
||||
error={error}
|
||||
onRetry={reload}
|
||||
isEmpty={jails.length === 0}
|
||||
|
||||
@@ -36,7 +36,7 @@ function wrap(ui: React.ReactElement) {
|
||||
const defaultResult: UseBanTrendResult = {
|
||||
buckets: [],
|
||||
bucketSize: "1h",
|
||||
isLoading: false,
|
||||
loading: false,
|
||||
error: null,
|
||||
reload: vi.fn(),
|
||||
};
|
||||
@@ -54,7 +54,7 @@ beforeEach(() => {
|
||||
|
||||
describe("BanTrendChart", () => {
|
||||
it("shows a spinner while loading", () => {
|
||||
mockHook({ isLoading: true });
|
||||
mockHook({ loading: true });
|
||||
wrap(<BanTrendChart timeRange="24h" origin="all" />);
|
||||
expect(screen.getByRole("progressbar")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ function wrap(ui: React.ReactElement) {
|
||||
const defaultResult: UseJailDistributionResult = {
|
||||
jails: [],
|
||||
total: 0,
|
||||
isLoading: false,
|
||||
loading: false,
|
||||
error: null,
|
||||
reload: vi.fn(),
|
||||
};
|
||||
@@ -53,7 +53,7 @@ beforeEach(() => {
|
||||
|
||||
describe("JailDistributionChart", () => {
|
||||
it("shows a spinner while loading", () => {
|
||||
mockHook({ isLoading: true });
|
||||
mockHook({ loading: true });
|
||||
wrap(<JailDistributionChart timeRange="24h" origin="all" />);
|
||||
expect(screen.getByRole("progressbar")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user