|
1 |
| -= OpenSCD Plugin: {plugin-name} Editor |
2 |
| -:plugin-name: Supervision |
| 1 | += OpenSCD Plugin: Supervision |
| 2 | +:plugin-name: oscd-supervision |
3 | 3 | :sectnums:
|
4 | 4 | :sectlinks:
|
5 | 5 | :toc: macro
|
6 | 6 | :imagesdir: docs/media
|
7 | 7 | :icons: font
|
8 | 8 | :experimental:
|
9 |
| -:uri-action-translate-ci-bundle: https://jakobvogelsang.github.io/oscd-action-translate/oscd-action-translate.js |
10 |
| -:uri-openscd-core: https://github.com/openscd/open-scd-core#readme |
11 |
| -:uri-openscd: https://github.com/openscd |
12 |
| -:uri-openscd-app: https://openscd.github.io |
13 |
| -:uri-openscd-core-app: https://openscd.github.io/open-scd/ |
14 |
| -:uri-openscd-core-plugin: pass:v[https://openscd.github.io/open-scd/?plugins=%7B%22menu%22:%5B%7B%22name%22:%22Open%20File%22,%22translations%22:%7B%22de%22:%22Datei%20%C3%B6ffnen%22%7D,%22icon%22:%22folder_open%22,%22active%22:true,%22src%22:%22https://openscd.github.io/oscd-open/oscd-open.js%22%7D,%7B%22name%22:%22Save%20File%22,%22translations%22:%7B%22de%22:%22Datei%20speichern%22%7D,%22icon%22:%22save%22,%22active%22:true,%22src%22:%22https://openscd.github.io/oscd-save/oscd-save.js%22%7D%5D,%22editor%22:%5B%7B%22name%22:%22Supervision%22,%22translations%22:%7B%22de%22:%22%C3%9Cberwachung%22,%22pt%22:%22Supervis%C3%A3o%22%7D,%22icon%22:%22ecg%22,%22active%22:true,%22src%22:%22https://danyill.github.io/oscd-supervision/oscd-supervision.js%22%7D%5D%7D] |
15 |
| -// TIP: |
16 |
| -// the above URI is done by taking the plugins object from demo.html (without strings) and updating to the correct {uri-ci-bundle} value and then in the browser calling: |
17 |
| -// console.log(`https://openscd.github.io/open-scd/?plugins=${encodeURI(JSON.stringify(plugins))}`) |
18 |
| -// then substitute the value within the pass:v[<url>] |
19 | 9 | :uri-openwc: https://github.com/open-wc/open-wc
|
20 |
| -:uri-plugin: https://github.com/danyill/oscd-supervision |
21 |
| -:uri-ci-bundle: https://danyill.github.io/oscd-supervision/oscd-supervision.js |
22 |
| -:uri-material-icons: https://fonts.google.com/icons |
23 |
| -:uri-openscd-core-plugin-demo: https://danyill.github.io/oscd-supervision/index.deploy.html |
24 |
| - |
| 10 | +:uri-docs: https://danyill.github.io/tpnz-openscd-docs |
| 11 | +:uri-openscd-core-plugin-demo: https://danyill.github.io/{plugin-name}/index.deploy.html |
25 | 12 | // badges
|
26 |
| -image:https://github.com/danyill/oscd-subscriber-later-binding/actions/workflows/test.yml/badge.svg[title='Build Status'] |
| 13 | +image:https://github.com/danyill/oscd-supervision/actions/workflows/test.yml/badge.svg[title='Build Status'] |
27 | 14 | image:https://img.shields.io/badge/built%20with-open--wc-blue.svg[link={uri-openwc},title='Built with open-wc recommendations']
|
28 |
| -image:https://img.shields.io/badge/LF%20Energy%20Slack-%20%23OpenSCD%20chat-purple?logo=slack&color=2aa198&labelColor=6c71c4[link=https://lfenergy.slack.com/archives/C03LH7EUP34,title='Slack LF Energy'] |
| 15 | +image:https://img.shields.io/badge/Zulip%20-%20%23OpenSCD%20chat-purple?logo=zulip&color=2aa198&labelColor=6c71c4[link=https://openscd.zulipchat.com/] |
29 | 16 |
|
30 | 17 | toc::[]
|
31 | 18 |
|
32 | 19 | == What is this?
|
33 | 20 |
|
34 | 21 | This plugin is intended to allow a user to add, remove and configure IEC 61850 GOOSE and SMV supervisions:
|
35 | 22 |
|
36 |
| -* This is a plugin for {uri-openscd-core}[open-scd-core], the core |
37 |
| -editor engine for {uri-openscd}[OpenSCD]. |
38 |
| - |
39 |
| -* This plugin is a web component and follows the |
40 |
| -{uri-openwc}[open-wc] recommendations. |
41 |
| - |
42 |
| -* This plugin uses the link:LICENSE[Apache License] and is intended for you to use, study, share and improve. |
43 |
| - |
44 |
| -{uri-openscd-core-plugin-demo}[Try it out online]! |
45 |
| - |
46 |
| -.Supervision Editor Plugin |
47 |
| -image::../../test/screenshots/baseline/LGOS changes supervisions can delete a used supervision-Chromium.png[width=800,link=../../test/screenshots/baseline/LGOS changes supervisions can delete a used supervision-Chromium.png] |
| 23 | +This is a plugin for OpenSCD core, the core editor engine for OpenSCD. |
48 | 24 |
|
49 | 25 | Feel free to log issues to request fixes, improvements or new features.
|
50 | 26 |
|
51 |
| -=== Features |
52 |
| - |
53 |
| -* Supports GOOSE and SMV |
54 |
| -* Will instantiate supervisions if possible (if `valImport=true` and `valKind=RO` or `valKind=Conf` on the first LGOS/LSVS instance or the datatype) |
55 |
| -* Allows removals of supervision elements |
56 |
| - |
57 |
| -== How to use? |
58 |
| - |
59 |
| -=== Online Using the Latest open-scd-core |
60 |
| - |
61 |
| -==== Using a URL |
62 |
| - |
63 |
| -Open SCD core allows plugins to be loaded from a URL. |
64 |
| - |
65 |
| -You can click on {uri-openscd-core-plugin}[this link] to trial this plugin. |
66 |
| - |
67 |
| -In this view it is without theming and only presents this plugin along with the open and save plugins. |
68 |
| - |
69 |
| -==== Manually |
70 |
| - |
71 |
| -. The latest core is available at {uri-openscd-core-app}. |
72 |
| - |
73 |
| -. Go to menu:Menu[Add plugins...] |
74 |
| - |
75 |
| -. Select Cancel - this is an editor plugin. |
76 |
| - |
77 |
| -. Select OK to required a loaded document. |
78 |
| - |
79 |
| -. Choose a plugin name of '{plugin-name}'. |
80 |
| - |
81 |
| -. Choose a plugin icon of 'link' |
82 |
| - |
83 |
| -. Provide a plugin source URI of: {uri-ci-bundle} |
84 |
| - |
85 |
| -. Click OK on the summary, it should indicate the parameters previously entered. |
86 |
| - |
87 |
| -. Open a file and enjoy! |
88 |
| - |
89 |
| -=== Locally for testing |
90 |
| - |
91 |
| -. Clone this project: |
92 |
| -+ |
93 |
| -[subs=+attributes] |
94 |
| -.... |
95 |
| -$ git clone {uri-plugin} |
96 |
| -.... |
97 |
| - |
98 |
| -. Install dependencies |
99 |
| - |
100 |
| - $ npm i |
101 |
| - |
102 |
| -. Start up a demo server |
103 |
| - |
104 |
| - $ npm run start |
105 |
| - |
106 |
| -. Open in your browser locally at http://localhost:8000/demo/ |
107 |
| - |
108 |
| -=== As part of the OpenSCD distribution |
109 |
| - |
110 |
| -TIP: OpenSCD is transitioning to use of `open-scd-core`, these instructions will require updating at the end of this transition. |
111 |
| - |
112 |
| -// TODO: Is this fixed yet? |
113 |
| -IMPORTANT: Currently the reactive update cycle in OpenSCD doesn't optimally support this plugin's behaviour -- it scrolls to the top of lists after a subscription is made or one of the window panes may go blank. This is a known issue and under investigation. |
114 |
| - |
115 |
| -. Open your OpenSCD distribution or use {uri-openscd-app}. |
116 |
| - |
117 |
| -. Create a custom extension by going to menu:menu[Extensions>Add Custom Extension]. |
118 |
| - |
119 |
| -. Enter the name '{plugin-name}', select 'Editor tab' and enter {uri-ci-bundle} as the URL. |
120 |
| -+ |
121 |
| -This is the URL of the bundle built by CI and is always the latest pre-release version of this plugin. |
122 |
| -+ |
123 |
| -.OpenSCD Add Custom Extension Screen |
124 |
| -image::screenshot-add-extension.png[width=300] |
125 |
| - |
126 |
| -. Click on menu:Add[]. |
127 |
| - |
128 |
| -. Until OpenSCD is fully transitioned to open-scd-core, a conversion plugin is also required to interface between the old and new APIs. |
129 |
| - |
130 |
| -. Create another custom extension by going to menu:menu[Extensions>Add Custom Extension]. |
131 |
| - |
132 |
| -. Enter the name 'Action Translate', select 'Menu entry' and enter {uri-action-translate-ci-bundle} as the URL. |
133 |
| -+ |
134 |
| -This is the URL of the bundle built by CI and is always the latest pre-release version of this plugin. |
135 |
| - |
136 |
| -. You should now be able to scroll across in the menu-bar and find a tab, "{plugin-name}" |
137 |
| -+ |
138 |
| -TIP: If there are too many editor plugin, hold down shift and wheel-mouse up and down to scroll them easily. |
139 |
| - |
140 |
| -=== As part of your own distribution |
141 |
| - |
142 |
| -==== Within the current OpenSCD distribution |
143 |
| - |
144 |
| -. Within the current OpenSCD distribution, plugins are stored in the `public/js/plugins.js` folder. |
145 |
| -Each plugin appears in the following form: |
146 |
| -+ |
147 |
| -[source,js,subs=+attributes] |
148 |
| ----- |
149 |
| -{ |
150 |
| - name: '{plugin-name}', // <.> |
151 |
| - src: '{uri-ci-bundle}', // <.> |
152 |
| - icon: 'ecg', // <.> |
153 |
| - default: true, // <.> |
154 |
| - kind: 'editor', // <.> |
155 |
| - requireDoc: true, // <.> |
156 |
| - position: 'middle' // <.> |
157 |
| - } |
158 |
| ----- |
159 |
| -<.> Name of the plugin which appears in the editor menu at top of screen |
160 |
| -<.> URL which can be a local or remote resource. |
161 |
| -For a local resource, begins without a forward slash, e.g. `plugins/oscd-supervision/dist/oscd-supervision.js`. |
162 |
| -In this case what is shown is loading a plugin from the build process. |
163 |
| -<.> A material icon, see others at {uri-material-icons}[Material Symbols and Icons] |
164 |
| -<.> Whether the plugin is enabled by default or has to be enabled in the plugins menu |
165 |
| -<.> The type of plugin, either `menu` or `editor`. This is an `editor` plugin. |
166 |
| -<.> Whether a document must be loaded for this plugin to be available |
167 |
| -<.> A string, either `top`, `middle` or `bottom` to give a location in the menu. |
168 |
| -Otherwise inferred from the order in the file relative to other plugins. |
169 |
| - |
170 |
| -. You need to copy an entry like the above, ensure the `src` URL resolves and the plugin should be loaded when the distribution is built. |
171 |
| - |
172 |
| -. If you are building locally you likely need to run an `npm run bundle` command in each plugin to make the `dist` folder, containing a single JavaScript file with the plugin available to OpenSCD. |
173 |
| - |
174 |
| -==== Within an OpenSCD core distribution |
175 |
| - |
176 |
| -Within an OpenSCD core distribution, plugins are also loaded from a json file with a slightly different schema. |
177 |
| - |
178 |
| -. Typically the distribution will be served from a static web page and within the web page there will be a plugins property declared on an `open-scd` object, for instance: |
179 |
| -+ |
180 |
| -[source,js,subs=+attributes] |
181 |
| ----- |
182 |
| -include::demo/index.html[tag=plugins] |
183 |
| ----- |
184 |
| - |
185 |
| -. This plugin is an editor plugin, editor plugins are an array of JSON of the following form: |
186 |
| -+ |
187 |
| -[source,js,subs=+attributes] |
188 |
| ----- |
189 |
| -{ |
190 |
| - "name": "{plugin-name}", // <.> |
191 |
| - "translations": { // <.> |
192 |
| - "de": "Überwachung", |
193 |
| - "pt":"Supervisão" |
194 |
| - }, |
195 |
| - "icon": "link", // <.> |
196 |
| - "active": true, // <.> |
197 |
| - "requireDoc": true, // <.> |
198 |
| - "src": "/dist/oscd-supervision.js" // <.> |
199 |
| -} |
200 |
| ----- |
201 |
| -<.> Name of the plugin which appears in the editor menu at top of screen |
202 |
| -<.> Translations of the plugin name as required using standard locale names. |
203 |
| -<.> A material icon, see others at {uri-material-icons}[Material Symbols and Icons] |
204 |
| -<.> Whether the plugin is enabled by default or has to be enabled in the plugins menu |
205 |
| -<.> Whether a document must be loaded for this plugin to be available |
206 |
| -<.> URL which can be a local or remote resource. |
207 |
| -For a local resource, begins with a forward slash, e.g. `plugins/oscd-supervision/dist/oscd-supervision.js`. |
208 |
| -In this case what is shown is loading a plugin from the internet using the continuous integration build process. |
209 |
| - |
210 |
| -. You need to copy an entry like the above, ensure the `src` URL resolves and the plugin should be loaded when the distribution is built. |
211 |
| - |
212 |
| -. If you are building locally you likely need to run an `npm run bundle` command in each plugin to make the `dist` folder, containing a single JavaScript file with the plugin available to OpenSCD. |
213 |
| - |
214 |
| -== Development |
215 |
| - |
216 |
| -=== Linting and formatting |
217 |
| - |
218 |
| -To scan the project for linting and formatting errors, run |
219 |
| - |
220 |
| -[source,bash] |
221 |
| ----- |
222 |
| -npm run lint |
223 |
| ----- |
224 |
| - |
225 |
| -To automatically fix linting and formatting errors, run |
226 |
| - |
227 |
| -[source,bash] |
228 |
| ----- |
229 |
| -npm run format |
230 |
| ----- |
231 |
| - |
232 |
| -=== Testing with Web Test Runner |
233 |
| - |
234 |
| -To execute a single test run: |
235 |
| - |
236 |
| -[source,bash] |
237 |
| ----- |
238 |
| -npm run test |
239 |
| ----- |
240 |
| - |
241 |
| -To run the tests in interactive watch mode run: |
242 |
| - |
243 |
| -[source,bash] |
244 |
| ----- |
245 |
| -npm run test:watch |
246 |
| ----- |
247 |
| - |
248 |
| -=== Tooling configs |
249 |
| - |
250 |
| -For most of the tools, the configuration is in the `package.json` to reduce the number of files in your project. |
251 |
| - |
252 |
| -If you customize the configuration a lot, you can consider moving them to individual files. |
253 |
| - |
254 |
| -=== Local Demo with `web-dev-server` |
255 |
| - |
256 |
| -To run a local development server that serves the basic demo located in `demo/index.html` |
257 |
| - |
258 |
| -[source,bash] |
259 |
| ----- |
260 |
| -npm start |
261 |
| ----- |
262 |
| - |
263 |
| -== Credit |
264 |
| - |
265 |
| -This plugin was refactored from base code in OpenSCD and relies on the code, architecture and review effort of multiple people other than the authors of this plugin, including: |
266 |
| - |
267 |
| -* Jakob Vogelsang |
268 |
| -* Juan Munoz |
| 27 | +See the {uri-docs}[documentation] for more information or {uri-openscd-core-plugin-demo}[try it out standalone]. |
269 | 28 |
|
270 |
| -© 2023 OpenSCD Daniel Mulholland |
| 29 | +© 2024 OpenSCD Daniel Mulholland |
0 commit comments