]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7191 fix web tests
authorStas Vilchik <vilchiks@gmail.com>
Wed, 17 Feb 2016 08:34:55 +0000 (09:34 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 17 Feb 2016 09:33:11 +0000 (10:33 +0100)
server/sonar-web/src/main/js/apps/background-tasks/components/Search.js [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/Stats.js [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/search.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/stats.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/tasks.js [deleted file]

diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Search.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Search.js
new file mode 100644 (file)
index 0000000..507cae2
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact 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 React from 'react';
+
+import StatusFilter from './StatusFilter';
+import TypesFilter from './TypesFilter';
+import CurrentsFilter from './CurrentsFilter';
+import DateFilter from './DateFilter';
+import { translate } from '../../../helpers/l10n';
+
+export default React.createClass({
+
+  onSearchFormSubmit(e) {
+    e.preventDefault();
+    this.onSearch();
+  },
+
+  onSearch() {
+    let searchInput = this.refs.searchInput;
+    let query = searchInput.value;
+    this.props.onSearch(query);
+  },
+
+  renderSearchBox() {
+    if (this.props.component) {
+      // do not render search form on the project-level page
+      return null;
+    }
+    return (
+        <li>
+          <h6 className="bt-search-form-label">
+            Component
+          </h6>
+
+          <input onChange={this.onSearch}
+                 value={this.props.query}
+                 ref="searchInput"
+                 className="js-search input-large"
+                 type="search"
+                 placeholder="Search"/>
+        </li>
+    );
+  },
+
+  refresh(e) {
+    e.preventDefault();
+    this.props.onRefresh();
+  },
+
+  render() {
+    return (
+        <section className="big-spacer-top big-spacer-bottom">
+          <ul className="bt-search-form">
+            <li>
+              <h6 className="bt-search-form-label">
+                Status
+              </h6>
+              <StatusFilter
+                  value={this.props.status}
+                  onChange={this.props.onStatusChange}/>
+            </li>
+            {this.props.types.length > 1 && (
+                <li>
+                  <h6 className="bt-search-form-label">
+                    Type
+                  </h6>
+                  <TypesFilter
+                      value={this.props.taskType}
+                      onChange={this.props.onTypeChange}
+                      types={this.props.types}/>
+                </li>
+            )}
+            <li>
+              <h6 className="bt-search-form-label">
+                Only Latest Analysis
+              </h6>
+              <CurrentsFilter
+                  value={this.props.currents}
+                  onChange={this.props.onCurrentsChange}/>
+            </li>
+            <li>
+              <h6 className="bt-search-form-label">
+                Date
+              </h6>
+              <DateFilter
+                  value={this.props.date}
+                  onChange={this.props.onDateChange}/>
+            </li>
+
+            {this.renderSearchBox()}
+
+            <li className="bt-search-form-right">
+              <button
+                  ref="reloadButton"
+                  onClick={this.refresh}
+                  disabled={this.props.fetching}>
+                {translate('reload')}
+              </button>
+            </li>
+          </ul>
+        </section>
+    );
+  }
+});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Stats.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Stats.js
new file mode 100644 (file)
index 0000000..2fc18a7
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact 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 React, { Component } from 'react';
+
+import { formatDuration } from './../helpers';
+import { translate } from '../../../helpers/l10n';
+
+
+export default class Stats extends Component {
+  handleCancelAllPending (e) {
+    e.preventDefault();
+    this.props.onCancelAllPending();
+  }
+
+  handleShowFailing (e) {
+    e.preventDefault();
+    this.props.onShowFailing();
+  }
+
+  renderInProgressDuration () {
+    if (!this.props.inProgressDuration) {
+      return null;
+    }
+    return (
+        <span
+            className="huge-spacer-left"
+            title={translate('background_tasks.in_progress_duration')}
+            data-toggle="tooltip">
+          <i
+              className="spinner spacer-right"
+              style={{ verticalAlign: 'text-top' }}/>
+          <span
+              ref="inProgressDuration"
+              className="emphasised-measure">
+            {formatDuration(this.props.inProgressDuration)}
+          </span>
+        </span>
+    );
+  }
+
+  renderPending () {
+    if (this.props.pendingCount == null) {
+      return null;
+    }
+    if (this.props.pendingCount > 0) {
+      return (
+          <span>
+            <span ref="pendingCount" className="emphasised-measure">{this.props.pendingCount}</span>
+            &nbsp;
+            {translate('background_tasks.pending')}
+            <a
+                ref="cancelPending"
+                onClick={this.handleCancelAllPending.bind(this)}
+                className="icon-delete spacer-left"
+                title={translate('background_tasks.cancel_all_tasks')}
+                data-toggle="tooltip"
+                href="#"/>
+          </span>
+      );
+    } else {
+      return (
+          <span>
+            <span ref="pendingCount" className="emphasised-measure">{this.props.pendingCount}</span>
+            &nbsp;
+            {translate('background_tasks.pending')}
+          </span>
+      );
+    }
+  }
+
+  renderFailures () {
+    if (this.props.failingCount == null) {
+      return null;
+    }
+
+    if (this.props.component) {
+      return null;
+    }
+
+    if (this.props.failingCount > 0) {
+      return (
+          <span>
+            <a ref="failureCount"
+               onClick={this.handleShowFailing.bind(this)}
+               className="emphasised-measure"
+               data-toggle="tooltip"
+               title="Count of projects where processing of most recent analysis report failed"
+               href="#">{this.props.failingCount}</a>
+            &nbsp;
+            {translate('background_tasks.failures')}
+          </span>
+      );
+    } else {
+      return (
+          <span>
+            <span ref="failureCount" className="emphasised-measure" data-toggle="tooltip"
+                  title="Count of projects where processing of most recent analysis report failed">
+              {this.props.failingCount}
+            </span>
+            &nbsp;
+            {translate('background_tasks.failures')}
+          </span>
+      );
+    }
+  }
+
+  render () {
+    return (
+        <section className="big-spacer-top big-spacer-bottom">
+          <span>
+            {this.renderPending()}
+          </span>
+          <span className="huge-spacer-left">
+            {this.renderFailures()}
+          </span>
+          {this.renderInProgressDuration()}
+        </section>
+
+    );
+  }
+}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js
new file mode 100644 (file)
index 0000000..6d3b225
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact 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 React from 'react';
+
+import Task from './Task';
+import { translate } from '../../../helpers/l10n';
+
+export default function Tasks ({ tasks, component, onCancelTask, onFilterTask }) {
+  return (
+      <table className="data zebra zebra-hover background-tasks">
+        <thead>
+          <tr>
+            <th>&nbsp;</th>
+            <th>&nbsp;</th>
+            <th>&nbsp;</th>
+            <th>{translate('background_tasks.table.submitted')}</th>
+            <th>{translate('background_tasks.table.started')}</th>
+            <th>{translate('background_tasks.table.finished')}</th>
+            <th>{translate('background_tasks.table.duration')}</th>
+            <th>&nbsp;</th>
+          </tr>
+        </thead>
+        <tbody>
+          {tasks.map((task, index, tasks) => (
+              <Task
+                  key={task.id}
+                  task={task}
+                  index={index}
+                  tasks={tasks}
+                  component={component}
+                  onCancelTask={onCancelTask}
+                  onFilterTask={onFilterTask}/>
+          ))}
+        </tbody>
+      </table>
+  );
+}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/search.js b/server/sonar-web/src/main/js/apps/background-tasks/components/search.js
deleted file mode 100644 (file)
index 507cae2..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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 React from 'react';
-
-import StatusFilter from './StatusFilter';
-import TypesFilter from './TypesFilter';
-import CurrentsFilter from './CurrentsFilter';
-import DateFilter from './DateFilter';
-import { translate } from '../../../helpers/l10n';
-
-export default React.createClass({
-
-  onSearchFormSubmit(e) {
-    e.preventDefault();
-    this.onSearch();
-  },
-
-  onSearch() {
-    let searchInput = this.refs.searchInput;
-    let query = searchInput.value;
-    this.props.onSearch(query);
-  },
-
-  renderSearchBox() {
-    if (this.props.component) {
-      // do not render search form on the project-level page
-      return null;
-    }
-    return (
-        <li>
-          <h6 className="bt-search-form-label">
-            Component
-          </h6>
-
-          <input onChange={this.onSearch}
-                 value={this.props.query}
-                 ref="searchInput"
-                 className="js-search input-large"
-                 type="search"
-                 placeholder="Search"/>
-        </li>
-    );
-  },
-
-  refresh(e) {
-    e.preventDefault();
-    this.props.onRefresh();
-  },
-
-  render() {
-    return (
-        <section className="big-spacer-top big-spacer-bottom">
-          <ul className="bt-search-form">
-            <li>
-              <h6 className="bt-search-form-label">
-                Status
-              </h6>
-              <StatusFilter
-                  value={this.props.status}
-                  onChange={this.props.onStatusChange}/>
-            </li>
-            {this.props.types.length > 1 && (
-                <li>
-                  <h6 className="bt-search-form-label">
-                    Type
-                  </h6>
-                  <TypesFilter
-                      value={this.props.taskType}
-                      onChange={this.props.onTypeChange}
-                      types={this.props.types}/>
-                </li>
-            )}
-            <li>
-              <h6 className="bt-search-form-label">
-                Only Latest Analysis
-              </h6>
-              <CurrentsFilter
-                  value={this.props.currents}
-                  onChange={this.props.onCurrentsChange}/>
-            </li>
-            <li>
-              <h6 className="bt-search-form-label">
-                Date
-              </h6>
-              <DateFilter
-                  value={this.props.date}
-                  onChange={this.props.onDateChange}/>
-            </li>
-
-            {this.renderSearchBox()}
-
-            <li className="bt-search-form-right">
-              <button
-                  ref="reloadButton"
-                  onClick={this.refresh}
-                  disabled={this.props.fetching}>
-                {translate('reload')}
-              </button>
-            </li>
-          </ul>
-        </section>
-    );
-  }
-});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/stats.js b/server/sonar-web/src/main/js/apps/background-tasks/components/stats.js
deleted file mode 100644 (file)
index 2fc18a7..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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 React, { Component } from 'react';
-
-import { formatDuration } from './../helpers';
-import { translate } from '../../../helpers/l10n';
-
-
-export default class Stats extends Component {
-  handleCancelAllPending (e) {
-    e.preventDefault();
-    this.props.onCancelAllPending();
-  }
-
-  handleShowFailing (e) {
-    e.preventDefault();
-    this.props.onShowFailing();
-  }
-
-  renderInProgressDuration () {
-    if (!this.props.inProgressDuration) {
-      return null;
-    }
-    return (
-        <span
-            className="huge-spacer-left"
-            title={translate('background_tasks.in_progress_duration')}
-            data-toggle="tooltip">
-          <i
-              className="spinner spacer-right"
-              style={{ verticalAlign: 'text-top' }}/>
-          <span
-              ref="inProgressDuration"
-              className="emphasised-measure">
-            {formatDuration(this.props.inProgressDuration)}
-          </span>
-        </span>
-    );
-  }
-
-  renderPending () {
-    if (this.props.pendingCount == null) {
-      return null;
-    }
-    if (this.props.pendingCount > 0) {
-      return (
-          <span>
-            <span ref="pendingCount" className="emphasised-measure">{this.props.pendingCount}</span>
-            &nbsp;
-            {translate('background_tasks.pending')}
-            <a
-                ref="cancelPending"
-                onClick={this.handleCancelAllPending.bind(this)}
-                className="icon-delete spacer-left"
-                title={translate('background_tasks.cancel_all_tasks')}
-                data-toggle="tooltip"
-                href="#"/>
-          </span>
-      );
-    } else {
-      return (
-          <span>
-            <span ref="pendingCount" className="emphasised-measure">{this.props.pendingCount}</span>
-            &nbsp;
-            {translate('background_tasks.pending')}
-          </span>
-      );
-    }
-  }
-
-  renderFailures () {
-    if (this.props.failingCount == null) {
-      return null;
-    }
-
-    if (this.props.component) {
-      return null;
-    }
-
-    if (this.props.failingCount > 0) {
-      return (
-          <span>
-            <a ref="failureCount"
-               onClick={this.handleShowFailing.bind(this)}
-               className="emphasised-measure"
-               data-toggle="tooltip"
-               title="Count of projects where processing of most recent analysis report failed"
-               href="#">{this.props.failingCount}</a>
-            &nbsp;
-            {translate('background_tasks.failures')}
-          </span>
-      );
-    } else {
-      return (
-          <span>
-            <span ref="failureCount" className="emphasised-measure" data-toggle="tooltip"
-                  title="Count of projects where processing of most recent analysis report failed">
-              {this.props.failingCount}
-            </span>
-            &nbsp;
-            {translate('background_tasks.failures')}
-          </span>
-      );
-    }
-  }
-
-  render () {
-    return (
-        <section className="big-spacer-top big-spacer-bottom">
-          <span>
-            {this.renderPending()}
-          </span>
-          <span className="huge-spacer-left">
-            {this.renderFailures()}
-          </span>
-          {this.renderInProgressDuration()}
-        </section>
-
-    );
-  }
-}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/tasks.js b/server/sonar-web/src/main/js/apps/background-tasks/components/tasks.js
deleted file mode 100644 (file)
index 6d3b225..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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 React from 'react';
-
-import Task from './Task';
-import { translate } from '../../../helpers/l10n';
-
-export default function Tasks ({ tasks, component, onCancelTask, onFilterTask }) {
-  return (
-      <table className="data zebra zebra-hover background-tasks">
-        <thead>
-          <tr>
-            <th>&nbsp;</th>
-            <th>&nbsp;</th>
-            <th>&nbsp;</th>
-            <th>{translate('background_tasks.table.submitted')}</th>
-            <th>{translate('background_tasks.table.started')}</th>
-            <th>{translate('background_tasks.table.finished')}</th>
-            <th>{translate('background_tasks.table.duration')}</th>
-            <th>&nbsp;</th>
-          </tr>
-        </thead>
-        <tbody>
-          {tasks.map((task, index, tasks) => (
-              <Task
-                  key={task.id}
-                  task={task}
-                  index={index}
-                  tasks={tasks}
-                  component={component}
-                  onCancelTask={onCancelTask}
-                  onFilterTask={onFilterTask}/>
-          ))}
-        </tbody>
-      </table>
-  );
-}