]> source.dussan.org Git - sonarqube.git/commitdiff
Revert "Merge branch 'master' of https://github.com/SonarSource/sonarqube"
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Wed, 7 Mar 2018 13:37:42 +0000 (14:37 +0100)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Wed, 7 Mar 2018 13:37:42 +0000 (14:37 +0100)
This reverts commit ec739303a171b09089a1987d69777fa988b19eb3, reversing
changes made to da6a97014a1aba426ca6253623f6ff71281a64ac.

server/sonar-web/src/main/js/apps/code/bucket.ts
server/sonar-web/src/main/js/apps/code/components/__tests__/buckets-test.tsx [deleted file]
server/sonar-web/src/main/js/components/workspace/models/items.js
server/sonar-web/src/main/js/helpers/storage.ts

index 7431dc36efaaa4305cac467812ca9859d24503f4..8fc8bce8e65e9aa17c18cadf407fd6bf43fcf06e 100644 (file)
@@ -17,7 +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 { concat } from 'lodash';
 import { Breadcrumb, Component } from './types';
 
 let bucket: { [key: string]: Component } = {};
@@ -44,10 +43,6 @@ export function addComponentChildren(
   total: number,
   page: number
 ): void {
-  const previous = getComponentChildren(componentKey);
-  if (previous) {
-    children = concat(previous.children, children);
-  }
   childrenBucket[componentKey] = { children, total, page };
 }
 
diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/buckets-test.tsx b/server/sonar-web/src/main/js/apps/code/components/__tests__/buckets-test.tsx
deleted file mode 100644 (file)
index 49334c2..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2018 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-import { concat } from 'lodash';
-import { Component } from '../../types';
-import {
-  addComponent,
-  getComponent,
-  addComponentChildren,
-  getComponentChildren
-} from '../../bucket';
-
-const component: Component = { key: 'frodo', name: 'frodo', qualifier: 'frodo' };
-
-const componentKey: string = 'foo';
-const childrenA: Component[] = [
-  { key: 'foo', name: 'foo', qualifier: 'foo' },
-  { key: 'bar', name: 'bar', qualifier: 'bar' }
-];
-const childrenB: Component[] = [
-  { key: 'bart', name: 'bart', qualifier: 'bart' },
-  { key: 'simpson', name: 'simpson', qualifier: 'simpson' }
-];
-
-it('Should have empty bucket at start', () => {
-  expect(getComponent(component.key)).toBeUndefined();
-});
-
-it('Should be able to store components in a bucket', () => {
-  addComponent(component);
-  expect(getComponent(component.key)).toEqual(component);
-});
-
-it('Should have empty children bucket at start', () => {
-  expect(getComponentChildren(componentKey)).toBeUndefined();
-});
-
-it('Should be able to store children components in a bucket', () => {
-  addComponentChildren(componentKey, childrenA, childrenA.length, 1);
-  expect(getComponentChildren(componentKey).children).toEqual(childrenA);
-});
-
-it('Should append new children components at the end of the bucket', () => {
-  addComponentChildren(componentKey, childrenB, 4, 2);
-  const finalBucket = getComponentChildren(componentKey);
-  expect(finalBucket.children).toEqual(concat(childrenA, childrenB));
-  expect(finalBucket.total).toBe(4);
-  expect(finalBucket.page).toBe(2);
-});
index 0b1c4c3adf1772b4dfd0b373a04d00c3aa701df0..c191ca98a9093ac8fe53610b7b07298dfa3760ce 100644 (file)
@@ -19,7 +19,6 @@
  */
 import Backbone from 'backbone';
 import Item from './item';
-import { saveWorkspace, getWorkspace } from '../../../helpers/storage';
 
 const STORAGE_KEY = 'sonarqube-workspace';
 
@@ -32,11 +31,11 @@ export default Backbone.Collection.extend({
 
   save() {
     const dump = JSON.stringify(this.toJSON());
-    saveWorkspace(dump);
+    window.localStorage.setItem(STORAGE_KEY, dump);
   },
 
   load() {
-    const dump = getWorkspace(STORAGE_KEY);
+    const dump = window.localStorage.getItem(STORAGE_KEY);
     if (dump != null) {
       try {
         const parsed = JSON.parse(dump);
index 37533dbdfaafeeae2502f406b2b63057f5b9a4ae..fc54899c8b490393b989585b778fade9f278ce1b 100644 (file)
@@ -28,8 +28,6 @@ const PROJECTS_SORT = 'sonarqube.projects.sort';
 const PROJECT_ACTIVITY_GRAPH = 'sonarqube.project_activity.graph';
 const PROJECT_ACTIVITY_GRAPH_CUSTOM = 'sonarqube.project_activity.graph.custom';
 
-const WORKSPACE = 'sonarqube-workspace';
-
 function save(key: string, value?: string): void {
   try {
     if (value) {
@@ -43,14 +41,6 @@ function save(key: string, value?: string): void {
   }
 }
 
-export function saveWorkspace(dump: string): void {
-  window.localStorage.setItem(WORKSPACE, dump);
-}
-
-export function getWorkspace(): string | null {
-  return window.localStorage.getItem(WORKSPACE);
-}
-
 export function saveFavorite(): void {
   save(PROJECTS_DEFAULT_FILTER, PROJECTS_FAVORITE);
 }