import CatalogDescriptorRaw from './catalogDescriptorRaw.jsx'
import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx';
import {Panel, PanelWrapper} from 'widgets/panel/panel';
-import Button from 'widgets/button/rw.button.js'
+import Button from 'widgets/button/rw.button.js';
+import {SkyquakeRBAC, isRBACValid} from 'widgets/skyquake_rbac/skyquakeRBAC.jsx';
+import ROLES from 'utils/roleConstants.js';
import 'style/layout.scss';
import './instantiateDashboard.scss';
+const PROJECT_ROLES = ROLES.PROJECT;
+const PLATFORM = ROLES.PLATFORM;
+
class InstantiateDashboard extends React.Component {
constructor(props) {
super(props);
let html;
let selectedNSDid = self.state.selectedNSDid;
let isPreviewing = self.state.isPreviewing;
+ const hasAccess = isRBACValid(this.context.userProfile, [PROJECT_ROLES.LCM_ADMIN]);
let descriptorPreview = (
<Panel title={(self.state.selectedNSD['short-name'] || self.state.selectedNSD.name ) + ' Descriptor Preview'} className="CatalogDescriptorPreview">
<span className="oi CatalogDescriptorPreview-button" data-glyph={"circle-x"} onClick={self.Store.deselectDescriptor}></span>
<Button label="Cancel" onClick={this.handleCancel}/>
{this.isSelectPage() ?
- <Button label="Next" isLoading={this.state.isSaving} onClick={this.state.selectedNSD && self.openDescriptor} className="dark" type="submit"/>
+ <Button label="Next" isLoading={this.state.isSaving} onClick={this.state.selectedNSD && self.openDescriptor} className="dark" type="submit"/>
: <div>
<Button label="Back" onClick={this.handleBack}/>
- <Button label="Launch" isLoading={this.state.isSaving} onClick={self.handleSave.bind(self, true)} className="dark" type="submit"/>
+ { hasAccess ? <Button label="Launch" isLoading={this.state.isSaving} onClick={self.handleSave.bind(self, true)} className="dark" type="submit"
+ /> : null}
</div>
}
</div>
}
}
InstantiateDashboard.contextTypes = {
- router: React.PropTypes.object
+ router: React.PropTypes.object,
+ userProfile: React.PropTypes.object
};
export default SkyquakeComponent(InstantiateDashboard);
/*
- *
+ *
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
import AppHeader from 'widgets/header/header.jsx';
import Utils from 'utils/utils.js';
import './launchpad.scss';
+
+import {SkyquakeRBAC, isRBACValid} from 'widgets/skyquake_rbac/skyquakeRBAC.jsx';
+import ROLES from 'utils/roleConstants.js';
+
+const PROJECT_ROLES = ROLES.PROJECT;
+
let ReactCSSTransitionGroup = require('react-addons-css-transition-group');
var LaunchpadFleetActions = require('./launchpadFleetActions.js');
var LaunchpadFleetStore = require('./launchpadFleetStore.js');
render () {
var self = this;
+ const hasAccess = isRBACValid(this.context.userProfile, [PROJECT_ROLES.LCM_ADMIN]);
let mgmtDomainName = window.location.hash.split('/')[2];
let navItems = [];
if(!mgmtDomainName) {
isVisible={self.state.isNsListPanelVisible}
/>
<NsCardPanel nsrs={self.state.nsrs}
- openedNsrIDs={self.state.openedNsrIDs} />
+ openedNsrIDs={self.state.openedNsrIDs}
+ hasAccess={hasAccess} />
</div>
</div>
);
}
}
LaunchpadApp.contextTypes = {
- router: React.PropTypes.object
+ router: React.PropTypes.object,
+ userProfile: React.PropTypes.object
};
LaunchpadApp.defaultProps = {
// name: 'Loading...',
/*
- *
+ *
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
<img src={circleXImage} title="Close card" />
</a>
);
-
+ if (this.props.hasAccess) closebutton = null;
html = (
<DashboardCard className={'launchpadCard'} closeCard={closeButton}>
<LaunchpadHeader nsr={this.props.nsr} name={this.props.name} isActive={this.props.isActive} id={this.props.id}/>
/*
- *
+ *
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
}
constructConfigPrimitiveTabs = (tabList, tabPanels) => {
+ const hasAccess = this.props.hasAccess;
let mandatoryFieldValue = 'true';
this.state.vnfrs && this.state.vnfrs.map((vnfr, vnfrIndex) => {
if (vnfr['vnf-configuration'] && vnfr['vnf-configuration']['service-primitive'] && vnfr['vnf-configuration']['service-primitive'].length > 0) {
{params}
</ul>
</div>
- <button className="dark" role="button" onClick={this.handleExecuteClick.bind(this, configPrimitiveIndex, vnfrIndex)}>{configPrimitive.name}</button>
+ {hasAccess ? <button className="dark" role="button" onClick={this.handleExecuteClick.bind(this, configPrimitiveIndex, vnfrIndex)}>{configPrimitive.name}</button> : null}
</TabPanel>
)
});
}
render() {
-
let tabList = [];
let tabPanels = [];
let isConfiguring = (this.props.data['config-status'] && this.props.data['config-status'] != 'configured') || false;
data={nsr.data}
nsr={nsr}
isActive={nsr["admin-status"] == "ENABLED"}
- closeButtonAction={this.onCloseCard(nsr.id)}/>
+ closeButtonAction={this.onCloseCard(nsr.id)}
+ hasAccess={this.props.hasAccess}/>
);
}
}
import Prism from 'prismjs';
import 'prismjs/themes/prism.css';
+import {SkyquakeRBAC, isRBACValid} from 'widgets/skyquake_rbac/skyquakeRBAC.jsx';
+import ROLES from 'utils/roleConstants.js';
+
+const PROJECT_ROLES = ROLES.PROJECT;
export default class RecordCard extends React.Component {
constructor(props) {
let notice = null;
+ let hasAccess = isRBACValid(this.context.userProfile, [PROJECT_ROLES.LCM_ADMIN]);
+
switch(this.props.type) {
case 'vnfr' :
cardData = this.props.data[0];
if (displayConfigPrimitives) {
configPrimitiveComponent = (
<div className="flex vnfrConfigPrimitiveContainer">
- <VnfrConfigPrimitives data={configPrimitivesProps} />
+ <VnfrConfigPrimitives data={configPrimitivesProps} hasAccess={hasAccess} />
{/* <NsrPrimitiveJobList jobs={cardData['config-agent-job']}/> */}
<div style={{display:'flex', flexDirection: 'column', flex: '1 1 40%'}}>
<div className="launchpadCard_title">
isLoading: true,
jobData: []
}
+RecordCard.contextTypes = {
+ router: React.PropTypes.object,
+ userProfile: React.PropTypes.object
+};