feat: sync graphql schema and clean code

This commit is contained in:
Ivan Li 2021-06-05 20:11:00 +08:00
parent 0a8d9386ca
commit 939777910c
5 changed files with 12 additions and 68 deletions

View File

@ -4,6 +4,7 @@
"clsx", "clsx",
"fontsource", "fontsource",
"notistack", "notistack",
"unmount",
"vditor" "vditor"
] ]
} }

View File

@ -128,7 +128,6 @@ const Item: FC<{ commit: Commit; pipeline: Pipeline }> = ({
pipeline, pipeline,
}) => { }) => {
const [isOpen, setOpen] = useState(() => false); const [isOpen, setOpen] = useState(() => false);
const classes = useStyles();
const [createTask, { loading }] = const [createTask, { loading }] =
useMutation< useMutation<

View File

@ -1,26 +1,4 @@
import { gql } from "@apollo/client"; import { gql } from "@apollo/client";
export const SUBSCRIPTION_COMMITS = gql`
subscription SubscriptionCommits($pipelineId: String!) {
results: listLogsForPipeline(id: $pipelineId) {
all {
hash
date
message
body
author_name
author_email
tasks {
id
units
status
startedAt
endedAt
}
}
}
}
`;
export const SYNC_COMMITS = gql` export const SYNC_COMMITS = gql`
subscription SyncCommits($pipelineId: String!) { subscription SyncCommits($pipelineId: String!) {
syncCommits(pipelineId: $pipelineId) syncCommits(pipelineId: $pipelineId)

View File

@ -1153,7 +1153,7 @@
}, },
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "PipelineTaskLogMessage", "name": "PipelineTaskEvent",
"description": null, "description": null,
"fields": [ "fields": [
{ {
@ -1169,47 +1169,15 @@
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "time", "name": "status",
"description": null, "description": null,
"args": [], "args": [],
"type": { "type": {
"kind": "NON_NULL", "kind": "NON_NULL",
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "SCALAR", "kind": "ENUM",
"name": "DateTime", "name": "TaskStatuses",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "message",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "isError",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null "ofType": null
} }
}, },
@ -1757,7 +1725,7 @@
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "pipelineTaskLog", "name": "pipelineTaskEvent",
"description": null, "description": null,
"args": [ "args": [
{ {
@ -1782,7 +1750,7 @@
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "OBJECT", "kind": "OBJECT",
"name": "PipelineTaskLogMessage", "name": "PipelineTaskEvent",
"ofType": null "ofType": null
} }
}, },

View File

@ -140,12 +140,10 @@ export type PipelineTask = {
endedAt?: Maybe<Scalars['DateTime']>; endedAt?: Maybe<Scalars['DateTime']>;
}; };
export type PipelineTaskLogMessage = { export type PipelineTaskEvent = {
__typename?: 'PipelineTaskLogMessage'; __typename?: 'PipelineTaskEvent';
unit?: Maybe<PipelineUnits>; unit?: Maybe<PipelineUnits>;
time: Scalars['DateTime']; status: TaskStatuses;
message: Scalars['String'];
isError: Scalars['Boolean'];
}; };
export type PipelineTaskLogs = { export type PipelineTaskLogs = {
@ -221,7 +219,7 @@ export type QueryPipelineTaskArgs = {
export type Subscription = { export type Subscription = {
__typename?: 'Subscription'; __typename?: 'Subscription';
syncCommits?: Maybe<Scalars['String']>; syncCommits?: Maybe<Scalars['String']>;
pipelineTaskLog: PipelineTaskLogMessage; pipelineTaskEvent: PipelineTaskEvent;
pipelineTaskChanged: PipelineTask; pipelineTaskChanged: PipelineTask;
}; };
@ -232,7 +230,7 @@ export type SubscriptionSyncCommitsArgs = {
}; };
export type SubscriptionPipelineTaskLogArgs = { export type SubscriptionPipelineTaskEventArgs = {
taskId: Scalars['String']; taskId: Scalars['String'];
}; };