diff --git a/x-pack/plugins/watcher/public/components/watch_type_select/index.js b/x-pack/plugins/watcher/public/components/watch_type_select/index.js deleted file mode 100644 index 8f1dd4cb69e0..000000000000 --- a/x-pack/plugins/watcher/public/components/watch_type_select/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import './watch_type_select'; diff --git a/x-pack/plugins/watcher/public/components/watch_type_select/watch_type_select.html b/x-pack/plugins/watcher/public/components/watch_type_select/watch_type_select.html deleted file mode 100644 index f4ba2e7eb846..000000000000 --- a/x-pack/plugins/watcher/public/components/watch_type_select/watch_type_select.html +++ /dev/null @@ -1,24 +0,0 @@ - - - {{$select.selected.typeName}} - - -
-
- -
-
-
-
- -
-
-
-
-
diff --git a/x-pack/plugins/watcher/public/components/watch_type_select/watch_type_select.js b/x-pack/plugins/watcher/public/components/watch_type_select/watch_type_select.js deleted file mode 100644 index 0b52f318e96e..000000000000 --- a/x-pack/plugins/watcher/public/components/watch_type_select/watch_type_select.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { map, filter, sortBy } from 'lodash'; -import { uiModules } from 'ui/modules'; -import template from './watch_type_select.html'; -import 'angular-ui-select'; -import { Watch } from 'plugins/watcher/models/watch'; -import './watch_type_select.less'; - -const app = uiModules.get('xpack/watcher'); - -function getWatchTypes() { - const allWatchTypes = map(Watch.getWatchTypes(), (WatchType, key) => { - return { - type: key, - typeName: WatchType.typeName, - iconClass: WatchType.iconClass, - selectMessage: WatchType.selectMessage, - sortOrder: WatchType.selectSortOrder, - isCreatable: WatchType.isCreatable - }; - }); - const fitleredWatchTypes = filter(allWatchTypes, watchType => watchType.isCreatable); - const result = sortBy(fitleredWatchTypes, watchType => watchType.sortOrder); - - return result; -} - -app.directive('watchTypeSelect', function () { - return { - restrict: 'E', - template: template, - scope: { - onChange: '=' - }, - controller: class ActionTypeSelectController { - constructor($scope) { - $scope.selectedItem = { value: null }; - - $scope.watchTypes = getWatchTypes(); - - $scope.onSelect = (watchType) => { - $scope.onChange(watchType.type); - $scope.selectedItem = { value: null }; - }; - } - } - }; -}); diff --git a/x-pack/plugins/watcher/public/components/watch_type_select/watch_type_select.less b/x-pack/plugins/watcher/public/components/watch_type_select/watch_type_select.less deleted file mode 100644 index a5f918e31138..000000000000 --- a/x-pack/plugins/watcher/public/components/watch_type_select/watch_type_select.less +++ /dev/null @@ -1,52 +0,0 @@ -@import (reference) "~ui/styles/variables"; -@import (reference) "~ui/styles/mixins"; -@import (reference) "~ui/styles/theme"; -@import (reference) '~ui/styles/variables/colors'; - -.watchTypeChoice { - display: flex; -} - -.watchTypeIcon { - flex: 1 0 auto; - margin-right: 10px; - font-size: 14pt; -} - -.watchTypeDescription { - flex: 1 1 auto; - width: 100%; -} - -.watchTypeDescription_name { - font-weight: bold; -} - -.watchTypeDescription_message { - font-size: 9pt; -} - -watch-type-select { - - //*************************** ui-select-tweaks - .ui-select-bootstrap > .ui-select-choices { - max-height: 350px; - width: 300px; - } - - .ui-select-bootstrap .ui-select-choices-row>span { - padding: 10px 20px; - } - - .ui-select-match .btn { - border-color: @globalColorBlue; - color: @globalColorBlue; - } - - .ui-select-placeholder { - color: @globalColorBlue !important; - padding-right: 10px; - } - //*************************** end ui-select-tweaks - -} diff --git a/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.html b/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.html index ac7236dbdceb..2676a329fdd0 100644 --- a/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.html +++ b/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.html @@ -6,83 +6,101 @@
-
-
- -
+
+ -
- - -
- -
- - -
+
- - +
+
+
+ +
- - No watches found. - +
+ +
-
-
- +
+ + +
-
- - + + + + + No watches found. + + +
+
+ +
+ +
+ + +
diff --git a/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.js b/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.js index fddc85e62754..a1c554753984 100644 --- a/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.js +++ b/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.js @@ -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'; @@ -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; diff --git a/x-pack/test/functional/page_objects/watcher_page.js b/x-pack/test/functional/page_objects/watcher_page.js index d90341c75c73..3b285106ccae 100644 --- a/x-pack/test/functional/page_objects/watcher_page.js +++ b/x-pack/test/functional/page_objects/watcher_page.js @@ -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');