From af29b7f9e81d2d33a328e459b26e982d98f30984 Mon Sep 17 00:00:00 2001 From: "sw.jung" Date: Tue, 26 Dec 2017 00:57:05 +0900 Subject: [PATCH] Clear complex code --- public/management/list.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/management/list.js b/public/management/list.js index 3d7a775..6075745 100644 --- a/public/management/list.js +++ b/public/management/list.js @@ -1,4 +1,4 @@ -import { chain, upperFirst, camelCase, remove, pick, attempt, isArray, find } from 'lodash'; +import { chain, remove, pick, attempt, isArray, find } from 'lodash'; import Promise from 'bluebird'; import angular from 'angular'; import { saveAs } from '@elastic/filesaver'; @@ -38,10 +38,11 @@ uiRoutes .reduce((map, hit) => { const { _id, _type, _source, indexPatternId } = hit; const item = map[_id] || (map[_id] = { _id }); - item[`has${upperFirst(camelCase(_type))}`] = true; if (_type === 'index-pattern') { + item.hasIndexPattern = true; item.indexPatternId = indexPatternId; } else if (_type === 'markdown_template') { + item.hasMarkdownTemplate = true; item._type = _type; item._source = _source; } @@ -63,6 +64,10 @@ uiRoutes .then(() => $scope.$apply()); }; + $scope.isSorted = key => { + return $scope.listOrder.endsWith(key); + }; + $scope.changeOrder = key => { const [direction, field] = $scope.listOrder.match(/^([\+\-])?(.+)$/).slice(1); if (field !== key) $scope.listOrder = `+${key}`;