You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+86-35Lines changed: 86 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,11 +59,11 @@ PLUGINS_CONFIG = {
59
59
60
60
## How It Works
61
61
62
-
For each **Device Type** you create a **DeviceView** object (at *Plugins → Device Views → Add*) containing a CSS `grid-template-areas` definition. When you visit a device of that type, the plugin renders every interface and port as a clickable cell in the grid.
62
+
For each **Device Type** you create a **DeviceView** object (at *Plugins → Device Views → Add*) with either a **YAML layout** or a raw **CSS layout**. When you visit a device of that type, the plugin renders every interface and port as a clickable cell in the grid.
63
63
64
64
### Port/Interface name → CSS grid-area name
65
65
66
-
The plugin derives a `stylename` for each interface and port, which must match the area names in your CSS:
66
+
The plugin derives a `stylename` for each interface and port:
67
67
68
68
| Interface name | Stylename |
69
69
|----------------|-----------|
@@ -82,54 +82,105 @@ The plugin derives a `stylename` for each interface and port, which must match t
82
82
- Purely numeric stylenames are prefixed with `p`
83
83
- Virtual and LAG interfaces are skipped
84
84
85
-
### CSS layout format
85
+
---
86
+
87
+
## Layout formats
88
+
89
+
A DeviceView supports two layout formats. **YAML is preferred** — it is easier to write, validate, and maintain. Legacy CSS is still fully supported for backward compatibility.
90
+
91
+
### YAML layout (recommended)
92
+
93
+
Fill the **YAML Layout** field with a YAML document describing the device layout. The plugin compiles it to CSS at render time.
94
+
95
+
Example for a Cisco C9300-24T with an optional 8x 10G expansion module:
96
+
97
+
```yaml
98
+
version: 1
99
+
100
+
meta:
101
+
description: "Cisco Catalyst 9300-24T"
102
+
103
+
canvas:
104
+
columns: 32
105
+
rows: 2
106
+
107
+
views:
108
+
front:
109
+
rows:
110
+
- blank: 14
111
+
- group:
112
+
spacer: 1
113
+
sections:
114
+
- sequence:
115
+
kind: interface
116
+
prefix: "gigabitethernet0-"
117
+
start: 1
118
+
count: 12
119
+
pattern: top-odd
120
+
- sequence:
121
+
kind: interface
122
+
prefix: "gigabitethernet0-"
123
+
start: 13
124
+
count: 12
125
+
pattern: top-odd
126
+
- spacer: 4
127
+
128
+
variants:
129
+
C9300-NM-8X:
130
+
match: module
131
+
rows:
132
+
- blank: 14
133
+
- group:
134
+
spacer: 1
135
+
sections:
136
+
- sequence:
137
+
kind: interface
138
+
prefix: "gigabitethernet0-"
139
+
start: 1
140
+
count: 12
141
+
pattern: top-odd
142
+
- sequence:
143
+
kind: interface
144
+
prefix: "gigabitethernet0-"
145
+
start: 13
146
+
count: 12
147
+
pattern: top-odd
148
+
- sequence:
149
+
kind: interface
150
+
prefix: "tengigabitethernet1-"
151
+
start: 1
152
+
count: 8
153
+
pattern: top-odd
154
+
```
155
+
156
+
See [`docs/yaml-layout-schema.md`](docs/yaml-layout-schema.md) for the full schema reference and [`examples/yaml/`](examples/yaml/) for ready-made YAML files.
86
157
87
-
The `grid_template_area` field stores raw CSS. The grid has **32 columns** and uses **20 px cells**.
158
+
### CSS layout (legacy)
88
159
89
-
Placeholder names:
90
-
-`x` — leading empty cell
91
-
-`z` — trailing empty cell
92
-
-`s0`–`s99` — interior spacer cells
160
+
Fill the **Grid Template Area** field with raw CSS. The grid has **32 columns** and uses **20 px cells**.
93
161
94
-
Example for a Cisco C9300-24T with an optional 8x 10G module (more in the [`examples/`](examples/) folder):
"x x x x x x x x x x x x x x gigabitethernet0-1 gigabitethernet0-3 gigabitethernet0-5 gigabitethernet0-7 gigabitethernet0-9 gigabitethernet0-11 s0 gigabitethernet0-13 gigabitethernet0-15 gigabitethernet0-17 gigabitethernet0-19 gigabitethernet0-21 gigabitethernet0-23 z z z z z"
101
-
"x x x x x x x x x x x x x x gigabitethernet0-2 gigabitethernet0-4 gigabitethernet0-6 gigabitethernet0-8 gigabitethernet0-10 gigabitethernet0-12 s0 gigabitethernet0-14 gigabitethernet0-16 gigabitethernet0-18 gigabitethernet0-20 gigabitethernet0-22 gigabitethernet0-24 z z z z z";
102
-
}
103
-
104
-
/* C9300-24T with C9300-NM-8X */
105
-
.deviceview.moduleC9300-NM-8X.area {
106
-
grid-template-areas:
107
-
"x x x x x x x x x x x x x x gigabitethernet0-1 gigabitethernet0-3 gigabitethernet0-5 gigabitethernet0-7 gigabitethernet0-9 gigabitethernet0-11 s0 gigabitethernet0-13 gigabitethernet0-15 gigabitethernet0-17 gigabitethernet0-19 gigabitethernet0-21 gigabitethernet0-23 s1 tengigabitethernet1-1 tengigabitethernet1-3 tengigabitethernet1-5 tengigabitethernet1-7"
108
-
"x x x x x x x x x x x x x x gigabitethernet0-2 gigabitethernet0-4 gigabitethernet0-6 gigabitethernet0-8 gigabitethernet0-10 gigabitethernet0-12 s0 gigabitethernet0-14 gigabitethernet0-16 gigabitethernet0-18 gigabitethernet0-20 gigabitethernet0-22 gigabitethernet0-24 s1 tengigabitethernet1-2 tengigabitethernet1-4 tengigabitethernet1-6 tengigabitethernet1-8";
167
+
grid-template-areas:
168
+
"x x x x x x x x x x x x x x gigabitethernet0-1 gigabitethernet0-3 ... z z z z z"
169
+
"x x x x x x x x x x x x x x gigabitethernet0-2 gigabitethernet0-4 ... z z z z z";
109
170
}
110
171
```
111
172
112
-
### Module variants
113
-
114
-
If a device has an installed module, an additional CSS class matching the module model is added. Define a separate rule to override the layout when that module is present (see the example above).
173
+
See [`examples/`](examples/) for ready-made CSS files.
115
174
116
-
### Virtual Chassis
175
+
> **Precedence:** if a DeviceView has a YAML layout, it is used and the CSS field is ignored.
117
176
118
-
For virtual chassis devices, each member's CSS areas are scoped with a `.d{vc_position}` suffix automatically. Define per-member layouts using those suffixes:
When a device has an installed module, an extra CSS class matching the module model is added to the device div. In YAML, declare a `variants:` block. In CSS, add a `.deviceview.module{ModelName}.area` rule.
More ready-made layouts for Cisco C2960X, C8300, C9200, C9300, generic patch panels, and Ubiquiti switches are in the [`examples/`](examples/) folder.
183
+
For virtual chassis devices, each member's CSS areas are scoped with a `.d{vc_position}` suffix automatically. YAML-rendered CSS is scoped the same way.
0 commit comments