Skip to content

Commit

Permalink
[7.x] [ML] Edit text for deleting calendars & add functional tests fo…
Browse files Browse the repository at this point in the history
…r Calendars and Filter Lists (#77566) (#78198)

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
qn895 and elasticmachine authored Sep 22, 2020
1 parent 52c37b8 commit bb6a65c
Show file tree
Hide file tree
Showing 31 changed files with 924 additions and 41 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function EditHeader({ calendarId, description }) {
/>
</h1>
</EuiTitle>
<EuiText>
<EuiText data-test-subj={'mlCalendarDescriptionText'}>
<p>{description}</p>
</EuiText>
<EuiSpacer size="l" />
Expand Down Expand Up @@ -116,6 +116,7 @@ export const CalendarForm = ({
value={calendarId}
onChange={onCalendarIdChange}
disabled={isEdit === true || saving === true}
data-test-subj="mlCalendarIdInput"
/>
</EuiFormRow>

Expand All @@ -132,6 +133,7 @@ export const CalendarForm = ({
value={description}
onChange={onDescriptionChange}
disabled={isEdit === true || saving === true}
data-test-subj="mlCalendarDescriptionInput"
/>
</EuiFormRow>
</Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,12 @@ export class NewEventModal extends Component {

return (
<Fragment>
<EuiModal onClose={closeModal} initialFocus="[name=eventDescription]" maxWidth={false}>
<EuiModal
onClose={closeModal}
initialFocus="[name=eventDescription]"
maxWidth={false}
data-test-subj={'mlCalendarEventForm'}
>
<EuiModalHeader>
<EuiModalHeaderTitle>
<FormattedMessage
Expand All @@ -283,6 +288,7 @@ export class NewEventModal extends Component {
onChange={this.onDescriptionChange}
isInvalid={!description}
fullWidth
data-test-subj={'mlCalendarEventDescriptionInput'}
/>
</EuiFormRow>

Expand All @@ -293,13 +299,18 @@ export class NewEventModal extends Component {
</EuiModalBody>

<EuiModalFooter>
<EuiButtonEmpty onClick={closeModal}>
<EuiButtonEmpty onClick={closeModal} data-test-subj={'mlCalendarCancelEventButton'}>
<FormattedMessage
id="xpack.ml.calendarsEdit.newEventModal.cancelButtonLabel"
defaultMessage="Cancel"
/>
</EuiButtonEmpty>
<EuiButton onClick={this.handleAddEvent} fill disabled={!description}>
<EuiButton
onClick={this.handleAddEvent}
fill
disabled={!description}
data-test-subj={'mlCalendarAddEventButton'}
>
<FormattedMessage
id="xpack.ml.calendarsEdit.newEventModal.addButtonLabel"
defaultMessage="Add"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,15 @@ export class CalendarsListUI extends Component {
destroyModal = (
<EuiOverlayMask>
<EuiConfirmModal
data-test-subj={'mlCalendarDeleteConfirmation'}
title={
<FormattedMessage
id="xpack.ml.calendarsList.deleteCalendarsModal.deleteCalendarTitle"
defaultMessage="Delete calendar"
id="xpack.ml.calendarsList.deleteCalendarsModal.deleteMultipleCalendarsTitle"
defaultMessage="Delete {calendarsCount, plural, one {{calendarsList}} other {# calendars}}?"
values={{
calendarsCount: selectedForDeletion.length,
calendarsList: selectedForDeletion.map((c) => c.calendar_id).join(', '),
}}
/>
}
onCancel={this.closeDestroyModal}
Expand All @@ -130,18 +135,7 @@ export class CalendarsListUI extends Component {
}
buttonColor="danger"
defaultFocusedButton={EUI_MODAL_CONFIRM_BUTTON}
>
<p>
<FormattedMessage
id="xpack.ml.calendarsList.deleteCalendarsModal.deleteCalendarsDescription"
defaultMessage="Delete {calendarsCount, plural, one {this calendar} other {these calendars}}? {calendarsList}"
values={{
calendarsCount: selectedForDeletion.length,
calendarsList: selectedForDeletion.map((c) => c.calendar_id).join(', '),
}}
/>
</p>
</EuiConfirmModal>
/>
</EuiOverlayMask>
);
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class AddItemPopover extends Component {
iconSide="right"
onClick={this.onButtonClick}
isDisabled={this.props.canCreateFilter === false}
data-test-subj="mlFilterListAddItemButton"
data-test-subj="mlFilterListOpenNewItemsPopoverButton"
>
<FormattedMessage
id="xpack.ml.settings.filterLists.addItemPopover.addItemButtonLabel"
Expand Down Expand Up @@ -112,7 +112,11 @@ export class AddItemPopover extends Component {
/>
}
>
<EuiTextArea value={this.state.itemsText} onChange={this.onItemsTextChange} />
<EuiTextArea
value={this.state.itemsText}
onChange={this.onItemsTextChange}
data-test-subj={'mlFilterListAddItemTextArea'}
/>
</EuiFormRow>
</EuiForm>
<EuiText size="xs">
Expand All @@ -127,6 +131,7 @@ export class AddItemPopover extends Component {
<EuiButton
onClick={this.onAddButtonClick}
disabled={this.state.itemsText.length === 0}
data-test-subj={'mlFilterListAddItemsButton'}
>
<FormattedMessage
id="xpack.ml.settings.filterLists.addItemPopover.addButtonLabel"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class DeleteFilterListModal extends Component {
}
buttonColor="danger"
defaultFocusedButton={EUI_MODAL_CONFIRM_BUTTON}
data-test-subj={'mlFilterListDeleteConfirmation'}
/>
</EuiOverlayMask>
);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export class EditDescriptionPopover extends Component {
name="filter_list_description"
value={value}
onChange={this.onChange}
data-test-subj={'mlFilterListDescriptionInput'}
/>
</EuiFormRow>
</EuiForm>
Expand Down
Loading

0 comments on commit bb6a65c

Please sign in to comment.