Skip to content

Commit

Permalink
Merge pull request #163 from Sanketika-Obsrv/listpage_fixes
Browse files Browse the repository at this point in the history
List Page fixes
  • Loading branch information
HarishGangula authored Jan 9, 2025
2 parents 1becfec + 564e527 commit ff723c5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
23 changes: 18 additions & 5 deletions web-console-v2/src/pages/DatasetList/DatasetList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ const DatasetList: React.FC = () => {
setEditTagsAnchorEl(null);
setSelectedDataset(null);
};

const handleEditTagsSave = async (
dataset: Dataset,
tags: string[],
Expand Down Expand Up @@ -367,13 +368,25 @@ const DatasetList: React.FC = () => {
};

await updateDataset({ data: payload });

const updatedDatasets = datasets.map((ds) =>
ds.dataset_id === dataset.dataset_id ? { ...ds, tags } : ds
);
setDatasets(updatedDatasets);

const allTags = Array.from(
new Set(updatedDatasets.flatMap((dataset) => dataset.tags || []))
);

const updatedFilters = {
...filters,
tag: _.union(defaultFilters.tag, allTags),
};
setFilters(updatedFilters);

setLoading(false);
showAlertMessage(dataset.name, 'success', 'Edit Tags');
setDatasets((prevDatasets) =>
prevDatasets.map((ds) =>
ds.dataset_id === dataset.dataset_id ? { ...ds, tags } : ds,
),
);
handleCloseEditTagsPopover();
} catch (error) {
showAlertMessage(dataset.name, 'error', 'Edit Tags');
setLoading(false);
Expand Down
4 changes: 2 additions & 2 deletions web-console-v2/src/pages/DatasetList/DatasetlistCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ const DatasetlistCard: React.FC<DatasetlistCardProps> = ({
Volume
</Typography>
<Typography variant="caption">
0
{eventCounts.totalEvents}
</Typography>
</Grid>
<Grid item xs={1} className={styles.gridItemNoBorder}>
<Typography variant="captionMedium">
Size
</Typography>
<Typography variant="caption">
0
{prettyBytes(datasetSize)}
</Typography>
</Grid>
</>
Expand Down
2 changes: 1 addition & 1 deletion web-console-v2/src/services/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ export const filterDatasets = (
export const useTotalEvents = (datasetId: string, isMasterDataset: boolean) => {
const dateFormat = 'YYYY-MM-DDT00:00:00+05:30';
const startDate = '2000-01-01';
const endDate = dayjs().add(1, 'day').format(dateFormat);
const endDate = dayjs().format(dateFormat);

return useQueryWithLocalStorageFallback(
['totalEvents', datasetId],
Expand Down

0 comments on commit ff723c5

Please sign in to comment.