Skip to content

Commit

Permalink
Merge pull request #1099 from griffithlab/browse-table-fixes
Browse files Browse the repository at this point in the history
Disease and Therapy browse table improvements
  • Loading branch information
acoffman authored Aug 21, 2024
2 parents c8e1655 + 0297aa1 commit d87f723
Show file tree
Hide file tree
Showing 29 changed files with 367 additions and 130 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,21 @@
<thead (nzSortOrderChange)="sortChange$.next($event)">
<tr class="col-header-row">
<th
nzWidth="300px"
nzWidth="200px"
nzLeft
[nzColumnKey]="sortColumns.Name"
[nzSortFn]="true">
Name
</th>
<th
nzWidth="150px"
nzWidth="100px"
nzLeft
[nzColumnKey]="sortColumns.Doid"
[nzSortFn]="true">
DOID
</th>
<th nzWidth="400px">Features</th>
<th nzWidth="200px">Aliases</th>
<th nzWidth="300px">Features</th>
<th
nzWidth="75px"
nzRight
Expand Down Expand Up @@ -131,6 +132,13 @@
filterChange$.next()
"></cvc-clearable-input-filter>
</th>
<th>
<cvc-clearable-input-filter
[(inputModel)]="diseaseAliasInput"
(inputModelChange)="
filterChange$.next()
"></cvc-clearable-input-filter>
</th>
<th>
<cvc-clearable-input-filter
[(inputModel)]="featureNameInput"
Expand Down Expand Up @@ -163,6 +171,12 @@

<ng-template #noDoid> -- </ng-template>
</td>
<td class="overflow-ellipsis">
<cvc-plain-tag-overflow
[maxDisplayCount]="1"
[tags]="disease.diseaseAliases"
[matchingText]="diseaseAliasInput"></cvc-plain-tag-overflow>
</td>
<td class="overflow-ellipsis">
<cvc-tag-overflow
tagType="feature"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
filter,
map,
skip,
take,
takeWhile,
withLatestFrom,
} from 'rxjs/operators'
Expand All @@ -41,6 +40,7 @@ export interface DiseasesTableUserFilters {
nameInput?: Maybe<string>
featureNameInput?: Maybe<string>
doidInput?: Maybe<string>
diseaseAliasInput?: Maybe<string>
}

@UntilDestroy()
Expand Down Expand Up @@ -85,10 +85,14 @@ export class CvcDiseasesTableComponent implements OnInit {
nameInput: Maybe<string>
featureNameInput: Maybe<string>
doidInput: Maybe<string>
diseaseAliasInput: Maybe<string>

sortColumns: typeof DiseasesSortColumns = DiseasesSortColumns

constructor(private gql: BrowseDiseasesGQL, private cdr: ChangeDetectorRef) {
constructor(
private gql: BrowseDiseasesGQL,
private cdr: ChangeDetectorRef
) {
this.noMoreRows$ = new BehaviorSubject<boolean>(false)
this.scrollEvent$ = new BehaviorSubject<ScrollEvent>('stop')
this.sortChange$ = new Subject<SortDirectionEvent>()
Expand Down Expand Up @@ -185,13 +189,17 @@ export class CvcDiseasesTableComponent implements OnInit {
name: this.nameInput,
featureName: this.featureNameInput,
doid: this.doidInput,
diseaseAlias: this.diseaseAliasInput,
})
.then(() => this.scrollIndex$.next(0))

this.cdr.detectChanges()
}

trackByIndex(_: number, data: Maybe<BrowseDiseaseRowFieldsFragment>): Maybe<number> {
trackByIndex(
_: number,
data: Maybe<BrowseDiseaseRowFieldsFragment>
): Maybe<number> {
return data?.id
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { NzToolTipModule } from 'ng-zorro-antd/tooltip'
import { NzTypographyModule } from 'ng-zorro-antd/typography'
import { CvcDiseaseTagModule } from '../cvc-disease-tag/cvc-disease-tag.module'
import { CvcDiseasesTableComponent } from './diseases-table.component'
import { CvcPlainTagOverflowModule } from '@app/components/shared/plain-tag-overflow/plain-tag-overflow.module'

@NgModule({
declarations: [CvcDiseasesTableComponent],
Expand Down Expand Up @@ -46,6 +47,7 @@ import { CvcDiseasesTableComponent } from './diseases-table.component'
CvcTableCountsModule,
CvcTableScrollModule,
CvcTagOverflowModule,
CvcPlainTagOverflowModule,
],
exports: [CvcDiseasesTableComponent],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ query BrowseDiseases(
$sortBy: DiseasesSort
$name: String
$doid: String
$diseaseAlias: String
$featureName: String
) {
browseDiseases(
Expand All @@ -16,6 +17,7 @@ query BrowseDiseases(
sortBy: $sortBy
name: $name
doid: $doid
diseaseAlias: $diseaseAlias
featureName: $featureName
) {
pageInfo {
Expand Down Expand Up @@ -53,4 +55,5 @@ fragment BrowseDiseaseRowFields on BrowseDisease {
featureCount
link
deprecated
diseaseAliases
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@
Name
</th>
<th
nzWidth="100%"
nzWidth="15%"
[nzColumnKey]="sortColumns.NcitId"
[nzSortFn]="true">
NCIt Code
</th>
<th nzWidth="85%">Aliases</th>
<th
nzWidth="75px"
nzRight
Expand Down Expand Up @@ -101,6 +102,13 @@
filterChange$.next()
"></cvc-clearable-input-filter>
</th>
<th>
<cvc-clearable-input-filter
[(inputModel)]="therapyAliasFilter"
(inputModelChange)="
filterChange$.next()
"></cvc-clearable-input-filter>
</th>
<th nzRight></th>
<th nzRight></th>
</tr>
Expand All @@ -123,6 +131,12 @@

<ng-template #noNcit>--</ng-template>
</td>
<td>
<cvc-plain-tag-overflow
[maxDisplayCount]="3"
[tags]="therapy.therapyAliases"
[matchingText]="therapyAliasFilter"></cvc-plain-tag-overflow>
</td>
<td
nzRight
nzAlign="right">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {
filter,
map,
skip,
take,
takeWhile,
withLatestFrom,
} from 'rxjs/operators'
Expand All @@ -42,6 +41,7 @@ import { pluck } from 'rxjs-etc/operators'
export interface TherapyTableUserFilters {
ncitIdFilter?: Maybe<string>
nameFilter?: Maybe<string>
therapyAliasFilter?: Maybe<string>
}

@UntilDestroy()
Expand Down Expand Up @@ -87,10 +87,14 @@ export class CvcTherapiesTableComponent implements OnInit {
// filters
ncitIdFilter: Maybe<string>
nameFilter: Maybe<string>
therapyAliasFilter: Maybe<string>

sortColumns = TherapySortColumns

constructor(private gql: TherapiesBrowseGQL, private cdr: ChangeDetectorRef) {
constructor(
private gql: TherapiesBrowseGQL,
private cdr: ChangeDetectorRef
) {
this.noMoreRows$ = new BehaviorSubject<boolean>(false)
this.scrollEvent$ = new BehaviorSubject<ScrollEvent>('stop')
this.sortChange$ = new Subject<SortDirectionEvent>()
Expand Down Expand Up @@ -186,13 +190,17 @@ export class CvcTherapiesTableComponent implements OnInit {
.refetch({
name: this.nameFilter,
ncitId: this.ncitIdFilter,
therapyAlias: this.therapyAliasFilter,
})
.then(() => this.scrollIndex$.next(0))

this.cdr.detectChanges()
}

trackByIndex(_: number, data: Maybe<TherapyBrowseTableRowFieldsFragment>): Maybe<number> {
trackByIndex(
_: number,
data: Maybe<TherapyBrowseTableRowFieldsFragment>
): Maybe<number> {
return data?.id
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CvcTableCountsModule } from '@app/components/shared/table-counts/table-
import { CvcNoMoreRowsModule } from '@app/components/shared/no-more-rows/no-more-rows.module'
import { CvcPipesModule } from '@app/core/pipes/pipes.module'
import { CvcTherapyTagModule } from '../cvc-therapy-tag/cvc-therapy-tag.module'
import { CvcPlainTagOverflowModule } from '@app/components/shared/plain-tag-overflow/plain-tag-overflow.module'

@NgModule({
declarations: [CvcTherapiesTableComponent],
Expand All @@ -44,6 +45,7 @@ import { CvcTherapyTagModule } from '../cvc-therapy-tag/cvc-therapy-tag.module'
CvcNoMoreRowsModule,
CvcTableCountsModule,
CvcTableScrollModule,
CvcPlainTagOverflowModule,
],
exports: [CvcTherapiesTableComponent],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ query TherapiesBrowse(
$after: String
$name: String
$ncitId: String
$therapyAlias: String,
$sortBy: TherapySort
) {
therapies(
Expand All @@ -14,6 +15,7 @@ query TherapiesBrowse(
after: $after
name: $name
ncitId: $ncitId
therapyAlias: $therapyAlias
sortBy: $sortBy
) {
totalCount
Expand Down Expand Up @@ -42,4 +44,5 @@ fragment TherapyBrowseTableRowFields on BrowseTherapy {
evidenceCount
link
deprecated
therapyAliases
}
6 changes: 4 additions & 2 deletions client/src/app/generated/civic.apollo-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,11 @@ export type BrowseClinicalTrialEdgeFieldPolicy = {
cursor?: FieldPolicy<any> | FieldReadFunction<any>,
node?: FieldPolicy<any> | FieldReadFunction<any>
};
export type BrowseDiseaseKeySpecifier = ('assertionCount' | 'deprecated' | 'diseaseUrl' | 'displayName' | 'doid' | 'evidenceItemCount' | 'featureCount' | 'features' | 'id' | 'link' | 'name' | 'variantCount' | BrowseDiseaseKeySpecifier)[];
export type BrowseDiseaseKeySpecifier = ('assertionCount' | 'deprecated' | 'diseaseAliases' | 'diseaseUrl' | 'displayName' | 'doid' | 'evidenceItemCount' | 'featureCount' | 'features' | 'id' | 'link' | 'name' | 'variantCount' | BrowseDiseaseKeySpecifier)[];
export type BrowseDiseaseFieldPolicy = {
assertionCount?: FieldPolicy<any> | FieldReadFunction<any>,
deprecated?: FieldPolicy<any> | FieldReadFunction<any>,
diseaseAliases?: FieldPolicy<any> | FieldReadFunction<any>,
diseaseUrl?: FieldPolicy<any> | FieldReadFunction<any>,
displayName?: FieldPolicy<any> | FieldReadFunction<any>,
doid?: FieldPolicy<any> | FieldReadFunction<any>,
Expand Down Expand Up @@ -348,7 +349,7 @@ export type BrowseSourceEdgeFieldPolicy = {
cursor?: FieldPolicy<any> | FieldReadFunction<any>,
node?: FieldPolicy<any> | FieldReadFunction<any>
};
export type BrowseTherapyKeySpecifier = ('assertionCount' | 'deprecated' | 'evidenceCount' | 'id' | 'link' | 'name' | 'ncitId' | 'therapyUrl' | BrowseTherapyKeySpecifier)[];
export type BrowseTherapyKeySpecifier = ('assertionCount' | 'deprecated' | 'evidenceCount' | 'id' | 'link' | 'name' | 'ncitId' | 'therapyAliases' | 'therapyUrl' | BrowseTherapyKeySpecifier)[];
export type BrowseTherapyFieldPolicy = {
assertionCount?: FieldPolicy<any> | FieldReadFunction<any>,
deprecated?: FieldPolicy<any> | FieldReadFunction<any>,
Expand All @@ -357,6 +358,7 @@ export type BrowseTherapyFieldPolicy = {
link?: FieldPolicy<any> | FieldReadFunction<any>,
name?: FieldPolicy<any> | FieldReadFunction<any>,
ncitId?: FieldPolicy<any> | FieldReadFunction<any>,
therapyAliases?: FieldPolicy<any> | FieldReadFunction<any>,
therapyUrl?: FieldPolicy<any> | FieldReadFunction<any>
};
export type BrowseTherapyConnectionKeySpecifier = ('edges' | 'filteredCount' | 'lastUpdated' | 'nodes' | 'pageCount' | 'pageInfo' | 'totalCount' | BrowseTherapyConnectionKeySpecifier)[];
Expand Down
Loading

0 comments on commit d87f723

Please sign in to comment.