mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
UI - remove extra loading Spinner from Software page (#12519)
## Addresses #11355, pt.1 (pt. 2 already fixed) # Checklist for submitter If some of the following don't apply, delete the relevant line. - [x] Changes file added for user-visible changes in `changes/` - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
parent
642ad21087
commit
569bf15fa5
1
changes/11355-software-page-rendering-bugs
Normal file
1
changes/11355-software-page-rendering-bugs
Normal file
@ -0,0 +1 @@
|
||||
- Fix a bug where an extraneous loading spinner was rendered on the Software page.
|
@ -613,12 +613,64 @@ const ManageSoftwarePage = ({
|
||||
searchQuery !== "" ||
|
||||
queryParams.vulnerable === "true");
|
||||
|
||||
return !isRouteOk ||
|
||||
(isPremiumTier && !userTeams) ||
|
||||
!globalConfig ||
|
||||
(!softwareConfig && !softwareConfigError) ? (
|
||||
<Spinner />
|
||||
) : (
|
||||
const renderSoftwareTable = () => {
|
||||
if (
|
||||
isFetchingCount ||
|
||||
isFetchingSoftware ||
|
||||
!globalConfig ||
|
||||
(!softwareConfig && !softwareConfigError)
|
||||
) {
|
||||
return <Spinner />;
|
||||
}
|
||||
if (
|
||||
(softwareError && !isFetchingSoftware) ||
|
||||
(softwareConfigError && !isFetchingSoftwareConfig)
|
||||
) {
|
||||
return <TableDataError />;
|
||||
}
|
||||
return (
|
||||
<TableContainer
|
||||
columns={softwareTableHeaders}
|
||||
data={(isSoftwareEnabled && software?.software) || []}
|
||||
isLoading={false}
|
||||
resultsTitle={"software items"}
|
||||
emptyComponent={() => (
|
||||
<EmptySoftwareTable
|
||||
isSoftwareDisabled={!isSoftwareEnabled}
|
||||
isFilterVulnerable={filterVuln}
|
||||
isSandboxMode={isSandboxMode}
|
||||
isCollectingSoftware={isCollectingInventory}
|
||||
isSearching={searchQuery !== ""}
|
||||
noSandboxHosts={noSandboxHosts}
|
||||
/>
|
||||
)}
|
||||
defaultSortHeader={sortHeader || DEFAULT_SORT_HEADER}
|
||||
defaultSortDirection={sortDirection || DEFAULT_SORT_DIRECTION}
|
||||
defaultPageIndex={page || 0}
|
||||
defaultSearchQuery={searchQuery}
|
||||
manualSortBy
|
||||
pageSize={DEFAULT_PAGE_SIZE}
|
||||
showMarkAllPages={false}
|
||||
isAllPagesSelected={false}
|
||||
resetPageIndex={resetPageIndex}
|
||||
disableNextPage={isLastPage}
|
||||
searchable={searchable}
|
||||
inputPlaceHolder="Search software by name or vulnerabilities (CVEs)"
|
||||
onQueryChange={onQueryChange}
|
||||
additionalQueries={filterVuln ? "vulnerable" : ""} // additionalQueries serves as a trigger
|
||||
// for the useDeepEffect hook to fire onQueryChange for events happeing outside of
|
||||
// the TableContainer
|
||||
customControl={searchable ? renderVulnFilterDropdown : undefined}
|
||||
stackControls
|
||||
renderCount={renderSoftwareCount}
|
||||
renderFooter={renderTableFooter}
|
||||
disableMultiRowSelect
|
||||
onSelectSingleRow={handleRowSelect}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<MainContent>
|
||||
<div className={`${baseClass}__wrapper`}>
|
||||
<div className={`${baseClass}__header-wrap`}>
|
||||
@ -655,51 +707,7 @@ const ManageSoftwarePage = ({
|
||||
<div className={`${baseClass}__description`}>
|
||||
{renderHeaderDescription()}
|
||||
</div>
|
||||
<div className={`${baseClass}__table`}>
|
||||
{(softwareError && !isFetchingSoftware) ||
|
||||
(softwareConfigError && !isFetchingSoftwareConfig) ? (
|
||||
<TableDataError />
|
||||
) : (
|
||||
<TableContainer
|
||||
columns={softwareTableHeaders}
|
||||
data={(isSoftwareEnabled && software?.software) || []}
|
||||
isLoading={isFetchingSoftware || isFetchingCount}
|
||||
resultsTitle={"software items"}
|
||||
emptyComponent={() => (
|
||||
<EmptySoftwareTable
|
||||
isSoftwareDisabled={!isSoftwareEnabled}
|
||||
isFilterVulnerable={filterVuln}
|
||||
isSandboxMode={isSandboxMode}
|
||||
isCollectingSoftware={isCollectingInventory}
|
||||
isSearching={searchQuery !== ""}
|
||||
noSandboxHosts={noSandboxHosts}
|
||||
/>
|
||||
)}
|
||||
defaultSortHeader={sortHeader || DEFAULT_SORT_HEADER}
|
||||
defaultSortDirection={sortDirection || DEFAULT_SORT_DIRECTION}
|
||||
defaultPageIndex={page || 0}
|
||||
defaultSearchQuery={searchQuery}
|
||||
manualSortBy
|
||||
pageSize={DEFAULT_PAGE_SIZE}
|
||||
showMarkAllPages={false}
|
||||
isAllPagesSelected={false}
|
||||
resetPageIndex={resetPageIndex}
|
||||
disableNextPage={isLastPage}
|
||||
searchable={searchable}
|
||||
inputPlaceHolder="Search software by name or vulnerabilities (CVEs)"
|
||||
onQueryChange={onQueryChange}
|
||||
additionalQueries={filterVuln ? "vulnerable" : ""} // additionalQueries serves as a trigger
|
||||
// for the useDeepEffect hook to fire onQueryChange for events happeing outside of
|
||||
// the TableContainer
|
||||
customControl={searchable ? renderVulnFilterDropdown : undefined}
|
||||
stackControls
|
||||
renderCount={renderSoftwareCount}
|
||||
renderFooter={renderTableFooter}
|
||||
disableMultiRowSelect
|
||||
onSelectSingleRow={handleRowSelect}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className={`${baseClass}__table`}>{renderSoftwareTable()}</div>
|
||||
{showManageAutomationsModal && (
|
||||
<ManageAutomationsModal
|
||||
onCancel={toggleManageAutomationsModal}
|
||||
|
Loading…
Reference in New Issue
Block a user