@@ -41,16 +41,17 @@ class @AgentShowPage |
||
41 | 41 |
$("#logs .spinner").stop(true, true).fadeOut -> |
42 | 42 |
$("#logs .refresh, #logs .clear").show() |
43 | 43 |
|
44 |
- toggleMemory: -> |
|
45 |
- if $('#memorypanel').hasClass('hidden') |
|
46 |
- $('#memorypanel').removeClass 'hidden' |
|
47 |
- $('#toggle-memory').text('Hide Memory') |
|
44 |
+ toggleMemory: (e) -> |
|
45 |
+ e.preventDefault() |
|
46 |
+ if $('pre.memory').hasClass('hidden') |
|
47 |
+ $('pre.memory').removeClass 'hidden' |
|
48 |
+ $('#toggle-memory').text('Hide') |
|
48 | 49 |
else |
49 |
- $('#memorypanel').addClass 'hidden' |
|
50 |
- $('#toggle-memory').text('Show Memory') |
|
50 |
+ $('pre.memory').addClass 'hidden' |
|
51 |
+ $('#toggle-memory').text('Show') |
|
51 | 52 |
|
52 | 53 |
clearMemory: (e) -> |
53 |
- if confirm("Are you sure you want to clear memory of this Agent?") |
|
54 |
+ if confirm("Are you sure you want to completely clear the memory of this Agent?") |
|
54 | 55 |
agentId = $(e.target).closest("[data-agent-id]").data("agent-id") |
55 | 56 |
e.preventDefault() |
56 | 57 |
$("#memory .spinner").css(display: 'inline-block') |
@@ -161,17 +161,15 @@ |
||
161 | 161 |
<b>Options:</b> |
162 | 162 |
<pre><%= Utils.pretty_jsonify @agent.options || {} %></pre> |
163 | 163 |
</p> |
164 |
- <button type="submit" class="btn btn-default" id="toggle-memory">Show Memory</button> |
|
165 |
- <div id="memorypanel" class="hidden"> |
|
164 |
+ <% if @agent.memory.present? %> |
|
166 | 165 |
<p id="memory" data-agent-id="<%= @agent.id %>"> |
167 | 166 |
<b>Memory:</b> |
168 |
- <% if @agent.memory.present? %> |
|
169 |
- <i class="fa fa-spinner fa-pulse spinner"></i> |
|
170 |
- <i class="fa fa-trash action-icon clear"></i> |
|
171 |
- <% end %> |
|
172 |
- <pre class="memory"><%= Utils.pretty_jsonify @agent.memory || {} %></pre> |
|
167 |
+ <i class="fa fa-spinner fa-pulse spinner"></i> |
|
168 |
+ <i class="fa fa-trash action-icon clear"></i> |
|
169 |
+ <a id="toggle-memory" href="#">Show</a> |
|
170 |
+ <pre class="memory hidden"><%= Utils.pretty_jsonify @agent.memory || {} %></pre> |
|
173 | 171 |
</p> |
174 |
- </div> |
|
172 |
+ <% end %> |
|
175 | 173 |
</div> |
176 | 174 |
</div> |
177 | 175 |
</div> |