dm-cutie-ui 0.0.2 → 0.4.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.
data/Rakefile CHANGED
@@ -45,7 +45,7 @@ require ROOT + 'lib/dm-cutie-ui/version'
45
45
  s.add_dependency "dm-core", ">=0.10.1"
46
46
  s.add_dependency "dm-aggregates", ">=0.10.1"
47
47
  s.add_dependency "data_objects", '>=0.10.0'
48
- s.add_dependency "dm-cutie", '>=0.3.0'
48
+ s.add_dependency "dm-cutie", '>=0.4.0'
49
49
  s.require_paths = ["lib"]
50
50
  s.rubygems_version = %q{1.2.0}
51
51
  end
data/lib/dm-cutie-ui.rb CHANGED
@@ -5,7 +5,7 @@ require 'logger'
5
5
  gem 'extlib', ">=0.9.13"
6
6
  require 'extlib'
7
7
 
8
- gem 'dm-cutie', '>=0.3.0'
8
+ gem 'dm-cutie', '>=0.4.0'
9
9
  require 'dm-cutie'
10
10
 
11
11
  gem 'dm-aggregates', '>=0.10.1'
@@ -17,7 +17,7 @@ require 'dm-core'
17
17
  gem "data_objects", '>=0.10.0'
18
18
  require 'data_objects'
19
19
 
20
- # SEt up a faux adapter. DM requires a default repository
20
+ # Set up a faux adapter. DM requires a default repository
21
21
  # Repository names are hashes of the Normalized URI and are stored in CutieUI.
22
22
  DataMapper.setup :default, "abstract://null"
23
23
 
@@ -58,21 +58,22 @@ module DmCutieUI
58
58
  view_path = DmCutieUI.view_root / 'views' / 'cutie_models' / "#{view_name}.erb"
59
59
  view_uri = "/#{view_name}"
60
60
  if File.exist? view_path
61
- DmCutieUI.routes[view_uri] = {
61
+ DmCutieUI.routes[view_name] = {
62
62
  :model => model,
63
63
  :file => view_path,
64
- :view_name => view_name
64
+ :view_uri => view_uri
65
65
  }
66
66
 
67
67
  # Create the 'controller'
68
68
  get view_uri do
69
69
  if !DmCutieUI.repos[session["current"]].blank?
70
70
  # The cutie model being viewed
71
+
72
+ @view_name = request.path_info.split('/')[1]
71
73
 
72
- @view_name = DmCutieUI.routes[ request.path_info ][:view_name]
73
- @cutie_model = DataMapper::Cutie.get_klass DmCutieUI.routes[ request.path_info ][:model]
74
+ @cutie_model = DataMapper::Cutie.get_klass DmCutieUI.routes[ @view_name ][:model]
74
75
 
75
- @title = DmCutieUI.routes[ request.path_info ][:model]
76
+ @title = Extlib::Inflection.classify( DmCutieUI.routes[ @view_name ][:model] )
76
77
 
77
78
  # Keep the response scoped to the users selected Cutie Repo
78
79
  user_current_repo { erb(:"cutie_models/#{@view_name}") }
@@ -205,7 +206,7 @@ module DmCutieUI
205
206
 
206
207
  remote_model_name = DataMapper::Cutie.get_human_name(remote_model).to_s.pluralize
207
208
  total_remote_records = remote_model.all( remote_model_key => filter_value ).count
208
- link_to "View: #{total_remote_records}", "/#{remote_model_name}?#{remote_model_key}=#{filter_value}"
209
+ link_to "#{total_remote_records} records", "/#{remote_model_name}?#{remote_model_key}=#{filter_value}"
209
210
  end
210
211
 
211
212
  # Returns 'selected="selected"' to reselect filter drop downs
@@ -47,9 +47,10 @@ table tr:hover td{
47
47
  }
48
48
 
49
49
  table.tablesorter thead tr .header {
50
+ padding-left: 20px;
50
51
  background-image: url(bg.gif);
51
52
  background-repeat: no-repeat;
52
- background-position: center right;
53
+ background-position: center left;
53
54
  cursor: pointer;
54
55
  }
55
56
 
@@ -116,6 +117,20 @@ a, a:visited{
116
117
 
117
118
 
118
119
  /* =========== BEGIN CLASSES =========== */
120
+ .checkbox_label{
121
+ font-weight: 500;
122
+ font-size: 12px;
123
+ }
124
+ .left{
125
+ float: left;
126
+ }
127
+ .right{
128
+ float: right;
129
+ }
130
+ .clear{
131
+ float: clear;
132
+ }
133
+
119
134
  .help_link{
120
135
 
121
136
  }
@@ -1,3 +1,4 @@
1
+ <% help_link %>
1
2
  <% @columns = ExecutedQuery.properties %>
2
3
  <%= partial :menu, :locals => {:columns => @columns} %>
3
4
 
@@ -27,3 +28,29 @@
27
28
  :relationships => ExecutedQuery.relationships
28
29
  }
29
30
  %>
31
+
32
+ <a name="help">
33
+ <div class="help_container">
34
+ <p>
35
+ This is an archive off all queries that were actually executed while DM Cutie was running.
36
+ </p>
37
+ <p>
38
+ Columns:
39
+ <ul>
40
+ <li>id - DM Cutie ExecutedQuery ID</li>
41
+ <li>statement - Actual executed statement</li>
42
+ <li>elapsed_time - Query execution time</li>
43
+ <li>slow - was the query 'slow' based on the setting in DM Cutie</li>
44
+ <li>executed_at - Time the query was executed</li>
45
+ <li>caller_file - The file that created the query</li>
46
+ <li>caller_line - The line in the file that created the query</li>
47
+ <li>caller_method - The method that created the query</li>
48
+ <li>bind_values - An array of the bind values</li>
49
+ <li>repo_signature - The signature of the executed statement and repository.</li>
50
+ <li>signature - The signature of the query across all repositories</li>
51
+ <li>generalized_query_id - The Generalized Query that this execution is tied to.</li>
52
+ </ul>
53
+ </p>
54
+
55
+ </div>
56
+ </a>
@@ -1,3 +1,4 @@
1
+ <% help_link %>
1
2
  <% @columns = GeneralizedQuery.properties %>
2
3
 
3
4
  <%= partial :menu, :locals => {:columns => @columns } %>
@@ -36,3 +37,27 @@
36
37
  :relationships => GeneralizedQuery.relationships.except(:query_storage_links)
37
38
  }
38
39
  %>
40
+
41
+
42
+ <a name="help">
43
+ <div class="help_container">
44
+ <p>
45
+ This is an archive of all 'generic' queries executed. A generic query is a unique query stripped of its bind values.
46
+ </p>
47
+ <p>
48
+ Example: Executing two statements that select one user by their id, would create one generalized query: select * from users where id = ?
49
+ </p>
50
+ <p>
51
+ Columns:
52
+ <ul>
53
+ <li>id - DM Cutie GeneralizedQuery ID</li>
54
+ <li>statement - Executed statement without its bind values.</li>
55
+ <li>operation - The SQL operation performed.</li>
56
+ <li>repo_signature - The signature of the executed statement and repository (globally unique).</li>
57
+ <li>signature - The signature of the query across all repositories (unique / query - will be duplicate across repositories).</li>
58
+ <li>has_links - Did the query have links to other tables (join)</li>
59
+ </ul>
60
+ </p>
61
+
62
+ </div>
63
+ </a>
@@ -1,3 +1,4 @@
1
+ <% help_link %>
1
2
  <% @columns = RepositoryStorage.properties.to_a + [:total_selects, :total_inserts, :total_updates, :total_deletes, :read_to_write_ratio]%>
2
3
  <%= partial :menu, :locals => {:columns => @columns } %>
3
4
 
@@ -18,4 +19,30 @@
18
19
  :relationships => RepositoryStorage.relationships.except(:query_storage_links),
19
20
  :adhoc_columns => {}
20
21
  }
21
- %>
22
+ %>
23
+
24
+ <a name="help">
25
+ <div class="help_container">
26
+ <p>
27
+ An archive of all tables(storages) across repositories.
28
+ </p>
29
+ <p>
30
+ Columns:
31
+ <ul>
32
+ <li>id - DM Cutie RepositoryStorage ID</li>
33
+ <li>repo_name - The DataMapper repository name</li>
34
+ <li>storage_name - The name of the storage (table)</li>
35
+ <li>adapter_name - The adapter storage was created with</li>
36
+ <li>model_name - The name of the model</li>
37
+ <li>record_count - The number of records in this adapters storage</li>
38
+ <li>signature - The RepositoryStorage signature (unique)</li>
39
+ <li>total_selects - Total number of selects (reads)</li>
40
+ <li>total_inserts - Total number of inserts (creates)</li>
41
+ <li>total_updates - Total number of updates</li>
42
+ <li>total_deletes - Total number of deletes</li>
43
+ <li>read_to_write_ratio - The read to write ratio of the storage</li>
44
+ </ul>
45
+ </p>
46
+
47
+ </div>
48
+ </a>
@@ -19,13 +19,26 @@
19
19
  <body>
20
20
  <div id="container">
21
21
  <div id="header">
22
- <%= @title %>
23
- <%= @help_link %>
22
+ <div class="left">
23
+ <%= @title %>
24
+ <%= @help_link %>
25
+ </div>
26
+ <div class="right">
27
+ <% if @record_count%>
28
+ Records: <%= @record_count %>
29
+ <% end %>
30
+ </div>
31
+ <div class="clear">&nbsp;</div>
24
32
  </div>
25
33
  <div id="content">
26
34
  <%= yield %>
27
35
  </div>
28
36
  <div id="footer">
37
+ <% if DmCutieUI.repos[session["current"]] %>
38
+ <div>
39
+ Connected to: <%= DmCutieUI.repos[session["current"]] %>
40
+ </div>
41
+ <% end %>
29
42
  <span>Powered by <a href="http://github.com/coryodaniel/dm-cutie">dm-cutie</a> (v. <%= DataMapper::Cutie::VERSION %>)</span>
30
43
  <br />
31
44
  <span><a href="http://github.com/coryodaniel/dm-cutie-ui">dm-cutie-ui </a>(v. <%= DmCutieUI::VERSION %>)</span>
@@ -1,3 +1,4 @@
1
+ <% @record_count = records.length %>
1
2
  <div id="grid">
2
3
  <table class="tablesorter">
3
4
  <thead>
@@ -1,7 +1,4 @@
1
1
  <div id="menu">
2
- <div>
3
- Connected to: <%= DmCutieUI.repos[session["current"]] %>
4
- </div>
5
2
  <div>
6
3
  <span>Filter By:</span>
7
4
  <select id="adapter_filter">
@@ -28,10 +25,10 @@
28
25
  <button id="filter_button">filter</button>
29
26
  </div>
30
27
  <div>
31
- <span>Columns:</span>
28
+ <div>Columns:</div>
32
29
  <% columns.each do |col| %>
33
30
  <input type="checkbox" checked="checked" id="<%=column_name col %>"/>
34
- <span class=""><%= column_name col %></span>
31
+ <span class="checkbox_label"><%= column_name col %></span>
35
32
  <% end %>
36
33
  </div>
37
34
  <%= partial :navigation %>
@@ -1,7 +1,7 @@
1
- <div id="model_tabs">
2
- <% DmCutieUI.routes.each do |uri, info| %>
3
- <span class="model_tab <%= info[:view_name] == @view_name ? 'active' : 'inactive'%>">
4
- <%= link_to info[:view_name].gsub('_',' '), uri %>
1
+ <div id="model_tabs">
2
+ <% DmCutieUI.routes.each do |view_name, info| %>
3
+ <span class="model_tab <%= view_name == @view_name ? 'active' : 'inactive'%>">
4
+ <%= link_to view_name.gsub('_',' '), info[:view_uri] %>
5
5
  </span>
6
6
  <% end %>
7
7
  </div>
@@ -1,3 +1,3 @@
1
1
  module DmCutieUI
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-cutie-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cory ODaniel
@@ -9,8 +9,8 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-15 00:00:00 -07:00
13
- default_executable:
12
+ date: 2009-10-15 00:00:00 +01:00
13
+ default_executable: dm-cutie-ui
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sinatra
@@ -70,7 +70,7 @@ dependencies:
70
70
  requirements:
71
71
  - - ">="
72
72
  - !ruby/object:Gem::Version
73
- version: 0.3.0
73
+ version: 0.4.0
74
74
  version:
75
75
  description: An interface to DM Cutie repos.
76
76
  email: cutie@coryodaniel.com