fix(pipelines): create pipeline is not woring.
This commit is contained in:
parent
edab87d3f1
commit
8e8c93ef2c
@ -1,4 +1,4 @@
|
||||
import { gql, Reference, useMutation, useQuery } from "@apollo/client";
|
||||
import { gql, Reference, useMutation } from "@apollo/client";
|
||||
import { useRouter } from "@curi/react-dom";
|
||||
import {
|
||||
Button,
|
||||
@ -13,21 +13,17 @@ import {
|
||||
import { Delete } from "@material-ui/icons";
|
||||
import { FormikHelpers, Formik, Form, Field } from "formik";
|
||||
import { TextField, TextFieldProps } from "formik-material-ui";
|
||||
import { TextField as MuiTextField } from "@material-ui/core";
|
||||
import { useConfirm } from "material-ui-confirm";
|
||||
import { useSnackbar } from "notistack";
|
||||
import { not, omit } from "ramda";
|
||||
import { ChangeEvent, FC } from "react";
|
||||
import {
|
||||
Pipeline,
|
||||
WorkUnitMetadata,
|
||||
PipelineUnits,
|
||||
} from "../generated/graphql";
|
||||
import { useHeaderContainer } from "../layouts";
|
||||
import { CREATE_PIPELINE, DELETE_PIPELINE, UPDATE_PIPELINE } from "./mutations";
|
||||
import { PIPELINE } from "./queries";
|
||||
import * as Yup from "yup";
|
||||
import { useField } from "formik";
|
||||
|
||||
type Values = Partial<Pipeline>;
|
||||
|
||||
@ -108,7 +104,7 @@ export const PipelineEditor: FC<Props> = ({ pipeline }) => {
|
||||
if (isCreate) {
|
||||
await createPipeline({
|
||||
variables: {
|
||||
input: values,
|
||||
pipeline: values,
|
||||
},
|
||||
}).then(({ data }) => {
|
||||
pipelineId = data!.createPipeline.id;
|
||||
@ -277,7 +273,7 @@ const ScriptsField: FC<TextFieldProps> = ({ field, form, meta, ...props }) => {
|
||||
onChange: (ev: ChangeEvent<HTMLInputElement>) =>
|
||||
form.setFieldValue(
|
||||
field.name,
|
||||
ev.target.value?.split("\n").map((it) => it.trim()) ?? []
|
||||
ev.target.value?.split("\n").map((it) => it) ?? []
|
||||
),
|
||||
}}
|
||||
/>
|
||||
|
@ -1,17 +1,19 @@
|
||||
import { ApolloClient, InMemoryCache } from "@apollo/client";
|
||||
import { prepareRoutes } from "@curi/router";
|
||||
import { omit } from 'ramda';
|
||||
import { omit } from "ramda";
|
||||
import React from "react";
|
||||
import { ProjectDetail, ProjectEditor, PROJECT } from "./projects";
|
||||
import { COMMIT_LIST_QUERY } from './commons/graphql/queries';
|
||||
import { CommitList } from './commits/commit-list';
|
||||
import { PipelineTaskDetail } from './pipeline-tasks/pipeline-task-detail';
|
||||
import { COMMIT_LIST_QUERY } from "./commons/graphql/queries";
|
||||
import { CommitList } from "./commits/commit-list";
|
||||
import { PipelineTaskDetail } from "./pipeline-tasks/pipeline-task-detail";
|
||||
import { PipelineEditor } from "./pipelines/pipeline-editor";
|
||||
import {
|
||||
CreatePipelineInput,
|
||||
CreateProjectInput,
|
||||
Pipeline,
|
||||
PipelineUnits,
|
||||
Project,
|
||||
WorkUnitInput,
|
||||
} from "./generated/graphql";
|
||||
import { PIPELINE } from "./pipelines";
|
||||
|
||||
@ -65,13 +67,20 @@ export default prepareRoutes([
|
||||
matched,
|
||||
{ client }: { client: ApolloClient<InMemoryCache> }
|
||||
) {
|
||||
const units = [
|
||||
PipelineUnits.Checkout,
|
||||
PipelineUnits.InstallDependencies,
|
||||
PipelineUnits.Test,
|
||||
PipelineUnits.Deploy,
|
||||
PipelineUnits.CleanUp,
|
||||
];
|
||||
const input: CreatePipelineInput = {
|
||||
name: "",
|
||||
branch: "",
|
||||
projectId: matched!.params.projectId,
|
||||
workUnitMetadata: {
|
||||
version: 1,
|
||||
units: [],
|
||||
units: units.map((util) => ({ type: util, scripts: [] })),
|
||||
},
|
||||
};
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user