9. Dashboard: Tabs and Tables¶
The dashboard is structured to organize the data tables using tabs beneath the widgets.
These tables can be configured to list key data entities in your data sharing platform along with a list of key data entity attributes. In the Bento reference implementation the Dashboard Table list the cases (or study subjects) in the program.
9.1. Tabs¶
The tabs can be configured as follows:
Open
$(src)/bento-frontend/src/bento/dashboardTabData.js
To change Properties of tab go to
tabs
object:
name
: Text to show on tabdataField
: specifies what data appears in the column, field must be from the GraphQL API query
:point_right: NOTE: the order of the entries in
tabs
should match the order in thetabsIndex
object. This is the order that the tabs will be displayed left to right on the UI.
To change style of tab go to tabIndex
object :
title
: Text to shown on tabprimaryColor
: background color when tab is selectedselectedColor
: font color when tab is selected
:point_right: NOTE: the order of the entries in
tabIndex
should match the order in thetabs
object. This is the order that the tabs will be displayed left to right on the UI.
9.2. Tables¶
The tables on each tab can be configured as follows:
Open
$(src)/bento-frontend/src/bento/dashboardTabData.js
The
tabContainers
object is an array of tables, with each table object having the following fields:
dataField
: field name in “Data” object to get values for table.:point_right: NOTE: This field should be in the GraphQL API query specified in the
api
field.defaultSortField
: Value must be one of the ‘dataField’ in columns.defaultSortDirection
: Sort default column in Ascending or Descending order (value must beasc
ordesc
)buttonText
: Text to appear on Add to cart buttonsaveButtonDefaultStyle
: Style of on Add to cart button, with fields such ascolor: '#fff', backgroundColor: '#09A175', opacity: '1', border: '0px', cursor: 'pointer',
ActiveSaveButtonDefaultStyle
: Style of on Add to cart button when it is active modeDeactiveSaveButtonDefaultStyle
: Style of on Add to cart button when it is disabled modecolumns
: a list of column objects. There is a maximum limit of 10 columns. If more than 10 columns are added, Bento will display the first 10 columns without an error or warning message. The top-down order of columns will be displayed left to right on the UI. Each column object is described by the following fields:dataField
: specifies what data appears in the column, field must be from the GraphQL API queryheader
: Heading Text for columnsort
: sort order for columnmust be
asc
ordesc
primary
: applies to primary field of table like “sample_ID” or “File_ID” based on which files will be added in to cart.must be
true
orfalse
display
: Show or Hide columnmust be
true
orfalse
dataFromRoot
: Get data from parent element.must be
true
orfalse
link
: Hyperlink to internal or external page. The value can be injected in link dynamically using{datafield}
, for example:// Internal Link link: '/arm/{dataField}', // External Link link: 'https://example.com/{dataField}',
9.2.1. Internal Links in the Dashboard Table.¶
links starting with
/
are considered as internal links.Internal links will be opened in the same tab.
Dynamic links can be generated by passing a valid table field to
{}
. For example,/program/{program_id}
will link toprogram/NCT00310180
.
9.2.2. External Links in the Dashboard Table.¶
External links should start with
http://
orhttps://
.External links should show-up with
externalLinkIcon
.External link will be opened in a new tab.
Dynamic links can be generated by passing a valid table filed to
{}
. For example,https://pubmed.ncbi.nlm.nih.gov/{pubmed_id}
will link tohttps://pubmed.ncbi.nlm.nih.gov/29860917/
9.2.3. Tool Tip¶
To change Properties of tool tip for each tab, table go to tooltipContent
object:
icon
: The help tip icon that appears next to the ‘add button’alt
: alt for the tooltip image0,1,2
: tooltip content for first tab, second tab and third tab.
9.2.4. GraphQL Query¶
The GraphQL Query used in the Dashboard page is defined in DASHBOARD_QUERY
. For example:
// GraphQL query to retrieve detailed info for a case
export const DASHBOARD_QUERY = gql`{
numberOfPrograms
numberOfStudies
numberOfSubjects
numberOfSamples
numberOfLabProcedures
numberOfFiles
subjectCountByProgram{
group
subjects
}
...
fileOverview {
file_id
file_name
association
file_description
file_format
file_size
program
arm
subject_id
sample_id
diagnosis
}
}`;
9.2.4.1. Suggested Best Practices¶
Dimension of the External Link Icon = 16 X 16 pixels.
All images should have a resolution >= 72 ppi and should be in the PNG format.
:warning: WARNING: You can add a maximum of 10 columns to the dashboard tab table. If you add more than 10 columns, Bento will display only the first ten columns, without any warning or error message