diff --git a/graylog2-web-interface/src/components/event-definitions/event-definition-form/EventConditionForm.tsx b/graylog2-web-interface/src/components/event-definitions/event-definition-form/EventConditionForm.tsx index 2c568d06ca89..742244940186 100644 --- a/graylog2-web-interface/src/components/event-definitions/event-definition-form/EventConditionForm.tsx +++ b/graylog2-web-interface/src/components/event-definitions/event-definition-form/EventConditionForm.tsx @@ -109,6 +109,7 @@ const EventConditionForm = ({ action, entityTypes, eventDefinition, validation, }; const disabledSelect = () => !formattedEventDefinitionTypes().some((edt) => eventDefinition.config.type === edt.value) && action === 'edit'; + const onlyFilters = () => eventDefinition._scope === 'ILLUMINATE' && action === 'edit'; const eventDefinitionType = getConditionPlugin(eventDefinition.config.type); const isSystemEventDefinition = eventDefinition.config.type === SYSTEM_EVENT_DEFINITION_TYPE; @@ -148,7 +149,7 @@ const EventConditionForm = ({ action, entityTypes, eventDefinition, validation, value={eventDefinition.config.type} onChange={handleEventDefinitionTypeChange} clearable={false} - disabled={disabledSelect()} + disabled={disabledSelect() || onlyFilters()} required /> {get(validation, 'errors.config[0]', 'Choose the type of Condition for this Event.')} diff --git a/graylog2-web-interface/src/components/event-definitions/event-definition-form/EventDefinitionForm.tsx b/graylog2-web-interface/src/components/event-definitions/event-definition-form/EventDefinitionForm.tsx index 31dcd3c6e0f2..b4635d49ca56 100644 --- a/graylog2-web-interface/src/components/event-definitions/event-definition-form/EventDefinitionForm.tsx +++ b/graylog2-web-interface/src/components/event-definitions/event-definition-form/EventDefinitionForm.tsx @@ -131,6 +131,10 @@ const EventDefinitionForm = ({ currentUser, }; + const canEditCondition = React.useMemo(() => ( + canEdit || eventDefinition._scope.toUpperCase() === 'ILLUMINATE' + ), [canEdit, eventDefinition._scope]); + const eventDefinitionType = getConditionPlugin(eventDefinition.config.type); const steps = [ @@ -142,7 +146,7 @@ const EventDefinitionForm = ({ { key: STEP_KEYS[1], title: defaultTo(eventDefinitionType.displayName, 'Condition'), - component: , + component: , }, { key: STEP_KEYS[2], diff --git a/graylog2-web-interface/src/components/event-definitions/event-definition-types/FilterAggregationForm.jsx b/graylog2-web-interface/src/components/event-definitions/event-definition-types/FilterAggregationForm.jsx index 5125a8318488..3747980b8dea 100644 --- a/graylog2-web-interface/src/components/event-definitions/event-definition-types/FilterAggregationForm.jsx +++ b/graylog2-web-interface/src/components/event-definitions/event-definition-types/FilterAggregationForm.jsx @@ -129,6 +129,8 @@ class FilterAggregationForm extends React.Component { const { conditionType } = this.state; const { entityTypes, eventDefinition, streams, validation, currentUser } = this.props; + const onlyFilters = eventDefinition._scope === 'ILLUMINATE'; + return ( <> @@ -139,24 +141,26 @@ class FilterAggregationForm extends React.Component { currentUser={currentUser} onChange={this.props.onChange} /> - - Create Events for Definition if... - - Filter has results - - - Aggregation of results reaches a threshold - - - {conditionType === conditionTypes.FILTER && ( + {onlyFilters || ( + + Create Events for Definition if... + + Filter has results + + + Aggregation of results reaches a threshold + + + )} + {(conditionType === conditionTypes.FILTER && !onlyFilters) && ( )} - - {conditionType === conditionTypes.AGGREGATION && ( + {(conditionType === conditionTypes.AGGREGATION && !onlyFilters) && ( s.id), defaultTo(eventDefinition.config.streams, [])); const formattedStreams = this.formatStreamIds(allStreamIds); @@ -340,25 +342,27 @@ class FilterForm extends React.Component {

Filter

Add information to filter the log messages that are relevant for this Event Definition.

- - Search query that Messages should match. You can use the same syntax as in the Search page, - including declaring Query Parameters from Lookup Tables by using the $newParameter$ syntax. - - )} - value={defaultTo(eventDefinition.config.query, '')} - onChange={this.handleQueryChange} /> - - {this.renderQueryParameters()} + {onlyFilters || ( + + Search query that Messages should match. You can use the same syntax as in the Search page, + including declaring Query Parameters from Lookup Tables by using the $newParameter$ syntax. + + )} + value={defaultTo(eventDefinition.config.query, '')} + onChange={this.handleQueryChange} /> + )} + + {onlyFilters || this.renderQueryParameters()} {!this.state.searchFiltersHidden && ( Search Filters (Optional) -
+
@@ -366,48 +370,52 @@ class FilterForm extends React.Component { )} - - Streams (Optional) - this.handleStreamsChange(selected === '' ? [] : selected.split(','))} - options={formattedStreams} - value={defaultTo(eventDefinition.config.streams, []).join(',')} /> - Select streams the search should include. Searches in all streams if empty. - - - - - {validation.errors.search_within_ms && ( - {get(validation, 'errors.search_within_ms[0]')} - )} - - - - - {validation.errors.execute_every_ms && ( - {get(validation, 'errors.execute_every_ms[0]')} - )} - - + {onlyFilters || ( + <> + + Streams (Optional) + this.handleStreamsChange(selected === '' ? [] : selected.split(','))} + options={formattedStreams} + value={defaultTo(eventDefinition.config.streams, []).join(',')} /> + Select streams the search should include. Searches in all streams if empty. + + + + + {validation.errors.search_within_ms && ( + {get(validation, 'errors.search_within_ms[0]')} + )} + + + + + {validation.errors.execute_every_ms && ( + {get(validation, 'errors.execute_every_ms[0]')} + )} + + + + )}
); }