Skip to content

EAGLE-1429: Fields on Construct component should not be ports #851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 8 additions & 0 deletions src/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,14 @@ export class Node {
}
}, this);

usageOptions : ko.PureComputed<Daliuge.FieldUsage[]> = ko.pureComputed(() => {
// fields on construct nodes cannot be ports
if (this.categoryType() === Category.Type.Construct){
return [Daliuge.FieldUsage.NoPort];
}
return Object.values(Daliuge.FieldUsage)
}, this);

getInputPorts = () : Field[] => {
const result: Field[] = []

Expand Down
3 changes: 3 additions & 0 deletions src/ParameterTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ export class ParameterTable {
if (edgesToRemove.length > 0){
Utils.showNotification("Removed edges", "Removed " + edgesToRemove.length + " edge(s) made invalid by the change in port usage", "info");
}

// trigger graph check, since changing the usage of a field may break some rules
eagle.checkGraph();
}

// when a field value is modified in the parameter table, we need to flag the containing palette or logical graph as modified
Expand Down
4 changes: 2 additions & 2 deletions templates/node_parameter_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ <h5 class="bottomWindowHeader">Fields Table: </h5>
<!-- ko if: ParameterTable.getActiveColumnVisibility().usage() -->
<td class='columnCell column_Usage'>
<div class="checkboxWrapper">
<select class="tbaleFieldUseAs" data-bind="options: Object.values(Daliuge.FieldUsage), value: usage, disabled: ParameterTable.getParamsTableEditState() , event: {change: ParameterTable.fieldUsageChanged}">
<select class="tableFieldUseAs" data-bind="options: eagle.selectedNode().usageOptions, value: usage, disabled: ParameterTable.getParamsTableEditState() , event: {change: ParameterTable.fieldUsageChanged}">
<!-- options are added dynamically -->
</select>
</div>
Expand All @@ -451,7 +451,7 @@ <h5 class="bottomWindowHeader">Fields Table: </h5>
<!-- /ko -->
<!-- ko ifnot: $data.usage() === Daliuge.FieldUsage.NoPort-->
<div class="checkboxWrapper">
<select class="tbaleFieldEncoding" data-bind="options: Object.values(Daliuge.Encoding), value: encoding, disabled: ParameterTable.getParamsTableEditState()">
<select class="tableFieldEncoding" data-bind="options: Object.values(Daliuge.Encoding), value: encoding, disabled: ParameterTable.getParamsTableEditState()">
<!-- options are added dynamically -->
</select>
</div>
Expand Down
4 changes: 2 additions & 2 deletions tests/page-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ class Page {
.click(Selector('#paramsTableWrapper').find('tr').nth(-1).find('.tableFieldParamTypeSelect').find('option').withText(parameterType))

//setting the requested use as
.click(Selector('#paramsTableWrapper').find('tr').nth(-1).find('.tbaleFieldUseAs'))
.click(Selector('#paramsTableWrapper').find('tr').nth(-1).find('.tbaleFieldUseAs').find('option').withText(useAs))
.click(Selector('#paramsTableWrapper').find('tr').nth(-1).find('.tableFieldUseAs'))
.click(Selector('#paramsTableWrapper').find('tr').nth(-1).find('.tableFieldUseAs').find('option').withText(useAs))

if(value != ''){
await t
Expand Down