Skip to content

Commit 1efe6d2

Browse files
committed
Edit template to reflect Bonsai properties pane
- This includes a minor refactor of partial templates and ManagedReferece.extensions.js
1 parent 9048b71 commit 1efe6d2

File tree

4 files changed

+88
-82
lines changed

4 files changed

+88
-82
lines changed

template/ManagedReference.extension.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ function extractConstituentOperatorsData(model) {
6161
.filter(child => child.type === 'property' && model.__global._shared?.[`~/api/${child.syntax.return.type.uid}.yml`].type === 'class')
6262
.map(child => {
6363
const deviceModel = model.__global._shared?.[`~/api/${child.syntax.return.type.uid}.yml`];
64-
const subProperties = sortPropertiesData(extractPropertiesData(deviceModel, model.__global._shared));
64+
const properties = sortPropertiesData(extractPropertiesData(deviceModel, model.__global._shared));
6565
return {
6666
'object': child.name[0].value,
6767
'type': child.syntax.return.type.specName[0].value,
6868
'constituentOperator': true,
69-
'hasSubProperties': subProperties === undefined || subProperties.length === 0 ? false : true,
70-
'subProperties': subProperties,
69+
'hasProperties': properties === undefined || properties.length === 0 ? false : true,
70+
'properties': properties,
7171
};
7272
});
7373
}
@@ -107,11 +107,11 @@ exports.preTransform = function (model) {
107107
operator = extractOperatorData(model);
108108
if (operator.hub) {
109109
properties = extractConstituentOperatorsData(model);
110-
properties.push({
111-
'object': 'Misc',
110+
properties.unshift({
111+
'object': 'Configuration',
112112
'constituentOperator': false,
113-
'hasSubProperties': true,
114-
'subProperties': sortPropertiesData([
113+
'hasProperties': true,
114+
'properties': sortPropertiesData([
115115
...extractPropertiesData(model, model.__global._shared),
116116
...extractPropertiesFromInheritedMembersData(model, model.__global._shared),
117117
]).filter(modelProperty => !properties.map(property => property.object).includes(modelProperty?.name))

template/partials/class.tmpl.partial

+46-52
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{{#oe.operator.configureDevice}}
2-
<div class="CAUTION alert alert-danger">
3-
<h5>Caution</h5>
4-
<p>
5-
This is a device configuration operator. Device configuration operators are not recommended for interfacing with off-the-shelf ONIX hardware. Use <a class="xref" href="configure.html">aggregate configuration operators</a> to do that instead.
6-
</p>
7-
<p>
8-
To understand the benefits of <a class="xref" href="configure.html">aggregate configuration operators</a>, refer to the <a class="xref" href="device-configure.html">device configuration operators</a> page.
9-
</p>
10-
</div>
2+
<div class="CAUTION alert alert-danger">
3+
<h5>Caution</h5>
4+
<p>
5+
This is a device configuration operator. Device configuration operators are not recommended for interfacing with off-the-shelf ONIX hardware. Use <a class="xref" href="configure.html">aggregate configuration operators</a> to do that instead.
6+
</p>
7+
<p>
8+
To understand the benefits of <a class="xref" href="configure.html">aggregate configuration operators</a>, refer to the <a class="xref" href="device-configure.html">device configuration operators</a> page.
9+
</p>
10+
</div>
1111
{{/oe.operator.configureDevice}}
1212

1313
<div>
@@ -16,69 +16,63 @@
1616
{{#sourceurl}}<a class="header-action link-secondary" title="View source" href="{{sourceurl}}"><i class="bi bi-code-slash"></i></a>{{/sourceurl}}
1717
</h1>
1818
{{#oe.operator.type}}
19-
<p style="display: inline; text-transform: capitalize"> {{oe.operator.type}} Operator</p>
19+
<p style="display: inline; text-transform: capitalize"> {{oe.operator.type}} Operator</p>
2020
{{/oe.operator.type}}
2121
</div>
2222

2323
<div>{{{oe.description}}}</div>
2424

2525
{{#oe.operator.workflow}}
26-
<div class="workflow"><p><img src="~/workflows/operators/{{oe.name}}.bonsai" alt="{{oe.name}} Workflow"></p></div>
27-
{{#oe.operator}}
28-
<h2>Inputs & Outputs</h2>
29-
{{>partials/diagram}}
30-
{{/oe.operator}}
26+
<div class="workflow"><p><img src="~/workflows/operators/{{oe.name}}.bonsai" alt="{{oe.name}} Workflow"></p></div>
27+
{{#oe.operator}}
28+
<h2>Inputs & Outputs</h2>
29+
{{>partials/diagram}}
30+
{{/oe.operator}}
3131
{{/oe.operator.workflow}}
3232

3333
<h2>Properties</h2>
3434

3535
{{#oe.operator.hub}}
3636

37-
<p>{{oe.name}} is an aggregate operator. Its properties comprise of the following operators' properties: </p>
37+
<h3>Configuration</h3>
38+
39+
{{#oe.properties}}
40+
{{^constituentOperator}}
3841

39-
{{#oe.properties}}
42+
<p>These are properties of the aggregate operator:</p>
4043

41-
<h3>{{{object}}}</h3>
44+
{{#hasProperties}}
45+
{{>partials/propertyTable}}
46+
{{/hasProperties}}
47+
{{^hasProperties}}
48+
<p>This operator does not have any configuration options.</p>
49+
{{/hasProperties}}
50+
{{/constituentOperator}}
51+
{{/oe.properties}}
4252

43-
{{#constituentOperator}}
44-
<p>{{{object}}} is a {{{type}}} operator encapsulated by the {{oe.name}} operator.</p>
45-
{{/constituentOperator}}
53+
<h3>Devices</h3>
4654

47-
{{^constituentOperator}}
48-
<p>These are properties of the aggregate operator, not of any constituent operator.</p>
49-
{{/constituentOperator}}
55+
{{#oe.properties}}
56+
{{#constituentOperator}}
5057

51-
{{#hasSubProperties}}
52-
<table>
53-
<tr>
54-
<th style="white-space: nowrap;">Property</th>
55-
<th style="white-space: nowrap;">Type</th>
56-
<th>Description</th>
57-
</tr>
58+
<h4>{{{object}}}</h4>
5859

59-
{{#subProperties}}
60-
{{>partials/propertyTables}}
61-
{{/subProperties}}
62-
</table>
63-
{{/hasSubProperties}}
60+
<p>{{{object}}} is a {{{type}}} operator encapsulated by the {{oe.name}} operator with the following properties:</p>
6461

65-
{{^hasSubProperties}}
66-
<p>This operator does not have any configuration options.</p>
67-
{{/hasSubProperties}}
62+
{{#hasProperties}}
63+
{{>partials/propertyTable}}
64+
{{/hasProperties}}
6865

69-
{{/oe.properties}}
66+
{{^hasProperties}}
67+
<p>This operator does not have any configuration options.</p>
68+
{{/hasProperties}}
7069

70+
{{/constituentOperator}}
71+
{{/oe.properties}}
7172
{{/oe.operator.hub}}
7273

73-
{{^oe.operator.hub}}
74-
<table>
75-
<tr>
76-
<th style = "white-space: nowrap;">Property</th>
77-
<th style = "white-space: nowrap;">Type</th>
78-
<th>Description</th>
79-
</tr>
80-
{{#oe.properties}}
81-
{{>partials/propertyTables}}
82-
{{/oe.properties}}
83-
</table>
84-
{{/oe.operator.hub}}
74+
{{#oe}}
75+
{{^operator.hub}}
76+
{{>partials/propertyTable}}
77+
{{/operator.hub}}
78+
{{/oe}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<table>
2+
3+
<tr>
4+
<th style = "white-space: nowrap;">Property</th>
5+
<th style = "white-space: nowrap;">Type</th>
6+
<th>Description</th>
7+
</tr>
8+
9+
{{#properties}}
10+
<tr>
11+
<td style = "white-space: nowrap;">
12+
<code>{{{name}}}</code>
13+
</td>
14+
<td style = "white-space: nowrap;">
15+
{{{type}}}
16+
</td>
17+
<td class="tableFormat">
18+
{{#propertyDescription}}
19+
{{{propertyDescription.text}}}
20+
{{#hasEnum}}
21+
<table>
22+
{{#enum}}
23+
<tr>
24+
<td class="term"><code>{{{field&value}}}</code></td>
25+
<td class="description">{{{enumDescription}}}</td>
26+
</tr>
27+
{{/enum}}
28+
</table>
29+
{{/hasEnum}}
30+
{{/propertyDescription}}
31+
</td>
32+
</tr>
33+
{{/properties}}
34+
35+
</table>

template/partials/propertyTables.tmpl.partial

-23
This file was deleted.

0 commit comments

Comments
 (0)