Skip to content

Commit

Permalink
Merge pull request #59 from pluralsh/klink/app-allow-list
Browse files Browse the repository at this point in the history
feat: Add an allow-list for showing apps without recipes
  • Loading branch information
dogmar authored Sep 20, 2023
2 parents f2ccb5f + 8b4b818 commit 79b2ed0
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 33 deletions.
46 changes: 25 additions & 21 deletions pages/applications/[repo].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export default function App({
globalProps,
}: InferGetStaticPropsType<typeof getStaticProps>) {
const router = useRouter()
const tabs =
const recipeTabs =
recipes?.filter(isRecipe).map((recipe) => ({
key: recipe.name,
label:
Expand Down Expand Up @@ -211,9 +211,9 @@ export default function App({
</Body1>
<div className="flex flex-col gap-medium">
<Overline>Available providers</Overline>
{!isEmpty(tabs) && (
{!isEmpty(recipeTabs) ? (
<div className="flex gap-small">
{tabs.map((provider) => (
{recipeTabs.map((provider) => (
<ProviderIcon
key={provider.key}
label={provider.label}
Expand All @@ -222,6 +222,8 @@ export default function App({
/>
))}
</div>
) : (
<Body2>Coming soon</Body2>
)}
</div>
</TextLimiter>
Expand Down Expand Up @@ -268,25 +270,27 @@ export default function App({
</TextLimiter>
</EqualColumn>
<EqualColumn>
{tabs && tabs.length > 0 && (
<div className="flex flex-col gap-medium">
<Body2 className="columns:mt-[17px]">
Deploying {repo.displayName} is a matter of executing these
3 commands:
</Body2>
<Code tabs={tabs} />
<Code>plural build</Code>
<Code>
{`plural deploy --commit "deploying ${repo.name}"`}
</Code>
</div>
{!isEmpty(recipeTabs) && (
<>
<div className="flex flex-col gap-medium">
<Body2 className="columns:mt-[17px]">
Deploying {repo.displayName} is a matter of executing
these 3 commands:
</Body2>
<Code tabs={recipeTabs} />
<Code>plural build</Code>
<Code>
{`plural deploy --commit "deploying ${repo.name}"`}
</Code>
</div>{' '}
<Cta
className="mt-xlarge"
href={`https://docs.plural.sh/applications/${repo.name}`}
>
Read the install documentation
</Cta>
</>
)}
<Cta
className="mt-xlarge"
href={`https://docs.plural.sh/applications/${repo.name}`}
>
Read the install documentation
</Cta>
</EqualColumn>
</Columns>
{repo?.readme && (
Expand Down
6 changes: 4 additions & 2 deletions pages/solutions/[solution].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ export default function Solution({
>
<Checklist2>
{solution.bullet_points.map(
(bullet) =>
(bullet, i) =>
bullet?.content && (
<Checklist2Item>{bullet.content}</Checklist2Item>
<Checklist2Item key={i}>
{bullet.content}
</Checklist2Item>
)
)}
</Checklist2>
Expand Down
22 changes: 13 additions & 9 deletions src/components/RepoSocials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
GitHubIcon,
} from '@pluralsh/design-system'

import { isEmpty } from 'lodash-es'

import { type BasicRepo, type FullRepo } from '@src/data/getRepos'

export function RepoSocials({
Expand Down Expand Up @@ -55,15 +57,17 @@ export function RepoSocials({
License
</Button>
)}
<Button
as="a"
target="_blank"
href={`https://docs.plural.sh/applications/${repo.name}`}
tertiary
startIcon={<DocumentIcon />}
>
Installing {repo.displayName} docs
</Button>
{!isEmpty(repo.recipes) && (
<Button
as="a"
target="_blank"
href={`https://docs.plural.sh/applications/${repo.name}`}
tertiary
startIcon={<DocumentIcon />}
>
Installing {repo.displayName} docs
</Button>
)}
</>
)
}
11 changes: 10 additions & 1 deletion src/data/getRepos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
} from '../generated/graphqlPlural'

const REMOVE_LIST = ['bootstrap', 'test-harness', 'gcp-config-connector']
const ALLOW_LIST = ['kubeflow']

export type BasicRepo = ReturnType<
typeof normalizeRepo<Exclude<BasicRepoFragment, null | undefined>>
Expand Down Expand Up @@ -83,6 +84,10 @@ function inRemoveList(repoName?: string) {
return !!REMOVE_LIST.find((name) => name === repoName)
}

function inAllowList(repoName?: string) {
return !!ALLOW_LIST.find((name) => name === repoName)
}

export function normalizeRepo<
T extends SetOptional<FullRepoFragment, keyof Omit<FullRepoFragment, 'name'>>
>(repo: T) {
Expand Down Expand Up @@ -121,7 +126,11 @@ export function normalizeTinyRepo(repo: TinyRepoFragment) {
function filterRepo<
T extends { name?: string; recipes?: any[] | null } | null | undefined
>(repo: T): boolean {
return !!repo && !inRemoveList(repo?.name) && !isEmpty(repo?.recipes)
return (
!!repo &&
!inRemoveList(repo?.name) &&
(!isEmpty(repo?.recipes) || inAllowList(repo?.name))
)
}

function filterTinyRepo<
Expand Down

0 comments on commit 79b2ed0

Please sign in to comment.