Commit beabc613 authored by David Rheinheimer's avatar David Rheinheimer

misc fixes

parent ee40b9b6
......@@ -47,10 +47,11 @@ const ScenarioSelector = (props) => {
const TreeNodeLink = ({displayName, ...otherProps}) => {
const href = getResourceDataUrl(otherProps);
return (<Link
to={href}>
<div style={{margin: "auto 0"}}>{displayName}</div>
</Link>);
return (
<Link to={href}>
<div style={{margin: "auto 0"}}>{displayName}</div>
</Link>
);
};
class DataEditorApp extends React.Component {
......@@ -113,7 +114,7 @@ class DataEditorApp extends React.Component {
if (resClass && resourceId &&
node.contentRef.resClass === resClass &&
node.contentRef.resourceId === resourceId &&
node.contentRef.scope === scope
(node.contentRef.scope === scope || resClass === 'network')
) {
node.isSelected = true;
selectedTreeNodeId = node.id;
......@@ -141,7 +142,6 @@ class DataEditorApp extends React.Component {
const netType = networkTypes.length ? networkTypes[0] : null;
const nodeTypes = sortBy(template.types.filter(tt => tt.resource_type === 'NODE'), ['name']);
const linkTypes = sortBy(template.types.filter(tt => tt.resource_type === 'LINK'), ['name']);
const displayName = GLOBAL_VARIABLES;
if (netType) {
let netAttrId;
......@@ -157,7 +157,7 @@ class DataEditorApp extends React.Component {
attrId={netAttrId}
typeId={netType.id}
scenarioId={scenarioId || this.props.scenarioId}
displayName={displayName}/>,
displayName={GLOBAL_VARIABLES}/>,
hasCaret: false,
contentRef: {
type: 'resource',
......@@ -165,7 +165,7 @@ class DataEditorApp extends React.Component {
resClass: "network",
resourceId: network.id,
typeId: netType.id,
displayName,
displayName: GLOBAL_VARIABLES,
},
childNodes: [],
isSelected: resClass === 'network' && resourceId === network.id,
......@@ -180,7 +180,9 @@ class DataEditorApp extends React.Component {
const typeId = ttype.id;
const typeResId = `${thisResClass}-${resource.id}`;
const treeNodeId = ['parent', 'child'].includes(scope) ? `${scope}-${typeResId}` : typeResId;
let isSelected = resource.id === resourceId && thisResClass === resClass && scope === this.props.scope;
let isSelected = resource.id === resourceId
&& thisResClass === resClass
&& scope === this.props.scope;
if (isSelected) {
selectedTreeNodeId = treeNodeId;
activeResource = resource;
......
......@@ -562,6 +562,8 @@ class ResourceEditor extends Component {
scope
});
const scopeQuery = resClass !== "network" ? `?${queryString.stringify({scope})}` : "";
return (
<div>
......@@ -621,7 +623,7 @@ class ResourceEditor extends Component {
animate={false}
onChange={this.onChangeAttrTab}>
{filteredSortedResAttrs.map(ra => {
const url = `${beforeAttrId}/attr/${ra.attr_id}/scen/${scenarioId}?scope=${scope}`;
const url = `${beforeAttrId}/attr/${ra.attr_id}/scen/${scenarioId}${scopeQuery}`;
return (<Tab key={ra.attr_id} id={ra.attr_id}
title={
<ResourceAttribute
......@@ -636,7 +638,7 @@ class ResourceEditor extends Component {
{Object.keys(resAttrGroups).map(category => {
const attrId = categoryAttrIds[category] && categoryAttrIds[category].attr_id || resAttrGroups[category].length && resAttrGroups[category][0].attr_id;
return (<Tab id={category} key={category} title={<Link
to={`${beforeAttrId}/attr/${attrId}/scen/${scenarioId}?scope=${scope}`}>
to={`${beforeAttrId}/attr/${attrId}/scen/${scenarioId}${scopeQuery}`}>
<div className="attribute-selector">{category}</div>
</Link>}/>)
}
......@@ -646,7 +648,7 @@ class ResourceEditor extends Component {
<Tabs id={selectedCategory} className="attribute-selectors" selectedTabId={attrId}
renderActiveTabPanelOnly animate={false}>
{resAttrGroups[selectedCategory].map(ra => {
const url = `${beforeAttrId}/attr/${ra.attr_id}/scen/${scenarioId}?scope=${scope}`;
const url = `${beforeAttrId}/attr/${ra.attr_id}/scen/${scenarioId}${scopeQuery}`;
return (<Tab key={ra.attr_id} id={ra.attr_id}
title={
<ResourceAttribute
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment