dev_panel 0.2.5 → 0.2.6

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.
@@ -29,7 +29,7 @@ module DevPanel
29
29
  $jq("#partialList").toggle();
30
30
  });
31
31
  $jq("#devPanelHider").on("click", function(s) {
32
- $jq("#devPanelContainer").toggle();
32
+ $jq("#devPanelContainer").slideToggle(110);
33
33
  $jq("#partialList").hide();
34
34
  $jq.get("/__DevPanel/set_options?visible=" + $jq("#devPanelContainer").is(":visible"));
35
35
  });
@@ -23,12 +23,16 @@ module DevPanel
23
23
  def css
24
24
  <<-css_code
25
25
  <style>
26
+ table {
27
+ width: 100%
28
+ }
29
+
26
30
  #devPanelWindow {
27
31
  border-radius: 3px;
28
32
  margin-bottom: 2px;
29
33
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.03), 1px 1px 0 rgba(0, 0, 0, 0.05), -1px 1px 0 rgba(0, 0, 0, 0.05), 0 0 0 4px rgba(0, 0, 0, 0.04);
30
34
  font-family: menlo, lucida console, monospace;
31
- border: 2px solid #000;
35
+ border: 3px solid #29488B;
32
36
  z-index: 500000000;
33
37
  padding: 3px;
34
38
  color: #000;
@@ -38,7 +42,7 @@ module DevPanel
38
42
  }
39
43
 
40
44
  #devPanelHider {
41
- background: #F1F1F1;
45
+ background: #5366EB;
42
46
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
43
47
  font-family: arial;
44
48
  font-size: 12.8px;
@@ -48,38 +52,46 @@ module DevPanel
48
52
  border-bottom: 0;
49
53
  border-top-left-radius: 2px;
50
54
  border-top-right-radius: 2px;
51
- width: 150px;
52
55
  text-align:center;
53
56
  border: solid 1px #fff;
54
57
  }
55
58
 
59
+ .hider-color {
60
+ color: #fff
61
+ }
62
+
56
63
  #devPanelContainer {
57
64
  font-family: menlo, lucida console, monospace;
58
65
  background-color: #fff;
59
66
  box-shadow: inset 3px 3px 3px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(0, 0, 0, 0.1);
60
- width: 300px; padding-top: 20px;
67
+ width: 300px;
68
+ padding: 2px
61
69
  }
62
70
 
63
71
  #devPanelContainer td {
64
72
  font-family: arial;
65
- color: #000;
66
- font-size: 10px;
73
+ font-size: 12px;
67
74
  font-weight: normal;
68
- padding: 8px;
75
+ padding: 5px;
69
76
  overflow: auto;
77
+ letter-spacing: 1.5px
70
78
  }
71
79
 
72
80
  #devPanelContainer tr {
73
- background-color: #FACC9B;
81
+ background-color: #2E2E2E;
82
+ color: rgb(238, 238, 238);
83
+ border-bottom: 1px solid #4B4444;
74
84
  }
75
85
 
76
- #devPanelContainer td.firstColumn {
77
- width: 60px;
78
- font-weight: bold;
86
+ #devPanelContainer .alt {
87
+ background-color: #000000;
88
+ color: rgb(238, 238, 238);
89
+ border-bottom: 1px solid #4B4444;
79
90
  }
80
91
 
81
- #devPanelContainer .alt {
82
- background-color: #FFF;
92
+ #devPanelContainer td.firstColumn {
93
+ width: 90px;
94
+ font-weight: bold;
83
95
  }
84
96
 
85
97
  #viewTime {
@@ -104,6 +116,12 @@ module DevPanel
104
116
  display: none;
105
117
  z-index: 500000001;
106
118
  }
119
+
120
+ .green { background: #21D61A !important}
121
+ .yellow { background: #BEBE00 !important }
122
+ .orange { background: #F0A811 !important }
123
+ .red { background: #B90000 !important }
124
+
107
125
  </style>
108
126
  css_code
109
127
  end
@@ -112,11 +130,25 @@ module DevPanel
112
130
  <<-html_code
113
131
  <div id='partialList'>#{partial_list}</div>
114
132
  <div id="devPanelWindow" style="top: #{Stats.top.to_s}px; left: #{Stats.left.to_s}px;" >
115
- <div id="devPanelHider"><a href="#">Show/Hide Stats</a> / <span style="font-size: 10px">#{Stats.data[:action_controller].duration.round(0).to_s}ms</span></div>
133
+ <div id="devPanelHider" class="#{heat_color}"><a class="hider-color" href="#">#{stats(:controller)}##{stats(:action)}</a> / <span class="hider-color" style="font-size: 10px">#{Stats.data[:action_controller].duration.round(0).to_s}ms</span></div>
116
134
  <div id="devPanelContainer">
117
135
  html_code
118
136
  end
119
137
 
138
+ def heat_color
139
+ time = Stats.data[:action_controller].duration.round(0)
140
+ if(time < 500)
141
+ "green"
142
+ elsif(time < 1500)
143
+ "yellow"
144
+ elsif(time < 2500)
145
+ "orange"
146
+ else
147
+ "red"
148
+ end
149
+
150
+ end
151
+
120
152
  def stats(symbol)
121
153
  Stats.data[:action_controller].payload[symbol]
122
154
  end
@@ -124,11 +156,11 @@ module DevPanel
124
156
  def html_table
125
157
  controller_time = (Stats.data[:action_controller].duration - stats(:view_runtime))
126
158
  table_rows = rowify([
127
- first_td("Total Time:") + td("#{Stats.data[:action_controller].duration.round(2).to_s}ms"),
128
- first_td("Controller Time:") + td("#{controller_time.round(2).to_s}ms"),
129
- first_td("View Time:") + td("#{stats(:view_runtime).round(2).to_s}ms"),
130
- first_td("Partials Rendered:") + td(partial_count),
131
- first_td("Response Code:") + td(stats(:status)),
159
+ first_td("Total:") + td("#{Stats.data[:action_controller].duration.round(2).to_s}ms"),
160
+ first_td("Controller:") + td("#{controller_time.round(2).to_s}ms"),
161
+ first_td("View:") + td("#{stats(:view_runtime).round(2).to_s}ms"),
162
+ first_td("Partials:") + td(partial_count),
163
+ first_td("Response:") + td(stats(:status)),
132
164
  first_td("Controller:") + td(stats(:controller)),
133
165
  first_td("Action:") + td(stats(:action)),
134
166
  first_td("Method:") + td(stats(:method)),
@@ -136,7 +168,7 @@ module DevPanel
136
168
  first_td("Log:") + td(Stats.data[:log])
137
169
  ])
138
170
 
139
- "<table style='width: 290px; margin: auto; table-layout: fixed'>#{table_rows}</table></div></div>"
171
+ "<table style='margin: auto; table-layout: fixed'>#{table_rows}</table></div></div>"
140
172
  end
141
173
 
142
174
  def partial_count
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev_panel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: