Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
acoffman committed Jul 25, 2024
2 parents 31e8e08 + 8509b02 commit 16f3ecc
Show file tree
Hide file tree
Showing 51 changed files with 2,503 additions and 836 deletions.
1 change: 1 addition & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
iif
mane
checkin
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,18 @@
<ng-container *ngSwitchCase="1">
<div class="tab-padding">
<nz-row [nzGutter]="8">
<nz-col [nzSpan]="12">
<nz-descriptions nzSize="small" [nzBordered]="true" [nzColumn]="2">
<nz-col [nzSpan]="24">
<nz-descriptions nzSize="small" [nzBordered]="true" [nzColumn]="1">
<nz-descriptions-item nzTitle="Definition">
<ng-container *ngIf="diseaseInfo.mondoDef; else noValue">
{{diseaseInfo.mondoDef}}
</ng-container>
</nz-descriptions-item>
<nz-descriptions-item nzTitle="ID">
<ng-container *ngIf="diseaseInfo.mondoId; else noValue">
{{diseaseInfo.mondoId}}
</ng-container>
</nz-descriptions-item>
</nz-descriptions>
</nz-col>
</nz-row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
nzPlaceHolder="Search CIViC"
[nzOptionHeightPx]="28"
[nzShowArrow]="false"
[nzDropdownRender]="searchEntities"
[nzDropdownMatchSelectWidth]="false">
<nz-option
*ngFor="let o of (option$ | ngrxPush)"
nzCustomContent
[nzValue]="o.result">
<i
nz-icon
style="margin-right: 0.5em;"
style="margin-right: 0.5em"
nzTheme="twotone"
[nzTwotoneColor]="converter(o.result.resultType) | entityColor"
[nzType]="o.result.resultType | iconNameForSubscribableEntity"></i>
Expand All @@ -39,3 +40,26 @@
Loading Data...
</nz-option>
</nz-select>

<ng-template #searchEntities>
<hr />
<nz-checkbox-wrapper (nzOnChange)="selectedEntitiesChanged($event)">
<div class="entity-select">
@for(entity of searchableEntities; track entity) {
<label
nz-checkbox
[nzValue]="entity"
nz-tooltip
[nzTooltipTitle]="entity"
[ngModel]="isSelected(entity)">
<i
nz-icon
nzTheme="twotone"
nzTool
[nzTwotoneColor]="entity | entityColor"
[nzType]="entity | iconNameForSubscribableEntity"></i>
</label>
}
</div>
</nz-checkbox-wrapper>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@
nz-select {
width: 100%;
}

hr {
border-color: #6666
}

.entity-select {
margin-right: 10px;
margin-left: 10px;

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export class CvcQuicksearchComponent {
@ViewChild(NzSelectComponent, { static: true })
selectNode!: NzSelectComponent

selectedEntities: SearchableEntities[] = Object.values(SearchableEntities)
searchableEntities = Object.keys(SearchableEntities)
currentSearchTerm?: string

// SOURCE STREAMS
onSearch$: Subject<string>
onSelect$: Subject<void>
Expand All @@ -62,25 +66,29 @@ export class CvcQuicksearchComponent {
option$: Observable<QuicksearchOption[]>
isLoading$: Observable<boolean>


converter = entityTypeToTypename

constructor(private gql: QuicksearchGQL, private router: Router) {
constructor(
private gql: QuicksearchGQL,
private router: Router
) {
this.onSearch$ = new Subject<string>()
this.onSelect$ = new Subject<void>()

this.response$ = this.onSearch$.pipe(
skip(1), // drop initial empty string from input init
throttleTime(300, asyncScheduler, { leading: false, trailing: true }),
switchMap((str: string) => {
this.currentSearchTerm = str
let selectedEntities = this.selectedEntities
// if queryRef doesn't exist, create it with watchQuery observable
// if it does, refetch with fetchQuery observable.
// using defer() ensures functions are not called until
// values are emitted. otherwise they'll be called on subscribe.
return iif(
() => this.queryRef === undefined, // predicate
defer(() => watchQuery(str)), // true
defer(() => fetchQuery(str))
defer(() => watchQuery(str, selectedEntities)), // true
defer(() => fetchQuery(str, selectedEntities))
) // false
})
)
Expand Down Expand Up @@ -114,14 +122,19 @@ export class CvcQuicksearchComponent {
})

// set queryRef with watch(), return its valueChanges observable
const watchQuery = (str: string) => {
this.queryRef = this.gql.watch({ query: str, highlightMatches: true })
const watchQuery = (str: string, entities: Maybe<SearchableEntities[]>) => {
this.queryRef = this.gql.watch({
query: str,
highlightMatches: true,
types: entities,
})
return this.queryRef.valueChanges
}

// return observable from refetch() promise
const fetchQuery = (str: string) =>
from(this.queryRef.refetch({ query: str }))
const fetchQuery = (str: string, entities: Maybe<SearchableEntities[]>) => {
return from(this.queryRef.refetch({ query: str, types: entities }))
}
}

urlForResult(res: SearchResult): string {
Expand All @@ -136,10 +149,28 @@ export class CvcQuicksearchComponent {
case SearchableEntities.MolecularProfile:
name = 'molecular-profiles'
break
case SearchableEntities.Therapy:
name = 'therapies'
break
default:
name = `${res.resultType.toLowerCase()}s`
}

return `/${name}/${res.id}/summary`
}

selectedEntitiesChanged(selectedEntities: string[]) {
this.selectedEntities = selectedEntities.map(
(x) => SearchableEntities[x as keyof typeof SearchableEntities]
)

if (this.currentSearchTerm) {
this.onSearch$.next(this.currentSearchTerm)
}
}

isSelected(entity: string): boolean {
const x = SearchableEntities[entity as keyof typeof SearchableEntities]
return this.selectedEntities.includes(x)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { FormsModule } from '@angular/forms'
import { NzSelectModule } from 'ng-zorro-antd/select'
import { NzTypographyModule } from 'ng-zorro-antd/typography'
import { CvcPipesModule } from '@app/core/pipes/pipes.module'
import { NzCheckboxModule } from 'ng-zorro-antd/checkbox'
import { NzToolTipModule } from 'ng-zorro-antd/tooltip'

@NgModule({
declarations: [CvcQuicksearchComponent],
Expand All @@ -27,6 +29,8 @@ import { CvcPipesModule } from '@app/core/pipes/pipes.module'
NzFormModule,
NzIconModule,
NzAutocompleteModule,
NzCheckboxModule,
NzToolTipModule,
],
exports: [CvcQuicksearchComponent],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,26 @@
[nzSortFn]="true">
Organization
</th>
<th nzWidth="100px">Members</th>
<th
nzWidth="100px"
[nzColumnKey]="sortColumns.MemberCount"
[nzSortFn]="true">
Members
</th>
<th nzWidth="320px">Sub Organizations</th>
<th
nzWidth="80px"
nzRight
[nzColumnKey]="sortColumns.ActivityCount"
[nzSortFn]="true"
nzAlign="right">
Actions
</th>
<th
nzWidth="125px"
nzRight
[nzColumnKey]="sortColumns.MostRecentActivityTimestamp"
[nzSortFn]="true"
nzAlign="right">
Last Action
</th>
Expand Down Expand Up @@ -97,13 +106,13 @@
<cvc-tag-overflow
[maxDisplayCount]="1"
tagType="organization"
[tags]="organization.subGroups">
[tags]="organization.childOrganizations">
</cvc-tag-overflow>
</td>
<td
nzRight
nzAlign="right">
{{ organization.eventCount | number }}
{{ organization.activityCount | number }}
</td>
<td
nzRight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ScrollEvent } from '@app/directives/table-scroll/table-scroll.directive
import {
Maybe,
OrganizationBrowseTableRowFieldsFragment,
OrganizationConnection,
BrowseOrganizationConnection,
OrganizationsBrowseGQL,
OrganizationsBrowseQuery,
OrganizationsBrowseQueryVariables,
Expand Down Expand Up @@ -70,7 +70,7 @@ export class CvcOrganizationsTableComponent implements OnInit {
OrganizationsBrowseQueryVariables
>
result$!: Observable<ApolloQueryResult<OrganizationsBrowseQuery>>
connection$!: Observable<OrganizationConnection>
connection$!: Observable<BrowseOrganizationConnection>

// PRESENTATION STREAMS
pageInfo$!: Observable<PageInfo>
Expand Down Expand Up @@ -126,7 +126,7 @@ export class CvcOrganizationsTableComponent implements OnInit {
this.connection$ = this.result$.pipe(
pluck('data', 'organizations'),
filter(isNonNulled)
) as Observable<OrganizationConnection>
) as Observable<BrowseOrganizationConnection>

// entity row nodes
this.row$ = this.connection$.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ query OrganizationsBrowse(
}
}

fragment OrganizationBrowseTableRowFields on Organization {
fragment OrganizationBrowseTableRowFields on BrowseOrganization {
id
name
description
# profileImagePath(size: 256) @include(if: $cardView)
url
memberCount
eventCount
subGroups {
name
activityCount
mostRecentActivityTimestamp
childOrganizations {
id
name
}
mostRecentActivityTimestamp
# profileImagePath(size: 256) @include(if: $cardView)
# orgStatsHash @include(if: $cardView) {
# comments
# revisions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
nzRight
nzAlign="right"
nz-tooltip
[nzColumnKey]="sortColumns.EvidenceCount"
[nzSortFn]="true"
nzTooltipTitle="Evidence Count">
<i
nz-icon
Expand All @@ -86,6 +88,8 @@
nzRight
nzAlign="right"
nz-tooltip
[nzColumnKey]="sortColumns.RevisionCount"
[nzSortFn]="true"
nzTooltipTitle="Revision Count">
<i
nz-icon
Expand Down Expand Up @@ -184,12 +188,12 @@
<td
nzRight
nzAlign="right">
{{ user.statsHash.submittedEvidenceItems }}
{{ user.evidenceCount }}
</td>
<td
nzRight
nzAlign="right">
{{ user.statsHash.revisions }}
{{ user.revisionCount }}
</td>
</tr>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
PageInfo,
SortDirection,
UserBrowseTableRowFieldsFragment,
UserConnection,
BrowseUserConnection,
UserRole,
UsersBrowseGQL,
UsersBrowseQuery,
Expand Down Expand Up @@ -71,7 +71,7 @@ export class CvcUsersTableComponent implements OnInit {
// INTERMEDIATE STREAMS
queryRef!: QueryRef<UsersBrowseQuery, UsersBrowseQueryVariables>
result$!: Observable<ApolloQueryResult<UsersBrowseQuery>>
connection$!: Observable<UserConnection>
connection$!: Observable<BrowseUserConnection>

// PRESENTATION STREAMS
pageInfo$!: Observable<PageInfo>
Expand Down Expand Up @@ -130,7 +130,7 @@ export class CvcUsersTableComponent implements OnInit {
this.connection$ = this.result$.pipe(
pluck('data', 'users'),
filter(isNonNulled)
) as Observable<UserConnection>
) as Observable<BrowseUserConnection>

// entity row nodes
this.row$ = this.connection$.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,18 @@ query UsersBrowse(
}
}

fragment UserBrowseTableRowFields on User {
fragment UserBrowseTableRowFields on BrowseUser {
id
name
displayName
username
organizations {
id
name
}
role
statsHash {
submittedEvidenceItems
revisions
}
evidenceCount
revisionCount
profileImagePath(size: 64)
mostRecentActivityTimestamp
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ export class IconNameForSubscribableEntity implements PipeTransform {
case SubscribableEntities.VariantGroup:
case 'VARIANT_GROUP':
case 'VariantGroup':
return 'civic-variant-group'
return 'civic-variantgroup'
case SubscribableEntities.MolecularProfile:
case 'MOLECULAR_PROFILE':
case 'MolecularProfile':
return 'civic-molecularprofile'
case 'THERAPY':
case 'Therapy':
return 'civic-therapy'
case 'DISEASE':
case 'Disease':
return 'civic-disease'
default:
console.log('String No icon name found for ' + e)
return 'border-outer'
Expand Down
Loading

0 comments on commit 16f3ecc

Please sign in to comment.