Skip to content

Commit

Permalink
Fix create alert button from not showing in alerts list (#60444)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecote authored Mar 18, 2020
1 parent 70c1b69 commit a97ecaa
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 53 deletions.
7 changes: 0 additions & 7 deletions x-pack/legacy/plugins/triggers_actions_ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@ export function triggersActionsUI(kibana: any) {
return Joi.object()
.keys({
enabled: Joi.boolean().default(true),
createAlertUiEnabled: Joi.boolean().default(false),
})
.default();
},
uiExports: {
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
injectDefaultVars(server: Legacy.Server) {
const serverConfig = server.config();
return {
createAlertUiEnabled: serverConfig.get('xpack.triggers_actions_ui.createAlertUiEnabled'),
};
},
},
});
}
6 changes: 0 additions & 6 deletions x-pack/plugins/triggers_actions_ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ As a developer you can reuse and extend built-in alerts and actions UI functiona
- Create and register a new Action Type.
- Embed the Create Alert flyout within any Kibana plugin.

To enable Alerts and Actions UIs, the following configuration settings are needed:
```
xpack.triggers_actions_ui.enabled: true
xpack.triggers_actions_ui.createAlertUiEnabled: true
```

-----


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export interface AppDeps {
chrome: ChromeStart;
docLinks: DocLinksStart;
toastNotifications: ToastsSetup;
injectedMetadata: any;
http: HttpSetup;
uiSettings: IUiSettingsClient;
setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ describe('actions_connectors_list component empty', () => {
dataPlugin: dataPluginMock.createStartContract(),
charts: chartPluginMock.createStartContract(),
toastNotifications: mockes.notifications.toasts,
injectedMetadata: mockes.injectedMetadata,
http: mockes.http,
uiSettings: mockes.uiSettings,
capabilities: {
Expand Down Expand Up @@ -155,7 +154,6 @@ describe('actions_connectors_list component with items', () => {
dataPlugin: dataPluginMock.createStartContract(),
charts: chartPluginMock.createStartContract(),
toastNotifications: mockes.notifications.toasts,
injectedMetadata: mockes.injectedMetadata,
http: mockes.http,
uiSettings: mockes.uiSettings,
capabilities: {
Expand Down Expand Up @@ -239,7 +237,6 @@ describe('actions_connectors_list component empty with show only capability', ()
dataPlugin: dataPluginMock.createStartContract(),
charts: chartPluginMock.createStartContract(),
toastNotifications: mockes.notifications.toasts,
injectedMetadata: mockes.injectedMetadata,
http: mockes.http,
uiSettings: mockes.uiSettings,
capabilities: {
Expand Down Expand Up @@ -328,7 +325,6 @@ describe('actions_connectors_list with show only capability', () => {
dataPlugin: dataPluginMock.createStartContract(),
charts: chartPluginMock.createStartContract(),
toastNotifications: mockes.notifications.toasts,
injectedMetadata: mockes.injectedMetadata,
http: mockes.http,
uiSettings: mockes.uiSettings,
capabilities: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ describe('alert_add', () => {
const mockes = coreMock.createSetup();
deps = {
toastNotifications: mockes.notifications.toasts,
injectedMetadata: mockes.injectedMetadata,
http: mockes.http,
uiSettings: mockes.uiSettings,
dataPlugin: dataPluginMock.createStartContract(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,6 @@ describe('alerts_list component empty', () => {
dataPlugin: dataPluginMock.createStartContract(),
charts: chartPluginMock.createStartContract(),
toastNotifications: mockes.notifications.toasts,
injectedMetadata: {
getInjectedVar(name: string) {
if (name === 'createAlertUiEnabled') {
return true;
}
},
} as any,
http: mockes.http,
uiSettings: mockes.uiSettings,
capabilities: {
Expand Down Expand Up @@ -220,13 +213,6 @@ describe('alerts_list component with items', () => {
dataPlugin: dataPluginMock.createStartContract(),
charts: chartPluginMock.createStartContract(),
toastNotifications: mockes.notifications.toasts,
injectedMetadata: {
getInjectedVar(name: string) {
if (name === 'createAlertUiEnabled') {
return true;
}
},
} as any,
http: mockes.http,
uiSettings: mockes.uiSettings,
capabilities: {
Expand Down Expand Up @@ -315,13 +301,6 @@ describe('alerts_list component empty with show only capability', () => {
dataPlugin: dataPluginMock.createStartContract(),
charts: chartPluginMock.createStartContract(),
toastNotifications: mockes.notifications.toasts,
injectedMetadata: {
getInjectedVar(name: string) {
if (name === 'createAlertUiEnabled') {
return true;
}
},
} as any,
http: mockes.http,
uiSettings: mockes.uiSettings,
capabilities: {
Expand Down Expand Up @@ -439,13 +418,6 @@ describe('alerts_list with show only capability', () => {
dataPlugin: dataPluginMock.createStartContract(),
charts: chartPluginMock.createStartContract(),
toastNotifications: mockes.notifications.toasts,
injectedMetadata: {
getInjectedVar(name: string) {
if (name === 'createAlertUiEnabled') {
return true;
}
},
} as any,
http: mockes.http,
uiSettings: mockes.uiSettings,
capabilities: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export const AlertsList: React.FunctionComponent = () => {
const history = useHistory();
const {
http,
injectedMetadata,
toastNotifications,
capabilities,
alertTypeRegistry,
Expand All @@ -63,7 +62,6 @@ export const AlertsList: React.FunctionComponent = () => {
} = useAppDependencies();
const canDelete = hasDeleteAlertsCapability(capabilities);
const canSave = hasSaveAlertsCapability(capabilities);
const createAlertUiEnabled = injectedMetadata.getInjectedVar('createAlertUiEnabled');

const [actionTypes, setActionTypes] = useState<ActionType[]>([]);
const [selectedIds, setSelectedIds] = useState<string[]>([]);
Expand Down Expand Up @@ -273,7 +271,7 @@ export const AlertsList: React.FunctionComponent = () => {
/>,
];

if (canSave && createAlertUiEnabled) {
if (canSave) {
toolsRight.push(
<EuiButton
key="create-alert"
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/triggers_actions_ui/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export class Plugin
charts: plugins.charts,
element: params.element,
toastNotifications: core.notifications.toasts,
injectedMetadata: core.injectedMetadata,
http: core.http,
uiSettings: core.uiSettings,
docLinks: core.docLinks,
Expand Down
2 changes: 0 additions & 2 deletions x-pack/test/functional_with_es_ssl/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ export default async function({ readConfigFile }: FtrConfigProviderContext) {
`--plugin-path=${join(__dirname, 'fixtures', 'plugins', 'alerts')}`,
'--xpack.actions.enabled=true',
'--xpack.alerting.enabled=true',
'--xpack.triggers_actions_ui.enabled=true',
'--xpack.triggers_actions_ui.createAlertUiEnabled=true',
],
},
};
Expand Down

0 comments on commit a97ecaa

Please sign in to comment.