pg_reports 0.2.0 → 0.2.1

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: 76f8945d09a2245c88f64ac0a07634055f7fb3133b87f15d7c7ca89915ace112
4
- data.tar.gz: 28d4080e6ed159f24b3df313237b312218acdfc0c1681157db81af1aa4f09aab
3
+ metadata.gz: 76df6e762c2183af15f4409d137e5705f97249922d6c5c5521ba6a7903d3e3f9
4
+ data.tar.gz: 7e52e17a4fa3b3961a1b3d9c5c64174376e38e0d97732017d3a248df8c19528f
5
5
  SHA512:
6
- metadata.gz: 3591a546c84af405ffa25664aa3016e85297608ba12130d6bb0aa8f0fc2f39b5c91c8470b672b1d67a24c834638384adf658062b08a582814d1271b8c1a5d9d1
7
- data.tar.gz: 3e90622e7676573d94b2ef2c7d5e2b7070bb9a9d5fef021440aab741bfc5faa15d9b3b6a5fbcba8883c98484f1096f0d93ec048a3db3d0b728deed4d1880cb72
6
+ metadata.gz: eed06fbb5e836b8ecd1452319e4a0af13ffe750525953fec4ee4aed49e9d04e47df6f8404afe29162950885b41cccdaf4cd1e0ec22f2b87917ee64d931245fc4
7
+ data.tar.gz: 3c6d3b1f7c04781428eaf8d8460177ef4e243d114ad88c83b4419ab15817214804184247a0074dd5f69775d7484205969830dd77169b6de52dc35cda8bda7e24
data/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.2.1] - 2026-01-28
9
+
10
+ ### Added
11
+
12
+ - Cursor (WSL) IDE support
13
+
14
+ ### Fixed
15
+
16
+ - Removed test data from production code
17
+ - Copy Query button now works correctly with special characters
18
+
8
19
  ## [0.2.0] - 2026-01-28
9
20
 
10
21
  ### Added
@@ -17,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
17
28
  - VS Code - direct path for native Linux
18
29
  - RubyMine
19
30
  - IntelliJ IDEA
31
+ - Cursor (WSL) - for Windows Subsystem for Linux
20
32
  - Cursor
21
33
  - IDE settings modal to choose default IDE (skip menu and open directly)
22
34
  - Save records for comparison - save query results to compare before/after optimizations
data/README.md CHANGED
@@ -18,7 +18,7 @@ A comprehensive PostgreSQL monitoring and analysis library for Rails application
18
18
  - 🌐 **Web Dashboard** - Beautiful dark-themed UI with sortable tables and expandable rows
19
19
  - 📨 **Telegram Integration** - Send reports directly to Telegram
20
20
  - 📥 **Export** - Download reports in TXT, CSV, or JSON format
21
- - 🔗 **IDE Integration** - Open source locations in VS Code, RubyMine, IntelliJ, or Cursor
21
+ - 🔗 **IDE Integration** - Open source locations in VS Code, Cursor, RubyMine, or IntelliJ (with WSL support)
22
22
  - 📌 **Comparison Mode** - Save records to compare before/after optimization
23
23
  - 📊 **EXPLAIN ANALYZE** - Run query plans directly from the dashboard
24
24
  - 🗑️ **Migration Generator** - Generate Rails migrations to drop unused indexes
@@ -280,6 +280,7 @@ Click on source locations in reports to open the file directly in your IDE. Supp
280
280
  - **VS Code** - direct path for native Linux/macOS
281
281
  - **RubyMine**
282
282
  - **IntelliJ IDEA**
283
+ - **Cursor (WSL)** - for Windows Subsystem for Linux
283
284
  - **Cursor**
284
285
 
285
286
  Use the ⚙️ button to set your default IDE and skip the selection menu.
@@ -74,6 +74,10 @@
74
74
  <input type="radio" name="default-ide" value="intellij" onchange="setDefaultIde('intellij')">
75
75
  <span>IntelliJ IDEA</span>
76
76
  </label>
77
+ <label class="ide-option">
78
+ <input type="radio" name="default-ide" value="cursor-wsl" onchange="setDefaultIde('cursor-wsl')">
79
+ <span>Cursor (WSL)</span>
80
+ </label>
77
81
  <label class="ide-option">
78
82
  <input type="radio" name="default-ide" value="cursor" onchange="setDefaultIde('cursor')">
79
83
  <span>Cursor</span>
@@ -1564,44 +1568,6 @@
1564
1568
  return '';
1565
1569
  }
1566
1570
 
1567
- // TEMP: Known controller methods with line numbers (for IDE link testing)
1568
- const knownControllerMethods = {
1569
- 'PostsController#show': { file: 'app/controllers/posts_controller.rb', line: 33 },
1570
- 'PostsController#index': { file: 'app/controllers/posts_controller.rb', line: 19 },
1571
- 'PostsController#create': { file: 'app/controllers/posts_controller.rb', line: 43 },
1572
- 'PostsController#update': { file: 'app/controllers/posts_controller.rb', line: 62 },
1573
- 'PostsController#destroy': { file: 'app/controllers/posts_controller.rb', line: 76 }
1574
- };
1575
-
1576
- // TEMP: Fake source values for testing IDE links
1577
- const fakeSourceValues = [
1578
- 'PostsController#show',
1579
- 'PostsController#index',
1580
- 'PostsController#create',
1581
- 'PostsController#update',
1582
- 'PostsController#destroy',
1583
- 'app/controllers/posts_controller.rb:33',
1584
- 'app/controllers/posts_controller.rb:19',
1585
- 'app/models/post.rb:45:in `find_by_slug`'
1586
- ];
1587
-
1588
- // TEMP: Inject fake source values into data for testing
1589
- function injectFakeSourceData(data) {
1590
- if (!data.data || data.data.length === 0) return;
1591
-
1592
- // Add 'source' column if not present
1593
- if (!data.columns.includes('source')) {
1594
- data.columns.push('source');
1595
- }
1596
-
1597
- // Inject fake source values
1598
- data.data.forEach((row, idx) => {
1599
- if (!row.source || row.source === '' || row.source === null) {
1600
- row.source = fakeSourceValues[idx % fakeSourceValues.length];
1601
- }
1602
- });
1603
- }
1604
-
1605
1571
  // Parse source location and generate IDE link
1606
1572
  function parseSourceLocation(source) {
1607
1573
  if (!source || source === 'null' || source === '') return null;
@@ -1627,41 +1593,31 @@
1627
1593
  const controllerMatch = source.match(/^(\w+Controller)#(\w+)/);
1628
1594
  if (controllerMatch) {
1629
1595
  methodName = `${controllerMatch[1]}#${controllerMatch[2]}`;
1630
-
1631
- // TEMP: Check known methods first for testing
1632
- const knownMethod = knownControllerMethods[methodName];
1633
- if (knownMethod) {
1634
- filePath = knownMethod.file;
1635
- lineNumber = knownMethod.line;
1636
- } else {
1637
- // Try to derive file path
1638
- const controllerName = controllerMatch[1].replace(/Controller$/, '').toLowerCase();
1639
- filePath = `app/controllers/${controllerName}_controller.rb`;
1640
- }
1596
+ // Derive file path from controller name
1597
+ const controllerName = controllerMatch[1].replace(/Controller$/, '').toLowerCase();
1598
+ filePath = `app/controllers/${controllerName}_controller.rb`;
1641
1599
  }
1642
1600
 
1643
1601
  return { filePath, lineNumber, methodName, original: source };
1644
1602
  }
1645
1603
 
1646
- // TEMP: Base path for parent project (for IDE link testing)
1647
- const parentProjectPath = '/home/deadalice/vmist-server';
1604
+ // Rails.root path for IDE links
1605
+ const railsRootPath = '<%= Rails.root.to_s %>';
1606
+ const wslDistro = 'Ubuntu';
1648
1607
 
1649
1608
  // Generate IDE URLs
1650
1609
  function generateIdeUrls(filePath, lineNumber) {
1651
1610
  if (!filePath) return [];
1652
1611
 
1653
- // TEMP: Convert relative paths to absolute paths in parent project
1612
+ // Convert relative paths to absolute paths using Rails.root
1654
1613
  let absolutePath = filePath;
1655
1614
  if (!filePath.startsWith('/')) {
1656
- absolutePath = `${parentProjectPath}/${filePath}`;
1615
+ absolutePath = `${railsRootPath}/${filePath}`;
1657
1616
  }
1658
1617
 
1659
1618
  const line = lineNumber || 1;
1660
1619
  const urls = [];
1661
1620
 
1662
- // TEMP: WSL distro name for VS Code Remote
1663
- const wslDistro = 'Ubuntu';
1664
-
1665
1621
  // VSCode (WSL Remote format)
1666
1622
  urls.push({
1667
1623
  name: 'VS Code (WSL)',
@@ -1685,7 +1641,13 @@
1685
1641
  url: `idea://open?file=${absolutePath}&line=${line}`
1686
1642
  });
1687
1643
 
1688
- // Cursor (VSCode-based)
1644
+ // Cursor (WSL Remote format)
1645
+ urls.push({
1646
+ name: 'Cursor (WSL)',
1647
+ url: `cursor://vscode-remote/wsl+${wslDistro}${absolutePath}:${line}`
1648
+ });
1649
+
1650
+ // Cursor (direct path)
1689
1651
  urls.push({
1690
1652
  name: 'Cursor',
1691
1653
  url: `cursor://file${absolutePath}:${line}`
@@ -1700,7 +1662,8 @@
1700
1662
  'vscode': 1,
1701
1663
  'rubymine': 2,
1702
1664
  'intellij': 3,
1703
- 'cursor': 4
1665
+ 'cursor-wsl': 4,
1666
+ 'cursor': 5
1704
1667
  };
1705
1668
 
1706
1669
  // Build source badge HTML with IDE links
@@ -1866,9 +1829,6 @@
1866
1829
  if (loadingEl) loadingEl.style.display = 'none';
1867
1830
 
1868
1831
  if (data.success) {
1869
- // TEMP: Inject fake source data for IDE link testing
1870
- injectFakeSourceData(data);
1871
-
1872
1832
  currentReportData = data;
1873
1833
  const thresholds = data.thresholds || {};
1874
1834
  const problemFields = data.problem_fields || [];
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgReports
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_reports
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eldar Avatov