Skip to content

Commit

Permalink
fix: remove mocked data
Browse files Browse the repository at this point in the history
  • Loading branch information
astandrik committed Dec 27, 2024
1 parent e8f359b commit d6897e6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 256 deletions.
50 changes: 18 additions & 32 deletions src/containers/Storage/StorageNodes/getNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
NODES_COLUMNS_TO_DATA_FIELDS,
getNodesColumnSortField,
} from '../../../components/nodesColumns/constants';
import {generateNodes} from '../../../mocks/storage/nodes';
import type {
PreparedStorageNode,
PreparedStorageNodeFilters,
Expand All @@ -13,6 +12,7 @@ import type {NodesRequestParams} from '../../../types/api/nodes';
import {prepareSortValue} from '../../../utils/filters';
import {getUptimeParamValue} from '../../../utils/nodes';
import {getRequiredDataFields} from '../../../utils/tableUtils/getRequiredDataFields';

export const getStorageNodes: FetchData<
PreparedStorageNode,
PreparedStorageNodeFilters,
Expand All @@ -38,42 +38,28 @@ export const getStorageNodes: FetchData<
filterGroupBy,
} = filters ?? {};
const {sortOrder, columnId} = sortParams ?? {};

const sortField = getNodesColumnSortField(columnId);
const sort = sortField ? prepareSortValue(sortField, sortOrder) : undefined;

const dataFieldsRequired = getRequiredDataFields(columnsIds, NODES_COLUMNS_TO_DATA_FIELDS);

let response;
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.get('mocks')) {
// Get mock configuration from URL parameters or use defaults
const pdisks = parseInt(urlParams.get('pdisks') || '10', 10);
const vdisksPerPDisk = parseInt(urlParams.get('vdisksPerPDisk') || '2', 10);
const totalNodes = parseInt(urlParams.get('totalNodes') || '50', 10);
response = generateNodes(totalNodes, {
maxVdisksPerPDisk: vdisksPerPDisk,
maxPdisks: pdisks,
offset,
limit,
});
} else {
response = await window.api.viewer.getNodes({
type,
storage,
limit,
offset,
sort,
filter: searchValue,
uptime: getUptimeParamValue(nodesUptimeFilter),
with: visibleEntities,
database,
node_id: nodeId,
group_id: groupId,
filter_group: filterGroup,
filter_group_by: filterGroupBy,
fieldsRequired: dataFieldsRequired,
});
}
const response = await window.api.viewer.getNodes({
type,
storage,
limit,
offset,
sort,
filter: searchValue,
uptime: getUptimeParamValue(nodesUptimeFilter),
with: visibleEntities,
database,
node_id: nodeId,
group_id: groupId,
filter_group: filterGroup,
filter_group_by: filterGroupBy,
fieldsRequired: dataFieldsRequired,
});
const preparedResponse = prepareStorageNodesResponse(response);
return {
data: preparedResponse.nodes || [],
Expand Down
224 changes: 0 additions & 224 deletions src/mocks/storage/nodes.ts

This file was deleted.

0 comments on commit d6897e6

Please sign in to comment.