-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOCS-2387: Adds FelixConfig component to CE
- Loading branch information
Showing
8 changed files
with
8,607 additions
and
545 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
calico-enterprise/_includes/components/FelixConfig/TableConfig.js
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,55 @@ | ||
import React from 'react'; | ||
import DOMPurify from 'isomorphic-dompurify'; | ||
import styles from './styles.module.css'; | ||
|
||
const getSanitizedData = ({ fieldData }) => ({ | ||
sanitizedDescription: { __html: DOMPurify.sanitize(fieldData.DescriptionHTML) }, | ||
sanitizedSchema: { __html: DOMPurify.sanitize(fieldData.StringSchemaHTML) }, | ||
}); | ||
|
||
const TableConfig = ({ fieldData }) => { | ||
const { sanitizedDescription, sanitizedSchema } = getSanitizedData({ fieldData }); | ||
|
||
return ( | ||
<table className={styles.felixTable}> | ||
<thead> | ||
<tr> | ||
<th>Attribute</th> | ||
<th>Value</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Key</td> | ||
<td> | ||
<code>{fieldData.NameConfigFile || 'No Default Value'}</code> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Description</td> | ||
<td dangerouslySetInnerHTML={sanitizedDescription} /> | ||
</tr> | ||
<tr> | ||
<td>Schema</td> | ||
<td dangerouslySetInnerHTML={sanitizedSchema} /> | ||
</tr> | ||
<tr> | ||
<td>Default</td> | ||
<td> | ||
{fieldData.StringDefault === '' ? ( | ||
'none' | ||
) : fieldData.GoType === '*v1.Duration' ? ( | ||
<> | ||
<code>{fieldData.StringDefault}</code> ({fieldData.ParsedDefault}) | ||
</> | ||
) : ( | ||
<code>{fieldData.StringDefault}</code> | ||
)} | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
); | ||
}; | ||
|
||
export default TableConfig; |
55 changes: 55 additions & 0 deletions
55
calico-enterprise/_includes/components/FelixConfig/TableEnv.js
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,55 @@ | ||
import React from 'react'; | ||
import DOMPurify from 'isomorphic-dompurify'; | ||
import styles from './styles.module.css'; | ||
|
||
const getSanitizedData = ({ fieldData }) => ({ | ||
sanitizedDescription: { __html: DOMPurify.sanitize(fieldData.DescriptionHTML) }, | ||
sanitizedSchema: { __html: DOMPurify.sanitize(fieldData.StringSchemaHTML) }, | ||
}); | ||
|
||
const TableEnv = ({ fieldData }) => { | ||
const { sanitizedDescription, sanitizedSchema } = getSanitizedData({ fieldData }); | ||
|
||
return ( | ||
<table className={styles.felixTable}> | ||
<thead> | ||
<tr> | ||
<th>Attribute</th> | ||
<th>Value</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Key</td> | ||
<td> | ||
<code>{fieldData.NameEnvVar.toUpperCase() || 'No Default Value'}</code> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Description</td> | ||
<td dangerouslySetInnerHTML={sanitizedDescription} /> | ||
</tr> | ||
<tr> | ||
<td>Schema</td> | ||
<td dangerouslySetInnerHTML={sanitizedSchema} /> | ||
</tr> | ||
<tr> | ||
<td>Default</td> | ||
<td> | ||
{fieldData.StringDefault === '' ? ( | ||
'none' | ||
) : fieldData.GoType === '*v1.Duration' ? ( | ||
<> | ||
<code>{fieldData.StringDefault}</code> ({fieldData.ParsedDefault}) | ||
</> | ||
) : ( | ||
<code>{fieldData.StringDefault}</code> | ||
)} | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
); | ||
}; | ||
|
||
export default TableEnv; |
46 changes: 46 additions & 0 deletions
46
calico-enterprise/_includes/components/FelixConfig/TableResource.js
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,46 @@ | ||
import React from 'react'; | ||
import DOMPurify from 'isomorphic-dompurify'; | ||
import styles from './styles.module.css'; | ||
|
||
const getSanitizedData = ({ fieldData }) => ({ | ||
sanitizedNAMEYAML: { __html: DOMPurify.sanitize(fieldData.NameYAML) }, | ||
sanitizedDescription: { __html: DOMPurify.sanitize(fieldData.DescriptionHTML) }, | ||
sanitizedSchema: { __html: DOMPurify.sanitize(fieldData.YAMLSchemaHTML) }, | ||
}); | ||
|
||
const TableResource = ({ fieldData }) => { | ||
const { sanitizedNAMEYAML, sanitizedDescription, sanitizedSchema } = getSanitizedData({ fieldData }); | ||
|
||
return ( | ||
<table className={styles.felixTable}> | ||
<thead> | ||
<tr> | ||
<th>Attribute</th> | ||
<th>Value</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Key</td> | ||
<td> | ||
<code dangerouslySetInnerHTML={sanitizedNAMEYAML} /> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Description</td> | ||
<td dangerouslySetInnerHTML={sanitizedDescription} /> | ||
</tr> | ||
<tr> | ||
<td>Schema</td> | ||
<td dangerouslySetInnerHTML={sanitizedSchema} /> | ||
</tr> | ||
<tr> | ||
<td>Default</td> | ||
<td>{fieldData.YAMLDefault === '' ? 'none' : <code>{fieldData.YAMLDefault}</code>}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
); | ||
}; | ||
|
||
export default TableResource; |
Oops, something went wrong.