Skip to content

Commit

Permalink
Hide stream rule Matching-Type-Switcher when stream is not editable (#…
Browse files Browse the repository at this point in the history
…20714)

* hide StreamRule MatchingTypeSwitcher when stream isNotEditable

* changelog file

* disable MatchingTypeSwitcher instead of hiding it
  • Loading branch information
gally47 authored Oct 18, 2024
1 parent ea1a4de commit 59b1c02
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions changelog/unreleased/pr-20714.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type = "fixed"
message = "Hide stream rule Matching-Type-Switcher when stream is not editable"

pulls = ["20714"]
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type Props = {

const MatchingTypeSwitcher = ({ stream, onChange }: Props) => {
const [matchingType, setMatchingType] = useState<'AND'|'OR'|undefined>(undefined);
const disabled = stream.is_default || !stream.is_editable;

const handleTypeChange = (newValue: 'AND'|'OR') => {
StreamsStore.update(stream.id, { matching_type: newValue }, (response) => {
Expand All @@ -72,12 +73,14 @@ const MatchingTypeSwitcher = ({ stream, onChange }: Props) => {
type="radio"
label="A message must match all of the following rules"
checked={stream.matching_type === 'AND'}
onChange={() => setMatchingType('AND')} />
onChange={() => setMatchingType('AND')}
disabled={disabled} />
<Input id="streamrule-or-connector"
type="radio"
label="A message must match at least one of the following rules"
checked={stream.matching_type === 'OR'}
onChange={() => setMatchingType('OR')} />
onChange={() => setMatchingType('OR')}
disabled={disabled} />
</div>
{matchingType && (
<ConfirmDialog show
Expand Down

0 comments on commit 59b1c02

Please sign in to comment.