From 939777910c93163fce5e30c49d863bd0efa5146c Mon Sep 17 00:00:00 2001 From: Ivan Li Date: Sat, 5 Jun 2021 20:11:00 +0800 Subject: [PATCH] feat: sync graphql schema and clean code --- .vscode/settings.json | 1 + src/commits/commit-list.tsx | 1 - src/commits/subscriptions.ts | 22 ---------------- src/generated/graphql.schema.json | 44 +++++-------------------------- src/generated/graphql.tsx | 12 ++++----- 5 files changed, 12 insertions(+), 68 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 6711284..e89a70f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,6 +4,7 @@ "clsx", "fontsource", "notistack", + "unmount", "vditor" ] } \ No newline at end of file diff --git a/src/commits/commit-list.tsx b/src/commits/commit-list.tsx index 543742e..5680c10 100644 --- a/src/commits/commit-list.tsx +++ b/src/commits/commit-list.tsx @@ -128,7 +128,6 @@ const Item: FC<{ commit: Commit; pipeline: Pipeline }> = ({ pipeline, }) => { const [isOpen, setOpen] = useState(() => false); - const classes = useStyles(); const [createTask, { loading }] = useMutation< diff --git a/src/commits/subscriptions.ts b/src/commits/subscriptions.ts index 087e1c8..57d8ab6 100644 --- a/src/commits/subscriptions.ts +++ b/src/commits/subscriptions.ts @@ -1,26 +1,4 @@ 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` subscription SyncCommits($pipelineId: String!) { syncCommits(pipelineId: $pipelineId) diff --git a/src/generated/graphql.schema.json b/src/generated/graphql.schema.json index 00cd183..9a2a492 100644 --- a/src/generated/graphql.schema.json +++ b/src/generated/graphql.schema.json @@ -1153,7 +1153,7 @@ }, { "kind": "OBJECT", - "name": "PipelineTaskLogMessage", + "name": "PipelineTaskEvent", "description": null, "fields": [ { @@ -1169,47 +1169,15 @@ "deprecationReason": null }, { - "name": "time", + "name": "status", "description": null, "args": [], "type": { "kind": "NON_NULL", "name": null, "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "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", + "kind": "ENUM", + "name": "TaskStatuses", "ofType": null } }, @@ -1757,7 +1725,7 @@ "deprecationReason": null }, { - "name": "pipelineTaskLog", + "name": "pipelineTaskEvent", "description": null, "args": [ { @@ -1782,7 +1750,7 @@ "name": null, "ofType": { "kind": "OBJECT", - "name": "PipelineTaskLogMessage", + "name": "PipelineTaskEvent", "ofType": null } }, diff --git a/src/generated/graphql.tsx b/src/generated/graphql.tsx index ff60187..dd9d0dd 100644 --- a/src/generated/graphql.tsx +++ b/src/generated/graphql.tsx @@ -140,12 +140,10 @@ export type PipelineTask = { endedAt?: Maybe; }; -export type PipelineTaskLogMessage = { - __typename?: 'PipelineTaskLogMessage'; +export type PipelineTaskEvent = { + __typename?: 'PipelineTaskEvent'; unit?: Maybe; - time: Scalars['DateTime']; - message: Scalars['String']; - isError: Scalars['Boolean']; + status: TaskStatuses; }; export type PipelineTaskLogs = { @@ -221,7 +219,7 @@ export type QueryPipelineTaskArgs = { export type Subscription = { __typename?: 'Subscription'; syncCommits?: Maybe; - pipelineTaskLog: PipelineTaskLogMessage; + pipelineTaskEvent: PipelineTaskEvent; pipelineTaskChanged: PipelineTask; }; @@ -232,7 +230,7 @@ export type SubscriptionSyncCommitsArgs = { }; -export type SubscriptionPipelineTaskLogArgs = { +export type SubscriptionPipelineTaskEventArgs = { taskId: Scalars['String']; };