Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/subnet-panel-navigation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hashintel/petrinaut": patch
---

Open a subnet directly from a component instance's properties panel.
2 changes: 2 additions & 0 deletions libs/@hashintel/petrinaut/docs/drawing-a-net.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ You can also focus the outgoing handle with **Tab**, press **Enter** or **Space*

Subnets can expose selected places as ports. If you don't see subnet or component controls, enable **User settings → Labs → Net Components** first.

To open a subnet from the canvas, select a component instance and click **Open subnet** in its properties panel. This navigation is also available in read-only mode.

Open the subnet, select a boundary place, and enable **Component port** in the place properties panel.

When you instantiate that subnet as a component, each port appears as a handle on the component instance:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { use } from "react";

import {
Button,
Form,
Expand All @@ -9,6 +11,7 @@ import { css } from "@hashintel/ds-helpers/css";
import { validateEntityName } from "@hashintel/petrinaut-core";

import { usePetrinautMutations } from "../../../../../../../react";
import { ActiveNetContext } from "../../../../../../../react/state/active-net-context";
import { useIsReadOnly } from "../../../../../../../react/state/use-is-read-only";
import { DescriptionField } from "../../../../../../components/description-field";
import { PropertyValue } from "../../../../../../components/property-value";
Expand Down Expand Up @@ -50,6 +53,7 @@ const hintTextStyle = css({
});

const ComponentInstanceMainContent: React.FC = () => {
const { setActiveSubnetId } = use(ActiveNetContext);
const { instance, subnet, subnetParameters, updateComponentInstance } =
useComponentInstancePropertiesContext();
const isDisabled = useIsReadOnly();
Expand Down Expand Up @@ -122,6 +126,15 @@ const ComponentInstanceMainContent: React.FC = () => {
<div className={hintTextStyle}>
{subnet?.name ?? "The referenced subnet no longer exists."}
</div>
{subnet && (
<Button
size="xs"
variant="subtle"
onClick={() => setActiveSubnetId(subnet.id)}
>
Open subnet
</Button>
)}
</Form.Field>
</Form.Section>

Expand Down
Loading