Skip to content

Commit

Permalink
Merge branch 'master' into refactor_connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Apr 30, 2020
2 parents 3603141 + 497c5da commit 269d164
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 242 deletions.
4 changes: 2 additions & 2 deletions x-pack/plugins/ml/common/types/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export const userMlCapabilities = {
canGetCalendars: false,
// File Data Visualizer
canFindFileStructure: false,
// Filters
canGetFilters: false,
// Data Frame Analytics
canGetDataFrameAnalytics: false,
// Annotations
Expand All @@ -38,6 +36,8 @@ export const adminMlCapabilities = {
canStartStopDatafeed: false,
canUpdateDatafeed: false,
canPreviewDatafeed: false,
// Filters
canGetFilters: false,
// Calendars
canCreateCalendar: false,
canDeleteCalendar: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ describe('check_capabilities', () => {
expect(capabilities.canGetDatafeeds).toBe(true);
expect(capabilities.canGetCalendars).toBe(true);
expect(capabilities.canFindFileStructure).toBe(true);
expect(capabilities.canGetFilters).toBe(true);
expect(capabilities.canGetDataFrameAnalytics).toBe(true);
expect(capabilities.canGetAnnotations).toBe(true);
expect(capabilities.canCreateAnnotation).toBe(true);
Expand All @@ -81,6 +80,7 @@ describe('check_capabilities', () => {
expect(capabilities.canDeleteDatafeed).toBe(false);
expect(capabilities.canUpdateDatafeed).toBe(false);
expect(capabilities.canPreviewDatafeed).toBe(false);
expect(capabilities.canGetFilters).toBe(false);
expect(capabilities.canCreateCalendar).toBe(false);
expect(capabilities.canDeleteCalendar).toBe(false);
expect(capabilities.canCreateFilter).toBe(false);
Expand Down Expand Up @@ -113,7 +113,6 @@ describe('check_capabilities', () => {
expect(capabilities.canGetDatafeeds).toBe(true);
expect(capabilities.canGetCalendars).toBe(true);
expect(capabilities.canFindFileStructure).toBe(true);
expect(capabilities.canGetFilters).toBe(true);
expect(capabilities.canGetDataFrameAnalytics).toBe(true);
expect(capabilities.canGetAnnotations).toBe(true);
expect(capabilities.canCreateAnnotation).toBe(true);
Expand All @@ -130,6 +129,7 @@ describe('check_capabilities', () => {
expect(capabilities.canDeleteDatafeed).toBe(true);
expect(capabilities.canUpdateDatafeed).toBe(true);
expect(capabilities.canPreviewDatafeed).toBe(true);
expect(capabilities.canGetFilters).toBe(true);
expect(capabilities.canCreateCalendar).toBe(true);
expect(capabilities.canDeleteCalendar).toBe(true);
expect(capabilities.canCreateFilter).toBe(true);
Expand Down Expand Up @@ -162,7 +162,6 @@ describe('check_capabilities', () => {
expect(capabilities.canGetDatafeeds).toBe(true);
expect(capabilities.canGetCalendars).toBe(true);
expect(capabilities.canFindFileStructure).toBe(true);
expect(capabilities.canGetFilters).toBe(true);
expect(capabilities.canGetDataFrameAnalytics).toBe(true);
expect(capabilities.canGetAnnotations).toBe(true);
expect(capabilities.canCreateAnnotation).toBe(false);
Expand All @@ -177,6 +176,7 @@ describe('check_capabilities', () => {
expect(capabilities.canUpdateJob).toBe(false);
expect(capabilities.canCreateDatafeed).toBe(false);
expect(capabilities.canDeleteDatafeed).toBe(false);
expect(capabilities.canGetFilters).toBe(false);
expect(capabilities.canUpdateDatafeed).toBe(false);
expect(capabilities.canPreviewDatafeed).toBe(false);
expect(capabilities.canCreateCalendar).toBe(false);
Expand Down Expand Up @@ -211,7 +211,6 @@ describe('check_capabilities', () => {
expect(capabilities.canGetDatafeeds).toBe(true);
expect(capabilities.canGetCalendars).toBe(true);
expect(capabilities.canFindFileStructure).toBe(true);
expect(capabilities.canGetFilters).toBe(true);
expect(capabilities.canGetDataFrameAnalytics).toBe(true);
expect(capabilities.canGetAnnotations).toBe(true);
expect(capabilities.canCreateAnnotation).toBe(false);
Expand All @@ -228,6 +227,7 @@ describe('check_capabilities', () => {
expect(capabilities.canDeleteDatafeed).toBe(false);
expect(capabilities.canUpdateDatafeed).toBe(false);
expect(capabilities.canPreviewDatafeed).toBe(false);
expect(capabilities.canGetFilters).toBe(false);
expect(capabilities.canCreateCalendar).toBe(false);
expect(capabilities.canDeleteCalendar).toBe(false);
expect(capabilities.canCreateFilter).toBe(false);
Expand Down Expand Up @@ -260,7 +260,6 @@ describe('check_capabilities', () => {
expect(capabilities.canGetDatafeeds).toBe(false);
expect(capabilities.canGetCalendars).toBe(false);
expect(capabilities.canFindFileStructure).toBe(false);
expect(capabilities.canGetFilters).toBe(false);
expect(capabilities.canGetDataFrameAnalytics).toBe(false);
expect(capabilities.canGetAnnotations).toBe(false);
expect(capabilities.canCreateAnnotation).toBe(false);
Expand All @@ -277,6 +276,7 @@ describe('check_capabilities', () => {
expect(capabilities.canDeleteDatafeed).toBe(false);
expect(capabilities.canUpdateDatafeed).toBe(false);
expect(capabilities.canPreviewDatafeed).toBe(false);
expect(capabilities.canGetFilters).toBe(false);
expect(capabilities.canCreateCalendar).toBe(false);
expect(capabilities.canDeleteCalendar).toBe(false);
expect(capabilities.canCreateFilter).toBe(false);
Expand Down Expand Up @@ -311,7 +311,6 @@ describe('check_capabilities', () => {
expect(capabilities.canGetDatafeeds).toBe(false);
expect(capabilities.canGetCalendars).toBe(false);
expect(capabilities.canFindFileStructure).toBe(false);
expect(capabilities.canGetFilters).toBe(false);
expect(capabilities.canGetDataFrameAnalytics).toBe(false);
expect(capabilities.canGetAnnotations).toBe(false);
expect(capabilities.canCreateAnnotation).toBe(false);
Expand All @@ -328,6 +327,7 @@ describe('check_capabilities', () => {
expect(capabilities.canDeleteDatafeed).toBe(false);
expect(capabilities.canUpdateDatafeed).toBe(false);
expect(capabilities.canPreviewDatafeed).toBe(false);
expect(capabilities.canGetFilters).toBe(false);
expect(capabilities.canCreateCalendar).toBe(false);
expect(capabilities.canDeleteCalendar).toBe(false);
expect(capabilities.canCreateFilter).toBe(false);
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -15881,7 +15881,6 @@
"xpack.triggersActionsUI.sections.alertsList.actionTypeFilterLabel": "アクションタイプ",
"xpack.triggersActionsUI.sections.alertsList.addActionButtonLabel": "アラートの作成",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.alertTypeTitle": "タイプ",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.editLinkTitle": "編集",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.intervalTitle": "次の間隔で実行",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.nameTitle": "名前",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.tagsText": "タグ",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -15886,7 +15886,6 @@
"xpack.triggersActionsUI.sections.alertsList.actionTypeFilterLabel": "操作类型",
"xpack.triggersActionsUI.sections.alertsList.addActionButtonLabel": "创建告警",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.alertTypeTitle": "类型",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.editLinkTitle": "编辑",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.intervalTitle": "运行间隔",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.nameTitle": "名称",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.tagsText": "标记",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,25 @@ describe('alert_form', () => {
const alertTypeSelectOptions = wrapper.find('[data-test-subj="selectedAlertTypeTitle"]');
expect(alertTypeSelectOptions.exists()).toBeTruthy();
});

it('should update throttle value', async () => {
const newThrottle = 17;
await setup();
const throttleField = wrapper.find('[data-test-subj="throttleInput"]');
expect(throttleField.exists()).toBeTruthy();
throttleField.at(1).simulate('change', { target: { value: newThrottle.toString() } });
const throttleFieldAfterUpdate = wrapper.find('[data-test-subj="throttleInput"]');
expect(throttleFieldAfterUpdate.at(1).prop('value')).toEqual(newThrottle);
});

it('should unset throttle value', async () => {
const newThrottle = '';
await setup();
const throttleField = wrapper.find('[data-test-subj="throttleInput"]');
expect(throttleField.exists()).toBeTruthy();
throttleField.at(1).simulate('change', { target: { value: newThrottle } });
const throttleFieldAfterUpdate = wrapper.find('[data-test-subj="throttleInput"]');
expect(throttleFieldAfterUpdate.at(1).prop('value')).toEqual(newThrottle);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,6 @@ describe('alerts_list component with items', () => {
expect(wrapper.find('EuiBasicTable')).toHaveLength(1);
expect(wrapper.find('EuiTableRow')).toHaveLength(2);
});
it('renders edit button for registered alert types', async () => {
await setup();
expect(wrapper.find('[data-test-subj="alertsTableCell-editLink"]').length).toBeGreaterThan(0);
});
});

describe('alerts_list component empty with show only capability', () => {
Expand Down Expand Up @@ -442,8 +438,4 @@ describe('alerts_list with show only capability', () => {
expect(wrapper.find('EuiTableRow')).toHaveLength(2);
// TODO: check delete button
});
it('not renders edit button for non registered alert types', async () => {
await setup();
expect(wrapper.find('[data-test-subj="alertsTableCell-editLink"]').length).toBe(0);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { isEmpty } from 'lodash';
import { AlertsContextProvider } from '../../../context/alerts_context';
import { useAppDependencies } from '../../../app_context';
import { ActionType, Alert, AlertTableItem, AlertTypeIndex, Pagination } from '../../../../types';
import { AlertAdd, AlertEdit } from '../../alert_form';
import { AlertAdd } from '../../alert_form';
import { BulkOperationPopover } from '../../common/components/bulk_operation_popover';
import { AlertQuickEditButtonsWithApi as AlertQuickEditButtons } from '../../common/components/alert_quick_edit_buttons';
import { CollapsedItemActionsWithApi as CollapsedItemActions } from './collapsed_item_actions';
Expand Down Expand Up @@ -85,8 +85,6 @@ export const AlertsList: React.FunctionComponent = () => {
data: [],
totalItemCount: 0,
});
const [editedAlertItem, setEditedAlertItem] = useState<AlertTableItem | undefined>(undefined);
const [editFlyoutVisible, setEditFlyoutVisibility] = useState<boolean>(false);
const [alertsToDelete, setAlertsToDelete] = useState<string[]>([]);

useEffect(() => {
Expand Down Expand Up @@ -162,11 +160,6 @@ export const AlertsList: React.FunctionComponent = () => {
}
}

async function editItem(alertTableItem: AlertTableItem) {
setEditedAlertItem(alertTableItem);
setEditFlyoutVisibility(true);
}

const alertsTableColumns = [
{
field: 'name',
Expand Down Expand Up @@ -219,27 +212,6 @@ export const AlertsList: React.FunctionComponent = () => {
truncateText: false,
'data-test-subj': 'alertsTableCell-interval',
},
{
name: '',
width: '50px',
render(item: AlertTableItem) {
if (!canSave || !alertTypeRegistry.has(item.alertTypeId)) {
return;
}
return (
<EuiLink
data-test-subj="alertsTableCell-editLink"
color="primary"
onClick={() => editItem(item)}
>
<FormattedMessage
defaultMessage="Edit"
id="xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.editLinkTitle"
/>
</EuiLink>
);
},
},
{
name: '',
width: '40px',
Expand Down Expand Up @@ -453,14 +425,6 @@ export const AlertsList: React.FunctionComponent = () => {
addFlyoutVisible={alertFlyoutVisible}
setAddFlyoutVisibility={setAlertFlyoutVisibility}
/>
{editFlyoutVisible && editedAlertItem ? (
<AlertEdit
key={editedAlertItem.id}
initialAlert={editedAlertItem}
editFlyoutVisible={editFlyoutVisible}
setEditFlyoutVisibility={setEditFlyoutVisibility}
/>
) : null}
</AlertsContextProvider>
</section>
);
Expand Down
Loading

0 comments on commit 269d164

Please sign in to comment.