From d4f696ab1e013f3d305b7cb978d65a3ee0937149 Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Thu, 24 Mar 2016 18:28:36 +0100 Subject: [PATCH] SONAR-7469 SONAR-7202 SONAR-7201 Remove action plan from the UI --- .../src/main/js/apps/issues/controller.js | 2 +- .../src/main/js/apps/issues/facets-view.js | 2 - .../apps/issues/facets/action-plan-facet.js | 85 ----------- .../src/main/js/apps/issues/models/issues.js | 1 - .../src/main/js/apps/issues/models/state.js | 5 +- .../facets/issues-action-plan-facet.hbs | 22 --- .../templates/issues-issue-filter-form.hbs | 12 -- .../apps/issues/workspace-list-item-view.js | 4 +- .../issue/collections/action-plans.js | 32 ---- .../js/components/issue/collections/issues.js | 1 - .../main/js/components/issue/issue-view.js | 22 --- .../main/js/components/issue/models/issue.js | 1 - .../js/components/issue/templates/issue.hbs | 13 -- .../components/issue/views/plan-form-view.js | 57 -------- .../main/js/components/source-viewer/main.js | 4 +- .../main/nav/component/component-nav-menu.js | 10 -- .../widget-issue-filter-action-plans.hbs | 26 ---- .../main/js/widgets/issue-filter/widget.js | 19 --- .../controllers/action_plans_controller.rb | 114 --------------- .../views/action_plans/_create_form.html.erb | 44 ------ .../views/action_plans/_edit_form.html.erb | 44 ------ .../app/views/action_plans/_progress.html.erb | 44 ------ .../app/views/action_plans/index.html.erb | 138 ------------------ .../views/issues/_bulk_change_form.html.erb | 28 ---- 24 files changed, 5 insertions(+), 725 deletions(-) delete mode 100644 server/sonar-web/src/main/js/apps/issues/facets/action-plan-facet.js delete mode 100644 server/sonar-web/src/main/js/apps/issues/templates/facets/issues-action-plan-facet.hbs delete mode 100644 server/sonar-web/src/main/js/components/issue/collections/action-plans.js delete mode 100644 server/sonar-web/src/main/js/components/issue/views/plan-form-view.js delete mode 100644 server/sonar-web/src/main/js/widgets/issue-filter/templates/widget-issue-filter-action-plans.hbs delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/controllers/action_plans_controller.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_create_form.html.erb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_edit_form.html.erb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_progress.html.erb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/index.html.erb diff --git a/server/sonar-web/src/main/js/apps/issues/controller.js b/server/sonar-web/src/main/js/apps/issues/controller.js index 07ead890dbd..bbca2009db9 100644 --- a/server/sonar-web/src/main/js/apps/issues/controller.js +++ b/server/sonar-web/src/main/js/apps/issues/controller.js @@ -24,7 +24,7 @@ import Controller from '../../components/navigator/controller'; import ComponentViewer from './component-viewer/main'; import HomeView from './workspace-home-view'; -const FACET_DATA_FIELDS = ['components', 'users', 'rules', 'actionPlans', 'languages']; +const FACET_DATA_FIELDS = ['components', 'users', 'rules', 'languages']; export default Controller.extend({ _facetsFromServer () { diff --git a/server/sonar-web/src/main/js/apps/issues/facets-view.js b/server/sonar-web/src/main/js/apps/issues/facets-view.js index 6a27534a049..ef1f4030170 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets-view.js +++ b/server/sonar-web/src/main/js/apps/issues/facets-view.js @@ -29,7 +29,6 @@ import RuleFacet from './facets/rule-facet'; import TagFacet from './facets/tag-facet'; import ResolutionFacet from './facets/resolution-facet'; import CreationDateFacet from './facets/creation-date-facet'; -import ActionPlanFacet from './facets/action-plan-facet'; import FileFacet from './facets/file-facet'; import ReporterFacet from './facets/reporter-facet'; import LanguageFacet from './facets/language-facet'; @@ -49,7 +48,6 @@ const viewsMapping = { moduleUuids: ModuleFacet, rules: RuleFacet, tags: TagFacet, - actionPlans: ActionPlanFacet, fileUuids: FileFacet, reporters: ReporterFacet, languages: LanguageFacet, diff --git a/server/sonar-web/src/main/js/apps/issues/facets/action-plan-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/action-plan-facet.js deleted file mode 100644 index 589329b7c27..00000000000 --- a/server/sonar-web/src/main/js/apps/issues/facets/action-plan-facet.js +++ /dev/null @@ -1,85 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import $ from 'jquery'; -import _ from 'underscore'; -import BaseFacet from './base-facet'; -import Template from '../templates/facets/issues-action-plan-facet.hbs'; - -export default BaseFacet.extend({ - template: Template, - - onRender () { - BaseFacet.prototype.onRender.apply(this, arguments); - const value = this.options.app.state.get('query').planned; - if ((value != null) && (!value || value === 'false')) { - return this.$('.js-facet').filter('[data-unplanned]').addClass('active'); - } - }, - - toggleFacet (e) { - const unplanned = $(e.currentTarget).is('[data-unplanned]'); - $(e.currentTarget).toggleClass('active'); - if (unplanned) { - const checked = $(e.currentTarget).is('.active'); - const value = checked ? 'false' : null; - return this.options.app.state.updateFilter({ - planned: value, - actionPlans: null - }); - } else { - return this.options.app.state.updateFilter({ - planned: null, - actionPlans: this.getValue() - }); - } - }, - - getValuesWithLabels () { - const values = this.model.getValues(); - const actionPlans = this.options.app.facets.actionPlans; - values.forEach(function (v) { - const key = v.val; - let label = null; - if (key) { - const actionPlan = _.findWhere(actionPlans, { key }); - if (actionPlan != null) { - label = actionPlan.name; - } - } - v.label = label; - }); - return values; - }, - - disable () { - return this.options.app.state.updateFilter({ - planned: null, - actionPlans: null - }); - }, - - serializeData () { - return _.extend(BaseFacet.prototype.serializeData.apply(this, arguments), { - values: this.getValuesWithLabels() - }); - } -}); - - diff --git a/server/sonar-web/src/main/js/apps/issues/models/issues.js b/server/sonar-web/src/main/js/apps/issues/models/issues.js index bf64834b6a7..6cf78fc7bf6 100644 --- a/server/sonar-web/src/main/js/apps/issues/models/issues.js +++ b/server/sonar-web/src/main/js/apps/issues/models/issues.js @@ -89,7 +89,6 @@ export default Backbone.Collection.extend({ issue = that._injectRelational(issue, r.rules, 'rule', 'key'); issue = that._injectRelational(issue, r.users, 'assignee', 'login'); issue = that._injectRelational(issue, r.users, 'reporter', 'login'); - issue = that._injectRelational(issue, r.actionPlans, 'actionPlan', 'key'); issue = that._injectCommentsRelational(issue, r.users); issue = that._prepareClosed(issue); issue = that.ensureTextRange(issue); diff --git a/server/sonar-web/src/main/js/apps/issues/models/state.js b/server/sonar-web/src/main/js/apps/issues/models/state.js index 26c08a44b5f..049f657f121 100644 --- a/server/sonar-web/src/main/js/apps/issues/models/state.js +++ b/server/sonar-web/src/main/js/apps/issues/models/state.js @@ -44,15 +44,13 @@ export default State.extend({ 'assignees', 'reporters', 'authors', - 'languages', - 'actionPlans' + 'languages' ], facetsFromServer: [ 'types', 'severities', 'statuses', 'resolutions', - 'actionPlans', 'projectUuids', 'directories', 'rules', @@ -68,7 +66,6 @@ export default State.extend({ transform: { 'resolved': 'resolutions', 'assigned': 'assignees', - 'planned': 'actionPlans', 'createdBefore': 'createdAt', 'createdAfter': 'createdAt', 'createdInLast': 'createdAt' diff --git a/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-action-plan-facet.hbs b/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-action-plan-facet.hbs deleted file mode 100644 index 25dace0c91f..00000000000 --- a/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-action-plan-facet.hbs +++ /dev/null @@ -1,22 +0,0 @@ -{{> "_issues-facet-header"}} - -
- {{#each values}} - {{#eq val ""}} - {{! unplanned }} - - {{t "issue.unplanned"}} - - {{formatFacetValue count ../../state.facetMode}} - - - {{else}} - - {{label}} - - {{formatFacetValue count ../../state.facetMode}} - - - {{/eq}} - {{/each}} -
diff --git a/server/sonar-web/src/main/js/apps/issues/templates/issues-issue-filter-form.hbs b/server/sonar-web/src/main/js/apps/issues/templates/issues-issue-filter-form.hbs index 1f37beb04ed..58764e59543 100644 --- a/server/sonar-web/src/main/js/apps/issues/templates/issues-issue-filter-form.hbs +++ b/server/sonar-web/src/main/js/apps/issues/templates/issues-issue-filter-form.hbs @@ -47,18 +47,6 @@ {{/if}} -
  • - {{#if actionPlan}} - - {{t "issue.planned_for"}} {{actionPlanName}} - - {{else}} - - {{t "issue.unplanned"}} - - {{/if}} -
  • -
  • diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-list-item-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-list-item-view.js index ff9a75d095f..eef64f22edd 100644 --- a/server/sonar-web/src/main/js/apps/issues/workspace-list-item-view.js +++ b/server/sonar-web/src/main/js/apps/issues/workspace-list-item-view.js @@ -29,9 +29,7 @@ const SHOULD_NULL = { resolutions: ['resolved'], resolved: ['resolutions'], assignees: ['assigned'], - assigned: ['assignees'], - actionPlans: ['planned'], - planned: ['actionPlans'] + assigned: ['assignees'] }; export default IssueView.extend({ diff --git a/server/sonar-web/src/main/js/components/issue/collections/action-plans.js b/server/sonar-web/src/main/js/components/issue/collections/action-plans.js deleted file mode 100644 index 5218f57e711..00000000000 --- a/server/sonar-web/src/main/js/components/issue/collections/action-plans.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import Backbone from 'backbone'; - -export default Backbone.Collection.extend({ - url () { - return '/api/action_plans/search'; - }, - - parse (r) { - return r.actionPlans; - } -}); - - diff --git a/server/sonar-web/src/main/js/components/issue/collections/issues.js b/server/sonar-web/src/main/js/components/issue/collections/issues.js index d8223896252..f13415e83d1 100644 --- a/server/sonar-web/src/main/js/components/issue/collections/issues.js +++ b/server/sonar-web/src/main/js/components/issue/collections/issues.js @@ -96,7 +96,6 @@ export default Backbone.Collection.extend({ issue = that._injectRelational(issue, r.rules, 'rule', 'key'); issue = that._injectRelational(issue, r.users, 'assignee', 'login'); issue = that._injectRelational(issue, r.users, 'reporter', 'login'); - issue = that._injectRelational(issue, r.actionPlans, 'actionPlan', 'key'); issue = that._injectCommentsRelational(issue, r.users); issue = that._prepareClosed(issue); issue = that.ensureTextRange(issue); diff --git a/server/sonar-web/src/main/js/components/issue/issue-view.js b/server/sonar-web/src/main/js/components/issue/issue-view.js index 9a4fb2e7849..82594682e0f 100644 --- a/server/sonar-web/src/main/js/components/issue/issue-view.js +++ b/server/sonar-web/src/main/js/components/issue/issue-view.js @@ -23,11 +23,9 @@ import Backbone from 'backbone'; import Marionette from 'backbone.marionette'; import ChangeLog from './models/changelog'; import ChangeLogView from './views/changelog-view'; -import ActionPlans from './collections/action-plans'; import TransitionsFormView from './views/transitions-form-view'; import AssignFormView from './views/assign-form-view'; import CommentFormView from './views/comment-form-view'; -import PlanFormView from './views/plan-form-view'; import SetSeverityFormView from './views/set-severity-form-view'; import SetTypeFormView from './views/set-type-form-view'; import TagsFormView from './views/tags-form-view'; @@ -214,26 +212,6 @@ export default Marionette.ItemView.extend({ view.destroy(); }, - plan (e) { - const that = this; - const t = $(e.currentTarget); - const actionPlans = new ActionPlans(); - return actionPlans.fetch({ - reset: true, - data: { project: this.model.get('project') } - }).done(function () { - e.stopPropagation(); - $('body').click(); - that.popup = new PlanFormView({ - triggerEl: t, - bottom: true, - model: that.model, - collection: actionPlans - }); - that.popup.render(); - }); - }, - showRule () { const ruleKey = this.model.get('rule'); Workspace.openRule({ key: ruleKey }); diff --git a/server/sonar-web/src/main/js/components/issue/models/issue.js b/server/sonar-web/src/main/js/components/issue/models/issue.js index 637c78b49c0..7976ba53449 100644 --- a/server/sonar-web/src/main/js/components/issue/models/issue.js +++ b/server/sonar-web/src/main/js/components/issue/models/issue.js @@ -46,7 +46,6 @@ export default Backbone.Model.extend({ issue = this._injectRelational(issue, r.rules, 'rule', 'key'); issue = this._injectRelational(issue, r.users, 'assignee', 'login'); issue = this._injectRelational(issue, r.users, 'reporter', 'login'); - issue = this._injectRelational(issue, r.actionPlans, 'actionPlan', 'key'); issue = this._injectCommentsRelational(issue, r.users); issue = this._prepareClosed(issue); issue = this.ensureTextRange(issue); diff --git a/server/sonar-web/src/main/js/components/issue/templates/issue.hbs b/server/sonar-web/src/main/js/components/issue/templates/issue.hbs index 6ed51a13a82..eb469e40c5f 100644 --- a/server/sonar-web/src/main/js/components/issue/templates/issue.hbs +++ b/server/sonar-web/src/main/js/components/issue/templates/issue.hbs @@ -95,19 +95,6 @@ {{/inArray}}
  • -
  • - {{#inArray actions "plan"}} - - {{else}} - {{#if actionPlan}}{{default actionPlanName actionPlan}}{{else}}{{t 'issue.unplanned'}}{{/if}} - {{/inArray}} -
  • - {{#if debt}}
  • diff --git a/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js b/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js deleted file mode 100644 index 19daabb80f4..00000000000 --- a/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import $ from 'jquery'; -import _ from 'underscore'; -import ActionOptionsView from '../../common/action-options-view'; -import Template from '../templates/issue-plan-form.hbs'; -import { translate } from '../../../helpers/l10n'; - -export default ActionOptionsView.extend({ - template: Template, - - getActionPlan () { - return this.model.get('actionPlan') || ''; - }, - - selectInitialOption () { - this.makeActive(this.getOptions().filter(`[data-value="${this.getActionPlan()}"]`)); - }, - - selectOption (e) { - const actionPlan = $(e.currentTarget).data('value'); - const actionPlanName = $(e.currentTarget).data('text'); - this.submit(actionPlan, actionPlanName); - return ActionOptionsView.prototype.selectOption.apply(this, arguments); - }, - - submit (actionPlan) { - return this.model.plan(actionPlan); - }, - - getActionPlans () { - return [{ key: '', name: translate('issue.unplanned') }].concat(this.collection.toJSON()); - }, - - serializeData () { - return _.extend(ActionOptionsView.prototype.serializeData.apply(this, arguments), { - items: this.getActionPlans() - }); - } -}); diff --git a/server/sonar-web/src/main/js/components/source-viewer/main.js b/server/sonar-web/src/main/js/components/source-viewer/main.js index 58db3aa9ea9..85f628c2751 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/main.js +++ b/server/sonar-web/src/main/js/components/source-viewer/main.js @@ -284,8 +284,8 @@ export default Marionette.LayoutView.extend({ data: { componentUuids: this.model.id, f: 'component,componentId,project,subProject,rule,status,resolution,author,reporter,assignee,debt,' + - 'line,message,severity,actionPlan,creationDate,updateDate,closeDate,tags,comments,attr,actions,' + - 'transitions,actionPlanName', + 'line,message,severity,creationDate,updateDate,closeDate,tags,comments,attr,actions,' + + 'transitions', additionalFields: '_all', resolved: false, s: 'FILE_LINE', diff --git a/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js b/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js index eb7223ab3f3..bab9e9325e0 100644 --- a/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js +++ b/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js @@ -177,7 +177,6 @@ export default React.createClass({ renderAdministration() { const shouldShowAdministration = - this.props.conf.showActionPlans || this.props.conf.showBackgroundTasks || this.props.conf.showDeletion || this.props.conf.showHistory || @@ -206,7 +205,6 @@ export default React.createClass({ {this.renderProfilesLink()} {this.renderQualityGatesLink()} {this.renderCustomMeasuresLink()} - {this.renderActionPlansLink()} {this.renderLinksLink()} {this.renderPermissionsLink()} {this.renderHistoryLink()} @@ -251,14 +249,6 @@ export default React.createClass({ return this.renderLink(url, translate('custom_measures.page'), '/custom_measures'); }, - renderActionPlansLink() { - if (!this.props.conf.showActionPlans) { - return null; - } - const url = `/action_plans?id=${encodeURIComponent(this.props.component.key)}`; - return this.renderLink(url, translate('action_plans.page'), '/action_plans'); - }, - renderLinksLink() { if (!this.props.conf.showLinks) { return null; diff --git a/server/sonar-web/src/main/js/widgets/issue-filter/templates/widget-issue-filter-action-plans.hbs b/server/sonar-web/src/main/js/widgets/issue-filter/templates/widget-issue-filter-action-plans.hbs deleted file mode 100644 index b5c93283194..00000000000 --- a/server/sonar-web/src/main/js/widgets/issue-filter/templates/widget-issue-filter-action-plans.hbs +++ /dev/null @@ -1,26 +0,0 @@ - - {{> '_widget-issue-filter-total'}} - {{#each items}} - - - - - - {{/each}} -
    - {{#eq val ''}} - {{t 'issue.unplanned'}} - {{else}} - {{default label val}} - {{/eq}} - - {{#notNull ../periodDate}}+{{/notNull}}{{issueFilterValue count ../displayMode}} - -
    -
    -
    -
    - -{{#if maxResultsReached}} - {{> '_widget-issue-filter-limit'}} -{{/if}} diff --git a/server/sonar-web/src/main/js/widgets/issue-filter/widget.js b/server/sonar-web/src/main/js/widgets/issue-filter/widget.js index 9aa78fa94bf..82cae89822d 100644 --- a/server/sonar-web/src/main/js/widgets/issue-filter/widget.js +++ b/server/sonar-web/src/main/js/widgets/issue-filter/widget.js @@ -24,7 +24,6 @@ import Backbone from 'backbone'; import Marionette from 'backbone.marionette'; import Template from './templates/widget-issue-filter.hbs'; -import ActionPlansTemplate from './templates/widget-issue-filter-action-plans.hbs'; import AssigneesTemplate from './templates/widget-issue-filter-assignees.hbs'; import ResolutionsTemplate from './templates/widget-issue-filter-resolutions.hbs'; import SeveritiesTemplate from './templates/widget-issue-filter-severities.hbs'; @@ -165,24 +164,6 @@ const byDistributionConf = { } } }, - 'actionPlans': { - template: ActionPlansTemplate, - label (item, r) { - if (_.isArray(r.actionPlans)) { - const actionPlan = _.findWhere(r.actionPlans, { key: item.val }); - if (actionPlan != null) { - return actionPlan.name; - } - } - }, - filter (item) { - if ('' + this.query.planned === 'false') { - return item.val === ''; - } else { - return defaultFilter.call(this, item); - } - } - }, 'createdAt': { comparator (item) { return -moment(item.val).unix(); diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/action_plans_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/action_plans_controller.rb deleted file mode 100644 index cc190374655..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/action_plans_controller.rb +++ /dev/null @@ -1,114 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube 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. -# -# SonarQube 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. -# - -class ActionPlansController < ApplicationController - - SECTION=Navigation::SECTION_RESOURCE - before_filter :load_resource - - def index - load_action_plans() - end - - def create_form - load_action_plans() - render :partial => 'action_plans/create_form' - end - - def edit_form - @action_plan = find_by_key(params[:plan_key]) - load_action_plans() - render :partial => 'action_plans/edit_form' - end - - def edit - verify_post_request - options = {'project' => @resource.key, 'name' => params[:name], 'description' => params[:description], 'deadLine' => params[:deadline]} - - action_plan_result = Internal.issues.updateActionPlan(params[:plan_key], options) - - if action_plan_result.ok() - @action_plan = action_plan_result.get() - flash[:notice] = 'Successfully edited.' - render :text => 'ok', :status => 200 - else - render :text => action_plan_result.errors().map{|error| error.text ? error.text : Api::Utils.message(error.l10nKey, :params => error.l10nParams)}.join('
    '), - :status => 400 - end - end - - def save - verify_post_request - options = {'project' => @resource.key, 'name' => params[:name], 'description' => params[:description], 'deadLine' => params[:deadline]} - - action_plan_result = Internal.issues.createActionPlan(options) - - if action_plan_result.ok() - @action_plan = action_plan_result.get() - flash[:notice] = 'Successfully created.' - render :text => 'ok', :status => 200 - else - render :text => action_plan_result.errors().map{|error| error.text ? error.text : Api::Utils.message(error.l10nKey, :params => error.l10nParams)}.join('
    '), - :status => 400 - end - end - - def delete - verify_post_request - Internal.issues.deleteActionPlan(params[:plan_key]) - flash[:notice] = 'Successfully deleted.' - redirect_to :action => 'index', :id => @resource.id - end - - def change_status - verify_post_request - action_plan = find_by_key(params[:plan_key]) - if action_plan - if action_plan.status == 'OPEN' - Internal.issues.closeActionPlan(params[:plan_key]) - else - Internal.issues.openActionPlan(params[:plan_key]) - end - end - redirect_to :action => 'index', :id => @resource.id - end - - private - - def load_resource - @resource=Project.by_key(params[:id]) - return redirect_to(home_path) unless @resource - access_denied unless has_role?(:admin, @resource) - @snapshot=@resource.last_snapshot - end - - def load_action_plans - action_plans = Internal.issues.findActionPlanStats(@resource.key) - @open_action_plans = action_plans.select {|plan| plan.isOpen()} - @closed_action_plans = action_plans.reject {|plan| plan.isOpen()} - users = Api.users.find('logins' => (@open_action_plans + @closed_action_plans).collect {|action_plan| action_plan.userLogin()}.join(",")) - @users = Hash[users.collect { |user| [user.login(), user.name()] }] - end - - def find_by_key(key) - Internal.issues.findActionPlan(key) - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_create_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_create_form.html.erb deleted file mode 100644 index cb0b7984c73..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_create_form.html.erb +++ /dev/null @@ -1,44 +0,0 @@ -
    - - - -
    - - - - -
    -
    - - - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_edit_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_edit_form.html.erb deleted file mode 100644 index 0da20a1070f..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_edit_form.html.erb +++ /dev/null @@ -1,44 +0,0 @@ -
    - - - -
    - - - - -
    -
    - - - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_progress.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_progress.html.erb deleted file mode 100644 index 209b77471c0..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_progress.html.erb +++ /dev/null @@ -1,44 +0,0 @@ -<% - unless action_plan.totalIssues()==0 - project = @project - project = @resource if project.nil? - options = {:actionPlans => action_plan.key} - - resolved_issues_link = action_plan.resolvedIssues().to_s - resolved_issues_link = link_to action_plan.resolvedIssues().to_s, url_for_component_issues(@project, options.merge(:resolved => 'true')) unless action_plan.resolvedIssues()==0 - total_issues_link = link_to action_plan.totalIssues().to_s, url_for_component_issues(@project, options) - - if action_plan.resolvedIssues() > 0 - resolved_issues_url = url_for_component_issues(@project, options.merge({:resolved => 'true'})) - percent_resolved = (action_plan.resolvedIssues()*100 / action_plan.totalIssues()).to_i - tooltip_resolved = message('action_plans.resolved_issues_x_percent', :params => [percent_resolved.to_s, action_plan.resolvedIssues().to_s]) - end - - if action_plan.unresolvedIssues() > 0 - unresolved_issues_url = url_for_component_issues(@project, options.merge({:resolved => 'false'})) - percent_open = (action_plan.unresolvedIssues()*100 / action_plan.totalIssues()).to_i - tooltip_open = message('action_plans.unresolved_issues_x_percent', :params => [percent_open.to_s, action_plan.unresolvedIssues().to_s]) - end -%> - -
    - - - - <% if action_plan.resolvedIssues() > 0 %> - - <% end %> - <% if action_plan.unresolvedIssues() > 0 %> - - <% end %> - - -
    - - - -
    -
    <%= message('action_plans.x_out_of_x_issues_solved', :params => [resolved_issues_link, total_issues_link]) -%>
    -
    - -<% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/index.html.erb deleted file mode 100644 index 6c384f37d06..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/index.html.erb +++ /dev/null @@ -1,138 +0,0 @@ -
    - - - - - - -
    - - - - - - - - - - - - - - <% if @open_action_plans.empty? %> - - <% end %> - <% - @open_action_plans.each do |plan| - %> - - - - - <% if plan.totalIssues()==0 %> - - <% else %> - - <% end %> - - - - - <% end %> - -
    <%= message('action_plans.col.status') -%><%= message('action_plans.col.name') -%><%= message('action_plans.col.due_for') -%><%= message('action_plans.col.progress') -%><%= message('action_plans.col.description') -%><%= message('action_plans.col.author') -%><%= message('action_plans.col.operations') -%>
    <%= message('action_plans.no_action_plan') -%>
    - "/><%= h(plan.name()) -%><%= format_date(plan.deadLine()) -%> - <%= message('action_plans.no_issues_linked_to_action_plan') -%> - - <%= render :partial => 'progress', :locals => {:action_plan => plan} -%> - <%= h(plan.description()) -%><%= h(@users[plan.userLogin()]) -%> - <%= link_to message('edit'), {:action => 'edit_form', :id => @resource.id, :plan_key => plan.key()}, :class => 'open-modal link-action' -%> -   - <% - close_confirmation_message = {} - if plan.isOpen() && plan.unresolvedIssues() > 0 - close_confirmation_message = {:confirm => message('action_plans.confirm_close')} - end - %> - <%= link_to message('close'), - {:action => 'change_status', :id => @resource.id, :plan_key => plan.key()}, {:method => 'POST', :class => 'link-action'}.merge(close_confirmation_message) -%> -   - <%= link_to_action message('delete'), "/action_plans/delete/#{h(@resource.id)}?plan_key=#{h(plan.key)}", - :class => 'link-action link-red', - :id => "delete_#{h(plan.key)}", - :confirm_button => message('delete'), - :confirm_title => message('action_plans.delete'), - :confirm_msg => message('action_plans.delete_message', :params => [h(plan.name)]), - :confirm_msg_params => '' - -%> -
    - - <% unless @closed_action_plans.empty? %> -

    - -

    <%= message('action_plans.closed_action_plan') -%>

    - - - - - - - - - - - - - - - - <% - @closed_action_plans.each do |plan| - %> - - - - - - <% if plan.totalIssues()==0 %> - - <% else %> - - <% end %> - - - - - <% end %> - -
    <%= message('action_plans.col.status') -%><%= message('action_plans.col.name') -%><%= message('action_plans.col.due_for') -%><%= message('action_plans.col.closed_on') -%><%= message('action_plans.col.progress') -%><%= message('action_plans.col.description') -%><%= message('action_plans.col.author') -%><%= message('action_plans.col.operations') -%>
    "/> - <%= h(plan.name) -%><%= format_date(plan.deadLine()) -%><%= format_date(plan.updatedAt()) -%> - <%= message('action_plans.no_issues_linked_to_action_plan') -%> - - <%= render :partial => 'progress', :locals => {:action_plan => plan} -%> - <%= h(plan.description()) -%><%= h(@users[plan.userLogin()]) -%> - <%= link_to message('action_plans.reopen'), - {:action => 'change_status', :id => @resource.id, :plan_key => plan.key}, {:method => 'POST', :class => 'link-action'} -%> -   - <%= link_to_action message('delete'), "/action_plans/delete/#{h(@resource.id)}?plan_key=#{h(plan.key)}", - :class => 'link-action link-red', - :id => "delete_#{h(plan.key)}", - :confirm_button => message('delete'), - :confirm_title => 'Delete action plan: '+ h(plan.name()), - :confirm_msg => message('action_plans.confirm_delete'), - :confirm_msg_params => '' - -%> -
    - <% end %> -
    -
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb index bc9ed4193bb..81e331a02a3 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb @@ -6,7 +6,6 @@ transitions_by_issues = {} unresolved_issues = 0 unresolved_issues_user_can_admin = 0 - at_least_one_issue_is_planned = false at_least_one_issue_is_assigned = false all_issues_are_assigned_to_current_user = true @issues.each do |issue| @@ -20,7 +19,6 @@ if Internal.issues.isUserIssueAdmin(issue.projectUuid) unresolved_issues_user_can_admin += 1 unless issue.resolution() end - at_least_one_issue_is_planned ||= issue.actionPlanKey() at_least_one_issue_is_assigned ||= issue.assignee() all_issues_are_assigned_to_current_user &&= issue.assignee() == current_user.login end @@ -56,30 +54,6 @@ -%> (<%= message('issue_bulk_change.x_issues', :params => unresolved_issues.to_s) -%>) - <% - if project_key - plans = Internal.issues.findOpenActionPlans(project_key) - # Display action plan combo box if there are some action plans defined on the project - unless plans.empty? - first_plan = plans[0] - options = plans.map { |plan| - label = plan.deadLine ? "#{h plan.name} (#{format_date(plan.deadLine)})" : h(plan.name) - [label, plan.key] - } - # SONAR-4728 Display 'Unplan' option only if at least one issue is planned - options.unshift([escape_javascript(message('issue.unplan.submit')), '']) if at_least_one_issue_is_planned - plan_options = options_for_select(options, first_plan.key) - %> - - <% end %> - <% end %> <% type_options = [ @@ -127,7 +101,6 @@ (<%= message('issue_bulk_change.x_issues', :params => unresolved_issues.to_s) -%>) - <% end %> <% if transitions_by_issues.size > 0 %> @@ -195,7 +168,6 @@ * Attach some events on select boxes to automatically select associate check box when selecting an option */ $j('#assignee').click(function() { check('assign-action'); }); - $j('#plan').click(function() { check('plan-action'); }); $j('#severity').click(function() { check('set-severity-action'); }); $j('#type').click(function() { check('set-type-action'); }); $j('#add_tags').select2({tags: [ '<%= @tags.join("', '") -%>' ], width: '250px' }); -- 2.39.5