Skip to content

chore(site): remove create template xservice #10112

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 17 commits into from
Oct 9, 2023
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
Show missed variables
  • Loading branch information
BrunoQuaresma committed Oct 9, 2023
commit d3ca396771a13d616ded12846712d88b7fb0380f
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
JobError,
createTemplate,
templateExamples,
templateVersionVariables,
} from "api/queries/templates";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { useOrganizationId } from "hooks";
Expand Down Expand Up @@ -40,6 +41,13 @@ export const ImportStarterTemplateView = () => {
enabled: isJobError,
});

const missedVariables = useQuery({
...templateVersionVariables(isJobError ? createError.version.id : ""),
enabled:
isJobError &&
createError.job.error_code === "REQUIRED_TEMPLATE_VARIABLES",
});

if (isLoading) {
return <Loader />;
}
Expand All @@ -52,6 +60,7 @@ export const ImportStarterTemplateView = () => {
<CreateTemplateForm
{...formPermissions}
starterTemplate={templateExample!}
variables={missedVariables.data}
error={createTemplateMutation.error}
isSubmitting={createTemplateMutation.isLoading}
onCancel={() => navigate(-1)}
Expand Down
14 changes: 13 additions & 1 deletion site/src/pages/CreateTemplatePage/UploadTemplateView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { useQuery, useMutation } from "react-query";
import { templateVersionLogs } from "api/queries/templateVersions";
import { JobError, createTemplate } from "api/queries/templates";
import {
JobError,
createTemplate,
templateVersionVariables,
} from "api/queries/templates";
import { useOrganizationId } from "hooks";
import { useNavigate } from "react-router-dom";
import { CreateTemplateForm } from "./CreateTemplateForm";
Expand All @@ -26,9 +30,17 @@ export const UploadTemplateView = () => {
enabled: isJobError,
});

const missedVariables = useQuery({
...templateVersionVariables(isJobError ? createError.version.id : ""),
enabled:
isJobError &&
createError.job.error_code === "REQUIRED_TEMPLATE_VARIABLES",
});

return (
<CreateTemplateForm
{...formPermissions}
variables={missedVariables.data}
error={createTemplateMutation.error}
isSubmitting={createTemplateMutation.isLoading}
onCancel={() => navigate(-1)}
Expand Down