sqlui 0.1.80 → 0.1.82

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2748bb417cefe4c4a644ed39d186bffc5c4d2a17efa301abcd94562a5ae3b4ce
4
- data.tar.gz: 319aa2fa1d11cd2fde367dda908ea3ef9c452661abc40c6c6b5c44871bf76034
3
+ metadata.gz: 2ea6baae4e715638e52392661dbae71c35028d29f13b44ab9c10392e7d784bbc
4
+ data.tar.gz: 55949e1df33c47a5a8833ce0e97894f8f958eaa7767bd76767231f47e91ae377
5
5
  SHA512:
6
- metadata.gz: f7192e72ea59c7b1b2f8877600844209598821dc6ded228e959b8d72f0d716403439c84197b097d5ff1a6fecb6452a6520ece7d4c1bac1b9b9b3bdd2f43be7e9
7
- data.tar.gz: 4f0689ecaea729efe24bc219a987c33b47c1da356dedacaedc553715f4b17b4578948ce4de4c7fd9d5343c3884d1e32e69c921b71649bcbb206fc5c96be822f5
6
+ metadata.gz: abd1e5cf01a0afdd4b1f952c1ae7ffc41f0849836187a867199a975f40efdde0d35b9db719f2f6a6b71c7cf41ed04c3415c4508c1f77e15c6f9e4393e7b1d2a3
7
+ data.tar.gz: 79776d1afa3caffe7c9332702d18a0d8cb58f9e4427dd073808b805249f809d50c2cd5a32a96bcb866fa3f5d9ca92153773283b9d278bbf393ab73c42a240abb
data/.release-version CHANGED
@@ -1 +1 @@
1
- 0.1.80
1
+ 0.1.82
@@ -53,8 +53,8 @@ module Github
53
53
  latch = CountDownLatch.new(tree_size)
54
54
  response['tree'].each do |blob|
55
55
  TreeClient.thread_pool.post do
56
- blob['content'] =
57
- get_file_content_with_caching(owner: owner, repo: repo, path: blob['path'], ref: response['sha'])
56
+ blob_response = @client.get_with_caching(blob['url'], cache_for: DEFAULT_MAX_FILE_CACHE_AGE_SECONDS)
57
+ blob['content'] = Base64.decode64(blob_response['content'])
58
58
  ensure
59
59
  latch.count_down
60
60
  end
@@ -133,18 +133,5 @@ module Github
133
133
  }
134
134
  )
135
135
  end
136
-
137
- private
138
-
139
- # Returns the contents of the file at the specified path. Uses the cache.
140
- def get_file_content_with_caching(owner:, repo:, path:, ref:)
141
- check_non_empty_string(owner: owner, repo: repo, sha: ref, path: path)
142
-
143
- response = @client.get_with_caching(
144
- "https://api.github.com/repos/#{owner}/#{repo}/contents/#{path}?ref=#{ref}",
145
- cache_for: DEFAULT_MAX_FILE_CACHE_AGE_SECONDS
146
- )
147
- Base64.decode64(response['content'])
148
- end
149
136
  end
150
137
  end
data/app/server.rb CHANGED
@@ -123,7 +123,6 @@ class Server < Sinatra::Base
123
123
  )
124
124
  # Prefetch all trees on startup. This should happen before the health endpoint is available.
125
125
  unless ENV.fetch('DISABLE_PREFETCH', '0') == '1'
126
- Sqlui.logger.info 'prefetch'
127
126
  tree_client.get_tree(
128
127
  owner: saved_config.owner,
129
128
  repo: saved_config.repo,
@@ -379,7 +378,12 @@ class Server < Sinatra::Base
379
378
  return Github::Cache.new({}, logger: Sqlui.logger) unless ENV['USE_LOCAL_SAVED_FILES']
380
379
 
381
380
  paths = Dir.glob('sql/**/*.sql')
382
- blobs = paths.map { |path| { 'path' => path, 'sha' => 'foo' } }
381
+ blobs = paths.map do |path|
382
+ {
383
+ 'path' => path,
384
+ 'url' => "https://api.github.com/repos/nicholasdower/sqlui/git/blobs/#{Base64.encode64(path)}"
385
+ }
386
+ end
383
387
  github_cache_hash = {
384
388
  'https://api.github.com/repos/nicholasdower/sqlui/git/trees/master?recursive=true' =>
385
389
  Github::Cache::Entry.new(
@@ -391,7 +395,7 @@ class Server < Sinatra::Base
391
395
  )
392
396
  }
393
397
  paths.each do |path|
394
- github_cache_hash["https://api.github.com/repos/nicholasdower/sqlui/contents/#{path}?ref=foo"] =
398
+ github_cache_hash["https://api.github.com/repos/nicholasdower/sqlui/git/blobs/#{Base64.encode64(path)}"] =
395
399
  Github::Cache::Entry.new(
396
400
  {
397
401
  'content' => Base64.encode64(File.read(path))
@@ -25881,7 +25881,8 @@
25881
25881
 
25882
25882
  if (node.tagName.toLowerCase() === 'td') {
25883
25883
  if (event.type === 'mousedown' && node.dataset.row) {
25884
- const row = parseInt(node.dataset.row);
25884
+ const rowOffset = window.sqlFetch.page * PAGE_SIZE;
25885
+ const row = rowOffset + parseInt(node.dataset.row);
25885
25886
  const column = parseInt(node.dataset.column);
25886
25887
  const title = window.sqlFetch.result.columns[column].replaceAll('\n', '¶');
25887
25888
  if (event.metaKey || event.ctrlKey) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.80
4
+ version: 0.1.82
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Dower