X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fframework%2Fwidgets%2Fskyquake_container%2FskyquakeContainer.jsx;h=5c4c97e8ebd9faeef888ef4d0839a59c8147108c;hp=53a382febc670ce343a320440195da8c1a3f1869;hb=03156e335275de1dafbc2a816e98006afdf249bf;hpb=dfe972ff7c9f7b6b1d730e66b0b2aa8df2ce329b diff --git a/skyquake/framework/widgets/skyquake_container/skyquakeContainer.jsx b/skyquake/framework/widgets/skyquake_container/skyquakeContainer.jsx index 53a382feb..5c4c97e8e 100644 --- a/skyquake/framework/widgets/skyquake_container/skyquakeContainer.jsx +++ b/skyquake/framework/widgets/skyquake_container/skyquakeContainer.jsx @@ -18,18 +18,23 @@ import React from 'react'; import AltContainer from 'alt-container'; import Alt from './skyquakeAltInstance.js'; -import SkyquakeNav from './skyquakeNav.jsx'; + import _cloneDeep from 'lodash/cloneDeep'; +import SkyquakeNav from '../skyquake_nav/skyquakeNav.jsx'; import EventCenter from './eventCenter.jsx'; import SkyquakeContainerActions from './skyquakeContainerActions.js' import SkyquakeContainerStore from './skyquakeContainerStore.js'; -import Breadcrumbs from 'react-breadcrumbs'; +// import Breadcrumbs from 'react-breadcrumbs'; import Utils from 'utils/utils.js'; -import _ from 'lodash'; import Crouton from 'react-crouton'; +import SkyquakeNotification from '../skyquake_notification/skyquakeNotification.jsx'; import ScreenLoader from 'widgets/screen-loader/screenLoader.jsx'; +import {SkyquakeRBAC, isRBACValid} from 'widgets/skyquake_rbac/skyquakeRBAC.jsx'; +import ROLES from 'utils/roleConstants.js'; import './skyquakeApp.scss'; // import 'style/reset.css'; import 'style/core.css'; +const PROJECT_ROLES = ROLES.PROJECT; +const PLATFORM = ROLES.PLATFORM; export default class skyquakeContainer extends React.Component { constructor(props) { super(props); @@ -40,13 +45,21 @@ export default class skyquakeContainer extends React.Component { this.state.eventCenterIsOpen = false; this.state.currentPlugin = SkyquakeContainerStore.currentPlugin; } - + getChildContext() { + return { + userProfile: this.state.user + }; + } + getUserProfile() { + return this.state.user; + } componentWillMount() { let self = this; Utils.bootstrapApplication().then(function() { SkyquakeContainerStore.listen(self.listener); SkyquakeContainerStore.getNav(); + SkyquakeContainerStore.getUserProfile(); SkyquakeContainerStore.getEventStreams(); }); @@ -83,12 +96,14 @@ export default class skyquakeContainer extends React.Component { } render() { - const {displayNotification, notificationMessage, displayScreenLoader, notificationType, ...state} = this.state; + const {displayNotification, notificationData, displayScreenLoader,...state} = this.state; + const User = this.state.user || {}; + const rbacValid = isRBACValid(User, [PLATFORM.SUPER, PLATFORM.ADMIN, PLATFORM.OPER]); var html; - + let nav = _cloneDeep(this.state.nav); if (this.matchesLoginUrl()) { html = ( - +
{this.props.children}
@@ -101,28 +116,33 @@ export default class skyquakeContainer extends React.Component { html = (
-
); @@ -130,6 +150,9 @@ export default class skyquakeContainer extends React.Component { return html; } } +skyquakeContainer.childContextTypes = { + userProfile: React.PropTypes.object +}; skyquakeContainer.contextTypes = { router: React.PropTypes.object };