Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: match templates search error with workspace search error#14479

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 4 commits intomainfromstevenmasley/template_search
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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
7 changes: 6 additions & 1 deletionsite/src/pages/TemplatesPage/TemplatesFilter.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,9 +16,13 @@ import type { FC } from "react";

interface TemplatesFilterProps {
filter: ReturnType<typeof useFilter>;
error?: unknown;
}

export const TemplatesFilter: FC<TemplatesFilterProps> = ({ filter }) => {
export const TemplatesFilter: FC<TemplatesFilterProps> = ({
filter,
error,
}) => {
const organizationMenu = useFilterMenu({
onChange: (option) =>
filter.update({ ...filter.values, organization: option?.value }),
Expand DownExpand Up@@ -48,6 +52,7 @@ export const TemplatesFilter: FC<TemplatesFilterProps> = ({ filter }) => {
// learnMoreLink={docs("/templates#template-filtering")}
isLoading={false}
filter={filter}
error={error}
options={
<>
<SelectFilter
Expand Down
19 changes: 19 additions & 0 deletionssite/src/pages/TemplatesPage/TemplatesPageView.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -112,3 +112,22 @@ export const WithError: Story = {
canCreateTemplates: false,
},
};

export const WithValidationError: Story = {
args: {
error: mockApiError({
message: "Something went wrong fetching templates.",
detail:
"This is a more detailed error message that should help you understand what went wrong.",
validations: [
{
field: "search",
detail: "That search query was invalid, why did you do that?",
},
],
}),
templates: undefined,
examples: undefined,
canCreateTemplates: false,
},
};
73 changes: 37 additions & 36 deletionssite/src/pages/TemplatesPage/TemplatesPageView.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,7 @@ import TableCell from "@mui/material/TableCell";
import TableContainer from "@mui/material/TableContainer";
import TableHead from "@mui/material/TableHead";
import TableRow from "@mui/material/TableRow";
import { hasError, isApiValidationError } from "api/errors";
import type { Template, TemplateExample } from "api/typesGenerated";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { ExternalAvatar } from "components/Avatar/Avatar";
Expand DownExpand Up@@ -228,45 +229,45 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = ({
</PageHeaderSubtitle>
</PageHeader>

<TemplatesFilter filter={filter} />

{error ? (
<TemplatesFilter filter={filter}error={error}/>
{/* Validation errors are shown on the filter, other errors are an alert box. */}
{hasError(error) && !isApiValidationError(error) && (
<ErrorAlert error={error} />
) : (
<TableContainer>
<Table>
<TableHead>
<TableRow>
<TableCell width="35%">{Language.nameLabel}</TableCell>
<TableCell width="15%">
{showOrganizations ? "Organization" : Language.usedByLabel}
</TableCell>
<TableCell width="10%">{Language.buildTimeLabel}</TableCell>
<TableCell width="15%">{Language.lastUpdatedLabel}</TableCell>
<TableCell width="1%" />
</TableRow>
</TableHead>
<TableBody>
{isLoading && <TableLoader />}
)}

{isEmpty ? (
<EmptyTemplates
canCreateTemplates={canCreateTemplates}
examples={examples ?? []}
<TableContainer>
<Table>
<TableHead>
<TableRow>
<TableCell width="35%">{Language.nameLabel}</TableCell>
<TableCell width="15%">
{showOrganizations ? "Organization" : Language.usedByLabel}
</TableCell>
<TableCell width="10%">{Language.buildTimeLabel}</TableCell>
<TableCell width="15%">{Language.lastUpdatedLabel}</TableCell>
<TableCell width="1%" />
</TableRow>
</TableHead>
<TableBody>
{isLoading && <TableLoader />}

{isEmpty ? (
<EmptyTemplates
canCreateTemplates={canCreateTemplates}
examples={examples ?? []}
/>
) : (
templates?.map((template) => (
<TemplateRow
key={template.id}
showOrganizations={showOrganizations}
template={template}
/>
) : (
templates?.map((template) => (
<TemplateRow
key={template.id}
showOrganizations={showOrganizations}
template={template}
/>
))
)}
</TableBody>
</Table>
</TableContainer>
)}
))
)}
</TableBody>
</Table>
</TableContainer>
</Margins>
);
};
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp