Skip to content

Commit

Permalink
www: PR comment response -- add some docs, remove 'Abort' button
Browse files Browse the repository at this point in the history
  • Loading branch information
mhasself committed Sep 24, 2020
1 parent 9551d56 commit d0b44e9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
14 changes: 9 additions & 5 deletions agents/fake_data/fake_data_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,15 @@ def set_heartbeat_state(self, session, params=None):
@inlineCallbacks
def delay_task(self, session, params={}):
"""Task that will take the requested number of seconds to complete.
This can run simultaneously with the acq Process. The Task
populates session.data with the requested_delay and
measured_delay.
This Task should run in the reactor thread.
This can run simultaneously with the acq Process. This Task
should run in the reactor thread.
The session data will be updated with the requested delay as
well as the time elapsed so far, for example::
{'requested_delay': 5.,
'delay_so_far': 1.2}
Args:
delay (float): Time to wait before returning, in seconds.
Expand All @@ -167,7 +171,7 @@ def delay_task(self, session, params={}):
t0 = time.time()
while True:
session.data['delay_so_far'] = time.time() - t0
sleep_time = min(0.5, delay - session.data['delay_so_far'])
sleep_time = min(0.5, delay - session.data['delay_so_far'])
if sleep_time < 0:
break
yield dsleep(sleep_time)
Expand Down
29 changes: 17 additions & 12 deletions docs/developer/web.rst
Original file line number Diff line number Diff line change
Expand Up @@ -395,18 +395,6 @@ like this::
OcsUiHelper Method Reference
----------------------------

Passive and Formatting Methods
``````````````````````````````

*Passive elements are intended to show static content, in contrast to
input or indicator elements. Formatting methods affect display
features (such as borders).*

banner(label_text)
This a large font text banner, spanning the entire width of
the parent block_unit div.


Contextual Methods
``````````````````

Expand All @@ -432,6 +420,23 @@ that subsequent input or indicator elements will be grouped together.*
Equivalent to ``set_context(op_name, 'task')``.


Passive and Formatting Methods
``````````````````````````````

*Passive elements are intended to show static content, in contrast to
input or indicator elements. Formatting methods affect display
features (such as borders).*

banner(label_text)
This a large font text banner, spanning the entire width of
the parent block_unit div.

set_boxes(auto_boxes)
This can be passed to a OcsUiHelper prior to setting the first
context. The argument is a boolean that controls whether to
display a border box around each operation's controls.


Input Elements
``````````````

Expand Down
6 changes: 4 additions & 2 deletions www/js/monitor_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,12 @@ OcsUiHelper.prototype = {
if (this.op_type == 'task') {
this.e.append($(`<label class="important">${this.op_name}</label>`
+`<input id="${id_base}-start" type="button" value="Start" />`
+`<input id="${id_base}-abort" type="button" value="Abort" />`));
+'<span />'
//+`<input id="${id_base}-abort" type="button" value="Abort" disabled />`
));
if (client) {
this.on(op_name, 'start', (params) => client.start_task(op_name, params));
this.on(op_name, 'abort', () => client.abort_task(op_name));
//this.on(op_name, 'abort', () => client.abort_task(op_name));
}
} else if (this.op_type == 'process') {
this.e.append($(`<label class="important">${this.op_name}</label>`
Expand Down

0 comments on commit d0b44e9

Please sign in to comment.