INFRA-614 | Abhishek | Add changes to disable editing of name and environment while editing manifest
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
import * as React from 'react';
|
||||
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||
import {makeStyles, Theme} from '@material-ui/core/styles';
|
||||
import Tabs from '@material-ui/core/Tabs';
|
||||
import Tab from '@material-ui/core/Tab';
|
||||
import ManifestForm from './ManifestForm'
|
||||
import DatabaseForm from './DatabaseForm'
|
||||
import * as _m from '../models/Manifest'
|
||||
import { Formik, Form, FormikProps } from 'formik';
|
||||
import { manifestValidationSchema } from "../models/ManifestValidationSchema";
|
||||
import { tabA11yProps, TabPanel } from './FormUtil';
|
||||
import {Form, Formik, FormikProps} from 'formik';
|
||||
import {manifestValidationSchema} from "../models/ManifestValidationSchema";
|
||||
import {tabA11yProps, TabPanel} from './FormUtil';
|
||||
import EnvironmentVariablesForm from './EnvironmentVariablesForm';
|
||||
import S3BucketForm from './S3BucketForm';
|
||||
import _ from 'lodash'
|
||||
import { Divider, Snackbar, Typography, Button } from '@material-ui/core';
|
||||
import { Alert } from "@material-ui/lab";
|
||||
import {Button, Divider, Snackbar, Typography} from '@material-ui/core';
|
||||
import {Alert} from "@material-ui/lab";
|
||||
import DeploymentForm from './DeploymentForm';
|
||||
import AWSAccessForm from './AWSAccessForm';
|
||||
|
||||
@@ -127,7 +126,7 @@ const BaseForm = (props: BaseFormProps) => {
|
||||
{
|
||||
props => (
|
||||
<Form>
|
||||
<ManifestForm />
|
||||
<ManifestForm id={props.values.id} />
|
||||
<Divider />
|
||||
<div className={classes.root}>
|
||||
<Tabs orientation="vertical" variant="scrollable" value={currentTab} onChange={handleTabChange}
|
||||
@@ -150,7 +149,7 @@ const BaseForm = (props: BaseFormProps) => {
|
||||
<Button color="secondary" type="submit" variant="contained" size="large" style={{ float: "right", marginRight: 100 }} >
|
||||
Submit
|
||||
</Button>
|
||||
{/* <Debug {...props} /> */}
|
||||
<Debug {...props} />
|
||||
<ErrorSnackBar errors={props.errors} />
|
||||
</Form>
|
||||
)
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { Grid, Box } from '@material-ui/core';
|
||||
import { toMenuItems } from './FormUtil';
|
||||
import { FormikTextField } from '../components/common/FormikTextField';
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
import {Box, Grid, makeStyles} from '@material-ui/core';
|
||||
import {toMenuItems} from './FormUtil';
|
||||
import {FormikTextField} from '../components/common/FormikTextField';
|
||||
import * as _m from '../models/Manifest'
|
||||
|
||||
const environments = ["dev", "qa", "prod"]
|
||||
@@ -22,16 +21,28 @@ const useStyles = makeStyles({
|
||||
});
|
||||
|
||||
|
||||
const ManifestForm = () => {
|
||||
const ManifestForm = (props: any) => {
|
||||
const classes = useStyles();
|
||||
const [id] = React.useState(props.id)
|
||||
return (
|
||||
<Box className={classes.box}>
|
||||
<Grid container direction="row" justify="space-evenly" alignItems="center">
|
||||
<FormikTextField className={classes.field} label="Name" name="name" />
|
||||
<FormikTextField className={classes.field} select label="Environment" name="environment" >
|
||||
{toMenuItems(environments)}
|
||||
</FormikTextField>
|
||||
<FormikTextField className={classes.field} select label="Team" name="team.name" >
|
||||
{id === undefined ? (
|
||||
<React.Fragment>
|
||||
<FormikTextField id={id} className={classes.field} label="Name" name="name"/>
|
||||
<FormikTextField id={id} className={classes.field} select label="Environment" name="environment">
|
||||
{toMenuItems(environments)}
|
||||
</FormikTextField>
|
||||
</React.Fragment>
|
||||
)
|
||||
:
|
||||
(<React.Fragment>
|
||||
<FormikTextField id={id} className={classes.field} disabled label="Name" name="name"/>
|
||||
<FormikTextField id={id} className={classes.field} disabled label="Environment" name="environment" />
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
<FormikTextField className={classes.field} select label="Team" name="team.name">
|
||||
{toMenuItems(_m.teams)}
|
||||
</FormikTextField>
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user