+++ /dev/null
-/*
- * 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.server.dashboard;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.template;
-
-import org.sonar.api.web.Dashboard;
-import org.sonar.api.web.DashboardLayout;
-import org.sonar.api.web.DashboardTemplate;
-import org.sonar.db.measure.MeasureFilterDao;
-import org.sonar.db.measure.MeasureFilterDto;
-import org.sonar.server.dashboard.widget.MeasureFilterAsTreemapWidget;
-import org.sonar.server.dashboard.widget.MeasureFilterListWidget;
-import org.sonar.server.dashboard.widget.WelcomeWidget;
-import org.sonar.server.measure.template.MyFavouritesFilter;
-import org.sonar.server.measure.template.ProjectFilter;
-
-/**
- * Projects global dashboard for Sonar
- *
- * @since 3.1
- */
-public final class GlobalDefaultDashboard extends DashboardTemplate {
-
- private MeasureFilterDao filterDao;
-
- public GlobalDefaultDashboard(MeasureFilterDao filterDao) {
- this.filterDao = filterDao;
- }
-
- @Override
- public Dashboard createDashboard() {
- Dashboard dashboard = Dashboard.create()
- .setGlobal(true)
- .setLayout(DashboardLayout.TWO_COLUMNS_30_70);
-
- dashboard.addWidget(WelcomeWidget.ID, 1);
- addMyFavouritesWidget(dashboard);
- addProjectsWidgets(dashboard);
-
- return dashboard;
- }
-
- private void addMyFavouritesWidget(Dashboard dashboard) {
- MeasureFilterDto filter = findSystemFilter(MyFavouritesFilter.NAME);
- if (filter != null) {
- dashboard
- .addWidget(MeasureFilterListWidget.ID, 1)
- .setProperty(MeasureFilterListWidget.FILTER_PROPERTY, filter.getId().toString())
- .setProperty(MeasureFilterListWidget.PAGE_SIZE_PROPERTY, "50");
- }
- }
-
- private void addProjectsWidgets(Dashboard dashboard) {
- MeasureFilterDto filter = findSystemFilter(ProjectFilter.NAME);
- if (filter != null) {
- dashboard
- .addWidget(MeasureFilterListWidget.ID, 2)
- .setProperty(MeasureFilterListWidget.FILTER_PROPERTY, filter.getId().toString())
- .setProperty(MeasureFilterListWidget.PAGE_SIZE_PROPERTY, "20");
-
- dashboard
- .addWidget(MeasureFilterAsTreemapWidget.ID, 2)
- .setProperty(MeasureFilterListWidget.FILTER_PROPERTY, filter.getId().toString())
- .setProperty(MeasureFilterAsTreemapWidget.SIZE_METRIC_PROPERTY, "ncloc")
- .setProperty(MeasureFilterAsTreemapWidget.COLOR_METRIC_PROPERTY, "coverage");
- }
- }
-
- @Override
- public String getName() {
- return "Home";
- }
-
- private MeasureFilterDto findSystemFilter(String name) {
- return filterDao.selectSystemFilterByName(name);
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.server.dashboard.template;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.WidgetLayout;
-import org.sonar.api.web.WidgetLayoutType;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetProperties({
- @WidgetProperty(key = "show_ok", type = WidgetPropertyType.BOOLEAN, defaultValue = "false"),
-})
-@WidgetLayout(WidgetLayoutType.NONE)
-public class AlertsWidget extends CoreWidget {
-
- public AlertsWidget() {
- super("alerts", "Alerts", "/org/sonar/server/dashboard/widget/alerts.html.erb");
- }
-
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetProperties({
- @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
- @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "300"),
- @WidgetProperty(key = "xMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "yMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.VIOLATIONS_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "xLogarithmic", type = WidgetPropertyType.BOOLEAN),
- @WidgetProperty(key = "yLogarithmic", type = WidgetPropertyType.BOOLEAN)
-})
-public class BubbleChartWidget extends CoreWidget {
- public BubbleChartWidget() {
- super("bubble_chart", "Project File Bubble Chart", "/org/sonar/server/dashboard/widget/bubbleChart.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-public class ComplexityWidget extends CoreWidget {
-
- public ComplexityWidget() {
- super("complexity", "Complexity", "/org/sonar/server/dashboard/widget/complexity.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.AbstractRubyTemplate;
-import org.sonar.api.web.RubyRailsWidget;
-
-public abstract class CoreWidget extends AbstractRubyTemplate implements RubyRailsWidget {
- private String id;
- private String title;
- private String templatePath;
-
- protected CoreWidget(String id, String title, String templatePath) {
- this.id = id;
- this.title = title;
- this.templatePath = templatePath;
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public String getTitle() {
- return title;
- }
-
- @Override
- protected String getTemplatePath() {
- return templatePath;
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.UserRole;
-import org.sonar.api.web.WidgetCategory;
-
-@WidgetCategory("Tests")
-@UserRole(UserRole.USER)
-public class CoverageWidget extends CoreWidget {
-
- public CoverageWidget() {
- super("code_coverage", "Code coverage", "/org/sonar/server/dashboard/widget/coverage.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetProperties({
- @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC),
- @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC),
- @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC),
- @WidgetProperty(key = "metric4", type = WidgetPropertyType.METRIC),
- @WidgetProperty(key = "metric5", type = WidgetPropertyType.METRIC),
- @WidgetProperty(key = "metric6", type = WidgetPropertyType.METRIC),
- @WidgetProperty(key = "metric7", type = WidgetPropertyType.METRIC),
- @WidgetProperty(key = "metric8", type = WidgetPropertyType.METRIC),
- @WidgetProperty(key = "metric9", type = WidgetPropertyType.METRIC),
- @WidgetProperty(key = "metric10", type = WidgetPropertyType.METRIC)
-})
-public class CustomMeasuresWidget extends CoreWidget {
- public CustomMeasuresWidget() {
- super("custom_measures", "Custom Measures", "/org/sonar/server/dashboard/widget/custom_measures.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.UserRole;
-import org.sonar.api.web.WidgetCategory;
-
-@UserRole(UserRole.USER)
-@WidgetCategory("Technical Debt")
-public final class DebtOverviewWidget extends CoreWidget {
-
- public DebtOverviewWidget() {
- super("debt_overview", "Technical Debt Overview", "/org/sonar/server/dashboard/widget/debt_overview.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.WidgetLayout;
-import org.sonar.api.web.WidgetLayoutType;
-
-@WidgetLayout(WidgetLayoutType.NONE)
-public class DescriptionWidget extends CoreWidget {
-
- public DescriptionWidget() {
- super("description", "Description", "/org/sonar/server/dashboard/widget/description.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-public class DocumentationCommentsWidget extends CoreWidget {
-
- public DocumentationCommentsWidget() {
- super("documentation_comments", "Documentation Metrics", "/org/sonar/server/dashboard/widget/documentation_comments_widget.html.erb");
- }
-
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-/**
- * @author Patroklos PAPAPETROU
- */
-
-public class DuplicationsWidget extends CoreWidget {
-
- public DuplicationsWidget() {
- super("duplications", "Duplications", "/org/sonar/server/dashboard/widget/duplications_widget.html.erb");
- }
-
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-public class EventsWidget extends CoreWidget {
-
- public EventsWidget() {
- super("events", "Events", "/org/sonar/server/dashboard/widget/events.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetCategory({"Hotspots"})
-@WidgetProperties({
- @WidgetProperty(key = "title", type = WidgetPropertyType.STRING),
- @WidgetProperty(key = "metric", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "numberOfLines", type = WidgetPropertyType.INTEGER, defaultValue = "5")
-})
-public class HotspotMetricWidget extends CoreWidget {
- public HotspotMetricWidget() {
- super("hotspot_metric", "Metric hotspot", "/org/sonar/server/dashboard/widget/hotspot_metric.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-import org.sonar.api.web.WidgetScope;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Filters", "Issues"})
-@WidgetScope(GLOBAL)
-@WidgetProperties({
- @WidgetProperty(key = IssueFilterWidget.FILTER_PROPERTY, type = WidgetPropertyType.ISSUE_FILTER, optional = false),
- @WidgetProperty(key = IssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, type = WidgetPropertyType.SINGLE_SELECT_LIST, defaultValue = "severities",
- options = {"types", "severities", "resolutions", "statuses", "rules", "tags", "projectUuids", "assignees",
- "authors", "languages", "createdAt"}),
- @WidgetProperty(key = IssueFilterWidget.DISPLAY_FILTER_DESCRIPTION, type = WidgetPropertyType.BOOLEAN, defaultValue = "false"),
- @WidgetProperty(key = IssueFilterWidget.DISPLAY_MODE, type = WidgetPropertyType.SINGLE_SELECT_LIST, defaultValue = "count", options = {"count", "debt"})
-})
-public class IssueFilterWidget extends CoreWidget {
-
- public static final String FILTER_PROPERTY = "filter";
- public static final String DISTRIBUTION_AXIS_PROPERTY = "distributionAxis";
- public static final String DISPLAY_FILTER_DESCRIPTION = "displayFilterDescription";
- public static final String DISPLAY_MODE = "displayMode";
- public static final String ID = "issue_filter";
-
- public IssueFilterWidget() {
- super(ID, "Issue Filter", "/org/sonar/server/dashboard/widget/issue_filter.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-import org.sonar.api.web.WidgetScope;
-
-import static org.sonar.api.web.WidgetScope.PROJECT;
-
-@WidgetCategory({"Issues"})
-@WidgetScope(PROJECT)
-@WidgetProperties({
- @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100")
-})
-public class IssueTagCloudWidget extends CoreWidget {
-
- public IssueTagCloudWidget() {
- super("issue_tag_cloud", "Issue Tag Cloud", "/org/sonar/server/dashboard/widget/issue_tag_cloud.html.erb");
- }
-
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.WidgetCategory;
-
-@WidgetCategory({"Issues", "Technical Debt"})
-public class IssuesWidget extends CoreWidget {
-
- public IssuesWidget() {
- super("rules", "Issues and Effort", "/org/sonar/server/dashboard/widget/issues.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.UserRole;
-import org.sonar.api.web.WidgetCategory;
-
-@WidgetCategory("Tests")
-@UserRole(UserRole.USER)
-public class ItCoverageWidget extends CoreWidget {
-
- public ItCoverageWidget() {
- super("it-coverage", "Integration Test Coverage", "/org/sonar/server/dashboard/widget/it_coverage.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-import org.sonar.api.web.WidgetScope;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Filters"})
-@WidgetScope(GLOBAL)
-@WidgetProperties({
- @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
- @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "300"),
- @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false),
- @WidgetProperty(key = "xMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "yMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.VIOLATIONS_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "xLogarithmic", type = WidgetPropertyType.BOOLEAN),
- @WidgetProperty(key = "yLogarithmic", type = WidgetPropertyType.BOOLEAN),
- @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER)
-})
-public class MeasureFilterAsBubbleChartWidget extends CoreWidget {
-
- public MeasureFilterAsBubbleChartWidget() {
- super("measure_filter_bubble_chart", "Measure Filter as Bubble Chart", "/org/sonar/server/dashboard/widget/measure_filter_bubble_chart.html.erb");
- }
-
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-import org.sonar.api.web.WidgetScope;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Filters"})
-@WidgetScope(GLOBAL)
-@WidgetProperties({
- @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false),
- @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
- @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COMPLEXITY_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COVERAGE_KEY,
- options = {WidgetConstants.FILTER_OUT_NEW_METRICS, "type:PERCENT"}),
- @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100")
-})
-public class MeasureFilterAsCloudWidget extends CoreWidget {
-
- public MeasureFilterAsCloudWidget() {
- super("measure_filter_cloud", "Measure Filter as Cloud", "/org/sonar/server/dashboard/widget/measure_filter_cloud.html.erb");
- }
-
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-import org.sonar.api.web.WidgetScope;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Filters"})
-@WidgetScope(GLOBAL)
-@WidgetProperties({
- @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
- @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false),
- @WidgetProperty(key = "metric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "40"),
- @WidgetProperty(key = "reverseOrder", type = WidgetPropertyType.BOOLEAN, defaultValue = "false"),
- @WidgetProperty(key = "relativeScale", type = WidgetPropertyType.BOOLEAN, defaultValue = "false")
-})
-public class MeasureFilterAsHistogramWidget extends CoreWidget {
-
- public MeasureFilterAsHistogramWidget() {
- super("measure_filter_histogram", "Measure Filter as Histogram", "/org/sonar/server/dashboard/widget/measure_filter_histogram.html.erb");
- }
-
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-import org.sonar.api.web.WidgetScope;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Filters"})
-@WidgetScope(GLOBAL)
-@WidgetProperties({
- @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
- @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "300"),
- @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false),
- @WidgetProperty(key = "mainMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "extraMetric1", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "extraMetric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "20")
-})
-public class MeasureFilterAsPieChartWidget extends CoreWidget {
-
- public MeasureFilterAsPieChartWidget() {
- super("measure_filter_pie_chart", "Measure Filter as Donut Chart", "/org/sonar/server/dashboard/widget/measure_filter_pie_chart.html.erb");
- }
-
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-import org.sonar.api.web.WidgetScope;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Filters"})
-@WidgetScope(GLOBAL)
-@WidgetProperties({
- @WidgetProperty(key = MeasureFilterAsTreemapWidget.FILTER_PROPERTY, type = WidgetPropertyType.FILTER,
- optional = false),
- @WidgetProperty(key = MeasureFilterAsTreemapWidget.CHART_TITLE_PROPERTY, type = WidgetPropertyType.STRING),
- @WidgetProperty(key = MeasureFilterAsTreemapWidget.SIZE_METRIC_PROPERTY, type = WidgetPropertyType.METRIC,
- defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = MeasureFilterAsTreemapWidget.COLOR_METRIC_PROPERTY, type = WidgetPropertyType.METRIC,
- defaultValue = CoreMetrics.COVERAGE_KEY,
- options = {WidgetConstants.FILTER_OUT_NEW_METRICS, "type:PERCENT,RATING,LEVEL"}),
- @WidgetProperty(key = MeasureFilterAsTreemapWidget.HEIGHT_PERCENTS_PROPERTY, type = WidgetPropertyType.INTEGER,
- defaultValue = "55", description = "Height in percents of width", optional = true),
- @WidgetProperty(key = MeasureFilterAsTreemapWidget.MAX_ITEMS_PROPERTY, type = WidgetPropertyType.INTEGER,
- defaultValue = "30")
-})
-public class MeasureFilterAsTreemapWidget extends CoreWidget {
- public static final String FILTER_PROPERTY = "filter";
- public static final String SIZE_METRIC_PROPERTY = "sizeMetric";
- public static final String COLOR_METRIC_PROPERTY = "colorMetric";
- public static final String HEIGHT_PERCENTS_PROPERTY = "heightInPercents";
- public static final String CHART_TITLE_PROPERTY = "chartTitle";
- public static final String MAX_ITEMS_PROPERTY = "maxItems";
- public static final String ID = "measure_filter_treemap";
-
- public MeasureFilterAsTreemapWidget() {
- super(ID, "Measure Filter as Treemap", "/org/sonar/server/dashboard/widget/measure_filter_treemap.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-import org.sonar.api.web.WidgetScope;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Filters"})
-@WidgetScope(GLOBAL)
-@WidgetProperties({
- @WidgetProperty(key = MeasureFilterListWidget.FILTER_PROPERTY, type = WidgetPropertyType.FILTER, optional = false),
- @WidgetProperty(key = MeasureFilterListWidget.PAGE_SIZE_PROPERTY, type = WidgetPropertyType.INTEGER, defaultValue = "30"),
- @WidgetProperty(key = MeasureFilterListWidget.DISPLAY_FILTER_DESCRIPTION, type = WidgetPropertyType.BOOLEAN, defaultValue = "false")
-})
-public class MeasureFilterListWidget extends CoreWidget {
- public static final String FILTER_PROPERTY = "filter";
- public static final String PAGE_SIZE_PROPERTY = "pageSize";
- public static final String DISPLAY_FILTER_DESCRIPTION = "displayFilterDescription";
- public static final String ID = "measure_filter_list";
-
- public MeasureFilterListWidget() {
- super(ID, "Measure Filter as List", "/org/sonar/server/dashboard/widget/measure_filter_list.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetProperties({
- @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
- @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COVERAGE_KEY, options = "type:PERCENT"),
- @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COMPLEXITY_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100")
-})
-public class ProjectFileCloudWidget extends CoreWidget {
- public ProjectFileCloudWidget() {
- super("project_file_cloud", "Project File Word Cloud", "/org/sonar/server/dashboard/widget/project_file_cloud.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-import org.sonar.api.web.WidgetScope;
-
-import static org.sonar.api.web.WidgetScope.PROJECT;
-
-@WidgetCategory({"Filters", "Issues"})
-@WidgetScope(PROJECT)
-@WidgetProperties({
- @WidgetProperty(key = ProjectIssueFilterWidget.FILTER_PROPERTY, type = WidgetPropertyType.ISSUE_FILTER, optional = false),
- @WidgetProperty(key = ProjectIssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, type = WidgetPropertyType.SINGLE_SELECT_LIST, defaultValue = "severities",
- options = {"types", "severities", "resolutions", "statuses", "rules", "tags", "assignees", "authors",
- "languages", "createdAt"}),
- @WidgetProperty(key = ProjectIssueFilterWidget.DISPLAY_FILTER_DESCRIPTION, type = WidgetPropertyType.BOOLEAN, defaultValue = "false"),
- @WidgetProperty(key = ProjectIssueFilterWidget.DISPLAY_MODE, type = WidgetPropertyType.SINGLE_SELECT_LIST, defaultValue = "count", options = {"count", "debt"})
-})
-public class ProjectIssueFilterWidget extends CoreWidget {
-
- public static final String FILTER_PROPERTY = "filter";
- public static final String DISTRIBUTION_AXIS_PROPERTY = "distributionAxis";
- public static final String DISPLAY_FILTER_DESCRIPTION = "displayFilterDescription";
- public static final String DISPLAY_MODE = "displayMode";
- public static final String ID = "project_issue_filter";
-
- public ProjectIssueFilterWidget() {
- super(ID, "Project Issue Filter", "/org/sonar/server/dashboard/widget/project_issue_filter.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-public class SizeWidget extends CoreWidget {
-
- public SizeWidget() {
- super("size", "Size metrics", "/org/sonar/server/dashboard/widget/size.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetCategory("History")
-@WidgetProperties({
- @WidgetProperty(key = "title", type = WidgetPropertyType.STRING),
- @WidgetProperty(key = "numberOfColumns", type = WidgetPropertyType.INTEGER, defaultValue = "3"),
- @WidgetProperty(key = "displaySparkLine", type = WidgetPropertyType.BOOLEAN),
- @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "metric4", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "metric5", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "metric6", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "metric7", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "metric8", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "metric9", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "metric10", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS})
-})
-public class TimeMachineWidget extends CoreWidget {
- public TimeMachineWidget() {
- super("time_machine", "History Table", "/org/sonar/server/dashboard/widget/time_machine.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetCategory("History")
-@WidgetProperties({
- @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
- @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "hideEvents", type = WidgetPropertyType.BOOLEAN),
- @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "180"),
- @WidgetProperty(key = "undefinedToZero", type = WidgetPropertyType.BOOLEAN, defaultValue = "true")
-})
-public class TimelineWidget extends CoreWidget {
- public TimelineWidget() {
- super("timeline", "Timeline", "/org/sonar/server/dashboard/widget/timeline.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetProperties({
- @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
- @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY,
- options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
- @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COVERAGE_KEY,
- options = {WidgetConstants.FILTER_OUT_NEW_METRICS, "type:PERCENT,RATING,LEVEL"}),
- @WidgetProperty(key = "heightInPercents", type = WidgetPropertyType.INTEGER, defaultValue = "55", optional = true),
- @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100")
-})
-public class TreemapWidget extends CoreWidget {
- public TreemapWidget() {
- super("treemap-widget", "Treemap of Components", "/org/sonar/server/dashboard/widget/treemap.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import org.sonar.api.web.WidgetScope;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetScope(GLOBAL)
-public class WelcomeWidget extends CoreWidget {
-
- public static final String ID = "welcome";
-
- public WelcomeWidget() {
- super(ID, "Welcome", "/org/sonar/server/dashboard/widget/welcome.html.erb");
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-/**
- * Constants shared accross multiple widgets
- */
-public interface WidgetConstants {
-
- /**
- * Widget property option used to filter out all the metrics which keys start with "new_".
- *
- * @see org.sonar.api.web.WidgetProperty#options()
- */
- String FILTER_OUT_NEW_METRICS = "key:^(?!new_).*";
-}
+++ /dev/null
-/*
- * 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.server.dashboard.widget;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
import org.sonar.server.component.es.ProjectsEsModule;
import org.sonar.server.component.ws.ComponentsWsModule;
import org.sonar.server.config.ws.PropertiesWs;
-import org.sonar.server.dashboard.template.GlobalDefaultDashboard;
-import org.sonar.server.dashboard.widget.AlertsWidget;
-import org.sonar.server.dashboard.widget.BubbleChartWidget;
-import org.sonar.server.dashboard.widget.ComplexityWidget;
-import org.sonar.server.dashboard.widget.CoverageWidget;
-import org.sonar.server.dashboard.widget.CustomMeasuresWidget;
-import org.sonar.server.dashboard.widget.DebtOverviewWidget;
-import org.sonar.server.dashboard.widget.DescriptionWidget;
-import org.sonar.server.dashboard.widget.DocumentationCommentsWidget;
-import org.sonar.server.dashboard.widget.DuplicationsWidget;
-import org.sonar.server.dashboard.widget.EventsWidget;
-import org.sonar.server.dashboard.widget.HotspotMetricWidget;
-import org.sonar.server.dashboard.widget.IssueFilterWidget;
-import org.sonar.server.dashboard.widget.IssueTagCloudWidget;
-import org.sonar.server.dashboard.widget.IssuesWidget;
-import org.sonar.server.dashboard.widget.ItCoverageWidget;
-import org.sonar.server.dashboard.widget.MeasureFilterAsBubbleChartWidget;
-import org.sonar.server.dashboard.widget.MeasureFilterAsCloudWidget;
-import org.sonar.server.dashboard.widget.MeasureFilterAsHistogramWidget;
-import org.sonar.server.dashboard.widget.MeasureFilterAsPieChartWidget;
-import org.sonar.server.dashboard.widget.MeasureFilterAsTreemapWidget;
-import org.sonar.server.dashboard.widget.MeasureFilterListWidget;
-import org.sonar.server.dashboard.widget.ProjectFileCloudWidget;
-import org.sonar.server.dashboard.widget.ProjectIssueFilterWidget;
-import org.sonar.server.dashboard.widget.SizeWidget;
-import org.sonar.server.dashboard.widget.TimeMachineWidget;
-import org.sonar.server.dashboard.widget.TimelineWidget;
-import org.sonar.server.dashboard.widget.TreemapWidget;
-import org.sonar.server.dashboard.widget.WelcomeWidget;
import org.sonar.server.debt.DebtModelBackup;
import org.sonar.server.debt.DebtModelPluginRepository;
import org.sonar.server.debt.DebtModelService;
// batch
BatchWsModule.class,
- // Dashboard
- GlobalDefaultDashboard.class,
- AlertsWidget.class,
- CoverageWidget.class,
- ItCoverageWidget.class,
- DescriptionWidget.class,
- ComplexityWidget.class,
- IssuesWidget.class,
- SizeWidget.class,
- EventsWidget.class,
- CustomMeasuresWidget.class,
- TimelineWidget.class,
- BubbleChartWidget.class,
- TimeMachineWidget.class,
- HotspotMetricWidget.class,
- TreemapWidget.class,
- MeasureFilterListWidget.class,
- MeasureFilterAsTreemapWidget.class,
- WelcomeWidget.class,
- DocumentationCommentsWidget.class,
- DuplicationsWidget.class,
- MeasureFilterAsPieChartWidget.class,
- MeasureFilterAsCloudWidget.class,
- MeasureFilterAsHistogramWidget.class,
- MeasureFilterAsBubbleChartWidget.class,
- ProjectFileCloudWidget.class,
- DebtOverviewWidget.class,
- IssueFilterWidget.class,
- ProjectIssueFilterWidget.class,
- IssueTagCloudWidget.class,
-
// update center
UpdateCenterModule.class,
*/
package org.sonar.server.ui;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
-import java.util.Collection;
-import java.util.Map;
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.sonar.api.web.ResourceScope;
import org.sonar.api.web.UserRole;
import org.sonar.api.web.View;
-import org.sonar.api.web.Widget;
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetLayout;
-import org.sonar.api.web.WidgetLayoutType;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetScope;
import org.sonar.db.component.ComponentDto;
import org.sonar.server.user.UserSession;
private String[] resourceLanguages = {};
private String[] defaultForMetrics = {};
private String description = "";
- private Map<String, WidgetProperty> widgetPropertiesByKey = Maps.newLinkedHashMap();
- private String[] widgetCategories = {};
- private WidgetLayoutType widgetLayout = WidgetLayoutType.DEFAULT;
private boolean isDefaultTab = false;
- private boolean isWidget = false;
- private boolean isGlobal = false;
public ViewProxy(V view, UserSession userSession) {
this.view = view;
initResourceLanguage(view);
initDefaultTabInfo(view);
initDescription(view);
- initWidgetProperties(view);
- initWidgetCategory(view);
- initWidgetLayout(view);
- initWidgetGlobal(view);
-
- isWidget = view instanceof Widget;
- }
-
- private void initWidgetLayout(final V view) {
- WidgetLayout layoutAnnotation = AnnotationUtils.getAnnotation(view, WidgetLayout.class);
- if (layoutAnnotation != null) {
- widgetLayout = layoutAnnotation.value();
- }
- }
-
- private void initWidgetCategory(final V view) {
- WidgetCategory categAnnotation = AnnotationUtils.getAnnotation(view, WidgetCategory.class);
- if (categAnnotation != null) {
- widgetCategories = categAnnotation.value();
- }
- }
-
- private void initWidgetGlobal(V view) {
- WidgetScope scopeAnnotation = AnnotationUtils.getAnnotation(view, WidgetScope.class);
- if (scopeAnnotation != null) {
- checkValidScope(view, scopeAnnotation);
- isGlobal = ImmutableSet.copyOf(scopeAnnotation.value()).contains(WidgetScope.GLOBAL);
- }
- }
-
- private static <V> void checkValidScope(V view, WidgetScope scopeAnnotation) {
- for (String scope : scopeAnnotation.value()) {
- if (!scope.equals(WidgetScope.PROJECT) && !scope.equalsIgnoreCase(WidgetScope.GLOBAL)) {
- throw new IllegalArgumentException(String.format("Invalid widget scope %s for widget %s", scope, view.getClass().getSimpleName()));
- }
- }
- }
-
- private void initWidgetProperties(final V view) {
- WidgetProperties propAnnotation = AnnotationUtils.getAnnotation(view, WidgetProperties.class);
- if (propAnnotation != null) {
- for (WidgetProperty property : propAnnotation.value()) {
- widgetPropertiesByKey.put(property.key(), property);
- }
- }
}
private void initDescription(final V view) {
return description;
}
- public Collection<WidgetProperty> getWidgetProperties() {
- return widgetPropertiesByKey.values();
- }
-
- public WidgetProperty getWidgetProperty(String propertyKey) {
- return widgetPropertiesByKey.get(propertyKey);
- }
-
- public String[] getWidgetCategories() {
- return widgetCategories;
- }
-
public String[] getSections() {
return sections;
}
return authorized;
}
- public boolean isWidget() {
- return isWidget;
- }
-
- public boolean isGlobal() {
- return isGlobal;
- }
-
- public WidgetLayoutType getWidgetLayout() {
- return widgetLayout;
- }
-
- public boolean isEditable() {
- return !widgetPropertiesByKey.isEmpty();
- }
-
- public boolean hasRequiredProperties() {
- boolean requires = false;
- for (WidgetProperty property : getWidgetProperties()) {
- if (!property.optional() && StringUtils.isEmpty(property.defaultValue())) {
- requires = true;
- }
- }
- return requires;
- }
-
@Override
public int hashCode() {
return getId().hashCode();
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.annotation.Nullable;
import org.apache.commons.lang.ArrayUtils;
import org.sonar.api.server.ServerSide;
import org.sonar.api.web.Page;
import org.sonar.api.web.View;
import org.sonar.api.web.Widget;
-
-import javax.annotation.Nullable;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
import org.sonar.server.user.UserSession;
@ServerSide
}
protected static boolean acceptNavigationSection(ViewProxy<?> proxy, @Nullable String section) {
- return proxy.isWidget() || section == null || ArrayUtils.contains(proxy.getSections(), section);
+ return section == null || ArrayUtils.contains(proxy.getSections(), section);
}
}
+++ /dev/null
-<% m=measure(Metric::QUALITY_GATE_DETAILS)
- if m && !m.data.blank?
- details = JSON.parse m.data
- m.alert_status = details['level']
- raw_conditions = details['conditions']
- conditions = []
- missing_metric = false
- raw_conditions.each do |condition|
- if metric(condition['metric']).nil?
- missing_metric = true
- else
- conditions << condition
- end
- end
- alert_metric = metric(Metric::ALERT_STATUS)
-
- warn_message = message('measure_filter.criteria.alert.warn')
- error_message = message('measure_filter.criteria.alert.error')
-
- css_class = "color_#{m.alert_status}"
- if m.alert_status==Metric::TYPE_LEVEL_OK
- label = "#{message('widget.alerts.no_alert')}."
- elsif m.alert_status==Metric::TYPE_LEVEL_WARN
- label = "#{message('widget.alerts.warnings')}"
- else
- label = "#{message('widget.alerts.errors')}"
- end
--%><div class="widget <%= css_class -%>" style="color: black !important" id="quality_gate_widget_<%= widget.id -%>">
- <div><%= format_measure(measure(Metric::ALERT_STATUS)) -%> <%= label -%></div>
- <% if conditions.any? {|condition| condition['level'] != 'OK'} || widget_properties['show_ok'] && !conditions.empty? -%>
- <% conditions.sort_by {|condition| [ -condition['level'].length, metric(condition['metric']).short_name] }.each do |condition|
-
- level = condition['level']
- condition_metric = metric(condition['metric'])
- operator = message("quality_gates.operator.#{condition['op']}.short")
- period = condition['period']
- warning_value = condition['warning']
- error_value = condition['error']
- actual_value = condition['actual']
-
- detail_measure = ProjectMeasure.new :metric => alert_metric, :alert_status => level
-
- drilldown_url = period.blank? ? url_for_drilldown(condition_metric) : url_for_drilldown(condition_metric, :period => period)
-
- actual_measure = ProjectMeasure.new :metric => condition_metric, :value => actual_value, :alert_status => level
- warning_measure = ProjectMeasure.new :metric => condition_metric, :value => warning_value
- error_measure = ProjectMeasure.new :metric => condition_metric, :value => error_value
-
- is_difference_measure = condition_metric.name.start_with?('new_')
- is_issue_measure = get_issue_metrics.include? condition_metric.name
- is_not_difference_measure_with_period = !is_difference_measure && !period.blank? && !is_issue_measure
-
- tooltip = message('widget.as_calculated_on_x', :params => l(@snapshot.created_at))
-
-
- unless level == 'OK' && !widget_properties['show_ok']
- -%>
- <div class="dashbox" style="margin: 10px; vertical-align: baseline">
- <p class="title"><%= condition_metric.short_name -%></p>
- <% if is_not_difference_measure_with_period %>
- <span class="big" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom"><%= format_measure(actual_measure) -%></span>
- <% else %>
- <span class="big" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom"><%= format_measure(actual_measure, :url => drilldown_url) -%></span>
- <% end %>
- <% if level == 'WARN' -%><%= operator -%> <%= format_measure(warning_measure) -%><% end -%>
- <% if level == 'ERROR' -%><%= operator -%> <%= format_measure(error_measure) -%><% end -%>
- <% if level == 'OK' -%>
- <% unless warning_value.blank? -%><%= warn_message -%> <%= operator -%> <%= format_measure(warning_measure) -%> <%= '|' unless error_value.blank? -%><% end -%>
- <% unless error_value.blank? -%><%= error_message -%> <%= operator -%> <%= format_measure(error_measure) -%><% end -%>
- <% end -%>
- <p><%= period_label(@snapshot, period) unless period.blank? -%></p>
- </div>
- <% end
- end
- end
- if missing_metric -%>
- <div class="warning" style="clear: left"><%= message('widget.alerts.missing_metric') -%></div>
- <% end -%>
-</div>
-<% else -%>
-<% m=measure(Metric::ALERT_STATUS)
- if m && !m.alert_status.blank?
- css_class = "widget color_#{m.alert_status}"
- if m.alert_status==Metric::TYPE_LEVEL_OK
- label = "<b>#{message('widget.alerts.no_alert')}</b>."
- elsif m.alert_status==Metric::TYPE_LEVEL_WARN
- label = "<b>#{message('widget.alerts.warnings')}</b>#{h(m.alert_text)}."
- else
- label = "<b>#{message('widget.alerts.errors')}</b>#{h(m.alert_text)}."
- end
--%><div class="<%= css_class -%>" id="alerts_widget">
- <div><%= format_measure(m) -%> <%= label -%></div>
-</div>
-<% end
-end -%>
+++ /dev/null
-<%
- containerId = 'bubble-chart-widget' + widget.id.to_s
- xMetric = widget_properties["xMetric"]
- yMetric = widget_properties["yMetric"]
- sizeMetric = widget_properties["sizeMetric"]
- xLog = !!widget_properties["xLogarithmic"]
- yLog = !!widget_properties["yLogarithmic"]
- chartHeight = widget_properties["chartHeight"]
- chartTitle = widget_properties["chartTitle"]
-%>
-
-<div class="bubble-chart-widget" id="<%= containerId %>">
- <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
- <!--[if (gte IE 9)|!(IE)]><!-->
- <% if chartTitle %>
- <h3><%= h(chartTitle) -%></h3>
- <% end %>
- <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
- (function () {
- <%
- filter = MeasureFilter.new
- # Test files should not be returned
- qualifiers = Api::Utils.java_facade.getResourceLeavesQualifiers(@project.qualifier).to_a.reject {|q| q == 'UTS'}
- filter.criteria = {:qualifiers => qualifiers, :base => @project.key}
- filter.metrics = [xMetric.name, yMetric.name, sizeMetric.name]
- filter.execute(self, :user => current_user)
- %>
-
- var data = {
- metrics: {
- <%= xMetric.name -%>: {
- name: '<%= xMetric.short_name -%>'
- },
- <%= yMetric.name -%>: {
- name: '<%= yMetric.short_name -%>'
- },
- <%= sizeMetric.name -%>: {
- name: '<%= sizeMetric.short_name -%>'
- }
- },
- components: [
- <%
- filter.rows.each do |row|
- x = row.measure(xMetric)
- y = row.measure(yMetric)
- size = row.measure(sizeMetric)
- %>
- {
- key: '<%= escape_javascript row.resource.key -%>',
- name: '<%= escape_javascript row.resource.name -%>',
- longName: '<%= escape_javascript row.resource.long_name -%>',
- qualifier: '<%= escape_javascript row.resource.qualifier -%>',
- measures: {
- <%= xMetric.name -%>: { val: <%= x ? x.value : 0 -%>, fval: '<%= x ? x.formatted_value : "-" -%>' },
- <%= yMetric.name -%>: { val: <%= y ? y.value : 0 -%>, fval: '<%= y ? y.formatted_value : "-" -%>' },
- <%= sizeMetric.name -%>: { val: <%= size ? size.value : 0 -%>, fval: '<%= size ? size.formatted_value : "-" -%>' }
- }
- },
- <% end %>
- ]
- },
- widget = new SonarWidgets.BubbleChart();
-
- widget
- .metrics(data.metrics)
- .metricsPriority(['<%= xMetric.name -%>', '<%= yMetric.name -%>', '<%= sizeMetric.name -%>'])
- .components(data.components)
- .height(<%= chartHeight -%>)
- .options({
- baseUrl: baseUrl + '/dashboard/index',
- xLog: <%= xLog -%>,
- yLog: <%= yLog -%>,
- noData: '<%= escape_javascript message('no_data') -%>',
- noMainMetric: '<%= escape_javascript message('widget.measure_filter.no_main_metric') -%>'
- })
- .render('#<%= containerId -%>');
-
- autoResize(500, function() {
- widget.update('#<%= containerId -%>');
- });
- })();
-</script>
-<!--<![endif]-->
+++ /dev/null
-<%
- file_complexity=measure('file_complexity')
- function_complexity=measure('function_complexity')
- class_complexity=measure('class_complexity')
-
- if file_complexity || function_complexity || class_complexity
- complexity=measure('complexity')
-%>
-
- <div class="widget-row">
- <div class="widget-span widget-span-5">
- <div class="widget-measure-container">
- <% if complexity %>
- <p class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('metric.complexity.name') %></span>
- <span class="nowrap">
- <%= format_measure(complexity, :url => url_for_drilldown(complexity)) %>
- <%= format_variation(complexity) if dashboard_configuration.selected_period? -%>
- </span>
- </p>
- <% end %>
- <% if function_complexity %>
- <p class="widget-measure">
- <span class="widget-label"><%= message('widget.complexity.per_method.suffix') %></span>
- <span class="nowrap">
- <%= format_measure(function_complexity, :url => url_for_drilldown(function_complexity)) %>
- <%= format_variation(function_complexity) if dashboard_configuration.selected_period? -%>
- </span>
- </p>
- <% end %>
- <% if class_complexity %>
- <p class="widget-measure">
- <span class="widget-label"><%= message('widget.complexity.per_class.suffix') %></span>
- <span class="nowrap">
- <%= format_measure(class_complexity, :url => url_for_drilldown(class_complexity)) %>
- <%= format_variation(class_complexity) if dashboard_configuration.selected_period? -%>
- </span>
- </p>
- <% end %>
- <% if file_complexity %>
- <p class="widget-measure">
- <span class="widget-label"><%= message('widget.complexity.per_file.suffix') %></span>
- <span class="nowrap">
- <%= format_measure(file_complexity, :url => url_for_drilldown(file_complexity)) %>
- <%= format_variation(file_complexity) if dashboard_configuration.selected_period? -%>
- </span>
- </p>
- <% end %>
- </div>
- </div>
-
- <div class="widget-span widget-span-7">
- <%
- function_distribution = measure('function_complexity_distribution')
- if function_distribution
- %>
- <div id="complexity-widget-<%= widget.id.to_s -%>-function-distribution"></div>
- <script>
- (function () {
- window.ComplexityDistribution({
- el: '#complexity-widget-<%= widget.id.to_s -%>-function-distribution',
- value: '<%= function_distribution.data -%>',
- of: 'function'
- });
- })();
- </script>
- <% end %>
- <%
- file_distribution = measure('file_complexity_distribution')
- if file_distribution
- %>
- <div id="complexity-widget-<%= widget.id.to_s -%>-file-distribution"></div>
- <script>
- (function () {
- window.ComplexityDistribution({
- el: '#complexity-widget-<%= widget.id.to_s -%>-file-distribution',
- value: '<%= file_distribution.data -%>',
- of: 'file'
- });
- })();
- </script>
- <% end %>
- </div>
- </div>
-<% end %>
+++ /dev/null
-<%
- code_coverage_measure=measure('coverage')
- tests_measure=measure('tests')
- execution_time=measure('test_execution_time')
- success_percentage=measure('test_success_density')
-
- if code_coverage_measure || tests_measure
-%>
- <div class="widget-row">
- <div class="widget-span widget-span-6">
- <div class="widget-measure-container">
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.code_coverage.name') -%></span>
- <span class="nowrap">
- <%= format_measure(code_coverage_measure, :suffix => '', :url => url_for_drilldown('uncovered_lines', :highlight => 'coverage'), :default => '-') %>
- <%= format_variation(code_coverage_measure) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <%
- line_coverage=measure('line_coverage')
- if line_coverage
- %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.code_coverage.line_coverage.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(line_coverage, :url => url_for_drilldown('uncovered_lines', :highlight => 'line_coverage')) %>
- <%= format_variation(line_coverage) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <% end %>
- <%
- branch_coverage=measure('branch_coverage')
- if branch_coverage
- %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.code_coverage.condition_coverage.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(branch_coverage, :url => url_for_drilldown('uncovered_conditions', :highlight => 'branch_coverage')) %>
- <%= format_variation(branch_coverage) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <% end %>
-
- <%
- if dashboard_configuration.selected_period?
- new_lines_to_cover_measure=measure('new_lines_to_cover')
- if new_lines_to_cover_measure
- new_lines=new_lines_to_cover_measure.variation(dashboard_configuration.period_index)
- if new_lines
- new_coverage=measure('new_coverage') if variation_value('new_coverage')
- new_line_coverage=measure('new_line_coverage') if variation_value('new_line_coverage')
- new_branch_coverage=measure('new_branch_coverage') if variation_value('new_branch_coverage')
- %>
- <% if new_lines.to_i==0 %>
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.code_coverage.on_new_code') -%></span>
- <p><%= message('widget.code_coverage.no_new_lines_to_cover') -%></p>
- </div>
- <% else %>
- <% if new_coverage %>
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.code_coverage.on_new_code') -%></span>
- <%= format_measure(new_coverage,
- :period => dashboard_configuration.period_index,
- :url => url_for_drilldown('new_uncovered_lines', :highlight => 'new_coverage', :period => dashboard_configuration.period_index)) %>
- </div>
- <% end %>
- <% if new_line_coverage %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.code_coverage.line_coverage.suffix') -%></span>
- <%= format_measure(new_line_coverage,
- :period => dashboard_configuration.period_index,
- :url => url_for_drilldown('new_uncovered_lines', :highlight => 'new_line_coverage', :period => dashboard_configuration.period_index),
- :default => '-') %>
- </div>
- <% end %>
- <% if new_branch_coverage %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.code_coverage.condition_coverage.suffix') -%></span>
- <%= format_measure(new_branch_coverage,
- :period => dashboard_configuration.period_index,
- :url => url_for_drilldown('new_uncovered_conditions', :highlight => 'new_branch_coverage', :period => dashboard_configuration.period_index),
- :default => '-') %>
- </div>
- <% end %>
- <% end %>
- <%
- end
- end
- end
- %>
- </div>
- </div>
- <div class="widget-span widget-span-6">
- <%
- if tests_measure
- %>
- <div class="widget-measure-container">
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.code_coverage.test_success') -%></span>
- <span class="nowrap">
- <%= format_measure(success_percentage, :url => url_for_drilldown(success_percentage)) %>
- <%= format_variation(success_percentage) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
-
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.code_coverage.failures.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(Metric::TEST_FAILURES, :url => url_for_drilldown(Metric::TEST_FAILURES)) %>
- <%= format_variation(Metric::TEST_FAILURES) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
-
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.code_coverage.errors.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(Metric::TEST_ERRORS, :url => url_for_drilldown(Metric::TEST_ERRORS)) %>
- <%= format_variation(Metric::TEST_ERRORS) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
-
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.code_coverage.tests.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(tests_measure, :url => url_for_drilldown('tests')) %>
- <%= format_variation(tests_measure) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
-
- <% skipped_measure=measure(Metric::SKIPPED_TESTS)
- if dashboard_configuration.selected_period? || (skipped_measure && skipped_measure.value && skipped_measure.value>0)
- %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.code_coverage.skipped.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(skipped_measure, :url => url_for_drilldown(Metric::SKIPPED_TESTS)) %>
- <%= format_variation(skipped_measure) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <% end %>
-
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.code_coverage.execution_time') -%></span>
- <span class="nowrap">
- <%= format_measure(execution_time, :url => url_for_drilldown('test_execution_time')) %>
- <%= format_variation(execution_time) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- </div>
- <% end %>
- </div>
- </div>
-<% end %>
+++ /dev/null
-<%
- measures=[]
- (1..10).each do |index|
- metric=widget_properties["metric#{index}"]
- m=(metric ? measure(metric) : nil)
- measures << m if m
- end
- period = params[:period]
- unless measures.empty? || measures.none? { |measure| measure.visible?(period.to_i) }
-%>
- <div class="widget-row">
- <%
- measures.each do |measure|
- if measure.visible?(period.to_i)
- -%>
- <div class="widget-span widget-span-3">
- <div class="widget-measure-container">
- <div class="widget-measure widget-measure-main">
- <div class="widget-label"><%= measure.metric.short_name -%></div>
- <div class="text-ellipsis">
- <% if measure.value.nil? && measure.text_value.nil? -%>
- <%= format_measure(measure, :url => url_for_drilldown(measure, :period => period), :period => period) -%>
- <% else %>
- <%= format_measure(measure, :url => url_for_drilldown(measure)) -%>
- <%= format_variation(measure) if dashboard_configuration.selected_period? -%>
- <% end -%>
- </div>
- </div>
- </div>
- </div>
- <%
- end
- end
- -%>
- </div>
-<% end %>
+++ /dev/null
-<%
- sqale_rating = @snapshot.measure('sqale_rating')
- sqale_debt_ratio = @snapshot.measure('sqale_debt_ratio')
- if sqale_rating && sqale_rating.text_value && sqale_debt_ratio
-%>
- <div class="widget-row">
- <% if sqale_rating && sqale_rating.text_value %>
- <div class="widget-span widget-span-6">
- <div class="widget-measure-container">
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('metric.sqale_rating.name') -%></span>
- <span class="nowrap">
- <%= format_measure(sqale_rating, :url => url_for_drilldown(sqale_rating)) %>
- </span>
- </div>
- </div>
- </div>
- <% end %>
- <% if sqale_debt_ratio %>
- <div class="widget-span widget-span-6">
- <div class="widget-measure-container">
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('metric.sqale_debt_ratio.name') -%></span>
- <span class="nowrap">
- <%= format_measure(sqale_debt_ratio, :url => url_for_drilldown(sqale_debt_ratio)) %>
- <%= format_variation(sqale_debt_ratio) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <% if dashboard_configuration.selected_period? %>
- <% new_sqale_debt_ratio = @snapshot.measure('new_sqale_debt_ratio') %>
- <% if new_sqale_debt_ratio %>
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.debt_overview.on_new_code') -%></span>
- <span class="nowrap">
- <%= format_measure(new_sqale_debt_ratio,
- :period => dashboard_configuration.period_index,
- :url => url_for_drilldown('new_sqale_debt_ratio', :period => dashboard_configuration.period_index)) %>
- </span>
- </div>
- <% end %>
- <% end %>
- </div>
- </div>
- <% end %>
- </div>
-<% end %>
+++ /dev/null
-<div class="widget">
- <h3 class="description-widget-project">
- <i class="icon-qualifier-<%= @project.qualifier.downcase -%>"></i>
- <%= @project.name -%>
- </h3>
- <span class="description-widget-key"><%= h @project.key -%></span>
-
- <% if @project.description.present? %>
- <p class="description-widget-description"><%= h @project.description -%></p>
- <% end %>
-
- <%
- qprofiles_measure = measure(Metric::QUALITY_PROFILES)
- if qprofiles_measure && !qprofiles_measure.data.blank?
- qprofiles = JSON.parse qprofiles_measure.data
- if qprofiles.size>0
- %>
- <p class="description-widget-description">
- <%= message('widget.description.profiles') -%>:
- <% qprofiles.each_with_index do |profile, i| %>
- <span class="nowrap">
- <span id="resource_profile">
- <%= link_to profile['name'], {:controller => 'profiles', :action => 'show', :key => profile['key']}, :class => 'widget-link', :id => profile['language'] + '_profile_link' -%>
- </span>
- <span class="subtitle">
- (<%= Api::Utils.language_name(profile['language']) -%>)
- </span>
- <% if i < (qprofiles.size - 1) %>,<% end %>
- </span>
- <% end
- end %>
- </p>
- <%
- else
- profile_measure=@snapshot.measure('profile')
- if profile_measure
- %>
- <p class="description-widget-description">
- <%= message('widget.description.profile') -%>:
- <span id="resource_profile">
- <%= link_to profile_measure.data, {:controller => 'profiles', :action => 'show', :id => profile_measure.value.to_i}, :class => 'widget-link', :id => 'profile_link' -%>
- </span>
- </p>
- <% end
- end %>
-
- <%
- unless @resource.qualifier == 'DEV' or @resource.qualifier == 'VW' or @resource.qualifier == 'SVW'
- using_default=false
- root = @resource.root_project
- quality_gate=Property.value('sonar.qualitygate', root.id, nil)
- unless quality_gate
- quality_gate=Property.value('sonar.qualitygate', nil, nil)
- using_default=false || quality_gate
- end
- if quality_gate
- qgate = Internal.quality_gates.get(quality_gate.to_i)
- %>
- <p class="description-widget-description">
- <span id="resource_qgate">
- <%= message('widget.description.qualitygate') -%>:
- <%= link_to qgate.getName(), (url_for :controller => '/quality_gates') + '#show/' + quality_gate, :class => 'widget-link', :id => 'qgate_link' -%>
- <% if using_default %>
- <span class="subtitle">(<%= message('default') -%>)</span>
- <% end %>
- </span>
- </p>
- <% end end %>
-
- <% unless @project.project_links.empty? %>
- <ul class="description-widget-links">
- <% @project.project_links.sort.each do |link| %>
- <li>
- <% if link.href.starts_with?('http') %>
- <a class="widget-link link-<%= h link.link_type -%>" target="_blank" href="<%= link.href -%>">
- <i class="icon-<%= h link.link_type -%>"></i>
- <%= h link.name -%>
- </a>
- <% else %>
- <a class="widget-link link-<%= h link.link_type -%>" href="#" onclick="$j('#link_<%= link.id -%>').toggle();return false;">
- <i class="icon-<%= h link.link_type -%>"></i>
- <%= h(link.name) -%>
- </a>
-
- <div class="description-widget-link-data" id="link_<%= link.id -%>" style="display:none"><%= h(link.href) -%></div>
- <% end %>
- </li>
- <% end %>
- </ul>
- <% end %>
-</div>
+++ /dev/null
-<%
- if measure(Metric::LINES) || measure(Metric::NCLOC)
- public_api=measure('public_api')
- public_documented_api_density=measure('public_documented_api_density')
- public_undocumented_api=measure('public_undocumented_api')
- comment_lines=measure('comment_lines')
- comment_lines_density=measure('comment_lines_density')
-%>
-<div class="widget-row">
- <div class="widget-span widget-span-6">
- <% if public_documented_api_density || public_api || public_undocumented_api %>
- <div class="widget-measure-container">
- <%
- if public_documented_api_density
- %>
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.documentation_comments.documentation') -%></span>
- <span class="nowrap">
- <%= format_measure(public_documented_api_density, :url => url_for_drilldown(Metric::PUBLIC_UNDOCUMENTED_API, :highlight => Metric::PUBLIC_DOCUMENTED_API_DENSITY)) %>
- <%= format_variation('public_documented_api_density') if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <% end %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('metric.public_api.name') -%></span>
- <span class="nowrap">
- <%= format_measure(public_api,:url => url_for_drilldown(public_api)) %>
- <%= format_variation(public_api) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <div class="widget-measure">
- <span class="widget-label"><%= message('metric.public_undocumented_api.abbreviation') -%></span>
- <span class="nowrap">
- <%= format_measure(public_undocumented_api,:url => url_for_drilldown(public_undocumented_api)) %>
- <%= format_variation(public_undocumented_api) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- </div>
- <% end %>
- </div>
-
- <div class="widget-span widget-span-6">
- <div class="widget-measure-container">
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.documentation_comments.comments') -%></span>
- <span class="nowrap">
- <%= format_measure(comment_lines_density,:url => url_for_drilldown(comment_lines_density))%>
- <%= format_variation(comment_lines_density) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <div class="widget-measure">
- <span class="widget-label"><%= message('metric.comment_lines.name') -%></span>
- <span class="nowrap">
- <%= format_measure(comment_lines,:url => url_for_drilldown(comment_lines)) %>
- <%= format_variation(comment_lines) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- </div>
- </div>
-</div>
-<%
- end
-%>
+++ /dev/null
-<%
- duplicated_lines_density=measure('duplicated_lines_density')
- if duplicated_lines_density
-%>
-<div class="widget-row">
- <div class="widget-span widget-span-12">
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.duplications.duplications') -%></span>
- <span class="nowrap">
- <%= format_measure(duplicated_lines_density, :url => url_for_drilldown('duplicated_lines', :highlight => 'duplicated_lines_density')) %>
- <%= format_variation('duplicated_lines_density') if dashboard_configuration.selected_period? -%>
- </span>
- </div>
-
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.duplications.lines.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(measure('duplicated_lines'), :url => url_for_drilldown('duplicated_lines'))%>
- <%= format_variation('duplicated_lines') if dashboard_configuration.selected_period? -%>
- </span>
- </div>
-
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.duplications.blocks.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(measure('duplicated_blocks'), :url => url_for_drilldown('duplicated_blocks'))%>
- <%= format_variation('duplicated_blocks') if dashboard_configuration.selected_period? -%>
- </span>
- </div>
-
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.duplications.files.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(measure('duplicated_files'), :url => url_for_drilldown('duplicated_files'))%>
- <%= format_variation('duplicated_files') if dashboard_configuration.selected_period? -%>
- </span>
- </div>
-
- </div>
-</div>
-<% end %>
+++ /dev/null
-<%
- if @resource.scope=='PRJ'
-
- conditions = "component_uuid=:component_uuid"
- values = {:component_uuid => @resource.uuid}
- # in order to not display events linked to deleted snapshot, we build the SQL request with 'NOT IN' as most of the time, there won't be unprocessed snapshots
- snapshots_to_be_deleted = Snapshot.find(:all, :conditions => ["status='U' AND component_uuid=?", @resource.uuid])
- unless snapshots_to_be_deleted.empty?
- conditions << " AND snapshot_id NOT IN (:sids)"
- values[:sids] = snapshots_to_be_deleted.map { |s| s.id }
- end
-
- events=Event.find(:all, :conditions => [conditions, values], :order => 'event_date desc')
-
- categories = EventCategory.categories(true)
-%>
-
-<script type="text/javascript">
- function changeCategory(categoryId, widgetId) {
- var eventTableMaxSize = 8;
- $j('#events_' + widgetId + ' tr.event').hide();
- var elements;
- if (categoryId=='all') {
- elements = $j('#events_' + widgetId + ' tr.event');
- } else {
- elements = $j('#events_' + widgetId + ' tr.cat_' + categoryId);
- }
- var elementsToDisplay = elements.slice(0,eventTableMaxSize);
- if (elementsToDisplay.size()==0) {
- $j('#events_' + widgetId).hide();
- $j('#show_more_events_' + widgetId).hide();
- $j('#no_event_message_' + widgetId).show();
- } else {
- $j('#events_' + widgetId).show();
- $j('#no_event_message_' + widgetId).hide();
- elementsToDisplay.show();
- if (elements.size() > eventTableMaxSize) {
- $j('#show_more_events_' + widgetId).show();
- } else {
- $j('#show_more_events_' + widgetId).hide();
- }
- }
- }
-
- function showAllEvents(widgetId) {
- var selectedCategory = $j('#select_category_' + widgetId).val();
- if (selectedCategory=='all') {
- $j('#events_' + widgetId + ' tr.event').show();
- } else {
- $j('#events_' + widgetId + ' tr.cat_' + selectedCategory).show();
- }
- $j('#show_more_events_' + widgetId).hide();
- }
-</script>
-
-
-<h3><%= message('widget.events.title') -%>
-
- <select class="small" id="select_category_<%= widget.id -%>" onchange="changeCategory(this.value, <%= widget.id -%>);">
- <option value="all"><%= message('widget.events.all') -%></option>
- <% categories.each do |categ| %>
- <option value="<%= categ.name.parameterize -%>"><%= h message('event.category.' + categ.name, :default => categ.name) %></option>
- <% end %>
- </select>
-
- <script>
- $j(function() {
- $j('#select_category_<%= widget.id -%>').select2({ width: '150px' });
- });
- </script>
-
-</h3>
-
-<table id="events_<%= widget.id -%>" class="spaced data">
- <thead>
- <tr>
- <th colspan="4"></th>
- </tr>
- </thead>
-
- <tbody>
-<%
- events.each do |event|
- categ = event.category
- profile_data={}
- if categ=='Profile' && event.event_data
- profile_data=Hash[*(event.event_data.split(';').map { |elt| elt.split('=') }.flatten)]
- end
-%>
-<tr class="<%= cycle 'even','odd' -%> event cat_<%= categ.parameterize -%>">
- <td x="<%= event.event_date -%>"><%= l(event.event_date.to_date) %></td>
- <td><%= h message('event.category.' + categ, :default => categ) %></td>
- <td>
- <%= link_to_if profile_data['key'] && profile_data['from'] && profile_data['to'], h(event.name),
- :controller => 'profiles', :action => 'changelog', :key => profile_data['key'],
- :since => profile_data['from'], :to => profile_data['to'] -%>
- </td>
- <td>
- <% unless event.description.blank? %>
- <i class="icon-info" title="<%= h event.description -%>"></i>
- <% end %>
- </td>
-</tr>
-<%
- end
-%>
- </tbody>
-</table>
-
-<div id="no_event_message_<%= widget.id -%>" style="margin: 5px">
- <span class="empty_widget"><%= message('widget.events.no_event') -%></span>
-</div>
-
-<a href="#" onclick="showAllEvents(<%= widget.id -%>);return false;" id="show_more_events_<%= widget.id -%>" class="action"><%= message('widget.events.show_all') -%></a>
-
-<script type="text/javascript">
- changeCategory('all', <%= widget.id -%>);
-</script>
-
-<% end %>
+++ /dev/null
-<%
- metric = widget_properties["metric"] || Metric.by_key('ncloc')
-
- if measure(metric)
-
- limit = widget_properties["numberOfLines"]
- title = widget_properties["title"]
- title = message('widget.hotspot_metric.hotspots_by_x', :params => metric.short_name) if title.blank?
-
- if metric.numeric? && !@resource.leaves_qualifiers.empty?
-
- conditions = [
- "projects.qualifier in (:qualifiers)",
- "projects.uuid_path like :uuid_path_like",
- "projects.project_uuid = :project_uuid",
- "snapshots.islast = :islast",
- "project_measures.person_id is null",
- "project_measures.metric_id = :metric_id"
- ]
- condition_values = {
- :qualifiers => @resource.leaves_qualifiers,
- :project_uuid => @resource.project_uuid,
- :uuid_path_like => "#{@resource.uuid_path}#{@resource.uuid}.%",
- :islast => true,
- :metric_id => metric.id
- }
-
- measures = ProjectMeasure.find(:all,
- :joins => [:analysis, :project],
- :conditions => [ conditions.join(' AND '), condition_values ],
- :order => "project_measures.value #{'DESC' if metric.direction<0}",
- :limit => limit)
-
- components_by_uuid = Project.all( :conditions => ['uuid in (?)', measures.map { |m| m.component_uuid } ] ).inject({}) do |hash, component|
- hash[component.uuid] = component
- hash
- end
- end
-
- unless components_by_uuid && !components_by_uuid.empty? %>
- <h3><%= title -%></h3>
- <span class="empty_widget"><%= message('no_results') -%></span>
- <% else %>
-
- <div class="line-block">
- <div style="float:right">
- <a class="underlined-link" href="<%= url_for_drilldown(metric) -%>"><%= message('widget.hotspot_metric.more') -%></a>
- </div>
- <h3><%= title -%></h3>
- </div>
-
- <table id="hotspots-<%= metric.name -%>-<%= widget.id -%>" class="data">
- <thead>
- <tr>
- <th colspan="3"/>
- </tr>
- </thead>
- <tbody>
- <%
- if metric.direction > 0
- metric_max_value = measures.last.value
- else
- metric_max_value = measures.first.value
- end
- measures.each do |measure|
- component = components_by_uuid[measure.component_uuid]
- %>
- <tr class="<%= cycle 'even', 'odd', :name => ('hotspot_metric' + widget.id.to_s) -%>">
- <td>
- <%= link_to_resource(component, h(component.name), {:metric => metric.name, :class => 'underlined-link'}) -%>
- </td>
- <td class="right nowrap">
- <%= format_measure(measure) -%>
- </td>
- <td class="barchart">
- <div class="barchart" style="width: <%= (measure.value*100/metric_max_value).round.to_i -%>%">
- <div style="width: 100%;"></div>
- </div>
- </td>
- </tr>
- <%
- end
- %>
- </tbody>
- </table>
-
- <% end %>
-
-<% end %>
+++ /dev/null
-<%
- container_id = 'widget-issue-filter-' + widget.id.to_s
- filter_id = widget_properties['filter']
- filter = Internal.issues.findIssueFilterById(filter_id.to_i)
- distribution_axis = widget_properties['distributionAxis']
- display_mode = widget_properties['displayMode']
- if display_mode == 'debt'
- display_mode = 'effort'
- end
- is_enough_permissions = filter.shared || (current_user && filter.userLogin == current_user.login)
-%>
-
-<% if filter %>
-
- <% if is_enough_permissions %>
-
- <% @widget_title = "<a href=\"#{url_for({:controller => 'issues', :action => 'index'})}#id=#{filter.id}|#{filter.data}|facetMode=#{display_mode}\">#{h(filter.name)}</a>" %>
- <% if widget_properties['displayFilterDescription'] && !filter.description.blank? %>
- <p class="note spacer-bottom"><%= h filter.description -%></p>
- <% end %>
-
- <div id="<%= container_id -%>"></div>
-
- <% if distribution_axis == 'reporters' %>
- <p class="note spacer-bottom">The distribution by reporter is no more supported. Please update this widget.</p>
- <% end %>
-
- <script>
- jQuery(function () {
- var query = '<%= filter.data -%>';
-
- // do not show widget if the filter contains "my" criterion,
- // and a user is not authenticated
- if (query && query.indexOf('__me__') !== -1 && !window.SS.user) {
- jQuery('#<%= container_id -%>').closest('.block').addClass('hidden');
- return;
- }
-
- var IssueFilterWidget = window.IssueFilterWidget;
- window.sonarqube.appStarted.then(function () {
- new IssueFilterWidget({
- el: '#<%= container_id -%>',
- query: query,
- distributionAxis: '<%= distribution_axis -%>',
- displayMode: '<%= display_mode -%>'
- });
- });
- });
- </script>
-
- <% else %>
-
- <p class="alert alert-warning"><%= message 'widget.issue_filter.insufficient_privileges_warning' -%></p>
-
- <% end %>
-
-<% else %>
-
- <p class="alert alert-warning"><%= message 'widget.issue_filter.unknown_filter_warning' -%></p>
-
-<% end %>
+++ /dev/null
-<%
- containerId = 'issue-tag-cloud' + widget.id.to_s
- maxItems = widget_properties['maxItems'].to_i
-
- if has_role?(:user, @project) && !Internal.issues.listTagsForComponent(@project.uuid, maxItems).isEmpty()
- search_options = {
- 'resolved' => 'false'
- }
- if @project
- search_options['componentUuids'] = @project.uuid
- end
- if @dashboard_configuration.selected_period?
- search_options['createdAfter'] = @snapshot.period_datetime(@dashboard_configuration.period_index).strftime('%Y-%m-%d')
- end
-
- title = message('widget.issue_tag_cloud.title')
-%>
-
-<div class="histogram-widget" id="<%= containerId %>">
- <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
- <!--[if (gte IE 9)|!(IE)]><!-->
- <h3 style="margin-bottom: 5px;"><%= title -%></h3>
- <!--<![endif]-->
-
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
- (function () {
- var createdAfter = '';
- <% if @dashboard_configuration.selected_period? -%>
- createdAfter = '<%= search_options['createdAfter'] -%>';
- <% end -%>
-
- var queryParams = [
- 'componentUuid=<%= @project.uuid() -%>',
- 'ps=<%= maxItems -%>',
- 'createdAfter=' + createdAfter
- ],
- query = queryParams.join('&'),
- widget = new SonarWidgets.Widget();
-
- widget
- .type('TagCloud')
- .source(baseUrl + '/api/issues/component_tags?' + query)
- .options({
- maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
- baseUrl: baseUrl + '/component_issues/index?id=<%= @project.key -%>#resolved=false',
- noData: '<%= message('no_data') -%>',
- createdAfter: createdAfter
- })
- .render('#<%= containerId -%>');
-
- autoResize(500, function() {
- widget.update('#<%= containerId -%>');
- });
- })();
-</script>
-<!--<![endif]-->
-<% end %>
+++ /dev/null
-<%
- issues = @snapshot.measure('violations')
- blocker_issues = @snapshot.measure('blocker_violations')
- critical_issues = @snapshot.measure('critical_violations')
- major_issues = @snapshot.measure('major_violations')
- minor_issues = @snapshot.measure('minor_violations')
- info_issues = @snapshot.measure('info_violations')
-
- new_issues = @snapshot.measure('new_violations')
- new_blocker_issues = @snapshot.measure('new_blocker_violations')
- new_critical_issues = @snapshot.measure('new_critical_violations')
- new_major_issues = @snapshot.measure('new_major_violations')
- new_minor_issues = @snapshot.measure('new_minor_violations')
- new_info_issues = @snapshot.measure('new_info_violations')
-
- technical_debt = @snapshot.measure('sqale_index')
- new_technical_debt = @snapshot.measure('new_technical_debt')
- reliability_remediation_effort = @snapshot.measure('reliability_remediation_effort')
- new_reliability_remediation_effort = @snapshot.measure('new_reliability_remediation_effort')
- security_remediation_effort = @snapshot.measure('security_remediation_effort')
- new_security_remediation_effort = @snapshot.measure('new_security_remediation_effort')
-
- if @dashboard_configuration.selected_period?
- period_date = (@snapshot.period_datetime(@dashboard_configuration.period_index) + 1).strftime('%FT%T%z')
- end
-
- tooltip = message('widget.as_calculated_on_x', :params => l(@snapshot.created_at))
-%>
-
-<div class="widget-row">
-
- <div class="widget-span widget-span-3">
- <div class="widget-measure-container">
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.rules.issues') -%></span>
- <span class="nowrap">
- <span class="link-<%= widget.key %>-issues">
- <a href="<%= "#{url_for(:controller => 'component_issues', :action => 'index')}?id=#{url_encode(@project.key)}" -%>" class="widget-link link-<%= widget.key %>-debt"
- title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
- <%= format_measure(issues) -%>
- </a>
- </span>
- <%= format_variation(issues) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <div class="widget-measure-delta">
- <%
- if @dashboard_configuration.selected_period?
- issues_variation = variation_value(issues)
- new_issues_variation = variation_value(new_issues)
- estimated_cleared_issues = (new_issues_variation - issues_variation).to_i if issues_variation && new_issues_variation
- %>
- <% if new_issues_variation && new_issues_variation > 0 %>
- <p class="small">
- <%= message('widget.rules.added') %>
- <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|createdAfter=<%= period_date -%>"
- class="varw widget-link widget-link-red link-<%= widget.key %>-new-issues"
- title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_issues, :style => 'none', :default => '-') -%></a>
- </p>
- <% end %>
- <% if estimated_cleared_issues && estimated_cleared_issues > 0 %>
- <p class="small">
- <%= message('widget.rules.removed') %>
- <span class="varb">-<%= number_with_precision(estimated_cleared_issues, :precision => 0) -%></span>
- </p>
- <% end %>
- <% end %>
- </div>
- </div>
- </div>
-
- <div class="widget-span widget-span-3">
- <% if technical_debt %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('metric.sqale_index.name') -%></span>
- <a href="<%= url_for_drilldown('sqale_index') -%>" class="widget-link link-<%= widget.key %>-debt"
- title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
- <%= format_measure(technical_debt) -%>
- </a>
- <%= format_variation(technical_debt) if dashboard_configuration.selected_period? -%>
- </div>
- <div class="widget-measure-delta">
- <%
- if @dashboard_configuration.selected_period?
- technical_debt_variation = variation_value(technical_debt)
- new_technical_debt_variation = variation_value(new_technical_debt)
- estimated_cleared_technical_debt = (new_technical_debt_variation - technical_debt_variation).to_i if technical_debt_variation && new_technical_debt_variation
- %>
- <% if new_technical_debt_variation && new_technical_debt_variation > 0 %>
- <p class="small">
- <%= message('widget.rules.added') %>
- <a href="<%= url_for_drilldown('new_technical_debt', :period => @dashboard_configuration.period_index) -%>"
- class="varw widget-link widget-link-red link-<%= widget.key %>-new-debt"
- title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_technical_debt, :style => 'none', :default => '-') -%></a>
- </p>
- <% end %>
- <% if estimated_cleared_technical_debt && estimated_cleared_technical_debt > 0 %>
- <p class="small">
- <%= message('widget.rules.removed') %>
- <span class="varb">-<%= Internal.i18n.formatLongDuration(estimated_cleared_technical_debt, 'SHORT') -%></span>
- </p>
- <% end %>
- <% end %>
- </div>
- <% end %>
-
- <% if reliability_remediation_effort %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('metric.reliability_remediation_effort.name') -%></span>
- <a href="<%= url_for_drilldown('reliability_remediation_effort') -%>" class="widget-link"
- title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
- <%= format_measure(reliability_remediation_effort) -%>
- </a>
- <%= format_variation(reliability_remediation_effort) if dashboard_configuration.selected_period? -%>
- </div>
- <div class="widget-measure-delta">
- <%
- if @dashboard_configuration.selected_period?
- reliability_remediation_effort_variation = variation_value(reliability_remediation_effort)
- new_reliability_remediation_effort_variation = variation_value(new_reliability_remediation_effort)
- estimated_cleared_reliability_remediation_effort = (new_reliability_remediation_effort_variation - reliability_remediation_effort_variation).to_i if reliability_remediation_effort_variation && new_reliability_remediation_effort_variation
- %>
- <% if new_reliability_remediation_effort_variation && new_reliability_remediation_effort_variation > 0 %>
- <p class="small">
- <%= message('widget.rules.added') %>
- <a href="<%= url_for_drilldown('new_reliability_remediation_effort', :period => @dashboard_configuration.period_index) -%>"
- class="varw widget-link widget-link-red"
- title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_reliability_remediation_effort, :style => 'none', :default => '-') -%></a>
- </p>
- <% end %>
- <% if estimated_cleared_reliability_remediation_effort && estimated_cleared_reliability_remediation_effort > 0 %>
- <p class="small">
- <%= message('widget.rules.removed') %>
- <span class="varb">-<%= Internal.i18n.formatLongDuration(estimated_cleared_reliability_remediation_effort, 'SHORT') -%></span>
- </p>
- <% end %>
- <% end %>
- </div>
- <% end %>
-
- <% if security_remediation_effort %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('metric.security_remediation_effort.name') -%></span>
- <a href="<%= url_for_drilldown('security_remediation_effort') -%>" class="widget-link"
- title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
- <%= format_measure(security_remediation_effort) -%>
- </a>
- <%= format_variation(security_remediation_effort) if dashboard_configuration.selected_period? -%>
- </div>
- <div class="widget-measure-delta">
- <%
- if @dashboard_configuration.selected_period?
- security_remediation_effort_variation = variation_value(security_remediation_effort)
- new_security_remediation_effort_variation = variation_value(new_security_remediation_effort)
- estimated_cleared_security_remediation_effort = (new_security_remediation_effort_variation - security_remediation_effort_variation).to_i if security_remediation_effort_variation && new_security_remediation_effort_variation
- %>
- <% if new_security_remediation_effort_variation && new_security_remediation_effort_variation > 0 %>
- <p class="small">
- <%= message('widget.rules.added') %>
- <a href="<%= url_for_drilldown('new_security_remediation_effort', :period => @dashboard_configuration.period_index) -%>"
- class="varw widget-link widget-link-red"
- title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_security_remediation_effort, :style => 'none', :default => '-') -%></a>
- </p>
- <% end %>
- <% if estimated_cleared_security_remediation_effort && estimated_cleared_security_remediation_effort > 0 %>
- <p class="small">
- <%= message('widget.rules.removed') %>
- <span class="varb">-<%= Internal.i18n.formatLongDuration(estimated_cleared_security_remediation_effort, 'SHORT') -%></span>
- </p>
- <% end %>
- <% end %>
- </div>
- <% end %>
- </div>
-
- <div class="widget-span widget-span-4">
- <table class="data widget-barchar">
- <tr>
- <td class="thin nowrap">
- <i class="icon-severity-blocker"></i>
- <%= message('blocker') -%>
- </td>
- <td class="thin right nowrap">
- <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=BLOCKER"
- class="widget-link drilldown_BLOCKER" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
- <%= format_measure(blocker_issues) -%>
- </a>
- </td>
- <td class="thin nowrap">
- <% if @dashboard_configuration.selected_period? %>
- <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=BLOCKER|createdAfter=<%= url_encode(period_date) -%>"
- class="widget-link <% if variation_value(new_blocker_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-blocker-issues"
- title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_blocker_issues, :style => 'none', :default => '-') -%></a>
- <% end %>
- </td>
- </tr>
- <tr>
- <td class="thin nowrap">
- <i class="icon-severity-critical"></i>
- <%= message('critical') -%>
- </td>
- <td class="thin right nowrap">
- <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=CRITICAL"
- class="widget-link drilldown_CRITICAL" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
- <%= format_measure(critical_issues) -%>
- </a>
- </td>
- <td class="thin nowrap">
- <% if @dashboard_configuration.selected_period? %>
- <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=CRITICAL|createdAfter=<%= url_encode(period_date) -%>"
- class="widget-link <% if variation_value(new_critical_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-critical-issues"
- title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_critical_issues, :style => 'none', :default => '-') -%></a>
- <% end %>
- </td>
- </tr>
- <tr>
- <td class="thin nowrap">
- <i class="icon-severity-major"></i>
- <%= message('major') -%>
- </td>
- <td class="thin right nowrap">
- <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=MAJOR"
- class="widget-link drilldown_MAJOR" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
- <%= format_measure(major_issues) -%>
- </a>
- </td>
- <td class="thin nowrap">
- <% if @dashboard_configuration.selected_period? %>
- <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=MAJOR|createdAfter=<%= url_encode(period_date) -%>"
- class="widget-link <% if variation_value(new_major_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-major-issues"
- title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_major_issues, :style => 'none', :default => '-') -%></a>
- <% end %>
- </td>
- </tr>
- <tr>
- <td class="thin nowrap">
- <i class="icon-severity-minor"></i>
- <%= message('minor') -%>
- </td>
- <td class="thin right nowrap">
- <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=MINOR"
- class="widget-link drilldown_MINOR" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
- <%= format_measure(minor_issues) -%>
- </a>
- </td>
- <td class="thin nowrap">
- <% if @dashboard_configuration.selected_period? %>
- <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=MINOR|createdAfter=<%= url_encode(period_date) -%>"
- class="widget-link <% if variation_value(new_minor_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-minor-issues"
- title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_minor_issues, :style => 'none', :default => '-') -%></a>
- <% end %>
- </td>
- </tr>
- <tr>
- <td class="thin nowrap">
- <i class="icon-severity-info"></i>
- <%= message('info') -%>
- </td>
- <td class="thin right nowrap">
- <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=INFO"
- class="widget-link drilldown_INFO" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
- <%= format_measure(info_issues) -%>
- </a>
- </td>
- <td class="thin nowrap">
- <% if @dashboard_configuration.selected_period? %>
- <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=INFO|createdAfter=<%= url_encode(period_date) -%>"
- class="widget-link <% if variation_value(new_info_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-info-issues"
- title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_info_issues, :style => 'none', :default => '-') -%></a>
- <% end %>
- </td>
- </tr>
- </table>
- </div>
-</div>
+++ /dev/null
-<%
- it_coverage=measure('it_coverage')
- overall_coverage=measure('overall_coverage')
-
- if it_coverage || overall_coverage
--%>
- <div class="widget-row">
-
- <% if it_coverage -%>
- <div class="widget-span widget-span-6">
- <div class="widget-measure-container">
-
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.it-coverage.name') -%></span>
- <span class="nowrap">
- <%= format_measure(it_coverage, :url => url_for_drilldown('it_uncovered_lines', :highlight => 'it_coverage'), :default => '-') %>
- <%= format_variation(it_coverage) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
-
- <%
- it_line_coverage=measure('it_line_coverage')
- if it_line_coverage
- %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.it-coverage.line_coverage.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(it_line_coverage, :url => url_for_drilldown('it_uncovered_lines', :highlight => 'it_line_coverage')) %>
- <%= format_variation(it_line_coverage) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <% end %>
-
- <%
- it_branch_coverage=measure('it_branch_coverage')
- if it_branch_coverage
- %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.it-coverage.condition_coverage.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(it_branch_coverage, :url => url_for_drilldown('it_uncovered_conditions', :highlight => 'it_branch_coverage')) %>
- <%= format_variation(it_branch_coverage) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <% end %>
-
- <%
- if dashboard_configuration.selected_period?
- new_lines_to_cover_measure=measure('new_it_lines_to_cover')
- if new_lines_to_cover_measure
- new_lines=new_lines_to_cover_measure.variation(dashboard_configuration.period_index)
- if new_lines
- new_coverage=measure('new_it_coverage')
- new_line_coverage=measure('new_it_line_coverage')
- new_branch_coverage=measure('new_it_branch_coverage')
- %>
- <% if new_lines.to_i==0 %>
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.it-coverage.on_new_code') -%></span>
-
- <p><%= message('widget.it-coverage.no_new_lines_to_cover') -%></p>
- </div>
- <% else %>
-
- <% if new_coverage %>
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.it-coverage.on_new_code') -%></span>
- <span class="nowrap">
- <%= format_measure(new_coverage,
- :period => dashboard_configuration.period_index,
- :url => url_for_drilldown('new_it_uncovered_lines', :highlight => 'new_it_coverage', :period => dashboard_configuration.period_index),
- :default => '-') %>
- </span>
- </div>
- <% end %>
-
- <% if new_line_coverage %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.it-coverage.line_coverage.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(new_line_coverage,
- :period => dashboard_configuration.period_index,
- :url => url_for_drilldown('new_it_uncovered_lines', :highlight => 'new_it_line_coverage', :period => dashboard_configuration.period_index)) %>
- </span>
- </div>
- <% end %>
-
- <% if new_branch_coverage %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.it-coverage.condition_coverage.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(new_branch_coverage,
- :period => dashboard_configuration.period_index,
- :url => url_for_drilldown('new_it_uncovered_conditions', :highlight => 'new_it_branch_coverage', :period => dashboard_configuration.period_index)) %>
- </span>
- </div>
- <% end %>
-
- <% end %>
-
- <% end %>
- <% end %>
- <% end %>
-
- </div>
- </div>
- <% end %>
-
- <% if overall_coverage -%>
- <div class="widget-span widget-span-6">
- <div class="widget-measure-container">
-
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.overall-coverage.name') -%></span>
- <span class="nowrap">
- <%= format_measure(overall_coverage, :url => url_for_drilldown('overall_uncovered_lines', :highlight => 'overall_coverage'), :default => '-') %>
- <%= format_variation(overall_coverage) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
-
- <%
- overall_line_coverage=measure('overall_line_coverage')
- if overall_line_coverage
- %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.overall-coverage.line_coverage.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(overall_line_coverage, :url => url_for_drilldown('overall_uncovered_lines', :highlight => 'overall_line_coverage')) %>
- <%= format_variation(overall_line_coverage) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <% end %>
-
- <%
- overall_branch_coverage=measure('overall_branch_coverage')
- if overall_branch_coverage
- %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.overall-coverage.condition_coverage.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(overall_branch_coverage, :url => url_for_drilldown('overall_uncovered_conditions', :highlight => 'overall_branch_coverage')) %>
- <%= format_variation(overall_branch_coverage) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <% end %>
-
- <%
- if dashboard_configuration.selected_period?
- new_lines_to_cover_measure=measure('new_overall_lines_to_cover')
- if new_lines_to_cover_measure
- new_lines=new_lines_to_cover_measure.variation(dashboard_configuration.period_index)
- if new_lines
- new_coverage=measure('new_overall_coverage')
- new_line_coverage=measure('new_overall_line_coverage')
- new_branch_coverage=measure('new_overall_branch_coverage')
- %>
- <% if new_lines.to_i==0 %>
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.overall-coverage.on_new_code') -%></span>
-
- <p><%= message('widget.overall-coverage.no_new_lines_to_cover') -%></p>
- </div>
- <% else %>
-
- <% if new_coverage %>
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.overall-coverage.on_new_code') -%></span>
- <span class="nowrap">
- <%= format_measure(new_coverage,
- :period => dashboard_configuration.period_index,
- :url => url_for_drilldown('new_overall_uncovered_lines', :highlight => 'new_overall_coverage', :period => dashboard_configuration.period_index),
- :default => '-') %>
- <%= format_variation(new_coverage) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <% end %>
-
- <% if new_line_coverage %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.overall-coverage.line_coverage.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(new_line_coverage,
- :period => dashboard_configuration.period_index,
- :url => url_for_drilldown('new_overall_uncovered_lines', :highlight => 'new_overall_line_coverage', :period => dashboard_configuration.period_index)) %>
- <%= format_variation(new_line_coverage) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <% end %>
-
- <% if new_branch_coverage %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.overall-coverage.condition_coverage.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(new_branch_coverage,
- :period => dashboard_configuration.period_index,
- :url => url_for_drilldown('new_overall_uncovered_conditions', :highlight => 'new_overall_branch_coverage', :period => dashboard_configuration.period_index)) %>
- <%= format_variation(new_branch_coverage) if dashboard_configuration.selected_period? -%>
- </span>
- </div>
- <% end %>
-
- <% end %>
-
- <% end %>
- <% end %>
- <% end %>
-
- </div>
- </div>
- <% end %>
-
- </div>
-<% end %>
+++ /dev/null
-<%
- containerId = 'bubble-chart-widget' + widget.id.to_s
- chartTitle = widget_properties["chartTitle"]
- chartHeight = widget_properties["chartHeight"]
- filterId = widget_properties["filter"].to_i
- xMetric = widget_properties["xMetric"]
- yMetric = widget_properties["yMetric"]
- sizeMetric = widget_properties["sizeMetric"]
- xLog = !!widget_properties["xLogarithmic"]
- yLog = !!widget_properties["yLogarithmic"]
- maxItems = widget_properties["maxItems"].to_i
-
- filter = MeasureFilter.find_by_id(filterId.to_i)
- if filter
- @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
-%>
-
-<div class="bubble-chart-widget" id="<%= containerId %>">
- <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
- <!--[if (gte IE 9)|!(IE)]><!-->
- <% if chartTitle %>
- <h3><%= h(chartTitle) -%></h3>
- <% end %>
- <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
- (function () {
- var metrics = [
- '<%= xMetric.name -%>', '<%= yMetric.name -%>', '<%= sizeMetric.name -%>'
- ],
- query = [
- 'filter=<%= filterId -%>',
- 'metrics=' + metrics.join(','),
- 'fields=name,longName,qualifier',
- <% if (maxItems > 0) %>
- 'pageSize=<%= maxItems -%>',
- <% end %>
- 'page=1',
- 'sort=metric:' + metrics[0]
- ].join('&'),
- widget = new SonarWidgets.Widget();
-
- widget
- .type('BubbleChart')
- .source(baseUrl + '/measures/search_filter?' + query)
- .metricsPriority(metrics)
- .height(<%= chartHeight -%>)
- .options({
- baseUrl: baseUrl + '/dashboard/index',
- xLog: <%= xLog -%>,
- yLog: <%= yLog -%>,
- noData: '<%= escape_javascript message('no_data') -%>',
- noMainMetric: '<%= escape_javascript message('widget.measure_filter.no_main_metric') -%>'
- })
- .render('#<%= containerId -%>');
-
- autoResize(500, function() {
- widget.update('#<%= containerId -%>');
- });
- })();
-</script>
-<!--<![endif]-->
-<% else %>
- <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
-<% end %>
+++ /dev/null
-<%
- containerId = 'word-cloud' + widget.id.to_s
- chartTitle = widget_properties['chartTitle']
- filterId = widget_properties['filter'].to_i
- maxItems = widget_properties['maxItems'].to_i
-
- filter = MeasureFilter.find_by_id(filterId.to_i)
- if filter
- @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
-%>
-
-<div class="histogram-widget" id="<%= containerId %>">
- <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
- <!--[if (gte IE 9)|!(IE)]><!-->
- <% if chartTitle %>
- <h3 style="margin-bottom: 5px;"><%= h(chartTitle) -%></h3>
- <% end %>
- <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
- (function () {
- var metrics = [
- '<%= widget_properties['colorMetric'].name -%>',
- '<%= widget_properties['sizeMetric'].name -%>'
- ],
- query = [
- 'filter=<%= filterId -%>',
- 'metrics=' + metrics.join(','),
- 'fields=name,longName,qualifier',
- 'pageSize=<%= maxItems -%>',
- 'page=1',
- 'sort=metric:' + metrics[1],
- 'asc=false'
- ].join('&'),
- widget = new SonarWidgets.Widget();
-
- widget
- .type('WordCloud')
- .source(baseUrl + '/measures/search_filter?' + query)
- .metricsPriority(metrics)
- .options({
- maxItemsReachedMessage: '<%= escape_javascript message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
- baseUrl: baseUrl + '/dashboard/index',
- noData: '<%= escape_javascript message('no_data') -%>'
- })
- .render('#<%= containerId -%>');
-
- autoResize(500, function() {
- widget.update('#<%= containerId -%>');
- });
- })();
-</script>
-<!--<![endif]-->
-<% else %>
- <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
-<% end %>
+++ /dev/null
-<%
- containerId = 'histogram-widget' + widget.id.to_s
- chartTitle = widget_properties["chartTitle"]
- filterId = widget_properties["filter"].to_i
- maxItems = widget_properties["maxItems"].to_i
- reverseOrder = widget_properties["reverseOrder"]
- relativeScale = widget_properties["relativeScale"]
-
- filter = MeasureFilter.find_by_id(filterId.to_i)
- if filter
- @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
-%>
-
-<div class="histogram-widget" id="<%= containerId %>">
- <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
- <!--[if (gte IE 9)|!(IE)]><!-->
- <% if chartTitle %>
- <h3><%= h(chartTitle) -%></h3>
- <% end %>
- <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
- (function () {
- var metrics = [
- '<%= widget_properties["metric"].name -%>'
- ],
- query = [
- 'filter=<%= filterId -%>',
- 'metrics=' + metrics.join(','),
- 'fields=name,longName,qualifier',
- 'pageSize=<%= maxItems -%>',
- 'page=1',
- 'sort=metric:' + metrics[0],
- 'asc=<%= reverseOrder -%>'
- ].join('&'),
- widget = new SonarWidgets.Widget();
-
- widget
- .type('Histogram')
- .source(baseUrl + '/measures/search_filter?' + query)
- .metricsPriority(metrics)
- .options({
- baseUrl: baseUrl + '/dashboard/index',
- relativeScale: <%= relativeScale -%>,
- maxItemsReachedMessage: '<%= escape_javascript message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
- noData: '<%= escape_javascript message('no_data') -%>',
- noMainMetric: '<%= escape_javascript message('widget.measure_filter.no_main_metric') -%>'
- })
- .render('#<%= containerId -%>');
-
- autoResize(500, function() {
- widget.update('#<%= containerId -%>');
- });
- })();
-</script>
-<!--<![endif]-->
-<% else %>
- <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
-<% end %>
+++ /dev/null
-<%
- filter_id = widget_properties['filter']
- page_size = widget_properties['pageSize']
- filter = MeasureFilter.find_by_id(filter_id.to_i) if filter_id
- if filter
- filter.load_criteria_from_data
- if !filter.require_authentication? || logged_in?
- filter.set_criteria_value('display', 'list')
- filter.set_criteria_value('pageSize', page_size)
- filter.execute(self, :user => current_user)
- @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id}
-%>
-
- <% if widget_properties['displayFilterDescription'] && !filter.description.blank? %>
- <div style="padding-bottom: 5px">
- <span class="note"><%= h filter.description -%></span>
- </div>
- <% end %>
-
- <%= render :partial => 'measures/display_list', :locals => {:edit_mode => false, :filter => filter, :widget_id => widget.id} -%>
-<%
- end
- else
-%>
- <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
-<%
- end
-%>
+++ /dev/null
-<%
- containerId = 'pie-chart-widget' + widget.id.to_s
- chartHeight = widget_properties["chartHeight"]
- chartTitle = widget_properties["chartTitle"]
- filterId = widget_properties["filter"].to_i
- maxItems = widget_properties["maxItems"].to_i
-
- filter = MeasureFilter.find_by_id(filterId.to_i)
- if filter
- @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
-%>
-
-<div class="pie-chart-widget" id="<%= containerId %>">
- <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
- <!--[if (gte IE 9)|!(IE)]><!-->
- <% if chartTitle %>
- <h3><%= h(chartTitle) -%></h3>
- <% end %>
- <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
- (function () {
- var metrics = [
- '<%= widget_properties["mainMetric"].name -%>',
- '<%= widget_properties["extraMetric1"].name -%>'
- <% if (widget_properties["extraMetric2"]) %>
- , '<%= widget_properties["extraMetric2"].name -%>'
- <% end %>
- ],
- query = [
- 'filter=<%= filterId -%>',
- 'metrics=' + metrics.join(','),
- 'fields=name,qualifier',
- 'pageSize=<%= maxItems -%>',
- 'page=1',
- 'sort=metric:' + metrics[0],
- 'asc=false'
- ].join('&'),
- widget = new SonarWidgets.Widget();
-
- widget
- .type('PieChart')
- .source(baseUrl + '/measures/search_filter?' + query)
- .metricsPriority(metrics)
- .height(<%= chartHeight %>)
- .options({
- baseUrl: baseUrl + '/dashboard/index',
- noData: '<%= escape_javascript message('no_data') -%>',
- noMainMetric: '<%= escape_javascript message('widget.measure_filter.no_main_metric') -%>'
- })
- .render('#<%= containerId -%>');
-
- autoResize(500, function() {
- widget.update('#<%= containerId -%>');
- });
- })();
-</script>
-<!--<![endif]-->
-<% else %>
- <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
-<% end %>
+++ /dev/null
-<%
- containerId = 'treemap-widget' + widget.id.to_s
- chartTitle = widget_properties['chartTitle']
- filterId = widget_properties['filter'].to_i
- maxItems = widget_properties['maxItems'].to_i
-
- # SONAR-2456
- # When metrics are removed, we have to manually set them to the default ones
- colorMetric = widget_properties['colorMetric'] || Metric.by_key('coverage')
- sizeMetric = widget_properties['sizeMetric'] || Metric.by_key('ncloc')
-
- filter = MeasureFilter.find_by_id(filterId.to_i)
- if filter
- @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
-%>
-
-<div class="treemap-widget" id="<%= containerId %>">
- <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
- <!--[if (gte IE 9)|!(IE)]><!-->
- <% if chartTitle %>
- <h3 style="margin-bottom: 5px;"><%= h(chartTitle) -%></h3>
- <% end %>
- <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
- (function () {
- var metrics = [
- '<%= colorMetric.name -%>',
- '<%= sizeMetric.name -%>'
- ],
- query = [
- 'filter=<%= filterId -%>',
- 'metrics=' + metrics.join(','),
- 'fields=name,longName,qualifier',
- 'pageSize=<%= maxItems -%>',
- 'page=1',
- 'sort=metric:' + metrics[1],
- 'asc=false'
- ].join('&'),
- widget = new SonarWidgets.Widget();
-
- widget
- .type('Treemap')
- .source(baseUrl + '/measures/search_filter?' + query)
- .metricsPriority(metrics)
- .options({
- heightInPercents: '<%= widget_properties['heightInPercents'] -%>',
- maxItems: <%= maxItems -%>,
- maxItemsReachedMessage: '<%= escape_javascript message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
- baseUrl: baseUrl + '/dashboard/index',
- noData: '<%= escape_javascript message('no_data') -%>',
- resource: '<%= escape_javascript filter.name -%>'
- })
- .render('#<%= containerId -%>');
-
- autoResize(500, function() {
- widget.update('#<%= containerId -%>');
- });
- })();
-</script>
-<!--<![endif]-->
-<% else %>
- <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
-<% end %>
+++ /dev/null
-<%
- containerId = 'project-file-widget' + widget.id.to_s
- colorMetric = widget_properties['colorMetric']
- sizeMetric = widget_properties['sizeMetric']
- chartTitle = widget_properties['chartTitle']
- maxItems = widget_properties['maxItems'].to_i
-%>
-
-<div class="word-cloud-widget" id="<%= containerId %>">
- <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
- <!--[if (gte IE 9)|!(IE)]><!-->
- <% if chartTitle %>
- <h3 style="margin-bottom: 5px;"><%= h(chartTitle) -%></h3>
- <% end %>
- <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
- (function () {
- <%
- filter = MeasureFilter.new
- # Test files should not be returned
- qualifiers = Api::Utils.java_facade.getResourceLeavesQualifiers(@project.qualifier).to_a.reject {|q| q == 'UTS'}
- filter.criteria = {:qualifiers => qualifiers, :base => @project.key, :pageSize => maxItems, :sort => 'metric:' + sizeMetric.name, :asc => false}
- filter.metrics = [colorMetric.name, sizeMetric.name]
- filter.execute(self, :user => current_user)
- %>
-
- var data = {
- metrics: {
- <%= colorMetric.name -%>: {
- name: '<%= colorMetric.short_name -%>',
- direction: <%= colorMetric.direction -%>
- },
- <%= sizeMetric.name -%>: {
- name: '<%= sizeMetric.short_name -%>'
- }
- },
- components: [
- <%
- filter.rows.each do |row|
- color = row.measure(colorMetric)
- size = row.measure(sizeMetric)
- %>
- {
- key: '<%= escape_javascript row.resource.key -%>',
- name: '<%= escape_javascript row.resource.name -%>',
- longName: '<%= escape_javascript row.resource.long_name -%>',
- qualifier: '<%= escape_javascript row.resource.qualifier -%>',
- measures: {
- <%= colorMetric.name -%>: { val: <%= color ? color.value : "null" -%>, fval: '<%= color ? color.formatted_value : "-" -%>' },
- <%= sizeMetric.name -%>: { val: <%= size ? size.value : "null" -%>, fval: '<%= size ? size.formatted_value : "-" -%>' }
- }
- },
- <% end %>
- ]
- },
- widget = new SonarWidgets.WordCloud();
-
- widget
- .metrics(data.metrics)
- .metricsPriority(['<%= colorMetric.name -%>', '<%= sizeMetric.name -%>'])
- .components(data.components)
- .options({
- baseUrl: baseUrl + '/dashboard/index/'
- })
- .render('#<%= containerId -%>');
-
- autoResize(500, function() {
- widget.update('#<%= containerId -%>');
- });
- })();
-</script>
-<!--<![endif]-->
+++ /dev/null
-<%
- container_id = 'widget-issue-filter-' + widget.id.to_s
- filter_id = widget_properties['filter']
- filter = Internal.issues.findIssueFilterById(filter_id.to_i)
- distribution_axis = widget_properties['distributionAxis']
- display_mode = widget_properties['displayMode']
- if display_mode == 'debt'
- display_mode = 'effort'
- end
- is_enough_permissions = filter.shared || (current_user && filter.userLogin == current_user.login)
-
- if @dashboard_configuration.selected_period?
- period_date = @snapshot.period_datetime(@dashboard_configuration.period_index).strftime('%FT%T%z')
- else
- period_date = nil
- end
-%>
-
-<% if filter %>
-
- <% if is_enough_permissions %>
-
- <% @widget_title = "<a href=\"#{url_for({:controller => 'component_issues', :action => 'index'})}?id=#{u(@project.key)}##{filter.data}\">#{h(filter.name)}</a>" %>
- <% if widget_properties['displayFilterDescription'] && !filter.description.blank? %>
- <p class="note spacer-bottom"><%= h filter.description -%></p>
- <% end %>
-
- <div id="<%= container_id -%>"></div>
-
- <% if distribution_axis == 'reporters' %>
- <p class="note spacer-bottom">The distribution by rReporter is no more supported. Please update this widget.</p>
- <% end %>
-
- <script>
- jQuery(function () {
- var query = '<%= filter.data -%>';
-
- // do not show widget if the filter contains "my" criterion,
- // and a user is not authenticated
- if (query && query.indexOf('__me__') !== -1 && !window.SS.user) {
- jQuery('#<%= container_id -%>').closest('.block').addClass('hidden');
- return;
- }
-
- var IssueFilterWidget = window.IssueFilterWidget;
- window.sonarqube.appStarted.then(function () {
- new IssueFilterWidget({
- el: '#<%= container_id -%>',
- query: query,
- distributionAxis: '<%= distribution_axis -%>',
- displayMode: '<%= display_mode -%>',
- <% if period_date %>
- periodDate: '<%= period_date -%>',
- <% end %>
- componentUuid: '<%= @project.uuid -%>',
- componentKey: '<%= @project.key -%>'
- });
- });
- });
- </script>
-
- <% else %>
-
- <p class="alert alert-warning"><%= message 'widget.issue_filter.insufficient_privileges_warning' -%></p>
-
- <% end %>
-
-<% else %>
-
- <p class="alert alert-warning"><%= message 'widget.issue_filter.unknown_filter_warning' -%></p>
-
-<% end %>
+++ /dev/null
-<%
- lines=measure('lines')
- ncloc=measure('ncloc')
- ncloc_language_distribution = measure('ncloc_language_distribution')
- ncloc_language_dist_hash = Hash[*(ncloc_language_distribution.data.split(';').map { |elt| elt.split('=') }.flatten)] if ncloc && ncloc_language_distribution
- generated_ncloc=measure('generated_ncloc')
- generated_lines=measure('generated_lines')
- accessors=measure('accessors')
- classes=measure('classes')
- files=measure('files')
- directories=measure('directories')
- functions=measure('functions')
- projects=measure('projects')
- if measure('lines') || ncloc
- files=measure('files')
- statements=measure('statements')
- languages = Api::Utils.java_facade.getLanguages()
-%>
-
-<div class="widget-row widget-row-x">
-
- <div class="widget-span widget-span-3-5">
- <div class="widget-measure-container">
- <% if ncloc %>
- <p class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('metric.ncloc.name') -%></span>
- <span class="nowrap">
- <%= format_measure(ncloc, :url => url_for_drilldown(ncloc)) %>
- <%= format_variation(ncloc) if dashboard_configuration.selected_period? -%>
- </span>
- </p>
- <% if generated_ncloc && generated_ncloc.value>0 %>
- <p class="widget-label nowrap" style="margin-bottom: 7px">
- <%= message('including_abbreviated') -%>
- <%= format_measure(generated_ncloc, :url => url_for_drilldown(generated_ncloc)) -%> <%= format_variation(generated_ncloc) if dashboard_configuration.selected_period? -%>
- <%= message('metric.generated_ncloc.name.suffix') -%>
- </p>
- <% end %>
-
- <% if ncloc_language_dist_hash %>
- <% if ncloc_language_dist_hash.size > 1 %>
- <table class="data widget-barchar" id="size-widget-language-dist">
- <%
- max = Math.sqrt(ncloc_language_dist_hash.max_by{|_k,v| v.to_i}[1].to_i)
-
- # Sort lines language distribution by lines count
- languages_by_key = Hash[languages.collect { |l| [l.getKey(), l.getName] }]
- ncloc_language_dist_hash.sort {|v1,v2| v2[1].to_i <=> v1[1].to_i }.each do |language_key, language_ncloc|
- %>
- <tr>
- <td>
- <% if language_key.eql? '<null>' %>
- <%= message('unknown') -%>
- <% else %>
- <% language = languages.find { |l| l.getKey()==language_key.to_s } -%>
- <%= language ? language.getName() : language_key -%>
- <% end %>
- </td>
- <td class="thin right nowrap">
- <%= ncloc.format_numeric_value(language_ncloc) %>
- </td>
- </tr>
- <% end %>
- </table>
- <script>
- jQuery(function () {
- var chart = jQuery('#size-widget-language-dist'),
- count = chart.find('tr').length;
- if (count > 3) {
- chart.find('tr:gt(2)').hide();
- var moreLinkBox = jQuery('<div></div>').addClass('widget-barchart-more').insertAfter(chart),
- moreLink = jQuery('<a><%= message('more') -%></a>').appendTo(moreLinkBox).on('click', function () {
- jQuery(this).hide();
- chart.find('tr').show();
- });
- }
- });
- </script>
- <% else %>
- <%
- language_key = ncloc_language_dist_hash.first[0]
- if language_key.eql? '<null>' %>
- <%= message('unknown') -%>
- <% else %>
- <% language = languages.find { |l| l.getKey()==language_key.to_s } -%>
- <%= language ? language.getName() : language_key -%>
- <% end %>
- <% end %>
- <% end %>
- <% else %>
- <p class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('metric.lines.name') -%></span>
- <span class="nowrap">
- <%= format_measure(lines, :url => url_for_drilldown(ncloc)) %>
- <%= format_variation(lines) if dashboard_configuration.selected_period? -%>
- </span>
- </p>
- <% end %>
- </div>
- </div>
-
- <div class="widget-span widget-span-3-5">
- <div class="widget-measure-container">
- <p class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('metric.files.name') -%></span>
- <span class="nowrap">
- <%= format_measure(files, :url => url_for_drilldown(files)) %>
- <%= format_variation(files) if dashboard_configuration.selected_period? -%>
- </span>
- </p>
-
- <% if directories %>
- <p class="widget-measure">
- <span class="widget-label"><%= message('metric.directories.name') -%></span>
- <span class="nowrap">
- <%= format_measure(directories, :url => url_for_drilldown(directories)) %>
- <%= format_variation(directories) if dashboard_configuration.selected_period? -%>
- </span>
- </p>
- <% end %>
-
- <p class="widget-measure">
- <span class="widget-label"><%= message('metric.lines.name') -%></span>
- <span class="nowrap">
- <%= format_measure(lines, :url => url_for_drilldown(lines)) %>
- <%= format_variation(lines) if dashboard_configuration.selected_period? -%>
- </span>
- </p>
-
- <% if generated_lines && generated_lines.value>0 %>
- <p class="widget-label nowrap" style="margin-bottom: 7px">
- <%= message('including_abbreviated') -%>
- <%= format_measure(generated_lines, :url => url_for_drilldown(generated_lines)) -%> <%= format_variation(generated_lines) if dashboard_configuration.selected_period? -%>
- <%= message('metric.generated_lines.name.suffix') -%>
- </p>
- <% end %>
-
- <% if projects %>
- <p class="widget-measure">
- <span class="widget-label"><%= message('projects') -%></span>
- <span class="nowrap">
- <span class="widget-number"><%= format_measure(projects) %></span>
- <%= format_variation(projects) if dashboard_configuration.selected_period? -%>
- </span>
- </p>
- <% end %>
- </div>
- </div>
-
- <div class="widget-span widget-span-5">
- <div class="widget-measure-container">
- <% if functions %>
- <p class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('metric.functions.name') -%></span>
- <span class="nowrap">
- <%= format_measure(functions, :url => url_for_drilldown(functions)) %>
- <%= format_variation(functions) if dashboard_configuration.selected_period? -%>
- </span>
- </p>
- <% end %>
-
- <% if classes %>
- <p class="widget-measure">
- <span class="widget-label"><%= message('metric.classes.name') -%></span>
- <span class="nowrap">
- <%= format_measure(classes, :url => url_for_drilldown(classes)) %>
- <%= format_variation(classes) if dashboard_configuration.selected_period? -%>
- </span>
- </p>
- <% end %>
-
- <% if statements %>
- <p class="widget-measure">
- <span class="widget-label"><%= message('metric.statements.name') -%></span>
- <span class="nowrap">
- <%= format_measure(statements, :url => url_for_drilldown(statements)) %>
- <%= format_variation(statements) if dashboard_configuration.selected_period? -%>
- </span>
- </p>
- <% end %>
-
- <% if accessors %>
- <p class="widget-measure">
- <span class="widget-label"><%= message('metric.accessors.name') -%></span>
- <span class="nowrap">
- <%= format_measure(accessors, :url => url_for_drilldown(accessors)) %>
- <%= format_variation(accessors) if dashboard_configuration.selected_period? -%>
- </span>
- </p>
- <% end %>
- </div>
- </div>
-
-</div>
-<% end %>
+++ /dev/null
-<%
- rows_by_metric_id={}
-
- # Retrieve widget settings
- metric_ids = []
- (1..10).each do |index|
- metric=widget_properties["metric#{index}"]
- if metric
- metric_ids << metric.id
- row=Sonar::TimemachineRow.new(metric)
- rows_by_metric_id[metric.id] = row
- end
- end
- if metric_ids.empty?
- # No metric has been selected, it's the first time the widget is displayed: 'ncloc' is the default metric
- ncloc = Metric.find(:first, :conditions => "name = 'ncloc'")
- metric_ids << ncloc.id
- end
- number_of_columns = widget_properties["numberOfColumns"]
-
- # Retrieve the measures for each metric on each snapshot
- options = {}
- from_date = dashboard_configuration.from_datetime
- if from_date
- options[:from] = from_date
- end
- analyses = Snapshot.for_timemachine_widget(@resource, number_of_columns, options)
- analysis_uuids = analyses.collect { |a| a.uuid }.uniq
- measures = ProjectMeasure.find(:all,
- :conditions =>
- ["analysis_uuid IN (:analysis_uuids) AND component_uuid = :component_uuid and metric_id IN (:metric_id) AND person_id IS NULL",
- {:analysis_uuids => analysis_uuids, :component_uuid => @resource.uuid, :metric_id => metric_ids}
- ]
- )
-
-
- # Prepare the rows to display
- analyses_by_uuid = {}
- analyses.each do |a|
- analyses_by_uuid[a.uuid] = a
- end
- measures.each do |measure|
- next unless measure.metric
-
- if measure.metric.timemachine? && (measure.value || measure.text_value)
- row = rows_by_metric_id[measure.metric_id]
- row.add_measure(measure)
- end
- end
-
- # Create the list of rows to display in the same order as defined by the user
- rows=[]
- metric_ids.each do |metric_id|
- row = rows_by_metric_id[metric_id]
- if row
- rows<<row
- end
- end
-
- # Should display the sparkline?
- sparklines_by_row = {}
- if widget_properties["displaySparkLine"]
- rows.each do |row|
- sparkline = row.sparkline(analyses)
- sparklines_by_row[row] = sparkline if sparkline
- end
- end
- display_sparkline = !sparklines_by_row.empty?
-%>
-
-<% if widget_properties["title"] %>
- <div style="position: absolute">
- <h3><%= h(widget_properties["title"]) -%></h3>
- </div>
-<% end %>
-
-<div style="overflow: auto;font-size: 12px;padding: 1px;">
- <table class="table table-bordered">
-
- <thead>
- <tr>
- <th></th>
- <%
- analyses.each do |analysis|
- event = analysis.event('Version')
- %>
- <th nowrap="nowrap" style="vertical-align:top;text-align: right;font-size: 10px">
- <%= l analysis.created_at.to_date -%>
- <br/>
- <%= event.name unless event==nil -%>
- </th>
- <% end %>
- <% if display_sparkline %>
- <th></th>
- <% end %>
- </tr>
- </thead>
-
- <tbody>
- <%
- rows.select { |row| row.metric.val_type != Metric::VALUE_TYPE_DISTRIB }.each do |row|
- %>
- <tr class="<%= cycle 'even', 'odd', :name => ('time_machine' + widget.id.to_s) -%>">
- <td width="1%" nowrap="nowrap" class="left text">
- <%= row.metric.short_name %>
- </td>
- <%
- analyses.each do |analysis|
- measure = row.measure(analysis)
- %>
- <td width="1%" nowrap="nowrap" class="right"><%= format_measure(measure, :skip_span_id => true) %></td>
- <% end %>
- <%
- if display_sparkline
- sparkline = sparklines_by_row[row]
- %>
- <td width="1%">
- <%
- if sparkline
- x = sparkline[0]
- y = sparkline[1]
- %>
- <div class="time-machine-sparkline" data-x="<%= x.join(',') -%>" data-y="<%= y.join(',') -%>"></div>
- <% end %>
- </td>
- <% end %>
- </tr>
- <% end %>
- </tbody>
-
- </table>
-
-</div>
-
-<script>
- (function () {
- var TimeMachineWidget = window.TimeMachineWidget;
- TimeMachineWidget('.time-machine-sparkline');
- })();
-</script>
+++ /dev/null
-<%
- # Retrieve widget settings
- metric_data_map = {}
- metric_map = {}
- metrics_specified = false
- (1..3).each do |index|
- metric=widget_properties["metric#{index}"]
- # we check that the current resource has the selected metric on the last snapshot
- # => if not, we do not display this metric at all
- if metric
- metrics_specified = true
- if measure(metric)
- metric_data_map[metric.id] = []
- metric_map[metric.id] = metric
- end
- end
- end
- unless metrics_specified
- # No metric has been selected, it's the first time the widget is displayed: 'ncloc' is the default metric
- ncloc = Metric.by_name('ncloc')
- metric_data_map[ncloc.id] = []
- metric_map[ncloc.id] = ncloc
- end
- chartHeight = widget_properties["chartHeight"]
- undefinedToZero = widget_properties["undefinedToZero"]
-
- unless metric_data_map.values.empty?
- # Retrieve metric trend information
- options = {}
- from_date = dashboard_configuration.from_datetime
- if from_date
- options[:from] = from_date
- end
- # Variables used if undefinedToZero is set to true
- previous_analysis_uuid = nil
- previous_created_at = nil
- first_trend_item = true
- metric_previous_analysis_uuid = {}
- metric_count_per_analysis_uuid = {}
- total_number_of_metrics = metric_map.keys.size()
- TrendsChart.time_machine_measures(@resource, metric_data_map.keys, options).each() do |trend_item|
- analysis_uuid = trend_item["analysis_uuid"]
- if undefinedToZero
- if first_trend_item
- first_trend_item = false
- previous_analysis_uuid = analysis_uuid
- previous_created_at = Time.at(trend_item["created_at"].to_i/1000)
- end
- if previous_analysis_uuid != analysis_uuid
- if metric_count_per_analysis_uuid[previous_analysis_uuid] != total_number_of_metrics
- metric_map.keys.each do |metric_id|
- unless metric_previous_analysis_uuid.include?(metric_id)
- metric_data_map[metric_id] << {:date => previous_created_at, :value => 0.00, :analysis_uuid => previous_analysis_uuid}
- if metric_count_per_analysis_uuid[previous_analysis_uuid]
- metric_count_per_analysis_uuid[previous_analysis_uuid] += 1
- else
- metric_count_per_analysis_uuid[previous_analysis_uuid] = 1
- end
- end
- end
- end
- previous_analysis_uuid = analysis_uuid
- previous_created_at = Time.at(trend_item["created_at"].to_i/1000)
- metric_previous_analysis_uuid = {}
- end
- metric_previous_analysis_uuid[trend_item["metric_id"].to_i] = 1
- end
- if metric_count_per_analysis_uuid[analysis_uuid]
- metric_count_per_analysis_uuid[analysis_uuid] += 1
- else
- metric_count_per_analysis_uuid[analysis_uuid] = 1
- end
- metric_data_map[trend_item["metric_id"].to_i] << {:date => Time.at(trend_item["created_at"].to_i/1000), :value => trend_item["value"], :analysis_uuid => trend_item["analysis_uuid"]}
- end
-
- # Create JS structures to print out in the HTML page
- js_data = "["
- js_snapshots = "["
- js_metrics = "["
- metric_data_map.keys.each_with_index() do |metric_id, index|
- unless metric_data_map[metric_id].empty?
- js_metrics += "\"" + metric_map[metric_id].short_name + "\","
- js_data += "["
- metric_data_map[metric_id].each() do |metric_data|
- # for every metric value, we need to check that the corresponding snapshot has values for each metric
- if metric_count_per_analysis_uuid[metric_data[:analysis_uuid]]==total_number_of_metrics
- m_date = metric_data[:date]
- m_value = sprintf("%0.02f", metric_data[:value])
- m_value_localized = ProjectMeasure.new(:metric => metric_map[metric_id]).format_numeric_value(metric_data[:value], {})
- js_data += "{x:d("
- js_data += m_date.year.to_s
- js_data += ","
- # Need to decrease by 1 the month as the JS Date object start months at 0 (= January)
- js_data += (m_date.month - 1).to_s
- js_data += ","
- js_data += m_date.day.to_s
- js_data += ","
- js_data += m_date.hour.to_s
- js_data += ","
- js_data += m_date.min.to_s
- js_data += ","
- js_data += m_date.sec.to_s
- js_data += "),y:"
- js_data += m_value
- js_data += ",yl:\""
- js_data += m_value_localized
- js_data += "\"},"
- if index == 0
- # we fill the js_snapshots array (no need to do this more than once)
- js_snapshots += "{sid:\""
- js_snapshots += metric_data[:analysis_uuid]
- js_snapshots += "\",d:\""
- js_snapshots += human_short_date m_date
- js_snapshots += "\"},"
- end
- end
- end
- js_data = js_data.chomp(',') + "],"
- end
- end
- js_data = js_data.chomp(',') + "]"
- js_snapshots = js_snapshots.chomp(',') + "]"
- js_metrics = js_metrics.chomp(',') + "]"
-
- # Prepare also event structure if required
- unless widget_properties["hideEvents"]
- events = {}
- unless from_date
- # find the oldest date
- metric_data_map.values.each() do |metric_data_array|
- first_date = metric_data_array[0][:date]
- from_date = first_date if !from_date || from_date > first_date
- end
- end
- Event.find(:all, :conditions => ["component_uuid=? AND event_date>=?", @resource.uuid, from_date.to_i*1000], :order => 'event_date', :include => 'snapshot').each() do |event|
- if events[event.event_date]
- events[event.event_date] << event
- else
- date_entry = [event]
- events[event.event_date] = date_entry
- end
- end
- js_events = "["
- events.keys().sort.each() do |e_date|
- e_details = events[e_date]
- js_events += "{sid:\""
- js_events += e_details[0].analysis_uuid
- js_events += "\",d:d("
- js_events += e_date.year.to_s
- js_events += ","
- # Need to decrease by 1 the month as the JS Date object start months at 0 (= January)
- js_events += (e_date.month - 1).to_s
- js_events += ","
- js_events += e_date.day.to_s
- js_events += ","
- js_events += e_date.hour.to_s
- js_events += ","
- js_events += e_date.min.to_s
- js_events += ","
- js_events += e_date.sec.to_s
- js_events += "),l:["
- e_details.each() do |e|
- js_events += "{n:\""
- js_events += escape_javascript(e.name)
- js_events += "\"},"
- end
- js_events = js_events.chomp(',') + "]},"
- end
- js_events = js_events.chomp(',') + "]"
- end
- end
-
-
-%>
-
-<!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<% if widget_properties["chartTitle"] %>
- <h3 style="margin-bottom: 10px"><%= h(widget_properties["chartTitle"]) -%></h3>
-<% end %>
-<!--<![endif]-->
-
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<%
- unless metric_data_map.values.empty?
-
- if metric_data_map.values[0].size == 1
-%>
-
- <span class="empty_widget"><%= message('widget.timeline.timeline_not_displayed') -%></span>
-
-<% else %>
- <% timeline = 'timeline' + widget.id.to_s %>
-
- <div id="timeline-chart-<%= widget.id -%>"></div>
- <script>
- function d(y, m, d, h, min, s) {
- return new Date(y, m, d, h, min, s);
- }
- var data = <%= js_data -%>;
- var snapshots = <%= js_snapshots -%>;
- var metrics = <%= js_metrics -%>;
- var events = <%= js_events ? js_events : "[]" -%>;
- var <%= timeline -%> = new SonarWidgets.Timeline('timeline-chart-<%= widget.id -%>')
- .height(<%= chartHeight -%>)
- .data(data)
- .snapshots(snapshots)
- .metrics(metrics)
- .events(events);
- <%= timeline -%>.limitedHistoricalData = '<%= message('widget.timeline.limited_histortical_data') -%>';
- <%= timeline -%>.render();
-
- autoResize(200, function() {
- <%= timeline -%>.update();
- });
- </script>
-
-<%
- end
- end
-%>
-<!--<![endif]-->
+++ /dev/null
-<%
- containerId = 'project-file-widget' + widget.id.to_s
- colorMetric = widget_properties['colorMetric']
- sizeMetric = widget_properties['sizeMetric']
- chartTitle = widget_properties['chartTitle']
- maxItems = widget_properties['maxItems'].to_i
-%>
-
-<div class="treemap-widget" id="<%= containerId %>">
- <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
- <!--[if (gte IE 9)|!(IE)]><!-->
- <% if chartTitle %>
- <h3 style="margin-bottom: 5px;"><%= h(chartTitle) -%></h3>
- <% end %>
- <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
- (function () {
- <%
- filter = MeasureFilter.new
- filter.set_criteria_value(:base, @resource.key)
- filter.set_criteria_value(:onBaseComponents, 'true')
- filter.set_criteria_value(:pageSize, 100)
- filter.set_criteria_value(:page, 1)
- filter.set_criteria_value(:sort, 'metric:' + sizeMetric.name)
- filter.set_criteria_value(:asc, false)
- filter.metrics=([sizeMetric, colorMetric].compact)
- filter.execute(self, :user => current_user)
- %>
-
- var data = {
- metrics: {
- <%= colorMetric.name -%>: {
- name: '<%= colorMetric.short_name -%>',
- direction: <%= colorMetric.direction -%>,
- type: '<%= colorMetric.val_type -%>'
- },
- <%= sizeMetric.name -%>: {
- name: '<%= sizeMetric.short_name -%>'
- }
- },
- components: [
- <%
- filter.rows.each do |row|
- color = row.measure(colorMetric)
- size = row.measure(sizeMetric)
- %>
- {
- key: '<%= escape_javascript row.resource.key -%>',
- name: '<%= escape_javascript row.resource.name -%>',
- longName: '<%= escape_javascript row.resource.long_name -%>',
- qualifier: '<%= escape_javascript row.resource.qualifier -%>',
- measures: {
- <%
- value = color ? (colorMetric.val_type == 'LEVEL' ? "'#{color.formatted_value}'" : color.value) : 'null';
- %>
- <%= colorMetric.name -%>: { val: <%= value -%>, fval: '<%= color ? color.formatted_value : "-" -%>' },
- <%= sizeMetric.name -%>: { val: <%= size ? size.value : "null" -%>, fval: '<%= size ? size.formatted_value : "-" -%>' }
- }
- },
- <% end %>
- ]
- },
- widget = new SonarWidgets.Treemap();
-
- widget
- .metrics(data.metrics)
- .metricsPriority(['<%= colorMetric.name -%>', '<%= sizeMetric.name -%>'])
- .components(data.components)
- .options({
- heightInPercents: '<%= widget_properties['heightInPercents'] -%>',
- maxItems: <%= maxItems -%>,
- maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
- baseUrl: baseUrl + '/dashboard/index',
- noData: '<%= message('no_data') -%>',
- resource: '<%= @resource.name -%>'
- })
- .render('#<%= containerId -%>');
-
- autoResize(500, function() {
- widget.update('#<%= containerId -%>');
- });
- })();
-</script>
-<!--<![endif]-->
+++ /dev/null
-<%= message('widget.welcome.html') -%>
\ No newline at end of file
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.template;
-
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.sonar.api.web.Dashboard;
-import org.sonar.api.web.Dashboard.Widget;
-import org.sonar.db.measure.MeasureFilterDao;
-import org.sonar.db.measure.MeasureFilterDto;
-import org.sonar.server.dashboard.widget.MeasureFilterAsTreemapWidget;
-import org.sonar.server.dashboard.widget.MeasureFilterListWidget;
-import org.sonar.server.dashboard.widget.WelcomeWidget;
-import org.sonar.server.measure.template.MyFavouritesFilter;
-import org.sonar.server.measure.template.ProjectFilter;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class GlobalDefaultDashboardTest {
- GlobalDefaultDashboard template;
- MeasureFilterDao dao;
-
- @Before
- public void init() {
- dao = mock(MeasureFilterDao.class);
- template = new GlobalDefaultDashboard(dao);
- }
-
- @Test
- public void should_have_a_name() {
- assertThat(template.getName()).isEqualTo("Home");
- }
-
- @Test
- public void should_create_global_dashboard_with_four_widgets() {
- when(dao.selectSystemFilterByName(MyFavouritesFilter.NAME)).thenReturn(
- new MeasureFilterDto().setId(100L)
- );
- when(dao.selectSystemFilterByName(ProjectFilter.NAME)).thenReturn(
- new MeasureFilterDto().setId(101L)
- );
- Dashboard dashboard = template.createDashboard();
- List<Widget> firstColumn = dashboard.getWidgetsOfColumn(1);
- assertThat(firstColumn).hasSize(2);
- assertThat(firstColumn.get(0).getId()).isEqualTo(WelcomeWidget.ID);
- assertThat(firstColumn.get(1).getId()).isEqualTo(MeasureFilterListWidget.ID);
- assertThat(firstColumn.get(1).getProperty("filter")).isEqualTo("100");
-
- List<Widget> secondColumn = dashboard.getWidgetsOfColumn(2);
- assertThat(secondColumn).hasSize(2);
- assertThat(secondColumn.get(0).getId()).isEqualTo(MeasureFilterListWidget.ID);
- assertThat(secondColumn.get(0).getProperty("filter")).isEqualTo("101");
- assertThat(secondColumn.get(1).getId()).isEqualTo(MeasureFilterAsTreemapWidget.ID);
- assertThat(secondColumn.get(1).getProperty("filter")).isEqualTo("101");
- }
-
- @Test
- public void should_not_fail_if_filter_widgets_not_found() {
- when(dao.selectSystemFilterByName(MyFavouritesFilter.NAME)).thenReturn(null);
- when(dao.selectSystemFilterByName(ProjectFilter.NAME)).thenReturn(null);
-
- Dashboard dashboard = template.createDashboard();
- List<Widget> firstColumn = dashboard.getWidgetsOfColumn(1);
- assertThat(firstColumn).hasSize(1);
- assertThat(firstColumn.get(0).getId()).isEqualTo(WelcomeWidget.ID);
-
- List<Widget> secondColumn = dashboard.getWidgetsOfColumn(2);
- assertThat(secondColumn).isEmpty();
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.dashboard.widget;
-
-import com.google.common.base.Function;
-import com.google.common.base.Throwables;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-import java.util.Collection;
-import java.util.Set;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.junit.Test;
-import org.reflections.Reflections;
-
-import static com.google.common.collect.Lists.newArrayList;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class CoreWidgetsTest {
-
- @Test
- public void widget_ids_should_be_unique() {
- Collection<CoreWidget> widgets = widgets();
- Collection<String> widgetIds = Collections2.transform(widgets, new Function<CoreWidget, String>() {
- public String apply(@Nonnull CoreWidget widget) {
- return widget.getId();
- }
- });
- assertThat(widgetIds).hasSize(Sets.newHashSet(widgetIds).size());
- }
-
- @Test
- public void widget_templates_should_be_unique() {
- Collection<CoreWidget> widgets = widgets();
- Collection<String> templates = Collections2.transform(widgets, new Function<CoreWidget, String>() {
- public String apply(@Nonnull CoreWidget widget) {
- return widget.getTemplatePath();
- }
- });
- assertThat(templates).hasSize(Sets.newHashSet(templates).size());
- }
-
- @Test
- public void widget_titles_should_be_unique() {
- Collection<CoreWidget> widgets = widgets();
- Collection<String> templates = Collections2.transform(widgets, new Function<CoreWidget, String>() {
- public String apply(@Nonnull CoreWidget widget) {
- return widget.getTitle();
- }
- });
- assertThat(templates).hasSize(Sets.newHashSet(templates).size());
- }
-
- @Test
- public void should_find_templates() {
- for (CoreWidget widget : widgets()) {
- assertThat(widget.getClass().getResource(widget.getTemplatePath()))
- .as("Template not found: " + widget.getTemplatePath())
- .isNotNull();
- }
- }
-
- @Test
- public void should_find_core_widgets() {
- assertThat(widgets().size()).isGreaterThan(23);
- }
-
- private Set<Class<? extends CoreWidget>> widgetClasses() {
- String[] packages = {"org.sonar.server.dashboard.widget"};
- return new Reflections(packages).getSubTypesOf(CoreWidget.class);
- }
-
- private Collection<CoreWidget> widgets() {
- return newArrayList(Iterables.transform(widgetClasses(), new Function<Class<? extends CoreWidget>, CoreWidget>() {
- public CoreWidget apply(@Nullable Class<? extends CoreWidget> aClass) {
- try {
- return aClass.newInstance();
- } catch (Exception e) {
- throw Throwables.propagate(e);
- }
- }
- }));
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-package org.sonar.server.ui;
-
-import org.sonar.api.web.Widget;
-
-public class FakeWidget implements Widget {
-
- private String id;
- private String title;
-
- public FakeWidget(String id, String title) {
- this.id = id;
- this.title = title;
- }
-
- public FakeWidget() {
- this("fake-widget", "fake widget");
- }
-
- public String getId() {
- return id;
- }
-
- public String getTitle() {
- return title;
- }
-}
*/
package org.sonar.server.ui;
-import com.google.common.collect.Lists;
-import java.util.List;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.web.NavigationSection;
import org.sonar.api.web.UserRole;
import org.sonar.api.web.View;
-import org.sonar.api.web.Widget;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-import org.sonar.api.web.WidgetScope;
import org.sonar.server.tester.UserSessionRule;
-import static com.google.common.collect.Iterables.getOnlyElement;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.db.component.ComponentTesting.newProjectDto;
assertThat(proxy.getDefaultTabForMetrics()).isEqualTo(new String[] {"ncloc", "coverage"});
}
- @Test
- public void widget_should_be_editable() {
- ViewProxy<Widget> proxy = new ViewProxy<Widget>(new EditableWidget(), userSession);
-
- assertThat(proxy.isEditable()).isTrue();
- assertThat(proxy.getWidgetProperties()).hasSize(3);
- }
-
- @Test
- public void load_widget_properties_in_the_same_order_than_annotations() {
- ViewProxy<Widget> proxy = new ViewProxy<Widget>(new EditableWidget(), userSession);
-
- List<WidgetProperty> widgetProperties = Lists.newArrayList(proxy.getWidgetProperties());
- assertThat(widgetProperties).hasSize(3);
- assertThat(widgetProperties.get(0).key()).isEqualTo("first_prop");
- assertThat(widgetProperties.get(1).key()).isEqualTo("second_prop");
- assertThat(widgetProperties.get(2).key()).isEqualTo("third_prop");
- }
-
- @Test
- public void widget_should_have_text_property() {
- ViewProxy<Widget> proxy = new ViewProxy<Widget>(new TextWidget(), userSession);
-
- assertThat(getOnlyElement(proxy.getWidgetProperties()).type()).isEqualTo(WidgetPropertyType.TEXT);
- }
-
- @Test
- public void widget_should_not_be_global_by_default() {
- ViewProxy<Widget> proxy = new ViewProxy<Widget>(new EditableWidget(), userSession);
-
- assertThat(proxy.isGlobal()).isFalse();
- }
-
- @Test
- public void widget_should_be_global() {
- ViewProxy<Widget> proxy = new ViewProxy<Widget>(new GlobalWidget(), userSession);
-
- assertThat(proxy.isGlobal()).isTrue();
- }
-
- @Test
- public void should_fail_to_load_widget_with_invalid_scope() {
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("INVALID");
- exception.expectMessage("WidgetWithInvalidScope");
-
- new ViewProxy<Widget>(new WidgetWithInvalidScope(), userSession);
- }
-
- @Test
- public void widgetShouldRequireMandatoryProperties() {
- ViewProxy<Widget> proxy = new ViewProxy<Widget>(new EditableWidget(), userSession);
- assertThat(proxy.hasRequiredProperties()).isTrue();
- }
-
- @Test
- public void widgetShouldDefineOnlyOptionalProperties() {
- ViewProxy<Widget> proxy = new ViewProxy<Widget>(new WidgetWithOptionalProperties(), userSession);
- assertThat(proxy.hasRequiredProperties()).isFalse();
- }
-
@Test
public void is_authorized_by_default() {
return id;
}
}
-
-@WidgetProperties({
- @WidgetProperty(key = "first_prop", optional = false),
- @WidgetProperty(key = "second_prop", defaultValue = "30", type = WidgetPropertyType.INTEGER),
- @WidgetProperty(key = "third_prop", type = WidgetPropertyType.INTEGER)
-})
-class EditableWidget implements Widget {
- @Override
- public String getId() {
- return "w1";
- }
-
- @Override
- public String getTitle() {
- return "W1";
- }
-}
-
-@WidgetProperties(@WidgetProperty(key = "message", defaultValue = "", type = WidgetPropertyType.TEXT))
-class TextWidget implements Widget {
- @Override
- public String getId() {
- return "text";
- }
-
- @Override
- public String getTitle() {
- return "TEXT";
- }
-}
-
-@WidgetScope("GLOBAL")
-class GlobalWidget implements Widget {
- @Override
- public String getId() {
- return "global";
- }
-
- @Override
- public String getTitle() {
- return "Global";
- }
-}
-
-@WidgetScope("INVALID")
-class WidgetWithInvalidScope implements Widget {
- @Override
- public String getId() {
- return "invalidScope";
- }
-
- @Override
- public String getTitle() {
- return "InvalidScope";
- }
-}
-
-@WidgetProperties({
- @WidgetProperty(key = "foo"),
- @WidgetProperty(key = "bar")
-})
-class WidgetWithOptionalProperties implements Widget {
- @Override
- public String getId() {
- return "w2";
- }
-
- @Override
- public String getTitle() {
- return "W2";
- }
-}
import org.sonar.api.web.NavigationSection;
import org.sonar.api.web.Page;
import org.sonar.api.web.View;
-import org.sonar.api.web.Widget;
import org.sonar.server.tester.UserSessionRule;
import static org.assertj.core.api.Assertions.assertThat;
public UserSessionRule userSessionRule = UserSessionRule.standalone();
private static FakeResourceViewer FAKE_TAB = new FakeResourceViewer();
- private static FakeWidget FAKE_WIDGET = new FakeWidget();
private static FakePage FAKE_PAGE = new FakePage();
- private static final View[] VIEWS = {FAKE_PAGE, FAKE_TAB, FAKE_WIDGET};
+ private static final View[] VIEWS = {FAKE_PAGE, FAKE_TAB};
@Test
public void should_get_page_by_id() {
assertThat(pages.size()).isEqualTo(0);
}
- @Test
- public void should_get_widgets() {
- final Views views = new Views(userSessionRule, VIEWS);
- List<ViewProxy<Widget>> widgets = views.getWidgets();
- assertThat(widgets.size()).isEqualTo(1);
- assertThat(widgets.get(0).getTarget().getClass()).isEqualTo(FakeWidget.class);
- }
-
- @Test
- public void should_sort_views_by_title() {
- final Views views = new Views(userSessionRule, new View[] {new FakeWidget("ccc", "ccc"), new FakeWidget("aaa", "aaa"), new FakeWidget("bbb", "bbb")});
- List<ViewProxy<Widget>> widgets = views.getWidgets();
- assertThat(widgets.size()).isEqualTo(3);
- assertThat(widgets.get(0).getId()).isEqualTo("aaa");
- assertThat(widgets.get(1).getId()).isEqualTo("bbb");
- assertThat(widgets.get(2).getId()).isEqualTo("ccc");
- }
-
- @Test
- public void should_prefix_title_by_number_to_display_first() {
- final Views views = new Views(userSessionRule, new View[] {new FakeWidget("other", "Other"), new FakeWidget("1id", "1widget"), new FakeWidget("2id", "2widget")});
- List<ViewProxy<Widget>> widgets = views.getWidgets();
- assertThat(widgets.size()).isEqualTo(3);
- assertThat(widgets.get(0).getId()).isEqualTo("1id");
- assertThat(widgets.get(1).getId()).isEqualTo("2id");
- assertThat(widgets.get(2).getId()).isEqualTo("other");
- }
-
@Test
public void should_accept_navigation_section() {
ViewProxy<?> proxy = mock(ViewProxy.class);
when(proxy.getSections()).thenReturn(new String[] {NavigationSection.RESOURCE});
- when(proxy.isWidget()).thenReturn(false);
assertThat(Views.acceptNavigationSection(proxy, NavigationSection.RESOURCE)).isEqualTo(true);
assertThat(Views.acceptNavigationSection(proxy, NavigationSection.HOME)).isEqualTo(false);
assertThat(Views.acceptNavigationSection(proxy, null)).isEqualTo(true);
}
- @Test
- public void should_not_check_navigation_section_on_widgets() {
- ViewProxy<?> proxy = mock(ViewProxy.class);
- when(proxy.isWidget()).thenReturn(true);
-
- assertThat(Views.acceptNavigationSection(proxy, NavigationSection.RESOURCE)).isEqualTo(true);
- assertThat(Views.acceptNavigationSection(proxy, NavigationSection.HOME)).isEqualTo(true);
- assertThat(Views.acceptNavigationSection(proxy, NavigationSection.CONFIGURATION)).isEqualTo(true);
- assertThat(Views.acceptNavigationSection(proxy, NavigationSection.RESOURCE_CONFIGURATION)).isEqualTo(true);
- assertThat(Views.acceptNavigationSection(proxy, null)).isEqualTo(true);
- }
}