-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #930 from Sitecore/changelog/action-required-filter
Add additional filter to changelog list
- Loading branch information
Showing
20 changed files
with
230 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
data/gql/custom/getCustomEntryByTitleProductAndChangeTypeQuery.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import { SearchByProductsAndChangeTypesQuery, SearchByProductsAndChangeTypesQueryVariables, TypedDocumentString } from '../generated/graphql'; | ||
|
||
export function getCustomEntryByTitleProductAndChangeTypeQuery(entryTitle: string): TypedDocumentString<SearchByProductsAndChangeTypesQuery, SearchByProductsAndChangeTypesQueryVariables> { | ||
let whereClauseSearchTerm = ''; | ||
|
||
const searchArray = entryTitle.split('-'); | ||
|
||
if (searchArray.length > 0) { | ||
whereClauseSearchTerm += `AND: [`; | ||
searchArray.forEach((term: string) => { | ||
whereClauseSearchTerm += `{title_contains: "${term}"}`; | ||
}); | ||
whereClauseSearchTerm += `]`; | ||
} | ||
|
||
const query = new TypedDocumentString(` | ||
query searchByProductsAndChangeTypes($date: DateTime!, $productIds: [ID], $changeTypeIds: [ID], $first: Int = 5, $after: String = "") { | ||
changelog: allChangelog( | ||
orderBy: RELEASEDATE_DESC, | ||
first: $first, | ||
after: $after, | ||
where: { | ||
releaseDate_lt: $date, | ||
OR: [ | ||
{ sitecoreProduct: { | ||
changelog_ids: $productIds | ||
} | ||
} | ||
], | ||
AND: | ||
{ | ||
OR: [{ changeType: { changelog_ids: $changeTypeIds } }] | ||
${whereClauseSearchTerm} | ||
}, | ||
} | ||
) { | ||
pageInfo { | ||
hasNext | ||
endCursor | ||
} | ||
total | ||
results { | ||
...changelogEntry | ||
} | ||
} | ||
} | ||
fragment changeType on Changetype { | ||
id | ||
name | ||
changeType | ||
} | ||
fragment changelogEntry on Changelog { | ||
id | ||
name | ||
title | ||
description | ||
fullArticle | ||
readMoreLink | ||
breakingChange | ||
version | ||
releaseDate | ||
scheduled | ||
image { | ||
total | ||
results { | ||
...media | ||
} | ||
} | ||
sitecoreProduct { | ||
total | ||
results { | ||
...product | ||
} | ||
} | ||
changeType { | ||
total | ||
results { | ||
...changeType | ||
} | ||
} | ||
status { | ||
total | ||
results { | ||
...status | ||
} | ||
} | ||
} | ||
fragment media on Media { | ||
id | ||
name | ||
fileName | ||
fileUrl | ||
description | ||
fileWidth | ||
fileHeight | ||
fileId | ||
fileSize | ||
fileType | ||
} | ||
fragment product on SitecoreProduct { | ||
id | ||
name | ||
productName | ||
productDescription | ||
darkIcon: productIconDark | ||
lightIcon: productIconLight | ||
} | ||
fragment status on Status { | ||
id | ||
name | ||
description | ||
identifier | ||
}`) as unknown as TypedDocumentString<SearchByProductsAndChangeTypesQuery, SearchByProductsAndChangeTypesQueryVariables>; | ||
|
||
return query; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import { Box } from '@chakra-ui/react'; | ||
import { Box, BoxProps } from '@chakra-ui/react'; | ||
import { ChangelogEntry } from '@lib/changelog/types'; | ||
|
||
import ChangeLogItem from './ChangeLogItem'; | ||
|
||
type ChangelogResultsListProps = { | ||
type ChangelogResultsListProps = BoxProps & { | ||
entries?: Array<ChangelogEntry>; | ||
isLoading: boolean; | ||
hasNext?: boolean; | ||
onEndTriggered: () => void; | ||
}; | ||
|
||
const ChangelogResultsList = ({ entries, isLoading, hasNext, onEndTriggered }: ChangelogResultsListProps): JSX.Element => { | ||
return <Box>{entries && entries.map((item, i) => <ChangeLogItem item={item} key={i} loading={isLoading} isLast={i === entries.length - 1} isMore={hasNext} loadEntries={() => onEndTriggered()} />)}</Box>; | ||
const ChangelogResultsList = ({ entries, isLoading, hasNext, onEndTriggered, ...rest }: ChangelogResultsListProps): JSX.Element => { | ||
return <Box {...rest}>{entries && entries.map((item, i) => <ChangeLogItem item={item} key={i} loading={isLoading} isLast={i === entries.length - 1} isMore={hasNext} loadEntries={() => onEndTriggered()} />)}</Box>; | ||
}; | ||
|
||
export default ChangelogResultsList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.