aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/projects/app.js
blob: 8e98bb1686ba145cde908fdba1869db9e2dee7ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import $ from 'jquery';
import React from 'react';
import Main from './main';
import {getCurrentUser} from '../../api/users';
import {getGlobalNavigation} from '../../api/nav';

export default {
  start(options) {
    $.when(
        getCurrentUser(),
        getGlobalNavigation(),
        window.requestMessages()
    ).then((user, nav) => {
          let el = document.querySelector(options.el),
              hasProvisionPermission = user[0].permissions.global.indexOf('provisioning') !== -1,
              topLevelQualifiers = nav[0].qualifiers;
          React.render(<Main hasProvisionPermission={hasProvisionPermission}
                             topLevelQualifiers={topLevelQualifiers}/>, el);
        });
  }
};