mirror of
				https://github.com/ClusterCockpit/cc-backend
				synced 2025-10-31 07:55:06 +01:00 
			
		
		
		
	Prevent high job counts in compare view by filter removal
This commit is contained in:
		| @@ -99,6 +99,7 @@ | |||||||
|   </Col> |   </Col> | ||||||
|   <Col lg="4" class="mb-1 mb-lg-0"> |   <Col lg="4" class="mb-1 mb-lg-0"> | ||||||
|     <Filters |     <Filters | ||||||
|  |       showFilter={!showCompare} | ||||||
|       {filterPresets} |       {filterPresets} | ||||||
|       matchedJobs={showCompare? matchedCompareJobs: matchedListJobs} |       matchedJobs={showCompare? matchedCompareJobs: matchedListJobs} | ||||||
|       bind:this={filterComponent} |       bind:this={filterComponent} | ||||||
| @@ -136,18 +137,20 @@ | |||||||
|   </Col> |   </Col> | ||||||
|   <Col lg="2" class="mb-2 mb-lg-0"> |   <Col lg="2" class="mb-2 mb-lg-0"> | ||||||
|     <ButtonGroup class="w-100"> |     <ButtonGroup class="w-100"> | ||||||
|       <Button color="primary" on:click={() => { |       <Button color="primary" disabled={matchedListJobs >= 500 && !(selectedJobs.length != 0)} on:click={() => { | ||||||
|         if (selectedJobs.length != 0) filterComponent.updateFilters({dbId: selectedJobs}) |         if (selectedJobs.length != 0) filterComponent.updateFilters({dbId: selectedJobs}) | ||||||
|         else if (selectedJobs.length == 0) filterComponent.updateFilters({dbId: []}) |  | ||||||
|         showCompare = !showCompare |         showCompare = !showCompare | ||||||
|       }} > |       }} > | ||||||
|         {showCompare ? 'List' : 'Compare'} Jobs {selectedJobs.length != 0 ? `(${selectedJobs.length} selected)` : `(Use Filter)`} |         {showCompare ? 'Return to List' :  | ||||||
|  |         'Compare Jobs' + (selectedJobs.length != 0 ? ` (${selectedJobs.length} selected)` : matchedListJobs >= 500 ? ` (Too Many)` : ``)} | ||||||
|       </Button> |       </Button> | ||||||
|       <Button color="danger" disabled={selectedJobs.length == 0} on:click={() => { |       {#if !showCompare && selectedJobs.length != 0} | ||||||
|  |         <Button color="warning" on:click={() => { | ||||||
|           selectedJobs = [] // Only empty array, filters handled by reactive reset |           selectedJobs = [] // Only empty array, filters handled by reactive reset | ||||||
|         }}> |         }}> | ||||||
|       Reset |         Clear | ||||||
|         </Button> |         </Button> | ||||||
|  |       {/if} | ||||||
|     </ButtonGroup> |     </ButtonGroup> | ||||||
|   </Col> |   </Col> | ||||||
| </Row> | </Row> | ||||||
|   | |||||||
| @@ -44,6 +44,7 @@ | |||||||
|   export let disableClusterSelection = false; |   export let disableClusterSelection = false; | ||||||
|   export let startTimeQuickSelect = false; |   export let startTimeQuickSelect = false; | ||||||
|   export let matchedJobs = -2; |   export let matchedJobs = -2; | ||||||
|  |   export let showFilter = true; | ||||||
|  |  | ||||||
|   const startTimeSelectOptions = [ |   const startTimeSelectOptions = [ | ||||||
|     { range: "", rangeLabel: "No Selection"}, |     { range: "", rangeLabel: "No Selection"}, | ||||||
| @@ -253,6 +254,7 @@ | |||||||
|  |  | ||||||
| <!-- Dropdown-Button --> | <!-- Dropdown-Button --> | ||||||
| <ButtonGroup> | <ButtonGroup> | ||||||
|  |   {#if showFilter} | ||||||
|     <ButtonDropdown class="cc-dropdown-on-hover mb-1" style="{(matchedJobs >= -1) ? '' : 'margin-right: 0.5rem;'}"> |     <ButtonDropdown class="cc-dropdown-on-hover mb-1" style="{(matchedJobs >= -1) ? '' : 'margin-right: 0.5rem;'}"> | ||||||
|       <DropdownToggle outline caret color="success"> |       <DropdownToggle outline caret color="success"> | ||||||
|         <Icon name="sliders" /> |         <Icon name="sliders" /> | ||||||
| @@ -307,6 +309,8 @@ | |||||||
|         {/if} |         {/if} | ||||||
|       </DropdownMenu> |       </DropdownMenu> | ||||||
|     </ButtonDropdown> |     </ButtonDropdown> | ||||||
|  |   {/if} | ||||||
|  |  | ||||||
|   {#if matchedJobs >= -1} |   {#if matchedJobs >= -1} | ||||||
|     <Button class="mb-1" style="margin-right: 0.5rem;" disabled outline> |     <Button class="mb-1" style="margin-right: 0.5rem;" disabled outline> | ||||||
|       {matchedJobs == -1 ? 'Loading ...' : `${matchedJobs} jobs`} |       {matchedJobs == -1 ? 'Loading ...' : `${matchedJobs} jobs`} | ||||||
| @@ -314,6 +318,7 @@ | |||||||
|   {/if} |   {/if} | ||||||
| </ButtonGroup> | </ButtonGroup> | ||||||
|  |  | ||||||
|  | {#if showFilter} | ||||||
|   <!-- SELECTED FILTER PILLS --> |   <!-- SELECTED FILTER PILLS --> | ||||||
|   {#if filters.cluster} |   {#if filters.cluster} | ||||||
|     <Info icon="cpu" on:click={() => (isClusterOpen = true)}> |     <Info icon="cpu" on:click={() => (isClusterOpen = true)}> | ||||||
| @@ -418,6 +423,7 @@ | |||||||
|         .join(", ")} |         .join(", ")} | ||||||
|     </Info> |     </Info> | ||||||
|   {/if} |   {/if} | ||||||
|  | {/if} | ||||||
|  |  | ||||||
| <Cluster | <Cluster | ||||||
|   {disableClusterSelection} |   {disableClusterSelection} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user