Skip to content

Commit

Permalink
fixed sorted query, removed Sort By select
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcmichael committed Oct 18, 2024
1 parent 0dc12e8 commit ba9f0e0
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ export class CvcActivityFeed {
this.queryRef = this.gql.watch(event.query)
} else {
if (event.type === 'refetch') {
this.onAllRowsFetched$.next(false)
this.queryRef.refetch(event.query).then((data) => {
this.onQueryComplete$.next(true)
if (this.scrollAdapter) this.scrollAdapter.reload()
Expand Down Expand Up @@ -309,16 +310,6 @@ export class CvcActivityFeed {
{ initialValue: feedFilterOptionDefaults }
)

this.allRowsFetched = toSignal(
this.onAllRowsFetched$.pipe(tag('onAllRowsFetched$')),
// connection$.pipe(
// map((connection) => {
// return connection.pageInfo.hasNextPage
// })
// ),
{ initialValue: false }
)

this.edge$ = this.result$.pipe(
pluck('data', 'activities'),
filter(isNonNulled),
Expand All @@ -337,8 +328,7 @@ export class CvcActivityFeed {

this.zeroRows = toSignal(
this.result$.pipe(
map((result) => result.data?.activities?.edges.length === 0),
shareReplay(1)
map((result) => result.data?.activities?.edges.length === 0)
),
{ initialValue: false }
)
Expand All @@ -360,6 +350,7 @@ export class CvcActivityFeed {
hasNextPage === false &&
edges.length <= edgesRequired
) {
this.onAllRowsFetched$.next(true)
return of(edges)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ query ActivityFeed(
$requestDetails: Boolean!
$occurredAfter: ISO8601DateTime
$occurredBefore: ISO8601DateTime
$sortBy: DateSort
) {
activities(
subject: $subject
Expand All @@ -31,6 +32,7 @@ query ActivityFeed(
mode: $mode
occurredAfter: $occurredAfter
occurredBefore: $occurredBefore
sortBy: $sortBy
) {
...ActivitiesConnectionFields @include(if: $includeConnection)
...ActivitiesPageInfoFields @include(if: $includePageInfo)
Expand Down Expand Up @@ -68,9 +70,6 @@ fragment ActivitiesConnectionFields on ActivityInterfaceConnection {
...ActivityFeedItem
}
}
# nodes {
# ...ActivityFeedItem
# }
}

# activity summary info to render each feed item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
</button>
</ng-template>
</nz-col>
<nz-col nzSpan="24"> </nz-col>
<nz-col nzSpan="24">
<ng-container
*ngTemplateOutlet="
Expand Down Expand Up @@ -224,25 +223,7 @@ <h4>Occurred Before</h4>
nzPlaceHolder="Select Date">
</nz-date-picker>
</nz-col>
<nz-col
nzMd="24"
nzLg="12">
<h4>Sort By</h4>
<nz-select
nzPlaceHolder="Select Sort By"
[ngModel]="sortByColumn()"
(ngModelChange)="sortByColumn.set($event)"
[nzOptionHeightPx]="28">
<nz-option
*ngFor="let sort of cvcFilterOptions().sortColumns"
[nzLabel]="sort | enumToTitle"
[nzValue]="sort">
</nz-option>
</nz-select>
</nz-col>
<nz-col
nzMd="24"
nzLg="12">
<nz-col nzSpan="24">
<h4>Sort Direction</h4>
<nz-select
nzPlaceHolder="Select Direction"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
<!-- User Tag -->
<div class="description">
@if (scope().mode !== 'USER') {
<cvc-user-tag [user]="activity.user"></cvc-user-tag>
<cvc-user-tag
[user]="activity.user"
[enablePopover]="!$scroller().isScrolling"></cvc-user-tag>
}
<!-- For CommentActivity, replace verbiage with 'added [comment]' -->
@if (activity.__typename === 'CommentActivity') {
Expand Down
4 changes: 3 additions & 1 deletion client/src/app/generated/civic.apollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7587,6 +7587,7 @@ export type ActivityFeedQueryVariables = Exact<{
requestDetails: Scalars['Boolean']['input'];
occurredAfter?: InputMaybe<Scalars['ISO8601DateTime']['input']>;
occurredBefore?: InputMaybe<Scalars['ISO8601DateTime']['input']>;
sortBy?: InputMaybe<DateSort>;
}>;


Expand Down Expand Up @@ -13444,7 +13445,7 @@ export const VariantSummaryFieldsFragmentDoc = gql`
${FactorVariantSummaryFieldsFragmentDoc}
${FusionVariantSummaryFieldsFragmentDoc}`;
export const ActivityFeedDocument = gql`
query ActivityFeed($subject: [SubscribableQueryInput!], $first: Int, $last: Int, $before: String, $after: String, $organizationId: [Int!], $userId: [Int!], $activityType: [ActivityTypeInput!], $subjectType: [ActivitySubjectInput!], $includeAutomatedEvents: Boolean, $includeConnection: Boolean = true, $includePageInfo: Boolean = true, $mode: EventFeedMode, $showFilters: Boolean!, $requestDetails: Boolean!, $occurredAfter: ISO8601DateTime, $occurredBefore: ISO8601DateTime) {
query ActivityFeed($subject: [SubscribableQueryInput!], $first: Int, $last: Int, $before: String, $after: String, $organizationId: [Int!], $userId: [Int!], $activityType: [ActivityTypeInput!], $subjectType: [ActivitySubjectInput!], $includeAutomatedEvents: Boolean, $includeConnection: Boolean = true, $includePageInfo: Boolean = true, $mode: EventFeedMode, $showFilters: Boolean!, $requestDetails: Boolean!, $occurredAfter: ISO8601DateTime, $occurredBefore: ISO8601DateTime, $sortBy: DateSort) {
activities(
subject: $subject
first: $first
Expand All @@ -13459,6 +13460,7 @@ export const ActivityFeedDocument = gql`
mode: $mode
occurredAfter: $occurredAfter
occurredBefore: $occurredBefore
sortBy: $sortBy
) {
...ActivitiesConnectionFields @include(if: $includeConnection)
...ActivitiesPageInfoFields @include(if: $includePageInfo)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
<cvc-activity-feed [cvcCheckInterval]="30"></cvc-activity-feed>
<!-- <cvc-event-feed
[showFilters]="true"
[mode]="feedMode"
[pageSize]="17"
[includeAutomatedEvents]="false"></cvc-event-feed> -->
<cvc-activity-feed [cvcCheckInterval]="5"></cvc-activity-feed>

0 comments on commit ba9f0e0

Please sign in to comment.