Skip to content

Commit

Permalink
feat(OperationJobsTable): add TaskName column in table [#828]
Browse files Browse the repository at this point in the history
  • Loading branch information
Flunt1k committed Oct 21, 2024
1 parent 0eba698 commit 0dcb998
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ interface ColumnsItem {
items: Array<{
sort?: boolean;
sortWithUndefined?: boolean;
hidden?: boolean;
}>;
sets: unknown;
mode: string;
Expand All @@ -78,6 +79,7 @@ interface ColumnGroupInfo {

tooltipProps?: undefined;
sort?: undefined;
hidden?: boolean;
renderHeader?: undefined;
sortWithUndefined?: undefined;
allowedOrderTypes?: undefined;
Expand All @@ -93,6 +95,7 @@ export interface ColumnInfo {
className?: string;
};
sort?: boolean;
hidden?: boolean;
sortWithUndefined?: boolean;
allowedOrderTypes?: Array<OrderType>;

Expand Down Expand Up @@ -328,12 +331,14 @@ export default class ElementsTableHeader extends Component<ElementsTableHeaderPr

return (
<tr className={b('row')}>
{columnSet.items.map((columnName, index) =>
this.renderHeaderCell(
columnName,
getColumnEdgePosition(columnSet, columnItems, index)!,
),
)}
{columnSet.items
.filter((cn) => !columnItems[cn].hidden)
.map((columnName, index) =>
this.renderHeaderCell(
columnName,
getColumnEdgePosition(columnSet, columnItems, index)!,
),
)}
</tr>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export default class ElementsTableRow extends React.PureComponent {
columnSet,
item,
itemHeight,
columnItems,
index,
selected,
onItemHover,
Expand All @@ -107,6 +108,13 @@ export default class ElementsTableRow extends React.PureComponent {
const cells = [];
for (let i = 0; i < columnSet.items.length; ) {
const columnName = columnSet.items[i];
const columnItem = columnItems[columnName];

if (columnItem.hidden) {
i += 1;
continue;
}

const {node, colSpanValue} = this.renderCell(item, columnName, index, i);
cells.push(node);
i += colSpanValue > 0 ? colSpanValue : 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ import {LOADING_STATUS} from '../../../../../../constants/index';
import {PLEASE_PROCEED_TEXT} from '../../../../../../utils/actions';
import {getShowCompetitiveJobs} from '../../../../../../pages/operations/selectors';
import {getJobsOperationId} from '../../../../../../store/selectors/operations/jobs';
import {getOperationId} from '../../../../../../store/selectors/operations/operation';
import {
getOperationId,
getOperationTasksNames,
} from '../../../../../../store/selectors/operations/operation';
import UIFactory from '../../../../../../UIFactory';
import {StaleJobIcon} from '../StaleJobIcon';

Expand Down Expand Up @@ -74,6 +77,7 @@ class OperationJobsTable extends React.Component {
promptAction: PropTypes.func.isRequired,
getJobs: PropTypes.func.isRequired,
getCompetitiveJobs: PropTypes.func.isRequired,
taskNamesNumber: PropTypes.number,
};

actions = [
Expand Down Expand Up @@ -286,6 +290,13 @@ class OperationJobsTable extends React.Component {
caption: 'Id / Address',
sort: false,
},
task_name: {
name: 'task_name',
align: 'left',
caption: 'Task name',
sort: true,
hidden: this.props.taskNamesNumber <= 1,
},
start_time: {
name: 'start_time',
align: 'left',
Expand Down Expand Up @@ -336,6 +347,7 @@ class OperationJobsTable extends React.Component {
'type',
'progress',
'error',
'task_name',
'start_time',
'finish_time',
'duration',
Expand All @@ -354,9 +366,14 @@ class OperationJobsTable extends React.Component {
finish_time: this.renderFinishTime,
duration: this.renderDuration,
actions: this.renderActions,
task_name: this.renderTaskName,
},
};

renderTaskName(item) {
return <div className={block('task-name', 'elements-ellipsis')}>{item.task_name}</div>;
}

renderProgress(item) {
const {state, progress, brief_statistics: statistics} = item;

Expand Down Expand Up @@ -492,6 +509,7 @@ function mapStateToProps(state, props) {
const {operations, global} = state;
const {cluster, login} = global;
const showCompetitiveJobs = getShowCompetitiveJobs(state);
const taskNamesNumber = getOperationTasksNames(state)?.length;
const jobsOperationId = getJobsOperationId(state);
const operationId = getOperationId(state);
const {jobs, job, competitiveJobs, inputPaths} = operations.jobs;
Expand All @@ -505,6 +523,7 @@ function mapStateToProps(state, props) {
login,
collapsibleSize: UI_COLLAPSIBLE_SIZE,
isLoading: props.isLoading || operationId !== jobsOperationId,
taskNamesNumber,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
width: 200px;
}

&_task-name {
width: 200px;
}

&_start-time,
&_finish-time {
width: 160px;
Expand Down

0 comments on commit 0dcb998

Please sign in to comment.