diff --git a/src/commons/auth/auth.provider.tsx b/src/commons/auth/auth.provider.tsx index 945159a..ac97b6e 100644 --- a/src/commons/auth/auth.provider.tsx +++ b/src/commons/auth/auth.provider.tsx @@ -39,7 +39,7 @@ export const AuthProvider: FC = ({ children }) => { }} > {children} - {/* {accessToken ? null : } */} + {accessToken ? null : } ); }; diff --git a/src/commons/auth/login.tsx b/src/commons/auth/login.tsx index ddbea9d..9f3f773 100644 --- a/src/commons/auth/login.tsx +++ b/src/commons/auth/login.tsx @@ -45,7 +45,7 @@ export const Login: FC = () => { ref={iframeRef} className={classes.iframe} title="Auth" - src="http://user.localhost/auth/login" + src="https://user.rpi.ivanli.cc/auth/login" > ); }; diff --git a/src/commons/route/router.tsx b/src/commons/route/router.tsx index 17af170..eea069a 100644 --- a/src/commons/route/router.tsx +++ b/src/commons/route/router.tsx @@ -2,7 +2,7 @@ import { useApolloClient } from "@apollo/client"; import { createRouterComponent } from "@curi/react-dom"; import { createRouter, announce } from "@curi/router"; import { browser } from "@hickory/browser"; -import { FC, ReactNode, useEffect, useMemo, useState } from "react"; +import { FC, useEffect, useState } from "react"; import routes from "../../routes"; import { LinearProgress } from "@material-ui/core"; diff --git a/src/generated/graphql.tsx b/src/generated/graphql.tsx index 736d229..847cf5f 100644 --- a/src/generated/graphql.tsx +++ b/src/generated/graphql.tsx @@ -1,8 +1,11 @@ -import { gql } from '@apollo/client'; export type Maybe = T | null; -export type Exact = { [K in keyof T]: T[K] }; -export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; -export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type Exact = { + [K in keyof T]: T[K]; +}; +export type MakeOptional = Omit & + { [SubKey in K]?: Maybe }; +export type MakeMaybe = Omit & + { [SubKey in K]: Maybe }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -15,174 +18,165 @@ export type Scalars = { }; export type Commit = { - __typename?: 'Commit'; - hash: Scalars['String']; - date: Scalars['DateTime']; - message: Scalars['String']; - refs: Scalars['String']; - body: Scalars['String']; - author_name: Scalars['String']; - author_email: Scalars['String']; + __typename?: "Commit"; + hash: Scalars["String"]; + date: Scalars["DateTime"]; + message: Scalars["String"]; + refs: Scalars["String"]; + body: Scalars["String"]; + author_name: Scalars["String"]; + author_email: Scalars["String"]; tasks: Array; }; export type CreatePipelineInput = { - projectId: Scalars['String']; - branch: Scalars['String']; - name: Scalars['String']; + projectId: Scalars["String"]; + branch: Scalars["String"]; + name: Scalars["String"]; workUnitMetadata: WorkUnitMetadataInput; }; export type CreatePipelineTaskInput = { - pipelineId: Scalars['String']; - commit: Scalars['String']; + pipelineId: Scalars["String"]; + commit: Scalars["String"]; units: Array; }; export type CreateProjectInput = { - name: Scalars['String']; - comment: Scalars['String']; - sshUrl: Scalars['String']; - webUrl?: Maybe; - webHookSecret?: Maybe; + name: Scalars["String"]; + comment: Scalars["String"]; + sshUrl: Scalars["String"]; + webUrl?: Maybe; + webHookSecret?: Maybe; }; - export type Hello = { - __typename?: 'Hello'; - message: Scalars['String']; + __typename?: "Hello"; + message: Scalars["String"]; }; export type LogFields = { - __typename?: 'LogFields'; - hash: Scalars['String']; - date: Scalars['String']; - message: Scalars['String']; - refs: Scalars['String']; - body: Scalars['String']; - author_name: Scalars['String']; - author_email: Scalars['String']; + __typename?: "LogFields"; + hash: Scalars["String"]; + date: Scalars["String"]; + message: Scalars["String"]; + refs: Scalars["String"]; + body: Scalars["String"]; + author_name: Scalars["String"]; + author_email: Scalars["String"]; tasks: Array; }; export type Mutation = { - __typename?: 'Mutation'; + __typename?: "Mutation"; createProject: Project; updateProject: Project; - removeProject: Scalars['Float']; + removeProject: Scalars["Float"]; createPipeline: Pipeline; updatePipeline: Pipeline; - deletePipeline: Scalars['Float']; + deletePipeline: Scalars["Float"]; createPipelineTask: PipelineTask; - stopPipelineTask: Scalars['Boolean']; + stopPipelineTask: Scalars["Boolean"]; }; - export type MutationCreateProjectArgs = { project: CreateProjectInput; }; - export type MutationUpdateProjectArgs = { project: UpdateProjectInput; }; - export type MutationRemoveProjectArgs = { - id: Scalars['String']; + id: Scalars["String"]; }; - export type MutationCreatePipelineArgs = { pipeline: CreatePipelineInput; }; - export type MutationUpdatePipelineArgs = { pipeline: UpdatePipelineInput; }; - export type MutationDeletePipelineArgs = { - id: Scalars['String']; + id: Scalars["String"]; }; - export type MutationCreatePipelineTaskArgs = { task: CreatePipelineTaskInput; }; - export type MutationStopPipelineTaskArgs = { - id: Scalars['String']; + id: Scalars["String"]; }; export type Pipeline = { - __typename?: 'Pipeline'; - id: Scalars['ID']; + __typename?: "Pipeline"; + id: Scalars["ID"]; project: Project; - projectId: Scalars['String']; - branch: Scalars['String']; - name: Scalars['String']; + projectId: Scalars["String"]; + branch: Scalars["String"]; + name: Scalars["String"]; workUnitMetadata: WorkUnitMetadata; }; export type PipelineTask = { - __typename?: 'PipelineTask'; - id: Scalars['ID']; + __typename?: "PipelineTask"; + id: Scalars["ID"]; pipeline: Pipeline; - pipelineId: Scalars['String']; - commit: Scalars['String']; + pipelineId: Scalars["String"]; + commit: Scalars["String"]; units: Array; logs: Array; status: TaskStatuses; - startedAt?: Maybe; - endedAt?: Maybe; - runOn: Scalars['String']; + startedAt?: Maybe; + endedAt?: Maybe; + runOn: Scalars["String"]; }; export type PipelineTaskEvent = { - __typename?: 'PipelineTaskEvent'; - taskId: Scalars['String']; - pipelineId: Scalars['String']; - projectId: Scalars['String']; + __typename?: "PipelineTaskEvent"; + taskId: Scalars["String"]; + pipelineId: Scalars["String"]; + projectId: Scalars["String"]; unit?: Maybe; - emittedAt: Scalars['DateTime']; - message: Scalars['String']; - messageType: Scalars['String']; + emittedAt: Scalars["DateTime"]; + message: Scalars["String"]; + messageType: Scalars["String"]; status: TaskStatuses; }; export type PipelineTaskLogs = { - __typename?: 'PipelineTaskLogs'; + __typename?: "PipelineTaskLogs"; unit: PipelineUnits; status: TaskStatuses; - startedAt?: Maybe; - endedAt?: Maybe; - logs: Scalars['String']; + startedAt?: Maybe; + endedAt?: Maybe; + logs: Scalars["String"]; }; /** 流水线单元 */ export enum PipelineUnits { - Checkout = 'checkout', - InstallDependencies = 'installDependencies', - Test = 'test', - Deploy = 'deploy', - CleanUp = 'cleanUp' + Checkout = "checkout", + InstallDependencies = "installDependencies", + Test = "test", + Deploy = "deploy", + CleanUp = "cleanUp", } export type Project = { - __typename?: 'Project'; - id: Scalars['ID']; - name: Scalars['String']; - comment: Scalars['String']; - sshUrl: Scalars['String']; - webUrl?: Maybe; - webHookSecret?: Maybe; + __typename?: "Project"; + id: Scalars["ID"]; + name: Scalars["String"]; + comment: Scalars["String"]; + sshUrl: Scalars["String"]; + webUrl?: Maybe; + webHookSecret?: Maybe; }; export type Query = { - __typename?: 'Query'; + __typename?: "Query"; hello: Hello; projects: Array; project: Project; @@ -193,101 +187,92 @@ export type Query = { pipelineTask: PipelineTask; }; - export type QueryProjectArgs = { - id: Scalars['String']; + id: Scalars["String"]; }; - export type QueryPipelinesArgs = { - projectId?: Maybe; + projectId?: Maybe; }; - export type QueryPipelineArgs = { - id: Scalars['String']; + id: Scalars["String"]; }; - export type QueryCommitsArgs = { - pipelineId: Scalars['String']; + pipelineId: Scalars["String"]; }; - export type QueryListPipelineTaskByPipelineIdArgs = { - pipelineId: Scalars['String']; + pipelineId: Scalars["String"]; }; - export type QueryPipelineTaskArgs = { - id: Scalars['String']; + id: Scalars["String"]; }; export type Subscription = { - __typename?: 'Subscription'; - syncCommits?: Maybe; + __typename?: "Subscription"; + syncCommits?: Maybe; pipelineTaskEvent: PipelineTaskEvent; pipelineTaskChanged: PipelineTask; }; - export type SubscriptionSyncCommitsArgs = { - appInstance?: Maybe; - pipelineId: Scalars['String']; + appInstance?: Maybe; + pipelineId: Scalars["String"]; }; - export type SubscriptionPipelineTaskEventArgs = { - taskId: Scalars['String']; + taskId: Scalars["String"]; }; - export type SubscriptionPipelineTaskChangedArgs = { - id: Scalars['String']; + id: Scalars["String"]; }; /** 任务状态 */ export enum TaskStatuses { - Success = 'success', - Failed = 'failed', - Working = 'working', - Pending = 'pending' + Success = "success", + Failed = "failed", + Working = "working", + Pending = "pending", } export type UpdatePipelineInput = { - branch: Scalars['String']; - name: Scalars['String']; + branch: Scalars["String"]; + name: Scalars["String"]; workUnitMetadata: WorkUnitMetadataInput; - id: Scalars['String']; + id: Scalars["String"]; }; export type UpdateProjectInput = { - name: Scalars['String']; - comment: Scalars['String']; - sshUrl: Scalars['String']; - webUrl?: Maybe; - webHookSecret?: Maybe; - id: Scalars['String']; + name: Scalars["String"]; + comment: Scalars["String"]; + sshUrl: Scalars["String"]; + webUrl?: Maybe; + webHookSecret?: Maybe; + id: Scalars["String"]; }; export type WorkUnit = { - __typename?: 'WorkUnit'; + __typename?: "WorkUnit"; type: PipelineUnits; - scripts: Array; + scripts: Array; }; export type WorkUnitInput = { type: PipelineUnits; - scripts: Array; + scripts: Array; }; export type WorkUnitMetadata = { - __typename?: 'WorkUnitMetadata'; - version: Scalars['Int']; + __typename?: "WorkUnitMetadata"; + version: Scalars["Int"]; units: Array; }; export type WorkUnitMetadataInput = { - version?: Maybe; + version?: Maybe; units: Array; }; diff --git a/src/layouts/default.tsx b/src/layouts/default.tsx index 8be51b6..8772fca 100644 --- a/src/layouts/default.tsx +++ b/src/layouts/default.tsx @@ -1,4 +1,4 @@ -import React, { FC, useCallback, useRef, useState } from "react"; +import React, { FC, useCallback, useState } from "react"; import clsx from "clsx"; import { createStyles, @@ -10,7 +10,6 @@ import Drawer from "@material-ui/core/Drawer"; import AppBar from "@material-ui/core/AppBar"; import Toolbar from "@material-ui/core/Toolbar"; import CssBaseline from "@material-ui/core/CssBaseline"; -import Typography from "@material-ui/core/Typography"; import Divider from "@material-ui/core/Divider"; import IconButton from "@material-ui/core/IconButton"; import MenuIcon from "@material-ui/icons/Menu"; diff --git a/src/pipelines/pipeline-list.tsx b/src/pipelines/pipeline-list.tsx index 630cee8..2a4b0cb 100644 --- a/src/pipelines/pipeline-list.tsx +++ b/src/pipelines/pipeline-list.tsx @@ -11,8 +11,6 @@ import { import { FC, MouseEventHandler, useMemo } from "react"; import { Pipeline, Project } from "../generated/graphql"; import { CallMerge, Edit } from "@material-ui/icons"; -import { clone } from "ramda"; -import { useEffect } from "react"; interface Props { projectId: string; @@ -32,7 +30,7 @@ const PIPELINES = gql` `; export const PipelineList: FC = ({ projectId }) => { - const { data, loading } = useQuery< + const { data } = useQuery< { pipelines: Pipeline[]; project: Project }, { projectId: string } >(PIPELINES, { diff --git a/src/routes.tsx b/src/routes.tsx index 7abfa58..b439aed 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -1,7 +1,6 @@ import { ApolloClient, InMemoryCache } from "@apollo/client"; import { prepareRoutes } from "@curi/router"; 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"; @@ -13,7 +12,6 @@ import { Pipeline, PipelineUnits, Project, - WorkUnitInput, } from "./generated/graphql"; import { PIPELINE } from "./pipelines";