Skip to content

refactor(site): add default owner:me filter to workspaces #7738

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 4 commits into from
Jun 1, 2023
Merged
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
5 changes: 4 additions & 1 deletion site/src/pages/WorkspacesPage/WorkspacesPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ export const WorkspacesPageView: FC<
</Stack>
<WorkspacesTable
workspaces={workspaces}
isUsingFilter={filterProps.filter.query !== ""}
isUsingFilter={
filterProps.filter.query !== "" &&
filterProps.filter.query !== workspaceFilterQuery.me
}
onUpdateWorkspace={onUpdateWorkspace}
error={error}
/>
Expand Down
3 changes: 2 additions & 1 deletion site/src/pages/WorkspacesPage/filter/filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
BaseOption,
} from "./options"
import debounce from "just-debounce-it"
import { workspaceFilterQuery } from "utils/filters"

export type FilterValues = {
owner?: string // User["username"]
Expand All @@ -50,7 +51,7 @@ export const useFilter = ({
onUpdate?: () => void
}) => {
const [searchParams, setSearchParams] = searchParamsResult
const query = searchParams.get("filter") ?? ""
const query = searchParams.get("filter") ?? workspaceFilterQuery.me
const values = parseFilterQuery(query)

const update = (values: string | FilterValues) => {
Expand Down