Remove nesting-indicator directive (#23180)

* Remove nesting-indicator directive

* Remove broken import
This commit is contained in:
Tim Roes 2018-09-14 15:22:43 +02:00 committed by GitHub
parent 801d7c339e
commit dbca0c59c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 1 additions and 106 deletions

View file

@ -108,16 +108,6 @@
}
}
nesting-indicator {
display: flex;
flex: 0 0 auto;
> span {
width: @vis-editor-nesting-width;
background-color: @vis-editor-nesting-indicator-bg;
}
}
vis-editor-agg-group {
.flex-parent(0, 1, auto);
}
@ -238,7 +228,7 @@ a tilemap in an iframe: https://github.com/elastic/kibana/issues/16457 */
flex-basis: 100%;
}
// wraps the .vis-editor-agg and nesting-indicator ^^
// wraps the .vis-editor-agg
.vis-editor-agg-wrapper {
display: flex;
}

View file

@ -171,9 +171,6 @@
@vis-editor-agg-editor-order-bg: transparent;
@vis-editor-agg-editor-order-border: @gray-lighter;
@vis-editor-nesting-indicator-bg: @brand-success;
// List Group Menu =============================================================
@list-group-menu-item-color: @link-color;
@list-group-menu-item-select-color: @link-color;

View file

@ -1,42 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import expect from 'expect.js';
import ngMock from 'ng_mock';
describe('nestingIndicator directive', () => {
let element;
let $rootScope;
beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject((_$rootScope_, _$compile_) => {
$rootScope = _$rootScope_;
$rootScope.list = ['test'];
$rootScope.item = 'test';
element = _$compile_('<nesting-indicator item="item" list="list">')($rootScope);
}));
it('should update background color on list change', () => {
$rootScope.list.push('test2');
$rootScope.$digest();
expect(element.find('span').length).to.equal(1);
});
});

View file

@ -4,7 +4,6 @@
</div>
<div ng-class="groupName" draggable-container="group" class="vis-editor-agg-group">
<!-- wrapper needed for nesting-indicator -->
<div ng-repeat="agg in group track by agg.id" data-test-subj="aggregationEditor{{agg.id}}" draggable-item="agg" class="vis-editor-agg-wrapper">
<!-- agg.html - controls for aggregation -->
<ng-form vis-editor-agg name="aggForm" class="vis-editor-agg"></ng-form>

View file

@ -20,7 +20,6 @@
import _ from 'lodash';
import './agg';
import './agg_add';
import './nesting_indicator';
import { uiModules } from '../../../modules';
import aggGroupTemplate from './agg_group.html';

View file

@ -1,48 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import $ from 'jquery';
import { createColorPalette } from '../../components/color/color_palette';
import { uiModules } from '../../../modules';
uiModules
.get('kibana')
.directive('nestingIndicator', function () {
return {
restrict: 'E',
scope: {
item: '=',
list: '='
},
link: function ($scope, $el) {
$scope.$watchCollection('list', function () {
if (!$scope.list || !$scope.item) return;
const index = $scope.list.indexOf($scope.item);
const bars = $scope.list.slice(0, index + 1);
const colors = createColorPalette(bars.length);
$el.html(bars.map(function (bar, i) {
return $(document.createElement('span'))
.css('background-color', colors[i]);
}));
});
}
};
});