From 5fc886028e18683784f4dc6edffe8c51da42f640 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 6 Nov 2023 16:29:51 -0500 Subject: [PATCH] Automatically expand task in project if there's a single task --- app/static/app/js/components/TaskList.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/static/app/js/components/TaskList.jsx b/app/static/app/js/components/TaskList.jsx index 541407cf..b41d81bb 100644 --- a/app/static/app/js/components/TaskList.jsx +++ b/app/static/app/js/components/TaskList.jsx @@ -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 - }) + }); }); }