Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTable #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

DataTable #4

wants to merge 1 commit into from

Conversation

david-mart
Copy link
Owner

Description
  • DataTable component is a custom table to represent data from RESTful api.
    It is working directly with the API. The only value that has to be provided is an api model endpoint (i.e. project, asset).
  • The complete URL is being generated by getRequestUrl helper function from src/utilities/datatable-utilities.js helper file.
  • When the component is first loaded, it is creating two actions: fetchDatatableData and fetchDatatableColumns
  • fetchDatatableData is getting table rows from the API, while fetchDatatableColumns is just getting static column values from getColumns helper function of datatable-utilities. It is to be replaced with an actual API call when it is implemented.
  • After both methods are called, the data is dispatched into a store by DatatableReducer. It is creating new attribute for both rows and columns store according to the name of the data type. Every new datatable reference is going to be populating same state with new attributes, for example:
    state: {
      rows: {
        project: [ ... ],
        asset: [ ... ]
      },
      columns: {
        project: [ ... ],
        asset: [ ... ]
      },
      filters: {},
      errors: []
    };
  • Any API errors are being pushed to errors array. Implementation of filters is to be determined
  • Table itself is based on Material-UI Table and uses few helper functions from datatable-utilities to generate table columns and rows.
  • As soon as corresponding attribute of rows and columns states is available, component is using same dataType property to get data from the store.
  • tableStyles property is being used for customizing table styles.
  • All elements of the component are covered by unit tests.
Next steps:
  • Add filtering and sorting using registered API filter values.
  • Add pagination support using API offset and limit filters.
  • Add unit test coverage for datatable-actions.js
  • Fix table container and body for scrolling
  • Stylize table according to designs

##### Description
- `DataTable` component is a custom table to represent data from RESTful api.
It is working directly with the API. The only value that has to be provided is an api model endpoint (i.e. _project_, _asset_). 
- The complete URL is being generated by `getRequestUrl` helper function from  `src/utilities/datatable-utilities.js` helper file. 
- When the component is first loaded, it is creating two actions: `fetchDatatableData` and `fetchDatatableColumns`
- `fetchDatatableData` is getting table rows from the API, while `fetchDatatableColumns` is just getting static column values from `getColumns` helper function of `datatable-utilities`. It is to be replaced with an actual API call when it is implemented.
- After both methods are called, the data is dispatched into a store by `DatatableReducer`. It is creating new attribute for both _rows_ and _columns_ store according to the name of the data type. Every new datatable reference is going to be populating same state with new attributes, for example:
```
    state: {
      rows: {
        project: [ ... ],
        asset: [ ... ]
      },
      columns: {
        project: [ ... ],
        asset: [ ... ]
      },
      filters: {},
      errors: []
    };
```
- Any API errors are being pushed to `errors` array. Implementation of `filters` is to be determined
- Table itself is based on _Material-UI Table_ and uses few helper functions from `datatable-utilities` to generate table columns and rows.
- As soon as corresponding attribute of _rows_ and _columns_ states is available, component is using same `dataType` property to get data from the store.
- `tableStyles` property is being used for customizing table styles.
- All elements of the component are covered by unit tests.
- 
##### Next steps:
- Add filtering and sorting using registered API filter values.
- Add pagination support using API `offset` and `limit` filters.
- Add unit test coverage for `datatable-actions.js`
- Fix table container and body for scrolling 
- Stylize table according to designs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant