rails-profiler 0.22.1 → 0.23.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87931b523c1fcf03710fe558f619591bc2a953aa50ad76ccf414357964515a5d
4
- data.tar.gz: c07a2ae3e5104529f72d4ce04caf67aa04647946c4ba5e98fc68ca1c7b10c320
3
+ metadata.gz: 893d3965287ddebc00378c605ff16d13734a4fd97c7016d2c613c0eb3c6b709b
4
+ data.tar.gz: 9574f00d346286e72d4d47abdab4d60520053b5f16b6f16c701ba178c24ab4ce
5
5
  SHA512:
6
- metadata.gz: ffb96a532e285ff59fe55059a2a0615c397ff82838479da8804709e14e7ec1802a0b759ffdd32ed64bb9166ea185efd8da06956cab3078c43bf4e6120b8d7c56
7
- data.tar.gz: 22de884813f0d456a53c2388bb3849ff343bbd4349951419ab2f04f3c1977ce0e1681ba5c8c5349fff3cb894d6f2a8b34de9cf13f92acce08921ec3298fe816c
6
+ metadata.gz: 1e0f22f1aa90112910678954253843a3d4bb245029a829359e195f99dc9e5bbc87c0f43d0333959dfa00f7d612cd83fb111c81cdb63767435751a2de26eae4bd
7
+ data.tar.gz: '058f8f1228758f62939eb97ee0b6124b737c053d00634971df9905bc7732c61936ece855280c14da509cc1bee981ef6a7185bc3c72652d3a2b816b97f9628765'
@@ -1664,17 +1664,14 @@
1664
1664
  const [jobHasMore, setJobHasMore] = d2(false);
1665
1665
  const [jobLoadingMore, setJobLoadingMore] = d2(false);
1666
1666
  const [outboundRequests, setOutboundRequests] = d2([]);
1667
- const [loadingHttp, setLoadingHttp] = d2(true);
1668
- const [loadingJobs, setLoadingJobs] = d2(false);
1669
- const [loadingOutbound, setLoadingOutbound] = d2(false);
1670
- const [jobsLoaded, setJobsLoaded] = d2(false);
1671
- const [outboundLoaded, setOutboundLoaded] = d2(false);
1667
+ const [loadingHttp, setLoadingHttp] = d2(initialSection() === "http");
1668
+ const [loadingJobs, setLoadingJobs] = d2(initialSection() === "jobs");
1669
+ const [loadingOutbound, setLoadingOutbound] = d2(initialSection() === "outbound");
1672
1670
  const [error, setError] = d2(null);
1673
1671
  const [jobsError, setJobsError] = d2(null);
1674
1672
  const [outboundError, setOutboundError] = d2(null);
1675
1673
  const [envData, setEnvData] = d2(void 0);
1676
- const [loadingEnv, setLoadingEnv] = d2(false);
1677
- const [envLoaded, setEnvLoaded] = d2(false);
1674
+ const [loadingEnv, setLoadingEnv] = d2(initialSection() === "env");
1678
1675
  const [envError, setEnvError] = d2(null);
1679
1676
  const [copiedToken, setCopiedToken] = d2(null);
1680
1677
  const [httpSearch, setHttpSearch] = d2("");
@@ -1694,20 +1691,7 @@
1694
1691
  const [outboundMethod, setOutboundMethod] = d2("");
1695
1692
  const [outboundStatus, setOutboundStatus] = d2("");
1696
1693
  y2(() => {
1697
- fetch(`${BASE}/api/profiles?limit=50&offset=0`).then((res) => res.json()).then((data) => {
1698
- setProfiles(data.profiles);
1699
- setHttpOffset(data.profiles.length);
1700
- setHttpHasMore(data.has_more);
1701
- setLoadingHttp(false);
1702
- }).catch(() => {
1703
- setError("Failed to load profiles");
1704
- setLoadingHttp(false);
1705
- });
1706
- }, []);
1707
- y2(() => {
1708
- if (section === "jobs") loadJobs();
1709
- if (section === "outbound") loadOutbound();
1710
- if (section === "env") loadEnv();
1694
+ refreshSection(section);
1711
1695
  }, []);
1712
1696
  y2(() => {
1713
1697
  const url = new URL(window.location.href);
@@ -1747,21 +1731,6 @@
1747
1731
  setHttpLoadingMore(false);
1748
1732
  }).catch(() => setHttpLoadingMore(false));
1749
1733
  };
1750
- const loadJobs = () => {
1751
- if (jobsLoaded) return;
1752
- setLoadingJobs(true);
1753
- fetch(`${BASE}/api/jobs?limit=50&offset=0`).then((res) => res.json()).then((data) => {
1754
- setJobs(data.profiles);
1755
- setJobOffset(data.profiles.length);
1756
- setJobHasMore(data.has_more);
1757
- setLoadingJobs(false);
1758
- setJobsLoaded(true);
1759
- }).catch(() => {
1760
- setJobsError("Failed to load job profiles");
1761
- setLoadingJobs(false);
1762
- setJobsLoaded(true);
1763
- });
1764
- };
1765
1734
  const loadMoreJobs = () => {
1766
1735
  setJobLoadingMore(true);
1767
1736
  fetch(`${BASE}/api/jobs?limit=50&offset=${jobOffset}`).then((res) => res.json()).then((data) => {
@@ -1771,40 +1740,16 @@
1771
1740
  setJobLoadingMore(false);
1772
1741
  }).catch(() => setJobLoadingMore(false));
1773
1742
  };
1774
- const loadOutbound = () => {
1775
- if (outboundLoaded) return;
1776
- setLoadingOutbound(true);
1777
- fetch(`${BASE}/api/outbound_http`).then((res) => res.json()).then((data) => {
1778
- setOutboundRequests(data);
1779
- setLoadingOutbound(false);
1780
- setOutboundLoaded(true);
1781
- }).catch(() => {
1782
- setOutboundError("Failed to load outbound HTTP requests");
1783
- setLoadingOutbound(false);
1784
- setOutboundLoaded(true);
1785
- });
1786
- };
1787
- const loadEnv = () => {
1788
- if (envLoaded) return;
1789
- setLoadingEnv(true);
1790
- fetch(`${BASE}/api/env_vars`).then((res) => res.json()).then((data) => {
1791
- setEnvData(data);
1792
- setLoadingEnv(false);
1793
- setEnvLoaded(true);
1794
- }).catch(() => {
1795
- setEnvError("Failed to load environment variables");
1796
- setLoadingEnv(false);
1797
- setEnvLoaded(true);
1798
- });
1799
- };
1800
1743
  const handleSectionChange = (s3) => {
1744
+ if (s3 === section) {
1745
+ refreshSection(s3);
1746
+ return;
1747
+ }
1801
1748
  setSection(s3);
1802
1749
  const url = new URL(window.location.href);
1803
1750
  url.searchParams.set("section", s3);
1804
1751
  history.pushState(null, "", url.toString());
1805
- if (s3 === "jobs") loadJobs();
1806
- if (s3 === "outbound") loadOutbound();
1807
- if (s3 === "env") loadEnv();
1752
+ refreshSection(s3);
1808
1753
  setHttpSearch("");
1809
1754
  setHttpMethod("");
1810
1755
  setHttpStatus("");
@@ -1836,17 +1781,29 @@
1836
1781
  });
1837
1782
  };
1838
1783
  const clearProfiles = () => {
1784
+ if (!window.confirm("Delete all HTTP profiles?")) return;
1839
1785
  fetch(`${BASE}/api/profiles/clear`, { method: "DELETE" }).then(() => {
1840
1786
  setProfiles([]);
1841
1787
  });
1842
1788
  };
1843
1789
  const clearJobs = () => {
1790
+ if (!window.confirm("Delete all job profiles?")) return;
1844
1791
  fetch(`${BASE}/api/jobs/clear`, { method: "DELETE" }).then(() => {
1845
1792
  setJobs([]);
1846
1793
  });
1847
1794
  };
1848
- const refresh = () => {
1849
- if (section === "http") {
1795
+ const clearAll = () => {
1796
+ if (!window.confirm("Delete all HTTP and job profiles?")) return;
1797
+ Promise.all([
1798
+ fetch(`${BASE}/api/profiles/clear`, { method: "DELETE" }),
1799
+ fetch(`${BASE}/api/jobs/clear`, { method: "DELETE" })
1800
+ ]).then(() => {
1801
+ setProfiles([]);
1802
+ setJobs([]);
1803
+ });
1804
+ };
1805
+ const refreshSection = (s3) => {
1806
+ if (s3 === "http") {
1850
1807
  setLoadingHttp(true);
1851
1808
  fetch(`${BASE}/api/profiles?limit=50&offset=0`).then((res) => res.json()).then((data) => {
1852
1809
  setProfiles(data.profiles);
@@ -1857,7 +1814,7 @@
1857
1814
  setError("Failed to load profiles");
1858
1815
  setLoadingHttp(false);
1859
1816
  });
1860
- } else if (section === "jobs") {
1817
+ } else if (s3 === "jobs") {
1861
1818
  setLoadingJobs(true);
1862
1819
  fetch(`${BASE}/api/jobs?limit=50&offset=0`).then((res) => res.json()).then((data) => {
1863
1820
  setJobs(data.profiles);
@@ -1868,7 +1825,7 @@
1868
1825
  setJobsError("Failed to load job profiles");
1869
1826
  setLoadingJobs(false);
1870
1827
  });
1871
- } else if (section === "outbound") {
1828
+ } else if (s3 === "outbound") {
1872
1829
  setLoadingOutbound(true);
1873
1830
  fetch(`${BASE}/api/outbound_http`).then((res) => res.json()).then((data) => {
1874
1831
  setOutboundRequests(data);
@@ -1888,6 +1845,7 @@
1888
1845
  });
1889
1846
  }
1890
1847
  };
1848
+ const refresh = () => refreshSection(section);
1891
1849
  const tabClass = (s3) => `tab${section === s3 ? " active" : ""}`;
1892
1850
  const filteredProfiles = profiles.filter((p3) => {
1893
1851
  if (httpSearch && !p3.path.toLowerCase().includes(httpSearch.toLowerCase())) return false;
@@ -2069,7 +2027,8 @@
2069
2027
  profiles.length
2070
2028
  ] }),
2071
2029
  /* @__PURE__ */ u3("button", { class: `btn-refresh${loadingHttp ? " btn-refresh--spinning" : ""}`, onClick: refresh, disabled: loadingHttp, title: "Refresh", children: "\u21BA" }),
2072
- /* @__PURE__ */ u3("button", { class: "btn btn-danger btn-sm", onClick: clearProfiles, children: "Clear All" })
2030
+ /* @__PURE__ */ u3("button", { class: "btn btn-danger btn-sm", onClick: clearProfiles, title: "Delete HTTP profiles", children: "Clear" }),
2031
+ /* @__PURE__ */ u3("button", { class: "btn btn-danger btn-sm", onClick: clearAll, title: "Delete all HTTP and job profiles", children: "Clear All" })
2073
2032
  ] })
2074
2033
  ] }),
2075
2034
  filteredProfiles.length === 0 ? /* @__PURE__ */ u3("div", { class: "profiler-empty", children: /* @__PURE__ */ u3("div", { class: "profiler-empty__title", children: "No results match filters" }) }) : /* @__PURE__ */ u3("table", { children: [
@@ -2154,7 +2113,8 @@
2154
2113
  jobs.length
2155
2114
  ] }),
2156
2115
  /* @__PURE__ */ u3("button", { class: `btn-refresh${loadingJobs ? " btn-refresh--spinning" : ""}`, onClick: refresh, disabled: loadingJobs, title: "Refresh", children: "\u21BA" }),
2157
- /* @__PURE__ */ u3("button", { class: "btn btn-danger btn-sm", onClick: clearJobs, children: "Clear All" })
2116
+ /* @__PURE__ */ u3("button", { class: "btn btn-danger btn-sm", onClick: clearJobs, title: "Delete job profiles", children: "Clear" }),
2117
+ /* @__PURE__ */ u3("button", { class: "btn btn-danger btn-sm", onClick: clearAll, title: "Delete all HTTP and job profiles", children: "Clear All" })
2158
2118
  ] })
2159
2119
  ] }),
2160
2120
  filteredJobs.length === 0 ? /* @__PURE__ */ u3("div", { class: "profiler-empty", children: /* @__PURE__ */ u3("div", { class: "profiler-empty__title", children: "No results match filters" }) }) : /* @__PURE__ */ u3("table", { children: [
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Profiler
4
- VERSION = "0.22.1"
4
+ VERSION = "0.23.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.1
4
+ version: 0.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Duplessy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-05-26 00:00:00.000000000 Z
11
+ date: 2026-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails