Skip to content

Commit

Permalink
src: introducing func comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Sinclert committed Jul 25, 2018
1 parent 265b28a commit 922a4f8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions reana-ui/src/components/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const POOLING_PERIOD = 5;

export default class SortTable extends Component {

/**
* Variables defining the state of the table
*/
state = {
column: null,
data: [],
Expand All @@ -44,6 +47,9 @@ export default class SortTable extends Component {
};


/**
* Transforms millisecond into a 'HH MM SS' string format
*/
static msToTime(millis) {

let seconds = Math.floor((millis / 1000) % 60);
Expand All @@ -58,8 +64,13 @@ export default class SortTable extends Component {
}


/**
* Parses API data into displayable data
*/
static parseData(data) {

if (!Array.isArray(data)) return [];

data.forEach((workflow) => {

let info = workflow['name'].split('.');
Expand All @@ -75,6 +86,9 @@ export default class SortTable extends Component {
}


/**
* Gets data from the specified API
*/
getData() {
fetch(URL + 'access_token=' + TOKEN)
.then(response => response.json())
Expand All @@ -88,6 +102,9 @@ export default class SortTable extends Component {
}


/**
* Default runnable method when the component is loaded
*/
componentDidMount() {
this.getData();
this.setState({
Expand All @@ -96,6 +113,9 @@ export default class SortTable extends Component {
}


/**
* Performs the sorting when a column header is clicked
*/
handleSort = clickedColumn => () => {

const { column, data, direction } = this.state;
Expand Down

0 comments on commit 922a4f8

Please sign in to comment.