Skip to content

feat: filter templates by organization #14254

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

Merged
merged 9 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feedback
  • Loading branch information
aslilac committed Aug 14, 2024
commit 5f0883549517dccd9a95628e1e94eaca778a37af
34 changes: 19 additions & 15 deletions site/src/components/Filter/filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ type FilterProps = {
filter: ReturnType<typeof useFilter>;
skeleton: ReactNode;
isLoading: boolean;
learnMoreLink: string;
learnMoreLink?: string;
learnMoreLabel2?: string;
learnMoreLink2?: string;
error?: unknown;
Expand Down Expand Up @@ -240,7 +240,7 @@ export const Filter: FC<FilterProps> = ({

interface PresetMenuProps {
presets: PresetFilter[];
learnMoreLink: string;
learnMoreLink?: string;
learnMoreLabel2?: string;
learnMoreLink2?: string;
onSelect: (query: string) => void;
Expand Down Expand Up @@ -293,19 +293,23 @@ const PresetMenu: FC<PresetMenuProps> = ({
{presetFilter.name}
</MenuItem>
))}
<Divider css={{ borderColor: theme.palette.divider }} />
<MenuItem
component="a"
href={learnMoreLink}
target="_blank"
css={{ fontSize: 13, fontWeight: 500 }}
onClick={() => {
setIsOpen(false);
}}
>
<OpenInNewOutlined css={{ fontSize: "14px !important" }} />
View advanced filtering
</MenuItem>
{learnMoreLink && (
<>
<Divider css={{ borderColor: theme.palette.divider }} />
<MenuItem
component="a"
href={learnMoreLink}
target="_blank"
css={{ fontSize: 13, fontWeight: 500 }}
onClick={() => {
setIsOpen(false);
}}
>
<OpenInNewOutlined css={{ fontSize: "14px !important" }} />
View advanced filtering
</MenuItem>
</>
)}
{learnMoreLink2 && learnMoreLabel2 && (
<MenuItem
component="a"
Expand Down
3 changes: 2 additions & 1 deletion site/src/pages/TemplatesPage/TemplatesFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
type SelectFilterOption,
} from "components/Filter/SelectFilter";
import { UserAvatar } from "components/UserAvatar/UserAvatar";
import { docs } from "utils/docs";

Check failure on line 16 in site/src/pages/TemplatesPage/TemplatesFilter.tsx

View workflow job for this annotation

GitHub Actions / fmt

'docs' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 16 in site/src/pages/TemplatesPage/TemplatesFilter.tsx

View workflow job for this annotation

GitHub Actions / lint

'docs' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 16 in site/src/pages/TemplatesPage/TemplatesFilter.tsx

View workflow job for this annotation

GitHub Actions / lint

'docs' is defined but never used. Allowed unused vars must match /^_/u

interface TemplatesFilterProps {
filter: ReturnType<typeof useFilter>;
Expand Down Expand Up @@ -45,7 +45,8 @@
{ query: "", name: "All templates" },
{ query: "deprecated:true", name: "Deprecated templates" },
]}
learnMoreLink={docs("/templates#template-filtering")}
// TODO: Add docs for this
// learnMoreLink={docs("/templates#template-filtering")}
isLoading={false}
filter={filter}
options={
Expand Down
8 changes: 3 additions & 5 deletions site/src/pages/TemplatesPage/TemplatesPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,9 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = ({
<TemplateHelpTooltip />
</Stack>
</PageHeaderTitle>
{templates && templates.length > 0 && (
<PageHeaderSubtitle>
Select a template to create a workspace.
</PageHeaderSubtitle>
)}
<PageHeaderSubtitle>
Select a template to create a workspace.
</PageHeaderSubtitle>
</PageHeader>

<TemplatesFilter filter={filter} />
Expand Down
Loading