Automatically expand task in project if there's a single task

pierotofy-patch-2
Piero Toffanin 2023-11-06 16:29:51 -05:00
rodzic 8976aa51e3
commit 5fc886028e
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -3,6 +3,7 @@ import '../css/TaskList.scss';
import TaskListItem from './TaskListItem';
import PropTypes from 'prop-types';
import $ from 'jquery';
import HistoryNav from '../classes/HistoryNav';
import { _, interpolate } from '../classes/gettext';
class TaskList extends React.Component {
@ -19,6 +20,8 @@ class TaskList extends React.Component {
constructor(props){
super(props);
this.historyNav = new HistoryNav(props.history);
this.state = {
tasks: [],
error: "",
@ -54,6 +57,10 @@ class TaskList extends React.Component {
this.taskListRequest =
$.getJSON(this.props.source, json => {
if (json.length === 1){
this.historyNav.addToQSList("project_task_expanded", json[0].id);
}
this.setState({
tasks: json
});
@ -67,7 +74,7 @@ class TaskList extends React.Component {
.always(() => {
this.setState({
loading: false
})
});
});
}