From 940ae805ba5550572102c7673d2c3ed57da60e5b Mon Sep 17 00:00:00 2001 From: Alexandre Magno Date: Tue, 20 Feb 2024 15:50:37 +0100 Subject: [PATCH] Revert "Fix for Issue #1013 (#1070)" This reverts commit 3303d699a136860d05dfd2f65bb00795165849a8. --- .circleci/config.yml | 2 +- frontend/src/components/task/task-table.js | 98 ++++++---------------- 2 files changed, 26 insertions(+), 74 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index aca69aace..cf31deacb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,7 +20,7 @@ jobs: build: docker: # specify the version you desire here - - image: cimg/node:17.3.0 + - image: cimg/node:19.7.0 environment: PG_HOST: 127.0.0.1 POSTGRES_DB: gitpay_test diff --git a/frontend/src/components/task/task-table.js b/frontend/src/components/task/task-table.js index 4b6ed8918..6e2f8f990 100644 --- a/frontend/src/components/task/task-table.js +++ b/frontend/src/components/task/task-table.js @@ -14,7 +14,6 @@ import { TableFooter, TablePagination, TableRow, - TableSortLabel, withStyles, Tooltip, Chip, @@ -32,7 +31,6 @@ import slugify from '@sindresorhus/slugify' import logoGithub from '../../images/github-logo.png' import logoBitbucket from '../../images/bitbucket-logo.png' import Constants from '../../consts' -import _ from 'lodash' const messages = defineMessages({ firstPageLabel: { @@ -157,15 +155,6 @@ const styles = theme => ({ }, }) -const tableHeaderMetadata ={ - "task.table.head.task": { sortable: true, numeric:false, dataBaseKey:"title" }, - "task.table.head.status" : {sortable: true,numeric:false, dataBaseKey:"status" }, - "task.table.head.project":{sortable: true,numeric:false, dataBaseKey:"Project.name" }, - "task.table.head.value" :{sortable: true,numeric:true, dataBaseKey:"value" }, - "task.table.head.labels":{sortable: true,numeric:false, dataBaseKey:"Labels" }, - "task.table.head.createdAt":{sortable: true,numeric:false, dataBaseKey:"createdAt" } -} - class CustomPaginationActionsTable extends React.Component { constructor (props) { super(props) @@ -173,23 +162,6 @@ class CustomPaginationActionsTable extends React.Component { this.state = { page: 0, rowsPerPage: 10, - sortByField:null, - sortDirection:null, // at starting point of page load - tasksData: props.tasks.data, - } - } - - sortHandler = (fieldId, direction) => { - if (tableHeaderMetadata[fieldId].sortable){ - const sortedData = _.orderBy( - this.state.tasksData, - o =>{ - if (tableHeaderMetadata[fieldId].numeric) return +(_.get(o,(tableHeaderMetadata[fieldId].dataBaseKey).split("."))) - else return _.get(o,(tableHeaderMetadata[fieldId].dataBaseKey).split(".")) - }, - [direction] - ) - this.setState({...this.state, sortByField:fieldId.split(".")[3], sortDirection:direction, tasksData:sortedData}) } } @@ -214,58 +186,38 @@ class CustomPaginationActionsTable extends React.Component { render () { const { classes, tasks } = this.props const { rowsPerPage, page } = this.state - const emptyRows = tasks.data.length ? rowsPerPage - Math.min(rowsPerPage, tasks.data.length - page * rowsPerPage) : 0; - const TableCellWithSortLogic = ({fieldId ,defineMessage, sortHandler})=>{ - return ( - { - this.setState({sortByField : fieldId}); - return sortHandler(fieldId, this.state.sortDirection ==="asc" ? "desc" : "asc" ) - } - } - > - - - ) - } - const TableHeadCustom = ()=> { - return ( - - - - - - - - - - - - - - - - - - - - - - - ) - } + const emptyRows = tasks.data.length ? rowsPerPage - Math.min(rowsPerPage, tasks.data.length - page * rowsPerPage) : 0 + return ( { tasks.completed && tasks.data.length ?
- + + + + + + + + + + + + + + + + + + + + + + - { this.state.tasksData.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map(n => { + { tasks.data.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map(n => { const assigned = n.Assigns.find(a => a.id === n.assigned) const assignedUser = assigned && assigned.User return (