]> source.dussan.org Git - sonarqube.git/commitdiff
remove _ dependecy in RecentHistory
authorStas Vilchik <vilchiks@gmail.com>
Fri, 9 Dec 2016 09:50:20 +0000 (10:50 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Fri, 9 Dec 2016 13:28:10 +0000 (14:28 +0100)
server/sonar-web/src/main/js/app/components/nav/component/RecentHistory.js

index 6454cfe8afb2a3e904edb919d12b580a4d4710ff..e7dc3f06f09276e6c9304276530f690a95a5954c 100644 (file)
@@ -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);
   }
 }