@acarmisc/backstage-plugin-litellm 0.36.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -6767,6 +6767,10 @@ function postToLoopback(redirectUri, fields) {
6767
6767
  document.body.appendChild(form);
6768
6768
  form.submit();
6769
6769
  }
6770
+ function initialTeams(all, have) {
6771
+ const missing = all.filter((id) => !have.has(id));
6772
+ return new Set(have.size ? missing : all);
6773
+ }
6770
6774
  var init_connect = __esm({
6771
6775
  "src/connect.ts"() {
6772
6776
  "use strict";
@@ -6804,6 +6808,7 @@ var init_ConnectPage = __esm({
6804
6808
  const redirectUri = params.get("redirect_uri");
6805
6809
  const state = params.get("state") ?? "";
6806
6810
  const client = params.get("client") || "a local application";
6811
+ const have = new Set((params.get("have") ?? "").split(",").filter(Boolean));
6807
6812
  const teams = useAsync3(() => api.getTeams(), [api]);
6808
6813
  const [selected, setSelected] = useState13();
6809
6814
  const [busy, setBusy] = useState13(false);
@@ -6813,7 +6818,7 @@ var init_ConnectPage = __esm({
6813
6818
  }
6814
6819
  if (teams.loading) return /* @__PURE__ */ jsx19(Progress2, {});
6815
6820
  const all = teams.value ?? [];
6816
- const chosen = selected ?? new Set(all.map((t) => t.team_id));
6821
+ const chosen = selected ?? initialTeams(all.map((t) => t.team_id), have);
6817
6822
  const toggle = (id) => {
6818
6823
  const next = new Set(chosen);
6819
6824
  if (!next.delete(id)) next.add(id);
@@ -6839,7 +6844,7 @@ var init_ConnectPage = __esm({
6839
6844
  ] }),
6840
6845
  /* @__PURE__ */ jsxs18(Typography16, { variant: "body2", color: "text.secondary", paragraph: true, children: [
6841
6846
  client,
6842
- " will receive an API key for each selected team. Connecting again replaces the keys created by a previous connection."
6847
+ " will receive an API key for each selected team. Selecting a team that is already connected replaces its key, also on your other devices."
6843
6848
  ] }),
6844
6849
  teams.error && /* @__PURE__ */ jsxs18(Alert7, { severity: "error", children: [
6845
6850
  "Could not load your teams: ",
@@ -6849,7 +6854,7 @@ var init_ConnectPage = __esm({
6849
6854
  FormControlLabel3,
6850
6855
  {
6851
6856
  control: /* @__PURE__ */ jsx19(Checkbox3, { checked: chosen.has(t.team_id), onChange: () => toggle(t.team_id) }),
6852
- label: t.team_alias ?? t.team_id
6857
+ label: `${t.team_alias ?? t.team_id}${have.has(t.team_id) ? " (already connected)" : ""}`
6853
6858
  },
6854
6859
  t.team_id
6855
6860
  )) }),