Skip to content

fix all blogs query #2969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 1 addition & 75 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ module.exports = {
query: `
{
allMarkdownRemark(filter: {fields: {sourceInstanceName: {eq: "blog"}
}, frontmatter: {disable:{ne: true},featuredBlog: {ne: true}}},
}, frontmatter: {disable:{ne: true}}},
sort: {frontmatter: {date: DESC}}) {
nodes {
id
Expand Down Expand Up @@ -377,80 +377,6 @@ module.exports = {
})),
},
},
{
resolve: 'gatsby-plugin-paginated-collection',
options: {
name: 'others-posts',
pageSize: 12,
query: `
{
allMarkdownRemark(filter: {fields: {sourceInstanceName: {eq: "blog"}
}, frontmatter: {disable:{ne: true},tags: {nin: [
"opensource",
"hpe-ezmeral-container-platform",
"spiffe-and-spire-projects",
"hpe-ezmeral-data-fabric",
"hpe-greenlake",
"chapel",
"grommet",
"hpe-alletra",
"kubedirector"
"deep-learning-cookbook",
"hpe-3par-and-primera",
"hpe-nimble-storage",
"hpe-oneview",
"hpe-oneview-global-dashboard",
"ilo",
"ilorest",
"iLOrest",
"ilo-restful-api",
"Redfish",
"hpe-ezmeral",
"determined-ai",
"cray",
"swarm-learning",
"dragonhpc",
"hpe-nonstop",
"hpe-opsramp",
"morpheus"
]}}}, sort: {frontmatter: {date: DESC}}) {
nodes {
id
fields {
slug
sourceInstanceName
}
frontmatter {
title
date
description
author
tags
authorimage
externalLink
}
excerpt
}
}
}
`,
normalizer: ({ data }) =>
data.allMarkdownRemark.nodes.map((node) => ({
id: node.id,
title: node.frontmatter.title,
date: node.frontmatter.date,
description: node.excerpt,
author: node.frontmatter.author,
tags: node.frontmatter.tags,
authorimage: node.frontmatter.authorimage,
externalLink: node.frontmatter.externalLink,
fields: {
slug: node.fields.slug,
sourceInstanceName: node.fields.sourceInstanceName,
},
})),
},
},
paginatedCollection('opensource-blog-posts', 'opensource'),
paginatedCollection('ezmeral-blog-posts', 'hpe-ezmeral'),
paginatedCollection('spiffe-blog-posts', 'spiffe-and-spire-projects'),
Expand Down
6 changes: 0 additions & 6 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,6 @@ exports.createPages = async ({ graphql, actions }) => {
// paginatedCollectionQuery('morpheus'),
// );

const othersQueryResult = await graphql(
paginatedCollectionQuery('others-posts'),
);

setPagination(allQueryResult);
setPagination(openSourceQueryResult);
setPagination(ezmeralRuntimeQueryResult);
Expand Down Expand Up @@ -259,8 +255,6 @@ exports.createPages = async ({ graphql, actions }) => {
setPagination(hpeNonStopQueryResult);
// setPagination(hpeOpsrampQueryResult);
// setPagination(hpeMorpheusQueryResult);
setPagination(othersQueryResult);

return graphql(`
{
allMarkdownRemark(
Expand Down
17 changes: 1 addition & 16 deletions src/components/BlogTabs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ function BlogTabs({ data, columns }) {
const totalAllBlogsCount = data.allBlogsCount.totalCount;
const totalOpenSourceBlogsCount = data.openSourceBlogsCount.totalCount;
const totalGreenLakeBlogsCount = data.greenlakeBlogsCount.totalCount;
const totalOthersBlogsCount = data.othersBlogsCount.totalCount;

useEffect(() => {
// loads persisted platform data when the user goes back to the blog page
Expand Down Expand Up @@ -199,16 +198,14 @@ function BlogTabs({ data, columns }) {
});

const previousTabContent = (previousTabIndex) => {
const { allBlogs, openSourceBlogs, greenlakeBlogs, othersBlogs } = data;
const { allBlogs, openSourceBlogs, greenlakeBlogs } = data;
switch (previousTabIndex) {
case 0:
return allBlogs;
case 1:
return greenlakeBlogs;
case 2:
return openSourceBlogs;
case 3:
return othersBlogs;
default:
return allBlogs;
}
Expand Down Expand Up @@ -340,16 +337,6 @@ function BlogTabs({ data, columns }) {
setPreviousTab={setPreviousTab}
/>
</Tab> */}
<Tab title={`Others (${totalOthersBlogsCount})`}>
<BlogTabContent
key={index}
initialPage={data.othersBlogs}
columns={columns}
activeTab={index}
setPlatform={setPlatform}
setPreviousTab={setPreviousTab}
/>
</Tab>
</Tabs>
);
}
Expand Down Expand Up @@ -403,7 +390,6 @@ BlogTabs.propTypes = {
allBlogs: blogsPropType,
openSourceBlogs: blogsPropType,
greenlakeBlogs: blogsPropType,
othersBlogs: blogsPropType,
allBlogsCount: PropTypes.objectOf(PropTypes.number),
openSourceBlogsCount: PropTypes.objectOf(PropTypes.number),
ezmeralBlogsCount: PropTypes.objectOf(PropTypes.number),
Expand All @@ -429,7 +415,6 @@ BlogTabs.propTypes = {
hpeNonstopBlogsCount: PropTypes.objectOf(PropTypes.number),
hpeOpsRampBlogsCount: PropTypes.objectOf(PropTypes.number),
hpeMorpheusBlogsCount: PropTypes.objectOf(PropTypes.number),
othersBlogsCount: PropTypes.objectOf(PropTypes.number),
}).isRequired,
columns: PropTypes.shape({
small: PropTypes.string,
Expand Down
48 changes: 1 addition & 47 deletions src/pages/blog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export const pageQuery = graphql`
allBlogsCount: allMarkdownRemark(
filter: {
fields: { sourceInstanceName: { eq: "blog" } }
frontmatter: { featuredBlog: { ne: true }, disable: { ne: true } }
frontmatter: { disable: { ne: true } }
}
sort: { frontmatter: { date: DESC } }
) {
Expand Down Expand Up @@ -789,51 +789,5 @@ export const pageQuery = graphql`
id
}
}
othersBlogs: paginatedCollectionPage(
collection: { name: { eq: "others-posts" } }
index: { eq: 0 }
) {
nodes
hasNextPage
nextPage {
id
}
collection {
id
}
}
othersBlogsCount: allMarkdownRemark(
filter: {
fields: { sourceInstanceName: { eq: "blog" } }
frontmatter: {
disable: { ne: true }
tags: {
nin: [
"opensource"
"hpe-ezmeral-container-platform"
"hpe-ezmeral"
"spiffe-and-spire-projects"
"hpe-ezmeral-data-fabric"
"hpe-greenlake"
"chapel"
"grommet"
"hpe-alletra"
"deep-learning-cookbook"
"hpe-3par-and-primera"
"hpe-nimble-storage"
"hpe-oneview"
"hpe-oneview-global-dashboard"
"ilo"
"data-services-cloud-console"
"determined-ai"
"cray"
]
}
}
}
sort: { frontmatter: { date: DESC } }
) {
totalCount
}
}
`;