aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/permission-templates/permission-templates.js
blob: 030fec04c2fad1d8e7f9fde21786c18df90e2523 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import classNames from 'classnames';
import React from 'react';

import PermissionsHeader from './permissions-header';
import PermissionTemplate from './permission-template';


export default React.createClass({
  propTypes:{
    permissionTemplates: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
    permissions: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
    topQualifiers: React.PropTypes.array.isRequired,
    refresh: React.PropTypes.func.isRequired
  },

  render() {
    let permissionTemplates = this.props.permissionTemplates.map(p => {
      return <PermissionTemplate
          key={p.id}
          permissionTemplate={p}
          topQualifiers={this.props.topQualifiers}
          refresh={this.props.refresh}/>;
    });
    let className = classNames('data zebra', { 'new-loading': !this.props.ready });
    return (
        <table id="permission-templates" className={className}>
          <PermissionsHeader permissions={this.props.permissions}/>
          <tbody>{permissionTemplates}</tbody>
        </table>
    );
  }
});