]> source.dussan.org Git - sonarqube.git/commitdiff
Remove unused ListItems
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Thu, 4 May 2017 15:09:46 +0000 (17:09 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Tue, 9 May 2017 09:14:36 +0000 (11:14 +0200)
server/sonar-web/src/main/js/apps/permission-templates/components/ListItem.js
server/sonar-web/src/main/js/apps/permission-templates/templates/permission-templates-groups.hbs [deleted file]
server/sonar-web/src/main/js/apps/permission-templates/templates/permission-templates-users.hbs [deleted file]
server/sonar-web/src/main/js/apps/permission-templates/views/GroupsView.js [deleted file]
server/sonar-web/src/main/js/apps/permission-templates/views/UsersView.js [deleted file]

index 9d60a805bf12ac201ada85998d58aef53ff27d84..855783fcb8b42370a9dec752ea863ad58e324e36 100644 (file)
@@ -21,8 +21,6 @@ import React from 'react';
 import NameCell from './NameCell';
 import PermissionCell from './PermissionCell';
 import ActionsCell from './ActionsCell';
-import UsersView from '../views/UsersView';
-import GroupsView from '../views/GroupsView';
 import { PermissionTemplateType, CallbackType } from '../propTypes';
 
 export default class ListItem extends React.PureComponent {
@@ -33,27 +31,6 @@ export default class ListItem extends React.PureComponent {
     refresh: CallbackType
   };
 
-  componentWillMount() {
-    this.handleShowGroups = this.handleShowGroups.bind(this);
-    this.handleShowUsers = this.handleShowUsers.bind(this);
-  }
-
-  handleShowGroups(permission) {
-    new GroupsView({
-      permission,
-      permissionTemplate: this.props.permissionTemplate,
-      refresh: this.props.refresh
-    }).render();
-  }
-
-  handleShowUsers(permission) {
-    new UsersView({
-      permission,
-      permissionTemplate: this.props.permissionTemplate,
-      refresh: this.props.refresh
-    }).render();
-  }
-
   render() {
     const permissions = this.props.permissionTemplate.permissions.map(p => (
       <PermissionCell key={p.key} permission={p} />
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/templates/permission-templates-groups.hbs b/server/sonar-web/src/main/js/apps/permission-templates/templates/permission-templates-groups.hbs
deleted file mode 100644 (file)
index 703ff00..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<div class="modal-head">
-  <h2>Update "{{permissionName}}" Groups for "{{permissionTemplateName}}"</h2>
-</div>
-<div class="modal-body">
-  <div class="js-modal-messages"></div>
-  <div id="permission-templates-groups"></div>
-</div>
-<div class="modal-foot">
-  <a href="#" class="js-modal-close">Done</a>
-</div>
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/templates/permission-templates-users.hbs b/server/sonar-web/src/main/js/apps/permission-templates/templates/permission-templates-users.hbs
deleted file mode 100644 (file)
index dcd5c51..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<div class="modal-head">
-  <h2>Update "{{permission.name}}" Users for "{{permissionTemplateName}}"</h2>
-</div>
-
-<div class="modal-body">
-  <div class="js-modal-messages"></div>
-
-  <div class="big-spacer-bottom panel panel-vertical">
-    <input id="grant-to-project-creators"
-           class="little-spacer-right"
-           type="checkbox"
-           {{#if permission.withProjectCreator}}checked{{/if}}/>
-    <label for="grant-to-project-creators">
-      {{tp 'permission_templates.grant_permission_to_project_creators' permission.name}}
-    </label>
-    <i class="icon-help little-spacer-left" title="{{t 'permission_templates.project_creators.explanation'}}" data-toggle="tooltip"/>
-  </div>
-
-  <div id="permission-templates-users"></div>
-</div>
-
-<div class="modal-foot">
-  <a href="#" class="js-modal-close">Done</a>
-</div>
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/views/GroupsView.js b/server/sonar-web/src/main/js/apps/permission-templates/views/GroupsView.js
deleted file mode 100644 (file)
index ca357a4..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-import escapeHtml from 'escape-html';
-import Modal from '../../../components/common/modals';
-import Template from '../templates/permission-templates-groups.hbs';
-import '../../../components/SelectList';
-
-function getSearchUrl(permission, permissionTemplate) {
-  return (
-    `${window.baseUrl}/api/permissions/template_groups?` +
-    `ps=100&permission=${permission.key}&templateId=${permissionTemplate.id}`
-  );
-}
-
-export default Modal.extend({
-  template: Template,
-
-  onRender() {
-    Modal.prototype.onRender.apply(this, arguments);
-    new window.SelectList({
-      el: this.$('#permission-templates-groups'),
-      width: '100%',
-      readOnly: false,
-      focusSearch: false,
-      dangerouslyUnescapedHtmlFormat(item) {
-        return escapeHtml(item.name);
-      },
-      queryParam: 'q',
-      searchUrl: getSearchUrl(this.options.permission, this.options.permissionTemplate),
-      selectUrl: window.baseUrl + '/api/permissions/add_group_to_template',
-      deselectUrl: window.baseUrl + '/api/permissions/remove_group_from_template',
-      extra: {
-        permission: this.options.permission.key,
-        templateId: this.options.permissionTemplate.id
-      },
-      selectParameter: 'groupName',
-      selectParameterValue: 'name',
-      parse(r) {
-        this.more = false;
-        return r.groups;
-      }
-    });
-  },
-
-  onDestroy() {
-    if (this.options.refresh) {
-      this.options.refresh();
-    }
-    Modal.prototype.onDestroy.apply(this, arguments);
-  },
-
-  serializeData() {
-    return {
-      ...Modal.prototype.serializeData.apply(this, arguments),
-      permissionName: this.options.permission.name,
-      permissionTemplateName: this.options.permissionTemplate.name
-    };
-  }
-});
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/views/UsersView.js b/server/sonar-web/src/main/js/apps/permission-templates/views/UsersView.js
deleted file mode 100644 (file)
index 9992398..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-import escapeHtml from 'escape-html';
-import Modal from '../../../components/common/modals';
-import Template from '../templates/permission-templates-users.hbs';
-import '../../../components/SelectList';
-import {
-  addProjectCreatorToTemplate,
-  removeProjectCreatorFromTemplate
-} from '../../../api/permissions';
-
-export default Modal.extend({
-  template: Template,
-
-  events() {
-    return {
-      ...Modal.prototype.events.apply(this, arguments),
-      'change #grant-to-project-creators': 'onCheckboxChange'
-    };
-  },
-
-  onCheckboxChange() {
-    const checked = this.$('#grant-to-project-creators').is(':checked');
-    if (checked) {
-      addProjectCreatorToTemplate(
-        this.options.permissionTemplate.name,
-        this.options.permission.key
-      );
-    } else {
-      removeProjectCreatorFromTemplate(
-        this.options.permissionTemplate.name,
-        this.options.permission.key
-      );
-    }
-  },
-
-  onRender() {
-    Modal.prototype.onRender.apply(this, arguments);
-    this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
-    const searchUrl =
-      window.baseUrl +
-      '/api/permissions/template_users?ps=100&permission=' +
-      this.options.permission.key +
-      '&templateId=' +
-      this.options.permissionTemplate.id;
-    new window.SelectList({
-      searchUrl,
-      el: this.$('#permission-templates-users'),
-      width: '100%',
-      readOnly: false,
-      focusSearch: false,
-      dangerouslyUnescapedHtmlFormat(item) {
-        return `${escapeHtml(item.name)}<br><span class="note">${escapeHtml(item.login)}</span>`;
-      },
-      queryParam: 'q',
-      selectUrl: window.baseUrl + '/api/permissions/add_user_to_template',
-      deselectUrl: window.baseUrl + '/api/permissions/remove_user_from_template',
-      extra: {
-        permission: this.options.permission.key,
-        templateId: this.options.permissionTemplate.id
-      },
-      selectParameter: 'login',
-      selectParameterValue: 'login',
-      parse(r) {
-        this.more = false;
-        return r.users;
-      }
-    });
-  },
-
-  onDestroy() {
-    if (this.options.refresh) {
-      this.options.refresh();
-    }
-    this.$('[data-toggle="tooltip"]').tooltip('destroy');
-    Modal.prototype.onDestroy.apply(this, arguments);
-  },
-
-  serializeData() {
-    return {
-      ...Modal.prototype.serializeData.apply(this, arguments),
-      permission: this.options.permission,
-      permissionTemplateName: this.options.permissionTemplate.name
-    };
-  }
-});