Skip to content

Commit

Permalink
Merge pull request #111 from MetaCell/feature/fix_new_comp_from_sidebar
Browse files Browse the repository at this point in the history
Fixing instantiation of composition from sidebar
  • Loading branch information
Salam-Dalloul authored Jun 19, 2023
2 parents 52d5adb + 9c7dd0c commit 8bb20c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export class NodeFactory {
// Add more cases for different node types as needed
switch (nodeType) {
//TODO: work on nodes and link creation improvements
case PNLClasses.COMPOSITION:
// TODO: remove new ports from composition since this does not have any ports
return new MechanismNode(name, nodeType, undefined, QueryService.getPortsNewNode(), extra);
case PNLClasses.PROJECTION:
const selectedNodes = engine.getModel().getSelectedEntities();

Expand Down
7 changes: 5 additions & 2 deletions src/client/components/views/editView/leftSidebar/nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import {
} from './icons';
import { onNodeDrop } from './dropCallback';
import { DefaultSidebarNodeTypes } from '@metacell/meta-diagram';
import { PNLMechanisms, PNLClasses} from '../../../../../constants';

// TODO: replace these with the PNLMechanisms defined in the constants file, we don't want 2 sources of truth
export const NodeType = {
TARGET_MECHANISM: 'TargetMechanism',
TRANSFER_MECHANISM: 'TransferMechanism',
Expand All @@ -26,6 +28,7 @@ export const NodeType = {
};



export const nodes = [
{
id: 'targetMechanism',
Expand Down Expand Up @@ -131,15 +134,15 @@ export const leftSideBarNodes = [
},
{
id: 'newProjection',
type: 'projection',
type: PNLClasses.PROJECTION,
name: 'Create a projection',
icon: <ProjectionIcon />,
draggable: true,
onNodeDrop,
},
{
id: 'newComposition',
type: 'composition',
type: PNLClasses.COMPOSITION,
name: 'Create a composition',
icon: <FolderIcon />,
draggable: true,
Expand Down

0 comments on commit 8bb20c5

Please sign in to comment.