Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/containers/Storage/PaginatedStorage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import {useStorageQueryParams} from './useStorageQueryParams';

export interface PaginatedStorageProps {
database?: string;
nodeId?: string;
groupId?: string;
nodeId?: string | number;
groupId?: string | number;
pDiskId?: string | number;

parentContainer?: Element | null;
}

Expand Down
24 changes: 20 additions & 4 deletions src/containers/Storage/PaginatedStorageGroups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,18 @@ export function PaginatedStorageGroups(props: PaginatedStorageProps) {
return <LoaderWrapper loading={!capabilitiesLoaded}>{renderContent()}</LoaderWrapper>;
}

function StorageGroupsComponent({database, nodeId, parentContainer}: PaginatedStorageProps) {
function StorageGroupsComponent({
database,
nodeId,
groupId,
pDiskId,
parentContainer,
}: PaginatedStorageProps) {
const {searchValue, visibleEntities, handleShowAllGroups} = useStorageQueryParams();

const {columnsToShow, columnsToSelect, setColumns} = useStorageGroupsSelectedColumns({
visibleEntities,
nodeId,
nodeId: nodeId?.toString(),
});

const renderControls: RenderControls = ({totalEntities, foundEntities, inited}) => {
Expand All @@ -75,6 +81,8 @@ function StorageGroupsComponent({database, nodeId, parentContainer}: PaginatedSt
<PaginatedStorageGroupsTable
database={database}
nodeId={nodeId}
groupId={groupId}
pDiskId={pDiskId}
searchValue={searchValue}
visibleEntities={visibleEntities}
onShowAll={handleShowAllGroups}
Expand All @@ -86,14 +94,19 @@ function StorageGroupsComponent({database, nodeId, parentContainer}: PaginatedSt
);
}

function GroupedStorageGroupsComponent({database, groupId, nodeId}: PaginatedStorageProps) {
function GroupedStorageGroupsComponent({
database,
nodeId,
groupId,
pDiskId,
}: PaginatedStorageProps) {
const [autoRefreshInterval] = useAutoRefreshInterval();
const {searchValue, storageGroupsGroupByParam, visibleEntities, handleShowAllGroups} =
useStorageQueryParams();

const {columnsToShow, columnsToSelect, setColumns} = useStorageGroupsSelectedColumns({
visibleEntities,
nodeId,
nodeId: nodeId?.toString(),
});

const {currentData, isFetching, error} = storageApi.useGetStorageGroupsInfoQuery(
Expand All @@ -102,6 +115,7 @@ function GroupedStorageGroupsComponent({database, groupId, nodeId}: PaginatedSto
with: 'all',
nodeId,
groupId,
pDiskId,
filter: searchValue,
shouldUseGroupsHandler: true,
group: storageGroupsGroupByParam,
Expand Down Expand Up @@ -147,6 +161,8 @@ function GroupedStorageGroupsComponent({database, groupId, nodeId}: PaginatedSto
<PaginatedStorageGroupsTable
database={database}
nodeId={nodeId}
groupId={groupId}
pDiskId={pDiskId}
filterGroup={name}
filterGroupBy={storageGroupsGroupByParam}
searchValue={searchValue}
Expand Down
19 changes: 13 additions & 6 deletions src/containers/Storage/PaginatedStorageNodes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from '../../store/reducers/capabilities/hooks';
import {useClusterBaseInfo} from '../../store/reducers/cluster/cluster';
import {storageApi} from '../../store/reducers/storage/storage';
import {valueIsDefined} from '../../utils';
import {useAutoRefreshInterval} from '../../utils/hooks';
import {NodesUptimeFilterValues} from '../../utils/nodes';
import {useAdditionalNodeProps} from '../AppWithClusters/useClusterData';
Expand Down Expand Up @@ -57,13 +56,18 @@ export const PaginatedStorageNodes = (props: PaginatedStorageProps) => {
return <LoaderWrapper loading={!capabilitiesLoaded}>{renderContent()}</LoaderWrapper>;
};

function StorageNodesComponent({database, groupId, parentContainer}: PaginatedStorageProps) {
function StorageNodesComponent({
database,
nodeId,
groupId,
parentContainer,
}: PaginatedStorageProps) {
const {searchValue, visibleEntities, nodesUptimeFilter, handleShowAllNodes} =
useStorageQueryParams();

const {columnsToShow, columnsToSelect, setColumns} = useStorageNodesColumnsToSelect({
database,
groupId,
groupId: groupId?.toString(),
});

const renderControls: RenderControls = ({totalEntities, foundEntities, inited}) => {
Expand All @@ -83,6 +87,8 @@ function StorageNodesComponent({database, groupId, parentContainer}: PaginatedSt
return (
<PaginatedStorageNodesTable
database={database}
nodeId={nodeId}
groupId={groupId}
searchValue={searchValue}
visibleEntities={visibleEntities}
nodesUptimeFilter={nodesUptimeFilter}
Expand All @@ -102,7 +108,7 @@ function GroupedStorageNodesComponent({database, groupId, nodeId}: PaginatedStor

const {columnsToShow, columnsToSelect, setColumns} = useStorageNodesColumnsToSelect({
database,
groupId,
groupId: groupId?.toString(),
});

const {currentData, isFetching, error} = storageApi.useGetStorageNodesInfoQuery(
Expand All @@ -111,8 +117,7 @@ function GroupedStorageNodesComponent({database, groupId, nodeId}: PaginatedStor
with: 'all',
filter: searchValue,
node_id: nodeId,
// node_id and group_id params don't work together
group_id: valueIsDefined(nodeId) ? undefined : groupId,
Comment on lines -114 to -115
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was fixed on backend recently

group_id: groupId,
group: storageNodesGroupByParam,
},
{
Expand Down Expand Up @@ -155,6 +160,8 @@ function GroupedStorageNodesComponent({database, groupId, nodeId}: PaginatedStor
>
<PaginatedStorageNodesTable
database={database}
nodeId={nodeId}
groupId={groupId}
searchValue={searchValue}
visibleEntities={'all'}
nodesUptimeFilter={NodesUptimeFilterValues.All}
Expand Down
4 changes: 1 addition & 3 deletions src/containers/Storage/Storage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import type {NodesSortParams} from '../../store/reducers/nodes/types';
import {filterGroups, filterNodes} from '../../store/reducers/storage/selectors';
import {storageApi} from '../../store/reducers/storage/storage';
import type {StorageSortParams} from '../../store/reducers/storage/types';
import {valueIsDefined} from '../../utils';
import {useAutoRefreshInterval, useTableSort} from '../../utils/hooks';
import {useAdditionalNodeProps} from '../AppWithClusters/useClusterData';

Expand Down Expand Up @@ -90,8 +89,7 @@ export const Storage = ({database, nodeId, groupId, pDiskId}: StorageProps) => {
database,
with: visibleEntities,
node_id: nodeId,
// node_id and group_id params don't work together
group_id: valueIsDefined(nodeId) ? undefined : groupId,
group_id: groupId,
},
{
skip: !isNodes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ interface PaginatedStorageGroupsTableProps {
columns: StorageGroupsColumn[];

database?: string;
nodeId?: string;
nodeId?: string | number;
groupId?: string | number;
pDiskId?: string | number;

filterGroup?: string;
filterGroupBy?: GroupsGroupByField;
Expand All @@ -40,6 +42,8 @@ export const PaginatedStorageGroupsTable = ({
columns,
database,
nodeId,
groupId,
pDiskId,
filterGroup,
filterGroupBy,
searchValue,
Expand All @@ -56,8 +60,26 @@ export const PaginatedStorageGroupsTable = ({
const fetchData = useGroupsGetter(groupsHandlerAvailable);

const tableFilters = React.useMemo(() => {
return {searchValue, visibleEntities, database, nodeId, filterGroup, filterGroupBy};
}, [searchValue, visibleEntities, database, nodeId, filterGroup, filterGroupBy]);
return {
searchValue,
visibleEntities,
database,
nodeId,
groupId,
pDiskId,
filterGroup,
filterGroupBy,
};
}, [
searchValue,
visibleEntities,
database,
nodeId,
groupId,
pDiskId,
filterGroup,
filterGroupBy,
]);

const renderEmptyDataMessage = () => {
if (visibleEntities !== VISIBLE_ENTITIES.all) {
Expand Down
14 changes: 12 additions & 2 deletions src/containers/Storage/StorageGroups/getGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,16 @@ export function useGroupsGetter(shouldUseGroupsHandler: boolean) {
async (params) => {
const {limit, offset, sortParams, filters} = params;
const {sortOrder, columnId} = sortParams ?? {};
const {searchValue, visibleEntities, database, nodeId, filterGroup, filterGroupBy} =
filters ?? {};
const {
searchValue,
visibleEntities,
database,
nodeId,
groupId,
pDiskId,
filterGroup,
filterGroupBy,
} = filters ?? {};

const sort = isSortableStorageProperty(columnId)
? prepareSortValue(columnId, sortOrder)
Expand All @@ -31,6 +39,8 @@ export function useGroupsGetter(shouldUseGroupsHandler: boolean) {
with: visibleEntities,
database,
nodeId,
groupId,
pDiskId,
filter_group: filterGroup,
filter_group_by: filterGroupBy,
shouldUseGroupsHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ interface PaginatedStorageNodesTableProps {
columns: StorageNodesColumn[];

database?: string;
nodeId?: string | number;
groupId?: string | number;

filterGroup?: string;
filterGroupBy?: NodesGroupByField;
Expand All @@ -36,6 +38,8 @@ interface PaginatedStorageNodesTableProps {
export const PaginatedStorageNodesTable = ({
columns,
database,
nodeId,
groupId,
filterGroup,
filterGroupBy,
searchValue,
Expand All @@ -53,10 +57,21 @@ export const PaginatedStorageNodesTable = ({
visibleEntities,
nodesUptimeFilter,
database,
nodeId,
groupId,
filterGroup,
filterGroupBy,
};
}, [searchValue, visibleEntities, nodesUptimeFilter, database, filterGroup, filterGroupBy]);
}, [
searchValue,
visibleEntities,
nodesUptimeFilter,
database,
nodeId,
groupId,
filterGroup,
filterGroupBy,
]);

const renderEmptyDataMessage = () => {
if (
Expand Down
14 changes: 12 additions & 2 deletions src/containers/Storage/StorageNodes/getNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ export const getStorageNodes: FetchData<
Pick<NodesRequestParams, 'type' | 'storage'>
> = async (params) => {
const {type = 'static', storage = true, limit, offset, sortParams, filters} = params;
const {searchValue, nodesUptimeFilter, visibleEntities, database, filterGroup, filterGroupBy} =
filters ?? {};
const {
searchValue,
nodesUptimeFilter,
visibleEntities,
database,
nodeId,
groupId,
filterGroup,
filterGroupBy,
} = filters ?? {};
const {sortOrder, columnId} = sortParams ?? {};

const sort = isSortableNodesProperty(columnId)
Expand All @@ -32,6 +40,8 @@ export const getStorageNodes: FetchData<
uptime: getUptimeParamValue(nodesUptimeFilter),
with: visibleEntities,
database,
node_id: nodeId,
group_id: groupId,
filter_group: filterGroup,
filter_group_by: filterGroupBy,
});
Expand Down
10 changes: 9 additions & 1 deletion src/store/reducers/storage/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export interface PreparedStorageNodeFilters {
searchValue: string;
nodesUptimeFilter: NodesUptimeFilterValues;
visibleEntities: VisibleEntities;

database?: string;
nodeId?: string | number;
groupId?: string | number;

filterGroup?: string;
filterGroupBy?: NodesGroupByField;
}
Expand All @@ -38,8 +42,12 @@ export interface PreparedStorageNode extends TSystemStateInfo {
export interface PreparedStorageGroupFilters {
searchValue: string;
visibleEntities: VisibleEntities;

database?: string;
nodeId?: string;
nodeId?: string | number;
groupId?: string | number;
pDiskId?: string | number;

filterGroup?: string;
filterGroupBy?: GroupsGroupByField;
}
Expand Down
Loading