• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / codegate-ui / 12926666174

23 Jan 2025 09:57AM UTC coverage: 69.335% (+0.05%) from 69.289%
12926666174

Pull #179

github

web-flow
Merge bca7c8f58 into 70310476e
Pull Request #179: refactor: implement new UIKit options schema

303 of 530 branches covered (57.17%)

Branch coverage included in aggregate %.

615 of 794 relevant lines covered (77.46%)

57.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/src/features/dashboard-codegate-status/components/codegate-status-polling-control.tsx
1
import { Dispatch, SetStateAction } from "react";
2
import { Label, Select, SelectButton, OptionsSchema } from "@stacklok/ui-kit";
3

4
// NOTE: We don't poll more than once per minute, as the server depends on
5
// Github's public API, which is rate limited to 60reqs per hour.
6
export const POLLING_INTERVAl = {
3✔
7
  "1_MIN": { value: 60_000, name: "1 minute" },
8
  "5_MIN": { value: 300_000, name: "5 minutes" },
9
  "10_MIN": { value: 600_000, name: "10 minutes" },
10
} as const;
11

12
export const INTERVAL_SELECT_ITEMS: OptionsSchema<"listbox">[] = Object.entries(
3✔
13
  POLLING_INTERVAl,
14
).map(([key, { name }]) => {
15
  return { textValue: name, id: key };
9✔
16
});
17

18
export const DEFAULT_INTERVAL: PollingInterval = "5_MIN";
3✔
19

20
export type PollingInterval = keyof typeof POLLING_INTERVAl;
21

22
export function PollIntervalControl({
23
  className,
24
  pollingInterval,
25
  setPollingInterval,
26
}: {
27
  className?: string;
28
  pollingInterval: PollingInterval;
29
  setPollingInterval: Dispatch<SetStateAction<PollingInterval>>;
30
}) {
31
  return (
32
    <Select
33
      className={className}
34
      onSelectionChange={(v) =>
35
        setPollingInterval(v.toString() as PollingInterval)
×
36
      }
37
      items={INTERVAL_SELECT_ITEMS}
38
      defaultSelectedKey={pollingInterval}
39
    >
40
      <Label className="w-full text-right font-semibold text-secondary -mb-1">
41
        Check for updates
42
      </Label>
43
      <SelectButton
44
        isBorderless
45
        className="h-7 max-w-36 pr-0 [&>span>span]:text-right [&>span>span]:justify-end !gap-0 text-secondary"
46
      />
47
    </Select>
48
  );
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc