Create search experiences for your content, wherever it lives.
= Omit< RouteConfig
,
@@ -201,11 +202,15 @@ export class Router ,
handler: RequestHandler ,
- { isVersioned }: { isVersioned: boolean } = { isVersioned: false }
+ { isVersioned }: InternalRegistrarOptions = { isVersioned: false }
) => {
route = prepareRouteConfigValidation(route);
const routeSchemas = routeSchemasFromRouteConfig(route, method);
- const isPublicUnversionedRoute = route.options?.access === 'public' && !isVersioned;
+ const isPublicUnversionedApi =
+ !isVersioned &&
+ route.options?.access === 'public' &&
+ // We do not consider HTTP resource routes as APIs
+ route.options?.httpResource !== true;
this.routes.push({
handler: async (req, responseToolkit) =>
@@ -213,7 +218,7 @@ export class Router
{RULE_FORM_ROUTE_PARAMS_ERROR_TEXT}
-{RULE_FORM_ROUTE_PARAMS_ERROR_TEXT}
+{RULE_FORM_CANCEL_MODAL_DESCRIPTION}
+ + )} + > ); }; diff --git a/packages/kbn-alerts-ui-shared/src/rule_form/rule_page/rule_page_footer.test.tsx b/packages/kbn-alerts-ui-shared/src/rule_form/rule_page/rule_page_footer.test.tsx index 45e200877358..d937c60aa3a5 100644 --- a/packages/kbn-alerts-ui-shared/src/rule_form/rule_page/rule_page_footer.test.tsx +++ b/packages/kbn-alerts-ui-shared/src/rule_form/rule_page/rule_page_footer.test.tsx @@ -32,15 +32,27 @@ const onSave = jest.fn(); const onCancel = jest.fn(); hasRuleErrors.mockReturnValue(false); -useRuleFormState.mockReturnValue({ - baseErrors: {}, - paramsErrors: {}, - formData: { - actions: [], - }, -}); describe('rulePageFooter', () => { + beforeEach(() => { + useRuleFormState.mockReturnValue({ + plugins: { + application: { + capabilities: { + actions: { + show: true, + }, + }, + }, + }, + baseErrors: {}, + paramsErrors: {}, + formData: { + actions: [], + }, + }); + }); + afterEach(() => { jest.clearAllMocks(); }); @@ -75,6 +87,30 @@ describe('rulePageFooter', () => { expect(screen.getByTestId('rulePageConfirmCreateRule')).toBeInTheDocument(); }); + test('should not show creat rule confirmation if user cannot read actions', () => { + useRuleFormState.mockReturnValue({ + plugins: { + application: { + capabilities: { + actions: { + show: false, + }, + }, + }, + }, + baseErrors: {}, + paramsErrors: {}, + formData: { + actions: [], + }, + }); + + render(