From 25a0ec7276939bb217f422bedbc8708cb7044131 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Fri, 9 Dec 2016 10:50:20 +0100 Subject: [PATCH] remove _ dependecy in RecentHistory --- .../main/js/app/components/nav/component/RecentHistory.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server/sonar-web/src/main/js/app/components/nav/component/RecentHistory.js b/server/sonar-web/src/main/js/app/components/nav/component/RecentHistory.js index 6454cfe8afb..e7dc3f06f09 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/RecentHistory.js +++ b/server/sonar-web/src/main/js/app/components/nav/component/RecentHistory.js @@ -17,8 +17,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import _ from 'underscore'; - const STORAGE_KEY = 'sonar_recent_history'; const HISTORY_LIMIT = 10; @@ -51,16 +49,16 @@ export default class RecentHistory { if (componentKey) { const newEntry = { key: componentKey, name: componentName, icon }; - let newHistory = _.reject(sonarHistory, entry => entry.key === newEntry.key); + let newHistory = sonarHistory.filter(entry => entry.key !== newEntry.key); newHistory.unshift(newEntry); - newHistory = _.first(newHistory, HISTORY_LIMIT); + newHistory = newHistory.slice(0, HISTORY_LIMIT); RecentHistory.set(newHistory); } } static remove (componentKey) { const history = RecentHistory.get(); - const newHistory = _.reject(history, entry => entry.key === componentKey); + const newHistory = history.filter(entry => entry.key !== componentKey); RecentHistory.set(newHistory); } } -- 2.39.5