Changelog
blockr 0.0.2.9031
Feature
- Improved
submitfeature for blocks. Now submit isn’t added as a class but as a special block attribute. When you design a block, you can pass thesubmitparameter like so:
new_super_block <- function(submit = NA, ...) {
fields <- list()
new_block(
fields = fields,
expr = quote(print("test")),
submit = submit,
...,
class = "my_block"
)
}When submit = NA, it will add a submit button but computations are blocked, as clicking on it is required. Internally, once the input$submit is clicked, the submit attribute is set to TRUE. This is useful when the stack is serialized, since this state is kept so that computations can be automatically re-triggered on restore. When submit = TRUE, a button is shown and the result is also computed. When submit = FALSE, no button is shown.
# You can disable the submit button for filter block
serve_stack(new_stack(new_dataset_block(), new_filter_block(columns = "Time", submit = FALSE)))
serve_stack(new_stack(new_dataset_block(), new_filter_block(columns = "Time", submit = NA)))
# Simulate what happens when restoring a serialised stack
serve_stack(new_stack(new_dataset_block(), new_filter_block(columns = "Time", submit = TRUE)))- Improved add new block.
- Added new
categoryto the registry. Now when a block is registered, you may pass a category parameter (which is used by the add block feature to sort blocks):
register_block(
constructor = new_tail_block,
name = "tail block",
description = "return last n rows",
category = "transform",
classes = c("tail_block", "transform_block"),
input = "data.frame",
output = "data.frame"
)If not passed, the block will belong to uncategorized blocks (default).
Doc
- Improved
registryandgetting startedvignettes. - Add new
case studiesvignette to present blockr in various contexts. - Refine GitHub readme.
Fixes
- Fix issue in
handle_remove.block:vals$stackwasn’t correctly updated when the last block was removed leading to wrong state. - Loading spinner is now correctly hidden when the block visual is updated.
- Fix #366:
- We no longer need a reactive poll per result field for the data.
- The (serialized) field “value” is only the stack name the field refers to (not data).
- We no longer need a reactive poll for the stack selector drop-down
- Fix #358.
blockr 0.0.2
Breaking changes
- Change blocks and fields constructor names to
new_*_blockandnew_*_field. For instance, for the select block, users are now supposed to usenew_select_block()and notselect_block. - Remove
datafrom block constructor:
new_select_block <- function(columns = character(), ...) {
...
}New features
- New validation functions:
validate_field()andvalidate_block()to check that values are consistent with data. These are used to then propagate any error to the user via JavaScript. - Evaluation stops whenever a block isn’t valid and the app should not crash.
- We can now instantiate block outside the stack with default parameter values (or use the old way with constructors):
# New way
data_blk <- new_dataset_block(selected = "lab", package = "blockr.data")
select_blk <- new_select_block("STUDYID")
stack <- new_stack(data_blk, select_blk)
# Old way
stack <- new_stack(new_data_block, new_select_block)