diff --git a/docs/cli/file-format.md b/docs/cli/file-format.md index cdb55d9b7d..e4f3192581 100644 --- a/docs/cli/file-format.md +++ b/docs/cli/file-format.md @@ -155,6 +155,22 @@ spec: ); ``` +Labels can also be "manually managed". When defining the label, reference hosts +by hostname: + +```yaml +apiVersion: v1 +kind: label +spec: + name: Manually Managed Example + label_membership_type: manual + hosts: + - hostname1 + - hostname2 + - hostname3 +``` + + ## Osquery Configuration Options The following file describes options returned to osqueryd when it checks for configuration. See the [osquery documentation](https://osquery.readthedocs.io/en/stable/deployment/configuration/#options) for the available options. Existing options will be over-written by the application of this file. diff --git a/frontend/components/forms/LabelForm/LabelForm.jsx b/frontend/components/forms/LabelForm/LabelForm.jsx index 647a34991c..fc5d1f84ef 100644 --- a/frontend/components/forms/LabelForm/LabelForm.jsx +++ b/frontend/components/forms/LabelForm/LabelForm.jsx @@ -22,6 +22,9 @@ class LabelForm extends Component { platform: formFieldInterface.isRequired, query: formFieldInterface.isRequired, }).isRequired, + formData: PropTypes.shape({ + label_membership_type: PropTypes.string, + }), handleSubmit: PropTypes.func.isRequired, isEdit: PropTypes.bool, onCancel: PropTypes.func.isRequired, @@ -50,24 +53,35 @@ class LabelForm extends Component { } render () { - const { baseError, fields, handleSubmit, isEdit, onCancel } = this.props; + const { baseError, fields, handleSubmit, isEdit, onCancel, formData } = this.props; const { onLoad } = this; + const isBuiltin = formData && (formData.label_type === 'builtin' || formData.type === 'status'); + const isManual = formData && formData.label_membership_type === 'manual'; const headerText = isEdit ? 'Edit Label' : 'New Label'; const saveBtnText = isEdit ? 'Update Label' : 'Save Label'; const aceHintText = isEdit ? 'Label queries are immutable. To change the query, delete this label and create a new one.' : ''; + if (isBuiltin) { + return ( +
+

Built in labels cannot be edited

+
+ ); + } + return (

{headerText}

- {aceHintText}} + hint={aceHintText} handleSubmit={noop} /> + )} {baseError &&
{baseError}
} -
+ {!isManual && + (
-
+
)}