[ML] Removes unused ml-item-select directive (#28669)

This commit is contained in:
Pete Harverson 2019-01-14 12:17:26 +00:00 committed by GitHub
parent 6d0d521ef7
commit e1a6f75acc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 0 additions and 164 deletions

View file

@ -1 +0,0 @@
@import 'item_select';

View file

@ -1,52 +0,0 @@
// This file contains a lot of additive hacks on top of bootstrap.
.ml-item-select {
.ui-select-container {
.ui-select-choices-group-label {
color: $euiColorMediumShade;
}
small {
font-size: $euiFontSizeXS;
margin-top: $euiSizeXS / 2;
font-style: italic;
color: $euiColorMediumShade;
}
.ui-select-choices-row.active {
small {
color: $euiColorMediumShade;
}
}
}
// SASSTODO: Brittle sizing matches other Kibana hacks
.ui-select-multiple.ui-select-bootstrap {
padding: 3px 5px 0px !important;
}
}
// SASSTODO: This is overwriting core behavior, needs a proper selector
.ui-select-bootstrap.open {
z-index: $euiZComboBox;
}
.ui-select-container {
.ui-select-choices-group-label {
color: $euiColorMediumShade;
}
// SASSTODO: Needs to be a proper selector
small {
font-size: $euiFontSizeXS;
margin-top: $euiSizeXS / 2;
font-style: italic;
color: $euiColorDarkShade;
}
.ui-select-choices-row.active {
// SASSTODO: Needs to be a proper selector
small {
color:$euiColorEmptyShade;
}
}
}

View file

@ -1,9 +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 './item_select';

View file

@ -1,26 +0,0 @@
<div class="ml-item-select">
<ui-select
ng-model="mlItemSelect.selectedItems"
on-select="mlItemSelect.onItemsChanged()"
on-remove="mlItemSelect.onItemsChanged()"
ng-disabled="mlItemSelect.disabled"
multiple
append-to-body=true
tagging="(mlItemSelect.allowTagging ? mlItemSelect.createNewItem : mlItemSelect.dontCreateNewItem)"
>
<ui-select-match placeholder="{{mlItemSelect.placeholder}}">
{{$item.id}}
</ui-select-match>
<ui-select-choices
repeat="item in mlItemSelect.allItems | filter: { id: $select.search }"
>
<div ng-if="item.isTag" class="select-item" ng-bind-html="(item.id | highlight: $select.search) +' <small>'+ (mlItemSelect.taggingText === undefined ? mlItemSelect.newItemLabel : mlItemSelect.taggingText) +'</small>'"></div>
<div ng-if="!item.isTag" class="select-item" >
<div ng-bind-html="item.id | highlight: $select.search"></div>
<small ng-if="item.extra!==undefined">
{{item.extra}}
</small>
</div>
</ui-select-choices>
</ui-select>
</div>

View file

@ -1,75 +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 template from './item_select.html';
import { InitAfterBindingsWorkaround } from 'ui/compat';
import { uiModules } from 'ui/modules';
import { i18n } from '@kbn/i18n';
const module = uiModules.get('apps/ml');
module.directive('mlItemSelect', function () {
return {
restrict: 'E',
template,
scope: {
itemIds: '=',
allItems: '=',
disabled: '=',
placeholder: '=',
externalUpdateFunction: '=',
allowTagging: '=',
taggingText: '='
},
controllerAs: 'mlItemSelect',
bindToController: true,
controller: class MlItemSelectController extends InitAfterBindingsWorkaround {
constructor() {
this.newItemLabel = i18n.translate('xpack.ml.itemSelect.newItemLabel', { defaultMessage: '(new item)' });
}
initAfterBindings($scope) {
this.$scope = $scope;
this.selectedItems = [];
this.populateSelectedItems(this.itemIds);
// make the populateSelectedItems function callable from elsewhere.
if (this.externalUpdateFunction !== undefined) {
this.externalUpdateFunction.update = (itemIds) => { this.populateSelectedItems(itemIds); };
}
}
// populate selectedItems based on a list of ids
populateSelectedItems(ids) {
this.selectedItems = ids.map(id => this.allItems.find((i) => i.id === id));
}
onItemsChanged() {
// wipe the groups and add all of the selected ids
this.itemIds.length = 0;
this.itemIds = this.selectedItems.map((i) => i.id);
}
createNewItem(id) {
return ({
id: id.toLowerCase(),
isTag: true
});
}
// non-tagging function needed as
// the tagging attribute in the html needs a function reference
// this is used when tagging is not allowed and always returns false
dontCreateNewItem() {
return false;
}
}
};
});

View file

@ -36,7 +36,6 @@
@import 'components/form_filter_input/index'; // SASSTODO: This file needs to be rewritten
@import 'components/form_label/index';
@import 'components/influencers_list/index';
@import 'components/item_select/index'; // SASSTODO: This file does some dangerous overwrites
@import 'components/items_grid/index';
@import 'components/job_group_select/index'; // SASSTODO: This file does some dangerous overwrites
@import 'components/job_select_list/index'; // SASSTODO: This file does EXTREMELY DANGEROUS overwrites