Skip to content

Commit

Permalink
NickAkhmetov/CAT-948 restore missing columns in derived entities tabl…
Browse files Browse the repository at this point in the history
…es (#3567)
  • Loading branch information
NickAkhmetov authored Oct 11, 2024
1 parent db46453 commit e07978c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-cat-948.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Restore missing columns to derived entities section.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const lastModifiedTimestampCol: Column = {
const organCol: Column = {
id: 'origin_samples_unique_mapped_organs',
label: 'Organ',
renderColumnCell: (entity) => (isDataset(entity) ? entity.origin_samples_unique_mapped_organs.join(', ') : ''),
renderColumnCell: (entity) =>
isDataset(entity) || isSample(entity) ? entity.origin_samples_unique_mapped_organs.join(', ') : '',
};

const dataTypesCol: Column = {
Expand All @@ -34,7 +35,7 @@ const dataTypesCol: Column = {
const statusCol: Column = {
id: 'mapped_status',
label: 'Status',
renderColumnCell: ({ mapped_status }) => mapped_status ?? '',
renderColumnCell: ({ mapped_status, status }) => mapped_status ?? status ?? '',
};

const derivedSamplesColumns: Column[] = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useMemo } from 'react';

import { useSearchHits } from 'js/hooks/useSearchData';
import { Dataset, Sample } from 'js/components/types';

function getTypeQuery(ancestorUUID, type) {
function getTypeQuery(ancestorUUID: string, type: string) {
return {
bool: {
filter: [
Expand All @@ -21,7 +22,7 @@ function getTypeQuery(ancestorUUID, type) {
};
}

function useDerivedDatasetSearchHits(ancestorUUID) {
function useDerivedDatasetSearchHits(ancestorUUID: string) {
const query = useMemo(
() => ({
query: getTypeQuery(ancestorUUID, 'dataset'),
Expand All @@ -39,10 +40,10 @@ function useDerivedDatasetSearchHits(ancestorUUID) {
[ancestorUUID],
);

return useSearchHits(query);
return useSearchHits<Dataset>(query);
}

function useDerivedSampleSearchHits(ancestorUUID) {
function useDerivedSampleSearchHits(ancestorUUID: string) {
const query = useMemo(
() => ({
query: getTypeQuery(ancestorUUID, 'sample'),
Expand All @@ -59,7 +60,7 @@ function useDerivedSampleSearchHits(ancestorUUID) {
}),
[ancestorUUID],
);
return useSearchHits(query);
return useSearchHits<Sample>(query);
}

export { useDerivedDatasetSearchHits, useDerivedSampleSearchHits };

0 comments on commit e07978c

Please sign in to comment.