Skip to content

Commit c648b10

Browse files
authored
Merge pull request #140 from open-ephys/issue-46
Edit template to reflect Bonsai properties pane
2 parents 7b79319 + dc023f7 commit c648b10

File tree

4 files changed

+97
-91
lines changed

4 files changed

+97
-91
lines changed

template/ManagedReference.extension.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ function extractConstituentOperatorsData(model) {
7373
.map(child =>
7474
{
7575
const deviceModel = model.__global._shared?.[`~/api/${child.syntax.return.type.uid}.yml`];
76-
const subProperties = sortPropertiesData(extractPropertiesData(deviceModel, model.__global._shared));
76+
const properties = sortPropertiesData(extractPropertiesData(deviceModel, model.__global._shared));
7777
return {
7878
'object': child.name[0].value,
7979
'type': child.syntax.return.type.specName[0].value,
8080
'constituentOperator': true,
81-
'hasSubProperties': subProperties === undefined || subProperties.length === 0 ? false : true,
82-
'subProperties': subProperties,
81+
'hasProperties': properties === undefined || properties.length === 0 ? false : true,
82+
'properties': properties,
8383
};
8484
}
8585
);
@@ -120,11 +120,11 @@ exports.preTransform = function (model) {
120120
operator = extractOperatorData(model);
121121
if (operator.hub) {
122122
properties = extractConstituentOperatorsData(model);
123-
properties.push({
124-
'object': 'Misc',
123+
properties.unshift({
124+
'object': 'Configuration',
125125
'constituentOperator': false,
126-
'hasSubProperties': true,
127-
'subProperties': sortPropertiesData([
126+
'hasProperties': true,
127+
'properties': sortPropertiesData([
128128
...extractPropertiesData(model, model.__global._shared),
129129
...extractPropertiesFromInheritedMembersData(model, model.__global._shared),
130130
]).filter(modelProperty => !properties.map(property => property.object).includes(modelProperty?.name))

template/partials/class.tmpl.partial

+37-43
Original file line numberDiff line numberDiff line change
@@ -13,69 +13,63 @@
1313
{{#sourceurl}}<a class="header-action link-secondary" title="View source" href="{{sourceurl}}"><i class="bi bi-code-slash"></i></a>{{/sourceurl}}
1414
</h1>
1515
{{#oe.operator.type}}
16-
<p style="display: inline; text-transform: capitalize"> {{oe.operator.type}} Operator</p>
16+
<p style="display: inline; text-transform: capitalize"> {{oe.operator.type}} Operator</p>
1717
{{/oe.operator.type}}
1818
</div>
1919

2020
<div>{{{oe.description}}}</div>
2121

2222
{{#oe.operator.workflow}}
23-
<div class="workflow"><p><img src="~/workflows/operators/{{oe.name}}.bonsai" alt="{{oe.name}} Workflow"></p></div>
24-
{{#oe.operator}}
25-
<h2>Inputs & Outputs</h2>
26-
{{>partials/diagram}}
27-
{{/oe.operator}}
23+
<div class="workflow"><p><img src="~/workflows/operators/{{oe.name}}.bonsai" alt="{{oe.name}} Workflow"></p></div>
24+
{{#oe.operator}}
25+
<h2>Inputs & Outputs</h2>
26+
{{>partials/diagram}}
27+
{{/oe.operator}}
2828
{{/oe.operator.workflow}}
2929

3030
<h2>Properties</h2>
3131

3232
{{#oe.operator.hub}}
3333

34-
<p>{{oe.name}} is an aggregate operator. Its properties comprise of the following operators' properties: </p>
34+
<h3>Configuration</h3>
3535

36-
{{#oe.properties}}
36+
{{#oe.properties}}
37+
{{^constituentOperator}}
3738

38-
<h3>{{{object}}}</h3>
39+
<p>These are properties of the aggregate operator:</p>
3940

40-
{{#constituentOperator}}
41-
<p>{{{object}}} is a {{{type}}} operator encapsulated by the {{oe.name}} operator.</p>
42-
{{/constituentOperator}}
41+
{{#hasProperties}}
42+
{{>partials/propertyTable}}
43+
{{/hasProperties}}
44+
{{^hasProperties}}
45+
<p>This operator does not have any configuration options.</p>
46+
{{/hasProperties}}
47+
{{/constituentOperator}}
48+
{{/oe.properties}}
4349

44-
{{^constituentOperator}}
45-
<p>These are properties of the aggregate operator, not of any constituent operator.</p>
46-
{{/constituentOperator}}
50+
<h3>Devices</h3>
4751

48-
{{#hasSubProperties}}
49-
<table>
50-
<tr>
51-
<th style="white-space: nowrap;">Property</th>
52-
<th style="white-space: nowrap;">Type</th>
53-
<th>Description</th>
54-
</tr>
52+
{{#oe.properties}}
53+
{{#constituentOperator}}
5554

56-
{{#subProperties}}
57-
{{>partials/propertyTables}}
58-
{{/subProperties}}
59-
</table>
60-
{{/hasSubProperties}}
55+
<h4>{{{object}}}</h4>
6156

62-
{{^hasSubProperties}}
63-
<p>This operator does not have any configuration options.</p>
64-
{{/hasSubProperties}}
57+
<p>{{{object}}} is a {{{type}}} operator encapsulated by the {{oe.name}} operator with the following properties:</p>
6558

66-
{{/oe.properties}}
59+
{{#hasProperties}}
60+
{{>partials/propertyTable}}
61+
{{/hasProperties}}
6762

63+
{{^hasProperties}}
64+
<p>This operator does not have any configuration options.</p>
65+
{{/hasProperties}}
66+
67+
{{/constituentOperator}}
68+
{{/oe.properties}}
6869
{{/oe.operator.hub}}
6970

70-
{{^oe.operator.hub}}
71-
<table>
72-
<tr>
73-
<th style = "white-space: nowrap;">Property</th>
74-
<th style = "white-space: nowrap;">Type</th>
75-
<th>Description</th>
76-
</tr>
77-
{{#oe.properties}}
78-
{{>partials/propertyTables}}
79-
{{/oe.properties}}
80-
</table>
81-
{{/oe.operator.hub}}
71+
{{#oe}}
72+
{{^operator.hub}}
73+
{{>partials/propertyTable}}
74+
{{/operator.hub}}
75+
{{/oe}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
{{#acquisition}}
14+
<div>
15+
<a class="xref" href="~/articles/getting-started/property-categories.html#acquisition">
16+
<button class="badge bg-primary-subtle border border-primary-subtle text-primary-emphasis rounded-pill">
17+
acquisition
18+
</button>
19+
</a>
20+
</div>
21+
{{/acquisition}}
22+
{{#configuration}}
23+
<div>
24+
<a class="xref" href="~/articles/getting-started/property-categories.html#configuration">
25+
<button class="badge bg-warning-subtle border border-warning-subtle text-warning-emphasis rounded-pill">
26+
configuration
27+
</button>
28+
</a>
29+
</div>
30+
{{/configuration}}
31+
</td>
32+
<td style = "white-space: nowrap;">
33+
{{{type}}}
34+
</td>
35+
<td class="tableFormat">
36+
{{#propertyDescription}}
37+
{{{propertyDescription.text}}}
38+
{{#hasEnum}}
39+
<table>
40+
{{#enum}}
41+
<tr>
42+
<td class="term"><code>{{{field&value}}}</code></td>
43+
<td class="description">{{{enumDescription}}}</td>
44+
</tr>
45+
{{/enum}}
46+
</table>
47+
{{/hasEnum}}
48+
{{/propertyDescription}}
49+
</td>
50+
</tr>
51+
{{/properties}}
52+
53+
</table>

template/partials/propertyTables.tmpl.partial

-41
This file was deleted.

0 commit comments

Comments
 (0)