-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add yaml editor for values.yaml in helm install form
- Loading branch information
1 parent
883c693
commit 9261dd1
Showing
8 changed files
with
173 additions
and
73 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
frontend/packages/console-shared/src/components/formik-fields/YAMLEditorField.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.yaml-editor-formik-field { | ||
margin: 0 !important; | ||
padding: 0 !important; | ||
} |
31 changes: 31 additions & 0 deletions
31
frontend/packages/console-shared/src/components/formik-fields/YAMLEditorField.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import * as React from 'react'; | ||
import { FormikValues, useField, useFormikContext } from 'formik'; | ||
import { FormGroup } from '@patternfly/react-core'; | ||
import { YAMLEditorFieldProps } from './field-types'; | ||
import { getFieldId } from './field-utils'; | ||
import { AsyncComponent } from '@console/internal/components/utils'; | ||
import './YAMLEditorField.scss'; | ||
|
||
const YAMLEditorField: React.FC<YAMLEditorFieldProps> = ({ name }) => { | ||
const [field] = useField(name); | ||
const { setFieldValue } = useFormikContext<FormikValues>(); | ||
const fieldId = getFieldId(name, 'yaml-editor'); | ||
|
||
return ( | ||
<FormGroup fieldId={fieldId}> | ||
<AsyncComponent | ||
loader={() => import('@console/internal/components/edit-yaml').then((c) => c.EditYAML)} | ||
obj={field.value} | ||
onChange={(yaml: string) => setFieldValue(name, yaml)} | ||
download={false} | ||
customClass="yaml-editor-formik-field" | ||
create | ||
hideHeader | ||
genericYAML | ||
hideActions | ||
/> | ||
</FormGroup> | ||
); | ||
}; | ||
|
||
export default YAMLEditorField; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters