Members
Client Lims Api
Returns an object with a series of methods for operating on worksheet data.
Also contains several helper methods for interacting with ESP.
Data management priority is as follow:
1. data from ``worksheet`` Proxy model
2. data from AG-Grid
- Source:
Methods
_viewOK(requiredView)
Check if function is appropriate to run in current view.
Parameters:
Name | Type | Description |
---|---|---|
requiredView |
String | options: - ``LIMSTabView.Grid``: for grid-able views (with columns and rows) - or single view from all available ones: ``LIMSTabView`` |
- Source:
activeModal()
Return the active modal node, if any modal is active.
Otherwise, return null.
- Source:
addChainButton(label, allowPartialTransition)
Add a ``Submit to Next Workflow`` chain transition button to a worksheet.
The button is added to the UI ONLY if this is the last protocol in the
workflow and at least one row is part of a workflow chain instance.
Parameters:
Name | Type | Description |
---|---|---|
label |
String | Text to show inside the button. |
allowPartialTransition |
Boolean | Do not require all samples to be completed. |
- Source:
addPrintGridButton(api, label, beforePrint, afterPrint)
Adds a button to print the contents of the grid.
Parameters:
Name | Type | Description |
---|---|---|
api |
client validation api object | |
label |
print button label | |
beforePrint |
function that is called prior to printing. Allows grid adjustments for printing purposes. If not provided, a default is used that hides the "Complete" column. | |
afterPrint |
function that is called after printing. Allows grid adjustments for returning to "normal" purposes. If not provided, a default is used that shows the "Complete" column. |
- Source:
addProtocolButton(name)
Add a custom protocol button to a worksheet.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | The text to show inside the button. |
- Source:
addProtocolLink(config)
Add a link to the worksheet action buttons area.
Parameters:
Name | Type | Description |
---|---|---|
config |
Object | Attributes of the ```` tag. |
- Source:
alias(text)
Get aliased text as configured by the application.
Parameters:
Name | Type | Description |
---|---|---|
text |
String | The text to (optionally) be replaced. Should refer to a business object. |
- Source:
allSamplesComplete() → {Boolean}
- Source:
Returns:
- true if all samples in a protocol are complete, false otherwise.
- Type
- Boolean
anySamplesComplete() → {Boolean}
- Source:
Returns:
- true if any samples in a protocol are complete, false otherwise.
- Type
- Boolean
chainInstanceUuids() → {Array.<String>}
- Source:
Returns:
- the list of WorkflowChainInstance uuids for every row in the grid.
- Type
- Array.<String>
checkRequiredFields() → {Object.<String, Boolean>}
Ensure that fields marked as ``required`` are populated.
- Source:
Returns:
- { success: true } if valid, { success: false } otherwise.
- Type
- Object.<String, Boolean>
checkResponseStatus(response)
Utility functions used for api interaction. Checks status code of http
responses.
Parameters:
Name | Type | Description |
---|---|---|
response |
Object | The response returned from ``fetch()``. |
- Source:
destroyModal()
Destroy the active modal, if any modal is active.
- Source:
evalExpression(expression, success, failure)
Ask ESP api to evaluate an expression.
Parameters:
Name | Type | Description |
---|---|---|
expression |
String | Expression to evaluate. |
success |
function | Success callback. |
failure |
function | Failure callback. |
- Source:
experimentUuidAt(rowIndex) → {String|Null}
Return the experiment uuid (workflow instance uuid) for the given row.
Row is 0-based and refers to the non-transposed row number, regardless
of whether the experiment is transposed. For grouped protocols, it is the
"ungrouped" row number.
Parameters:
Name | Type | Description |
---|---|---|
rowIndex |
Number | non-transposed row index. |
- Source:
Returns:
- ``experimentUuid`` of specified row, null otherwise.
- Type
- String | Null
experimentUuids() → {Array.<String>}
- Source:
Returns:
- the list of experiment uuids for every row in the grid.
- Type
- Array.<String>
getActiveTab()
Get currently active tab passed when creating ``clientLimsApi`` object.
- Source:
Throws:
-
- Current view cannot be ``LIMSView.DocumentAllTabs`` to select current tab.
- Type
- Error
getCellForDropdown(rowIndex, columnIndexOrHeaderName)
Utility function used by API interactions. Return a cell based on row index and column index/name.
Parameters:
Name | Type | Description |
---|---|---|
rowIndex |
Number | The index (untransposed) of the cell's row. |
columnIndexOrHeaderName |
String | Number | The index (untransposed) or header name of the cell's column. |
- Source:
getColumn(headerNameOrIndex)
Return a column of the active sheet tab.
It returns column from ``gridOptions`` object.
Parameters:
Name | Type | Description |
---|---|---|
headerNameOrIndex |
String | Number | The header name or index of the desired column. |
- Source:
Throws:
-
- Function available only in a ag-grid view, for other views use ``getModelColumnName()``.
- Type
- Error
getColumnDef(columnIndexOrHeaderName)
Return the column definition at the given index or possessing the given header name.
It returns column def from ``activeComponent === worksheetTab`` object.
Parameters:
Name | Type | Description |
---|---|---|
columnIndexOrHeaderName |
Number | String | The column index (untransposed) or headerName property of the desired column. |
- Source:
getColumnIndex()
Duplicate of ``getColumnName()``
- Source:
getColumnName(headerNameOrIndex)
Return the field of a column in the active sheet tab.
It returns column name from ``gridOptions`` object.
Parameters:
Name | Type | Description |
---|---|---|
headerNameOrIndex |
String | Number | The header name or index of the desired column. |
- Source:
Throws:
-
- Function available only in a ag-grid view, for other views use ``getModelColumnName()``.
- Type
- Error
getDataAt(rowIndexOrSampleName, columnIndexOrHeaderName, defaultValue, asString)
Return the sample or sheet uuid for reserved keys.
Otherwise return data in the cell at the give row/column.
Parameters:
Name | Type | Description |
---|---|---|
rowIndexOrSampleName |
String | Number | The index (untransposed) or sample name of the desired row. |
columnIndexOrHeaderName |
String | Number | The index (untransposed) or header name of the desired column. |
defaultValue |
Object | value to return by default if the requested row/sample or column are not found |
asString |
Boolean | For backwards compatibility with 2.4. If true (default), ensure the return value is a string. Note: asString=true does not coerce boolean to string because checkbox columns returned boolean from getDataAt in 2.4, so the behavior is consistent with 2.4 at this time. That is subject to change in the future. Also note that asString=false does not guarantee the return value is _not_ a string at this time. It just doesn't force it to be a string. In particular, in 3.0.x., after calling `api.setDataAt` with a string value, calling `api.getDataData` with asString=false for that same cell may return a string until the sheet is saved and refreshed. |
- Source:
getDropdownSource(rowIndex, columnIndexOrHeaderName)
Return a cell's dropdown options.
Parameters:
Name | Type | Description |
---|---|---|
rowIndex |
Number | The index (untransposed) of the cell's row. |
columnIndexOrHeaderName |
String | Number | The index (untransposed) or header name of the cell's column. |
- Source:
getFromESP(url, onsuccess, onerror)
Fetch JSON data from a given url.
Must provide callbacks or it won't work.
The Promise is returned so if you want to use Promises just pass no-op callbacks.
Parameters:
Name | Type | Description |
---|---|---|
url |
String | The url to request. |
onsuccess |
function | Success callback. |
onerror |
function | Failure callback. |
- Source:
getModelColumn(headerNameOrIndex)
Return a column of the active sheet tab.
It returns column from ``worksheet`` object.
Parameters:
Name | Type | Description |
---|---|---|
headerNameOrIndex |
String | Number | The header name or index of the desired column. |
- Source:
getModelColumnIndex(columnIndexOrHeaderName) → {Number}
Return the REAL column index based on its name or index.
Real column index means it could be used for referencing to cells from ``WorksheetRow`` model object.
Such functionality is required to maintain backwards compatibility, where first column
(with index '0') were taken into account and now it's gone.
It returns column index independently from view, using ``worksheet`` object.
Example (without shared columns):
getModelColumnIndex(0) - throws an exception because "Entity" column is not referable in a model.
getModelColumnIndex(1) - returns 0, as it's first column in the model, allowing cells in rows to be referable by this index.
getModelColumnIndex(2) - returns 1, as it's second column in the model.
getModelColumnIndex("Custom") - returns index of column with name === "Custom"
For shared data use ``getModelSharedColumnIndex()``.
Parameters:
Name | Type | Description |
---|---|---|
columnIndexOrHeaderName |
String | Number | The column ``name`` property or index (untranposed) of the desired column. |
- Source:
Throws:
-
- Entity" column is not referable in model, thus 0/'Entity' values are forbidden.
- Type
- Error
Returns:
- The column index.
- Type
- Number
getModelColumnName(headerNameOrIndex)
Return the resource var UUID of a column in the active sheet tab.
It returns column UUID from ``worksheet`` object.
Parameters:
Name | Type | Description |
---|---|---|
headerNameOrIndex |
String | Number | The header name or index of the desired column. |
- Source:
getModelRowData(rowIndexOrSampleName)
Return the row data at the given index or possessing the given name.
It returns row data independently from view, using ``worksheet`` object.
Parameters:
Name | Type | Description |
---|---|---|
rowIndexOrSampleName |
Number | String | The row index (untransposed) or name property of the desired sample. |
- Source:
getModelSharedColumn(sharedHeaderNameOrIndex)
Same as ``getModelColumn()`` but for shared data.
Parameters:
Name | Type | Description |
---|---|---|
sharedHeaderNameOrIndex |
String | Number | The header name or index of the desired column. |
- Source:
getModelSharedColumnIndex(sharedColumnIndexOrHeaderName) → {Number}
Same as ``getModelColumnIndex()`` but for shared data.
Parameters:
Name | Type | Description |
---|---|---|
sharedColumnIndexOrHeaderName |
String | Number | The column ``name`` property or index (untranposed) of the desired column. |
- Source:
Returns:
- The column index.
- Type
- Number
getProtocolName() → {String}
- Source:
Returns:
- the name of the active protocol.
- Type
- String
getRowCount()
- Deprecated:
- since new LIMS data model use ``getSampleCount``
- Source:
getRowData(rowIndexOrSampleName)
Return the row data at the given index or possessing the given name.
It returns row data from ``activeComponent === worksheetTab`` object.
Parameters:
Name | Type | Description |
---|---|---|
rowIndexOrSampleName |
Number | String | The row index (untransposed) or name property of the desired sample. |
- Source:
getSampleCount() → {Number}
- Source:
Returns:
- samples count
- Type
- Number
getSampleSheetName()
Return the name of the current worksheet.
- Source:
getSampleSheetUuid()
Return the uuid of the current worksheet.
- Source:
getSampleUuidAt(index)
Return the uuid of the sample at a given row index.
Parameters:
Name | Type | Description |
---|---|---|
index |
Number | Index of the row. |
- Source:
getSampleUuids()
Return the uuids of all samples in the worksheet.
- Source:
getSelectedCells()
Return cells UUIDs for all selected cells.
- Source:
getSelectedSamples()
Return the sample UUIDs for all selected samples, regardless of whether the sheet is transposed or grouped.
For grouped protocols, if a group is selected, the UUIDs of all samples in the group are returned.
- Source:
getSharedDataAt(sharedColumnIndexOrHeaderName, defaultValue)
Return shared data from specific column.
Shared data is the same for every sample, so we can use any row to extract it.
To preserve convention used in other components function uses first sample as an reference.
Parameters:
Name | Type | Description |
---|---|---|
sharedColumnIndexOrHeaderName |
String | Number | The index (untransposed) or header name of the desired column. |
defaultValue |
Object | value to return by default if the requested row/sample or column are not found |
- Source:
getWorkflowName() → {String}
- Source:
Returns:
- the name of the workflow for the active protocol
- Type
- String
hideColumns()
Set the given columns as hidden in the worksheet tab.
This function works only on supported views, for others it's no-op.
Parameters:
Type | Description |
---|---|
- Source:
hideColumnsTransposed()
Delegated from ``hideColumns()`` to deal with transposed tables.
Parameters:
Type | Description |
---|---|
- Source:
isProtocolDirty() → {Boolean}
- Source:
Returns:
- true if there are modified cells in the worksheet.
- Type
- Boolean
isProtocolFirst() → {Boolean}
- Source:
Returns:
- true if the active protocol is the first protocol in the workflow.
- Type
- Boolean
isProtocolGrouped() → {Boolean}
- Source:
Returns:
- true if the protocol is grouped, false otherwise.
- Type
- Boolean
isProtocolLast() → {Boolean}
- Source:
Returns:
- true if the active protocol is the last protocol in the workflow.
- Type
- Boolean
isProtocolTransposed() → {Boolean}
- Source:
Returns:
- true if the protocol is in "transpose" mode, false otherwise.
- Type
- Boolean
makeForm(config)
Fast form creation with markup consistent with the
rest of the application.
Parameters:
Name | Type | Description |
---|---|---|
config |
Array | The form configuration. Consists of a list of objects. Each object must have key "label". Additional attributes may also be specified: type (String): one of "select", "text", and "button". Default is "text" name (String): form field name/id. Default is a normalized form of "label" with adjacent spaces collapsed, collapsed spaced converted to "-", and the full string lower-cased. default (Object): The default value. required (boolean): Whether the field is required options (Array): List of options. Only used for type="select" click (function): Callback for onClick. Only used for type="button" |
- Source:
pollPipelineInstances(instances, doneHandler, failedHandler)
Poll a list of pipeline instances for status updates.
Parameters:
Name | Type | Description |
---|---|---|
instances |
Array.<Object> | Array of pipeline instances to monitor. |
doneHandler |
function | Called when pipeline transitions to the ``done`` state. |
failedHandler |
function | Called when pipeline transitions to the ``failed`` state. |
- Source:
postToESP(url, data, onsuccess, onerror)
Post JSON data to a given url.
Must provide callbacks or it won't work.
The Promise is returned so if you want to use Promises just pass no-op callbacks.
Parameters:
Name | Type | Description |
---|---|---|
url |
String | The url to POST. |
data |
Object | The JSON payload. |
onsuccess |
function | Success callback. |
onerror |
function | Failure callback. |
- Source:
putToESP(url, data, onsuccess, onerror)
Put JSON data to a given url.
Must provide callbacks or it won't work.
The Promise is returned so if you want to use Promises just pass no-op callbacks.
Parameters:
Name | Type | Description |
---|---|---|
url |
String | The url to PUT. |
data |
Object | The JSON payload. |
onsuccess |
function | Success callback. |
onerror |
function | Failure callback. |
- Source:
redraw()
An abstraction of the underlying call to redraw the grid.
Prevents content dependence on ag-grid specifically.
- Source:
refetchTab()
Forces a re-fetch of the grid data.
Note that any unsaved user data may be lost
by calling this, so use with care.
- Source:
responseToJson(response)
Utility function used by api interactions. Returns response as JSON.
Parameters:
Name | Type | Description |
---|---|---|
response |
Object | The response returned from ``fetch()``. |
- Source:
runPipeline(pipelineName, params, callback)
Run a pipeline.
Parameters:
Name | Type | Description |
---|---|---|
pipelineName |
String | Name of the pipeline to run. |
params |
Object | Environmental context for the pipeline. |
callback |
function | Run when pipeline is successfully launched. |
- Source:
saveSheet(continueAfter)
Save the active sample sheet tab.
Parameters:
Name | Type | Description |
---|---|---|
continueAfter |
Boolean | ``true`` to Save and Continue, ``false`` to save only. |
- Source:
Throws:
-
- ``WorksheetVue`` component is required while saving worksheet.
- Type
- Error
sendEmailNotification(subject, body, recipients, sender)
Send an email notification.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
subject |
String | Email subject. | |||||||||||||||
body |
String | Email body. | |||||||||||||||
recipients |
Object | Criteria for selecting recipients:
Properties
|
|||||||||||||||
sender |
String | Sender email address. |
- Source:
setCellStyle()
Function unimplemented
- Source:
setDataAt(rowIndexOrSampleName, columnIndexOrHeaderName, value)
Set a cell's data to a given value at a give row/column position.
Parameters:
Name | Type | Description |
---|---|---|
rowIndexOrSampleName |
String | Number | The index (untransposed) or sample name of the desired row. |
columnIndexOrHeaderName |
String | Number | The index (untransposed) or header name of the desired column. |
value |
* | The value to set. |
- Source:
Throws:
-
- Entity" column is not referable in model, thus 0 as an column index is forbidden.
- Type
- Error
setDataAtSilent(rowIndexOrSampleName, columnIndexOrHeaderName, value, shouldCallChangeHandler)
Similarly to setDataAt, set a cell's data to a given value at a give row/column position. The difference with setDataAt is that when doing
bulk changes sometimes it isn't needed to trigger the worksheet's model onChange handlers (cellValueChanged), because this triggers
a rerender. So for performance reasons, setModelValueSilent should be called instead.
Note on `shouldCallChangeHandler` parameter: this parameter determines whether to call the onChange handler of the target column.
Defaults to true. Calling the onChange handler may introduce some overhead. Set it to false only for the cases when the onChange handler
of the target column doesn't have a side effect (ie, target column have also a change handler that affect some other value).
Parameters:
Name | Type | Description |
---|---|---|
rowIndexOrSampleName |
String | Number | The index (untransposed) or sample name of the desired row. |
columnIndexOrHeaderName |
String | Number | The index (untransposed) or header name of the desired column. |
value |
* | The value to set. |
shouldCallChangeHandler |
Boolean | Either to call the onChange handler of the target column. Defaults to true. Note: calling the onChange handler may introduce some overhead. |
- Source:
Throws:
-
- Entity" column is not referable in model, thus 0 as an column index is forbidden.
- Type
- Error
setDropdownSource(rowIndex, columnIndexOrHeaderName, source)
Set a dropdown cell's options.
Parameters:
Name | Type | Description |
---|---|---|
rowIndex |
Number | The index of the cell's row. |
columnIndexOrHeaderName |
String | Number | The index or header name of the cell's column. |
source |
Array.<String> | The dropdown options. |
- Source:
setFocus(rowIndex, columnIndexOrHeaderName)
Focus on a cell.
Parameters:
Name | Type | Description |
---|---|---|
rowIndex |
Number | Index of the cell's row. |
columnIndexOrHeaderName |
String | Number | Index or header name of the cell's column. |
- Source:
setSharedDataAt(sharedColumnIndexOrHeaderName, value)
Set shared data to specific value.
Since shared data needs to be the same for every sample we need to update them all.
Parameters:
Name | Type | Description |
---|---|---|
sharedColumnIndexOrHeaderName |
String | Number | The index (untransposed) or header name of the desired column. |
value |
* | The value to set. |
- Source:
Throws:
-
- Setting data for not shared columns using this function is forbidden. Use ``setDataAt()`` instead.
- Type
- Error
showColumns()
Set the given columns as visible in the worksheet tab.
This function works only on supported views, for others it's no-op.
Parameters:
Type | Description |
---|---|
- Source:
showColumnsTransposed()
Delegated from `showColumns` for dealing with a transposed table.
Parameters:
Type | Description |
---|---|
- Source:
showModal(header, content, footer)
Display a modal.
Parameters:
Name | Type | Description |
---|---|---|
header |
String | Array | Node | Header to display, either HTML string, array of HTML nodes, or a single HTML node. Null means no header. |
content |
String | Array | Node | Content to display, either HTML string, array of HTML nodes, or a single HTML node. Null means no content. |
footer |
String | Array | Node | Footer to display, either HTML string, array of HTML nodes, or a single HTML node. Null means no footer. |
- Source:
showNotification(message, category, title)
Show a toast message.
Parameters:
Name | Type | Description |
---|---|---|
message |
String | $toast.description. |
category |
String | $toast.status. |
title |
String | optional $toast.title. |
- Source:
switchTab(newTabIndex)
Switch the active sample sheet tab WITHOUT saving the current tab.
For "save and continue", use saveSheet(true).
For save and stay, use saveSheet(false).
Parameters:
Name | Type | Description |
---|---|---|
newTabIndex |
Number | index of the new tab |
- Source:
Throws:
-
- ``WorksheetVue`` component is required while switching tabs.
- Type
- Error