Compare commits

...

2 Commits

9 changed files with 5987 additions and 2365 deletions

8204
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,9 +9,9 @@
"@curi/router": "^2.1.2", "@curi/router": "^2.1.2",
"@emotion/react": "^11.4.1", "@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0", "@emotion/styled": "^11.3.0",
"@fortawesome/fontawesome-svg-core": "^1.2.35", "@fortawesome/fontawesome-svg-core": "^1.2.36",
"@fortawesome/free-solid-svg-icons": "^5.15.3", "@fortawesome/free-solid-svg-icons": "^5.15.4",
"@fortawesome/react-fontawesome": "^0.1.14", "@fortawesome/react-fontawesome": "^0.1.16",
"@hickory/browser": "^2.1.0", "@hickory/browser": "^2.1.0",
"@mui/icons-material": "^5.0.1", "@mui/icons-material": "^5.0.1",
"@mui/lab": "^5.0.0-alpha.49", "@mui/lab": "^5.0.0-alpha.49",
@ -35,7 +35,7 @@
"graphql": "^15.5.0", "graphql": "^15.5.0",
"graphql-scalars": "^1.10.0", "graphql-scalars": "^1.10.0",
"material-ui-confirm": "^2.1.2", "material-ui-confirm": "^2.1.2",
"notistack": "^1.0.6", "notistack": "^2.0.2",
"ramda": "^0.27.1", "ramda": "^0.27.1",
"react": "^17.0.2", "react": "^17.0.2",
"react-ace": "^9.4.4", "react-ace": "^9.4.4",

View File

@ -1176,6 +1176,22 @@
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
},
{
"name": "environment",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
} }
], ],
"inputFields": null, "inputFields": null,
@ -2021,13 +2037,9 @@
} }
], ],
"type": { "type": {
"kind": "NON_NULL", "kind": "OBJECT",
"name": null, "name": "Configuration",
"ofType": { "ofType": null
"kind": "OBJECT",
"name": "Configuration",
"ofType": null
}
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
@ -2044,6 +2056,18 @@
"description": null, "description": null,
"fields": null, "fields": null,
"inputFields": [ "inputFields": [
{
"name": "id",
"description": null,
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "pipelineId", "name": "pipelineId",
"description": null, "description": null,
@ -2107,6 +2131,18 @@
"defaultValue": null, "defaultValue": null,
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
},
{
"name": "name",
"description": null,
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": "\"Default Configuration\"",
"isDeprecated": false,
"deprecationReason": null
} }
], ],
"interfaces": null, "interfaces": null,

View File

@ -148,6 +148,7 @@ export type Pipeline = {
branch: Scalars['String']; branch: Scalars['String'];
name: Scalars['String']; name: Scalars['String'];
workUnitMetadata: WorkUnitMetadata; workUnitMetadata: WorkUnitMetadata;
environment: Scalars['String'];
}; };
export type PipelineTask = { export type PipelineTask = {
@ -214,7 +215,7 @@ export type Query = {
commits?: Maybe<Array<Commit>>; commits?: Maybe<Array<Commit>>;
listPipelineTaskByPipelineId: Array<PipelineTask>; listPipelineTaskByPipelineId: Array<PipelineTask>;
pipelineTask: PipelineTask; pipelineTask: PipelineTask;
getConfiguration: Configuration; getConfiguration?: Maybe<Configuration>;
}; };
@ -255,10 +256,12 @@ export type QueryGetConfigurationArgs = {
}; };
export type SetConfigurationInput = { export type SetConfigurationInput = {
id?: Maybe<Scalars['String']>;
pipelineId: Scalars['String']; pipelineId: Scalars['String'];
projectId: Scalars['String']; projectId: Scalars['String'];
content: Scalars['String']; content: Scalars['String'];
language: ConfigurationLanguage; language: ConfigurationLanguage;
name?: Maybe<Scalars['String']>;
}; };
export type Subscription = { export type Subscription = {

View File

@ -9,8 +9,7 @@ import { ConfirmProvider } from "material-ui-confirm";
import { SnackbarProvider } from "notistack"; import { SnackbarProvider } from "notistack";
import Router from "./commons/route/router"; import Router from "./commons/route/router";
import { AuthProvider } from "./commons/auth/auth.provider"; import { AuthProvider } from "./commons/auth/auth.provider";
import { LocalizationProvider } from "@mui/lab"; import { zhCN } from "@mui/material/locale";
import AdapterDateFns from "@mui/lab/AdapterDateFns";
import { import {
ThemeProvider, ThemeProvider,
Theme, Theme,
@ -23,7 +22,7 @@ declare module "@mui/styles/defaultTheme" {
interface DefaultTheme extends Theme {} interface DefaultTheme extends Theme {}
} }
const theme = createTheme(); const theme = createTheme({}, zhCN);
ReactDOM.render( ReactDOM.render(
<React.StrictMode> <React.StrictMode>
@ -33,11 +32,9 @@ ReactDOM.render(
<SnackbarProvider maxSnack={5}> <SnackbarProvider maxSnack={5}>
<AuthProvider> <AuthProvider>
<AppApolloClientProvider> <AppApolloClientProvider>
<LocalizationProvider dateAdapter={AdapterDateFns}> <Router>
<Router> <App />
<App /> </Router>
</Router>
</LocalizationProvider>
</AppApolloClientProvider> </AppApolloClientProvider>
</AuthProvider> </AuthProvider>
</SnackbarProvider> </SnackbarProvider>

View File

@ -7,6 +7,7 @@ export const CREATE_PIPELINE = gql`
projectId projectId
branch branch
name name
environment
workUnitMetadata { workUnitMetadata {
version version
units { units {
@ -25,6 +26,7 @@ export const UPDATE_PIPELINE = gql`
projectId projectId
branch branch
name name
environment
workUnitMetadata { workUnitMetadata {
version version
units { units {

View File

@ -61,6 +61,7 @@ export const PipelineEditor: FC<Props> = ({ pipeline }) => {
id id
projectId projectId
branch branch
environment
name name
workUnitMetadata { workUnitMetadata {
version version
@ -173,7 +174,12 @@ export const PipelineEditor: FC<Props> = ({ pipeline }) => {
{isCreate ? "Create" : "Edit"} Pipeline {isCreate ? "Create" : "Edit"} Pipeline
</Typography> </Typography>
{isCreate ? null : ( {isCreate ? null : (
<IconButton color="inherit" onClick={handleDelete} disabled={deleting} size="large"> <IconButton
color="inherit"
onClick={handleDelete}
disabled={deleting}
size="large"
>
<Delete /> <Delete />
</IconButton> </IconButton>
)} )}
@ -186,7 +192,10 @@ export const PipelineEditor: FC<Props> = ({ pipeline }) => {
.max(32, "Must be 32 characters or less") .max(32, "Must be 32 characters or less")
.required("Required"), .required("Required"),
branch: Yup.string() branch: Yup.string()
.max(32, "Must be 32 characters or less") .max(64, "Must be 64 characters or less")
.required("Required"),
environment: Yup.string()
.max(64, "Must be 64 characters or less")
.required("Required"), .required("Required"),
})} })}
onSubmit={submitForm} onSubmit={submitForm}
@ -202,6 +211,13 @@ export const PipelineEditor: FC<Props> = ({ pipeline }) => {
fullWidth fullWidth
margin="normal" margin="normal"
/> />
<Field
component={TextField}
name="environment"
label="Environment"
fullWidth
margin="normal"
/>
<Paper className={classes.metadataContainer}> <Paper className={classes.metadataContainer}>
<Field <Field
component={TextField} component={TextField}

View File

@ -13,6 +13,12 @@ import { FC, useMemo, useState, MouseEvent } from "react";
import { Pipeline, Project } from "../generated/graphql"; import { Pipeline, Project } from "../generated/graphql";
import { CallMerge } from "@mui/icons-material"; import { CallMerge } from "@mui/icons-material";
import { Divider } from "@material-ui/core"; import { Divider } from "@material-ui/core";
import { Box } from "@mui/system";
import {
faCodeBranch,
faMapMarkerAlt,
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
interface Props { interface Props {
projectId: string; projectId: string;
@ -24,6 +30,7 @@ const PIPELINES = gql`
id id
name name
branch branch
environment
} }
project(id: $projectId) { project(id: $projectId) {
id id
@ -140,10 +147,44 @@ const Item = ({ pipeline }: { pipeline: Pipeline }) => {
<ListItemText <ListItemText
primary={pipeline.name} primary={pipeline.name}
secondary={ secondary={
<Typography component="span" variant="body2" color="textSecondary"> <Box sx={{ display: "flex", flexFlow: "column" }}>
<CallMerge fontSize="small" /> <Box
{pipeline.branch} sx={{
</Typography> display: "flex",
alignItems: "center",
}}
>
<FontAwesomeIcon
style={{ width: "1em", marginRight: "0.5em" }}
icon={faCodeBranch}
/>
<Typography
component="span"
variant="body2"
color="textSecondary"
>
{pipeline.branch}
</Typography>
</Box>
<Box
sx={{
display: "flex",
alignItems: "center",
}}
>
<FontAwesomeIcon
style={{ width: "1em", marginRight: "0.5em" }}
icon={faMapMarkerAlt}
/>
<Typography
component="span"
variant="body2"
color="textSecondary"
>
{pipeline.environment}
</Typography>
</Box>
</Box>
} }
/> />
</ListItem> </ListItem>

View File

@ -7,6 +7,7 @@ export const PIPELINE = gql`
name name
projectId projectId
branch branch
environment
workUnitMetadata { workUnitMetadata {
version version
units { units {