Skip to content

Commit b4dc71f

Browse files
committed
Organize TOC
- Dataframes have a dropdown - enums have a drop - remove excess operators from datai/o dropdown
1 parent 3c2860a commit b4dc71f

File tree

2 files changed

+89
-76
lines changed

2 files changed

+89
-76
lines changed

template/partials/class.tmpl.partial

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
{{#oe.operator.configureDevice}}
2-
<div class="CAUTION alert alert-danger">
3-
<h5>Caution</h5>
2+
<div class="Important alert alert-info">
3+
<h5>TIP</h5>
44
<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.
5+
This is a device configuration operator. <a class="xref" href="configure.html">Aggregate configuration operators</a> are recommended in lieu of <a class="xref" href="device-configure.html">device configuration operators</a> for interfacing with Open Ephys Onix hardware.
96
</p>
107
</div>
118
{{/oe.operator.configureDevice}}

template/toc.extension.js

Lines changed: 86 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -8,84 +8,100 @@ exports.preTransform = function (model) {
88
if (model.items[0].name === 'OpenEphys.Onix1'){
99
if (model.items[0].items){
1010
itemsItemsLength = model.items[0].items.length;
11-
let items = [{
12-
'name': 'Core Operators',
13-
'href' : 'core.html',
14-
'topicHref': 'core.html',
15-
'topicUid': 'core',
16-
'items': []}, {
17-
'name': 'Configuration Operators',
18-
'href' : 'configure.html',
19-
'topicHref': 'configure.html',
20-
'topicUid': 'configure',
21-
'items': []}, {
22-
'name': 'Data I/O Operators',
23-
'href' : 'dataio.html',
24-
'topicHref': 'dataio.html',
25-
'topicUid': 'dataio',
26-
'items': []}, {
27-
'name': 'Other',
28-
'items': [
11+
let items = [
12+
{
13+
'name': 'Core Operators',
14+
'href' : 'core.html',
15+
'topicHref': 'core.html',
16+
'topicUid': 'core',
17+
'items': []
18+
},
19+
{
20+
'name': 'Configuration Operators',
21+
'href' : 'configure.html',
22+
'topicHref': 'configure.html',
23+
'topicUid': 'configure',
24+
'items': []
25+
},
26+
{
27+
'name': 'Data I/O Operators',
28+
'href' : 'dataio.html',
29+
'topicHref': 'dataio.html',
30+
'topicUid': 'dataio',
31+
'items': []
32+
},
33+
{
34+
'name': 'Device Configuration Operators',
35+
'href' : 'device-configure.html',
36+
'topicHref': 'device-configure.html',
37+
'topicUid': 'device-configure',
38+
'items': []
39+
},
40+
{
41+
'name': 'Data Frames',
42+
'href' : 'dataframes.html',
43+
'topicHref': 'dataframes.html',
44+
'topicUid': 'dataframes',
45+
'items': []
46+
},
47+
{
48+
'name': 'Other',
49+
'href' : 'other.html',
50+
'topicHref': 'other.html',
51+
'topicUid': 'other',
52+
'items':
53+
[
54+
{
55+
'name': 'Enums',
56+
'href' : 'enums.html',
57+
'topicHref': 'enums.html',
58+
'topicUid': 'enums',
59+
'items': []
60+
}
61+
]
62+
}
63+
];
64+
for (let i = 0; i < itemsItemsLength; i++)
65+
{
66+
globalYml = '~/api/' + model.items[0].items[i].topicUid + '.yml';
67+
globalModel = model.__global._shared[globalYml];
68+
if (globalModel?.type === 'class' || globalModel?.type === 'struct')
69+
{
70+
if (model.items[0].items[i].name.includes('CreateContext') || model.items[0].items[i].name.includes('StartAcquisition'))
2971
{
30-
'name': 'Device Configuration Operators',
31-
'href' : 'device-configure.html',
32-
'topicHref': 'device-configure.html',
33-
'topicUid': 'device-configure',
34-
'items': [],
72+
items[0].items.push(model.items[0].items[i]);
3573
}
36-
]
37-
}];
38-
for (let i = 0; i < itemsItemsLength; i++) {
39-
globalYml = '~/api/' + model.items[0].items[i].topicUid + '.yml';
40-
if (model.items[0].items[i].name.includes('Frame') ||
41-
model.items[0].items[i].name.includes('DeviceFactory') ||
42-
model.items[0].items[i].name.includes('ContextTask') ||
43-
model.items[0].items[i].name.includes('DeviceNameConverter') ||
44-
model.items[0].items[i].name.includes('ConfigureDS90UB9x') ||
45-
model.items[0].items[i].name.includes('ConfigureFmcLinkController') ||
46-
model.items[0].items[i].name.includes('DeviceContext') ||
47-
model.items[0].items[i].name.includes('NeuropixelsV2QuadShankElectrode') ||
48-
model.items[0].items[i].name.includes('NeuropixelsV2QuadShankProbeConfiguration') ||
49-
model.items[0].items[i].name.includes('NeuropixelsV1eAdc')){
50-
model.items[0].items[i].hide = true;
51-
}
52-
else if (model.__global._shared[globalYml] && model.__global._shared[globalYml].type === 'enum') {
53-
model.items[0].items[i].hide = true;
54-
}
55-
else {
56-
if (model.__global._shared[globalYml] && model.__global._shared[globalYml].type === 'class'){
57-
const inheritanceLength = model.__global._shared[globalYml].inheritance.length;
58-
device = false;
59-
hub = false;
60-
for (let j = 0; j < inheritanceLength; j++){
61-
if (model.__global._shared[globalYml].inheritance[j].uid === 'OpenEphys.Onix1.SingleDeviceFactory'){
62-
device = true;
63-
}
64-
else if (model.__global._shared[globalYml].inheritance[j].uid === 'OpenEphys.Onix1.MultiDeviceFactory'){
65-
hub = true;
66-
}
67-
}
68-
if (model.items[0].items[i].name.includes('CreateContext') || model.items[0].items[i].name.includes('StartAcquisition')){
69-
items[0].items.push(model.items[0].items[i]);
70-
}
71-
else if (device){
72-
items[3].items[0].items.push(model.items[0].items[i]);
73-
}
74-
else if (hub){
75-
items[1].items.push(model.items[0].items[i]);
76-
}
77-
else {
78-
items[2].items.push(model.items[0].items[i]);
79-
}
74+
else if (globalModel?.inheritance.some(inherited => inherited.uid === 'OpenEphys.Onix1.MultiDeviceFactory'))
75+
{
76+
items[1].items.push(model.items[0].items[i]);
8077
}
78+
else if (globalModel?.inheritance.some(inherited => inherited.uid === 'OpenEphys.Onix1.SingleDeviceFactory'))
79+
{
80+
items[3].items.push(model.items[0].items[i]);
81+
}
82+
else if ((globalModel.syntax?.content[0].value.includes('ElementCategory.Source') ||
83+
globalModel.syntax?.content[0].value.includes('ElementCategory.Sink') ||
84+
globalModel?.inheritance.some(inherited => inherited.uid.includes('Bonsai.Source')) ||
85+
globalModel?.inheritance.some(inherited => inherited.uid.includes('Bonsai.Sink'))) &&
86+
!globalModel.syntax?.content[0].value.includes('abstract'))
87+
{
88+
items[2].items.push(model.items[0].items[i]);
89+
}
90+
else if (model.items[0].items[i].name.includes('ContextTask') ||
91+
model.items[0].items[i].name.includes('OutputClockParameters') ||
92+
globalModel?.inheritance.some(inherited => inherited.uid === 'OpenEphys.Onix1.DataFrame' || inherited.uid === 'OpenEphys.Onix1.BufferedDataFrame'))
93+
{
94+
items[4].items.push(model.items[0].items[i]);
95+
}
96+
}
97+
else if (globalModel && globalModel.type === 'enum')
98+
{
99+
items[5].items[0].items.push(model.items[0].items[i]);
81100
}
82101
}
83102
model.items[0].items = items;
84103
}
85104
}
86-
// if (model.items[1].name === 'OpenEphys.Onix1.Design'){
87-
// model.items.splice(1, 1);
88-
// }
89105
return model;
90106
}
91107

0 commit comments

Comments
 (0)