/*
- *
+ *
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
import React from 'react'
import PureRenderMixin from 'react-addons-pure-render-mixin'
import EditDescriptorModelProperties from './EditDescriptorModelProperties'
+import '../styles/CatalogItemDetailsEditor.scss'
+import {SkyquakeRBAC, isRBACValid} from 'widgets/skyquake_rbac/skyquakeRBAC.jsx';
+import ROLES from 'utils/roleConstants.js';
+const PROJECT_ROLES = ROLES.PROJECT;
+const PLATFORM = ROLES.PLATFORM;
const CatalogItemDetailsEditor = React.createClass({
mixins: [PureRenderMixin],
width: 0
};
},
+ contextTypes: {
+ router: React.PropTypes.object,
+ userProfile: React.PropTypes.object
+ },
componentWillMount() {
},
componentDidMount() {
componentWillUnmount() {
},
render() {
+ const User = this.context.userProfile;
- const container = this.props.container || {model: {}, uiState: {}};
+ const container = this.props.container || { model: {}, uiState: {} };
if (!(container && container.model && container.uiState)) {
return null;
}
-
+ const height = this.props.height;
+ const style = height > 0 ? { height: height + 'px' } : {};
return (
- <div className="CatalogItemDetailsEditor">
+ <div className="CatalogItemDetailsEditor" style={style}>
<form name="details-descriptor-editor-form">
<div className="properties-group">
- <EditDescriptorModelProperties container={this.props.container} width={this.props.width} />
+ {
+ isRBACValid(User, [PROJECT_ROLES.PROJECT_ADMIN, PROJECT_ROLES.CATALOG_ADMIN]) ?
+ <EditDescriptorModelProperties
+ container={this.props.container}
+ idMaker={this.props.idMaker}
+ showHelp={this.props.showHelp}
+ collapsePanelsByDefault={this.props.collapsePanelsByDefault}
+ openPanelsWithData={this.props.openPanelsWithData}
+ width={this.props.width} />
+ :<EditDescriptorModelProperties
+ container={this.props.container}
+ idMaker={this.props.idMaker}
+ showHelp={this.props.showHelp}
+ collapsePanelsByDefault={this.props.collapsePanelsByDefault}
+ openPanelsWithData={this.props.openPanelsWithData}
+ width={this.props.width}
+ readOnly={true} />
+ }
</div>
</form>
</div>
}
});
-
export default CatalogItemDetailsEditor;