diff --git a/web/src/containers/status/PipelineSummary.jsx b/web/src/containers/status/PipelineSummary.jsx index 27d352d001..3b6e2292d0 100644 --- a/web/src/containers/status/PipelineSummary.jsx +++ b/web/src/containers/status/PipelineSummary.jsx @@ -12,7 +12,7 @@ // License for the specific language governing permissions and limitations // under the License. -import React, { useState } from 'react' +import React, { useState, useEffect } from 'react' import PropTypes from 'prop-types' import { Link } from 'react-router-dom' @@ -66,7 +66,7 @@ QueueItemSquare.propTypes = { item: PropTypes.object, } -function QueueCard({ pipeline, queue, allQueuesExpanded }) { +function QueueCard({ pipeline, queue, allQueuesExpanded, jobsExpanded }) { const [isQueueExpanded, setIsQueueExpanded] = useState(undefined) const [areAllQueuesExpanded, setAreAllQueuesExpanded] = useState(undefined) @@ -113,7 +113,7 @@ function QueueCard({ pipeline, queue, allQueuesExpanded }) { } {isQueueExpanded ? - + : null } @@ -124,9 +124,10 @@ QueueCard.propTypes = { pipeline: PropTypes.object, queue: PropTypes.object, allQueuesExpanded: PropTypes.bool, + jobsExpanded: PropTypes.bool, } -function QueueSummary({ pipeline, showAllQueues, allQueuesExpanded }) { +function QueueSummary({ pipeline, showAllQueues, allQueuesExpanded, jobsExpanded }) { let changeQueues = pipeline.change_queues if (!showAllQueues) { @@ -143,6 +144,7 @@ function QueueSummary({ pipeline, showAllQueues, allQueuesExpanded }) { pipeline={pipeline} queue={queue} allQueuesExpanded={allQueuesExpanded} + jobsExpanded={jobsExpanded} /> ) } else { @@ -152,7 +154,7 @@ function QueueSummary({ pipeline, showAllQueues, allQueuesExpanded }) { // where each change is enqueued in it's own queue by design. return ( allQueuesExpanded ? - + : { setAreAllQueuesExpanded(!areAllQueuesExpanded) } + useEffect(() => { + setAreAllQueuesExpanded(areAllJobsExpanded) + }, [areAllJobsExpanded]) + return ( @@ -228,6 +235,7 @@ function PipelineSummary({ pipeline, tenant, showAllQueues, filters }) { pipeline={pipeline} showAllQueues={showAllQueues} allQueuesExpanded={areAllQueuesExpanded} + jobsExpanded={areAllJobsExpanded} /> @@ -239,6 +247,7 @@ PipelineSummary.propTypes = { pipeline: PropTypes.object, tenant: PropTypes.object, showAllQueues: PropTypes.bool, + areAllJobsExpanded: PropTypes.bool, filters: PropTypes.object, } diff --git a/web/src/pages/PipelineOverview.jsx b/web/src/pages/PipelineOverview.jsx index 558d8c95ce..aa50cffbc8 100644 --- a/web/src/pages/PipelineOverview.jsx +++ b/web/src/pages/PipelineOverview.jsx @@ -118,7 +118,7 @@ TenantStats.propTypes = { reloadCallback: PropTypes.func.isRequired, } -function PipelineGallery({ pipelines, tenant, showAllPipelines, isLoading, filters, onClearFilters }) { +function PipelineGallery({ pipelines, tenant, showAllPipelines, expandAll, isLoading, filters, onClearFilters }) { // Filter out empty pipelines if necessary if (!showAllPipelines) { pipelines = pipelines.filter(ppl => ppl._count > 0) @@ -134,7 +134,7 @@ function PipelineGallery({ pipelines, tenant, showAllPipelines, isLoading, filte > {pipelines.map(pipeline => ( - + ))} @@ -156,6 +156,7 @@ PipelineGallery.propTypes = { pipelines: PropTypes.array, tenant: PropTypes.object, showAllPipelines: PropTypes.bool, + expandAll: PropTypes.bool, isLoading: PropTypes.bool, filters: PropTypes.object, onClearFilters: PropTypes.func, @@ -166,6 +167,9 @@ function PipelineOverviewPage({ }) { const [showAllPipelines, setShowAllPipelines] = useState( localStorage.getItem('zuul_show_all_pipelines') === 'true') + const [expandAll, setExpandAll] = useState( + localStorage.getItem('zuul_overview_expand_all') === 'true') + const [isReloading, setIsReloading] = useState(false) const location = useLocation() const history = useHistory() @@ -179,6 +183,11 @@ function PipelineOverviewPage({ localStorage.setItem('zuul_show_all_pipelines', isChecked.toString()) } + const onExpandAllToggle = (isChecked) => { + setExpandAll(isChecked) + localStorage.setItem('zuul_overview_expand_all', isChecked.toString()) + } + const onFilterChanged = (newFilters) => { handleFilterChange(newFilters, location, history) // show all pipelines when filtering, hide when not @@ -255,6 +264,16 @@ function PipelineOverviewPage({ {allPipelinesSwitch} : allPipelinesSwitch} + + + @@ -262,6 +281,7 @@ function PipelineOverviewPage({ pipelines={pipelines} tenant={tenant} showAllPipelines={showAllPipelines} + expandAll={expandAll} isLoading={isFetching} filters={filters} onClearFilters={onClearFilters}