diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_status_dropdown.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_status_dropdown.test.tsx
index 4f7df21ee53e1..d482608598336 100644
--- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_status_dropdown.test.tsx
+++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_status_dropdown.test.tsx
@@ -22,6 +22,7 @@ describe('RuleStatusDropdown', () => {
enableRule,
snoozeRule,
unsnoozeRule,
+ isEditable: true,
item: {
id: '1',
name: 'test rule',
@@ -114,4 +115,19 @@ describe('RuleStatusDropdown', () => {
'Disabled'
);
});
+
+ test('renders read-only status control when isEditable is false', () => {
+ const wrapper = mountWithIntl(
+
+ );
+ expect(wrapper.find('[data-test-subj="statusDropdownReadonly"]').first().props().children).toBe(
+ 'Enabled'
+ );
+ });
});
diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_status_dropdown.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_status_dropdown.tsx
index 756e4e3a1bc8b..485a5f3a5cfc6 100644
--- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_status_dropdown.tsx
+++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_status_dropdown.tsx
@@ -115,11 +115,17 @@ export const RuleStatusDropdown: React.FunctionComponent = ({
) : null;
- const badge = (
+ const nonEditableBadge = (
+
+ {badgeMessage}
+
+ );
+
+ const editableBadge = (
= ({
responsive={false}
>
-
-
-
+ {isEditable ? (
+
+
+
+ ) : (
+ nonEditableBadge
+ )}
{remainingSnoozeTime}
diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx
index abd9a46c3f51d..af66fa6c93f1a 100644
--- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx
+++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx
@@ -358,6 +358,7 @@ export const RulesList: React.FunctionComponent = () => {
unsnoozeRule={async () => await unsnoozeRule({ http, id: item.id })}
item={item}
onRuleChanged={() => loadRulesData()}
+ isEditable={item.isEditable && isRuleTypeEditableInContext(item.ruleTypeId)}
/>
);
};