feat: 完善添加流水线界面。

This commit is contained in:
Ivan Li 2021-03-11 20:10:43 +08:00
parent 044e74b7ff
commit 11221ae8dd
2 changed files with 7 additions and 4 deletions

View File

@ -4,7 +4,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { makeAutoObservable } from 'mobx'; import { makeAutoObservable } from 'mobx';
import { ActionButton } from './action-button'; import { ActionButton } from './action-button';
import { gql, useMutation } from '@apollo/client'; import { gql, useMutation } from '@apollo/client';
import { Project } from '../../generated/graphql'; import { Project, Pipeline } from '../../generated/graphql';
import { import {
CommitActionsStoreProvider, CommitActionsStoreProvider,
CommitActionsStore CommitActionsStore
@ -20,7 +20,7 @@ import { useLocalObservable } from 'mobx-react';
const CHECKOUT = ''; const CHECKOUT = '';
interface Props { interface Props {
project: Project; pipeline: Pipeline;
commitNumber: string; commitNumber: string;
branch?: string; branch?: string;
} }
@ -32,7 +32,7 @@ class Store {
isTasksWorking = [false, false, false, false]; isTasksWorking = [false, false, false, false];
} }
export const CommitActions = ({ project, commitNumber }: Props) => { export const CommitActions = ({ pipeline, commitNumber }: Props) => {
const [checkout] = useMutation<CheckoutInput>(CHECKOUT); const [checkout] = useMutation<CheckoutInput>(CHECKOUT);
const onCheckoutBtnClick = async () => { const onCheckoutBtnClick = async () => {

View File

@ -119,7 +119,10 @@ export const PipelineEditor = ({ projectId, id }: Props) => {
delete fd.__typename; delete fd.__typename;
return fd; return fd;
} }
return {}; return {
projectId,
workUnitMetadata: JSON.stringify(defaultWorkUnitMetadata, null, 2)
};
}, [data, data?.pipeline]); }, [data, data?.pipeline]);
const [createPipeline] = useMutation<{ pipeline: Pipeline }>( const [createPipeline] = useMutation<{ pipeline: Pipeline }>(