Skip to content

Commit

Permalink
Replace Watcher's watch-type-select directive with two buttons. (elas…
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcenizal authored and maryia-lapata committed Jun 25, 2018
1 parent 3e08dbf commit ae94b09
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 211 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,83 +6,101 @@

<div
ng-if="!watchList.forbidden"
class="kuiViewContentItem kuiControlledTable kuiVerticalRhythm"
class="kuiViewContentItem kuiVerticalRhythm"
>
<div class="kuiToolBar">
<div class="kuiToolBarSearch">
<tool-bar-search-box
filter="watchList.query"
on-filter="watchList.onQueryChange"
></tool-bar-search-box>
</div>

<div class="kuiToolBarSection">
<watch-type-select
class="watchTypeSelect"
on-change="watchList.onWatchTypeChange"
></watch-type-select>
<button
class="kuiButton kuiButton--danger"
ng-disabled="!watchList.hasSelectedWatches"
ng-click="watchList.onSelectedWatchesDelete()"
data-test-subj="btnDeleteWatches"
>
Delete
</button>
</div>
<div class="kuiVerticalRhythm">
<button
class="kuiButton kuiButton--primary"
ng-click="watchList.onClickCreateThresholdAlert()"
data-test-subj="createThresholdAlertButton"
tooltip="Set up a custom watch in raw JSON"
>
Create threshold alert
</button>

<div class="kuiToolBarSection">
<tool-bar-pager-text
start-item="watchList.pager.startItem"
end-item="watchList.pager.endItem"
total-items="watchList.pager.totalItems"
></tool-bar-pager-text>
<tool-bar-pager-buttons
has-previous-page="watchList.pager.hasPreviousPage"
has-next-page="watchList.pager.hasNextPage"
on-page-next="watchList.onPageNext"
on-page-previous="watchList.onPagePrevious"
></tool-bar-pager-buttons>
</div>
<button
class="kuiButton kuiButton--primary"
ng-click="watchList.onClickCreateAdvancedWatch()"
data-test-subj="createAdvancedWatchButton"
tooltip="Send an alert on a specific condition"
>
Create advanced watch
</button>
</div>

<watch-table
watches="watchList.pageOfWatches"
watches-being-deleted="watchList.watchesBeingDeleted"
sort-field="watchList.sortField"
sort-reverse="watchList.sortReverse"
on-sort-change="watchList.onSortChange"
on-select-change="watchList.onSelectedChange"
ng-show="watchList.hasPageOfWatches"
>
</watch-table>
<div class="kuiControlledTable kuiVerticalRhythm">
<div class="kuiToolBar">
<div class="kuiToolBarSearch">
<tool-bar-search-box
filter="watchList.query"
on-filter="watchList.onQueryChange"
></tool-bar-search-box>
</div>

<table-info ng-show="!watchList.hasPageOfWatches">
No watches found.
</table-info>
<div class="kuiToolBarSection">
<button
class="kuiButton kuiButton--danger"
ng-disabled="!watchList.hasSelectedWatches"
ng-click="watchList.onSelectedWatchesDelete()"
data-test-subj="btnDeleteWatches"
>
Delete
</button>
</div>

<div class="kuiToolBarFooter">
<div class="kuiToolBarFooterSection">
<tool-bar-selected-count
count="watchList.selectedWatches.length"
singular-name="watch"
plural-name="watches"
ng-show="watchList.hasSelectedWatches"
></tool-bar-selected-count>
<div class="kuiToolBarSection">
<tool-bar-pager-text
start-item="watchList.pager.startItem"
end-item="watchList.pager.endItem"
total-items="watchList.pager.totalItems"
></tool-bar-pager-text>
<tool-bar-pager-buttons
has-previous-page="watchList.pager.hasPreviousPage"
has-next-page="watchList.pager.hasNextPage"
on-page-next="watchList.onPageNext"
on-page-previous="watchList.onPagePrevious"
></tool-bar-pager-buttons>
</div>
</div>

<div class="kuiToolBarFooterSection">
<tool-bar-pager-text
start-item="watchList.pager.startItem"
end-item="watchList.pager.endItem"
total-items="watchList.pager.totalItems"
></tool-bar-pager-text>
<tool-bar-pager-buttons
has-previous-page="watchList.pager.hasPreviousPage"
has-next-page="watchList.pager.hasNextPage"
on-page-next="watchList.onPageNext"
on-page-previous="watchList.onPagePrevious"
></tool-bar-pager-buttons>
<watch-table
watches="watchList.pageOfWatches"
watches-being-deleted="watchList.watchesBeingDeleted"
sort-field="watchList.sortField"
sort-reverse="watchList.sortReverse"
on-sort-change="watchList.onSortChange"
on-select-change="watchList.onSelectedChange"
ng-show="watchList.hasPageOfWatches"
>
</watch-table>

<table-info ng-show="!watchList.hasPageOfWatches">
No watches found.
</table-info>

<div class="kuiToolBarFooter">
<div class="kuiToolBarFooterSection">
<tool-bar-selected-count
count="watchList.selectedWatches.length"
singular-name="watch"
plural-name="watches"
ng-show="watchList.hasSelectedWatches"
></tool-bar-selected-count>
</div>

<div class="kuiToolBarFooterSection">
<tool-bar-pager-text
start-item="watchList.pager.startItem"
end-item="watchList.pager.endItem"
total-items="watchList.pager.totalItems"
></tool-bar-pager-text>
<tool-bar-pager-buttons
has-previous-page="watchList.pager.hasPreviousPage"
has-next-page="watchList.pager.hasNextPage"
on-page-next="watchList.onPageNext"
on-page-previous="watchList.onPagePrevious"
></tool-bar-pager-buttons>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ import { InitAfterBindingsWorkaround } from 'ui/compat';
import { Notifier, toastNotifications } from 'ui/notify';
import template from './watch_list.html';
import '../watch_table';
import { PAGINATION, REFRESH_INTERVALS } from 'plugins/watcher/../common/constants';
import { PAGINATION, REFRESH_INTERVALS, WATCH_TYPES } from 'plugins/watcher/../common/constants';
import 'ui/pager_control';
import 'ui/pager';
import 'ui/react_components';
import 'ui/table_info';
import 'plugins/watcher/components/tool_bar_selected_count';
import 'plugins/watcher/components/forbidden_message';
import 'plugins/watcher/components/watch_type_select';
import 'plugins/watcher/services/watches';
import 'plugins/watcher/services/license';

Expand Down Expand Up @@ -123,10 +122,18 @@ app.directive('watchList', function ($injector) {
this.selectedWatches = selectedWatches;
};

onWatchTypeChange = (watchType) => {
onClickCreateThresholdAlert = () => {
this.goToWatchWizardForType(WATCH_TYPES.THRESHOLD);
};

onClickCreateAdvancedWatch = () => {
this.goToWatchWizardForType(WATCH_TYPES.JSON);
};

goToWatchWizardForType = (watchType) => {
const url = `management/elasticsearch/watcher/watches/new-watch/${watchType}`;
kbnUrl.change(url, {});
}
};

onSelectedWatchesDelete = () => {
const watchesBeingDeleted = this.selectedWatches;
Expand Down
3 changes: 1 addition & 2 deletions x-pack/test/functional/page_objects/watcher_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ export function WatcherPageProvider({ getPageObjects, getService }) {
}

async createWatch(watchName, name) {
await testSubjects.click('createNewWatch');
await testSubjects.click('AdvancedWatch');
await testSubjects.click('createAdvancedWatchButton');
await remote.findById('id').type(watchName);
await remote.findById('name').type(name);
await testSubjects.click('btnSaveWatch');
Expand Down

0 comments on commit ae94b09

Please sign in to comment.