-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): create Antora documentation
- Loading branch information
Benjamin Reed
committed
Nov 17, 2020
1 parent
21c15fe
commit b58b0cf
Showing
16 changed files
with
1,477 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,7 @@ grafana | |
dist/cli.* | ||
dist/opennms.* | ||
dist/docs | ||
|
||
# Antora documentation | ||
docs/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name: opennms-js | ||
version: '2.0.3-SNAPSHOT' | ||
title: OpenNMS.js | ||
nav: | ||
- modules/ROOT/nav.adoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.About | ||
* xref:about:introduction.adoc[What is OpenNMS.js?] | ||
* xref:about:legal_notice.adoc[Legal Notice] | ||
.Installation | ||
* xref:installation:cli.adoc[CLI Utility] | ||
* xref:installation:js.adoc[JavaScript/TypeScript API] | ||
.Contributing | ||
* xref:contributing:index.adoc[Contributing] | ||
.Using | ||
* xref:using:developing.adoc[Developing] | ||
* xref:using:api-basics.adoc[API Basics] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
:imagesdir: ../assets/images | ||
|
||
[[welcome-index]] | ||
= {page-component-title} {page-version} Documentation | ||
|
||
:data-uri: | ||
:icons: | ||
|
||
[.lead] | ||
Welcome to the {page-component-title} {page-version} documentation: information and guides to help you learn about {page-component-title} and start exploring its features. | ||
|
||
[TIP] | ||
==== | ||
Use the left navigation bar to browse the documentation or the links below to access some highlights. | ||
==== | ||
|
||
[big]*Need help?* | ||
|
||
* talk to us in https://chat.opennms.com/opennms/channels/opennms-development[chat] | ||
* join our community on https://opennms.discourse.group/latest[Discourse] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
:imagesdir: ../assets/images | ||
:!figure-caption: | ||
|
||
= What is {page-component-title}? | ||
|
||
{page-component-title} is both a command-line utility as well as a collection of JavaScript and TypeScript APIs for interacting with OpenNMS Horizon and Meridian servers. | ||
|
||
[[cli]] | ||
== Command-Line Utility | ||
|
||
The CLI is a tool for performing a variety of operations against an OpenNMS server, most notably querying, acknowledging, and creating tickets from alarms. | ||
|
||
[[api]] | ||
== JavaScript and TypeScript API | ||
|
||
The JavaScript and TypeScript API provides access to a wide variety of functions for interacting with an OpenNMS server. | ||
It provides a core of functionality used by other OpenNMS tools, most notably Helm. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[[welcome-legal-notice]] | ||
= Legal Notice | ||
{} | ||
{page-version} | ||
:data-uri: | ||
:icons: | ||
|
||
[.lead] | ||
Copyright © {docyear} The OpenNMS Group, Inc. | ||
|
||
OpenNMS is a registered trademark of The OpenNMS Group, Inc. | ||
|
||
All other trademarks are the property of their respective owners. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Contributing | ||
|
||
* Fork me on https://github.com/OpenNMS/opennms-js[GitHub] | ||
* Open an https://issues.opennms.org/projects/JS/summary[issue in JIRA] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
= Getting Started With the CLI Utility | ||
|
||
== Installation | ||
|
||
Just install the `opennms` project globally, using https://www.npmjs.com/[npm]. | ||
|
||
1. install https://nodejs.org/en/download/[Node.js] (Node.js comes with `npm`) | ||
2. run `npm install -g opennms` | ||
3. run `opennms --help` for a list of available commands | ||
|
||
== Configuration | ||
|
||
Before you can query your OpenNMS server, you must first configure the command-line tool to know where to find it. | ||
|
||
Run: | ||
|
||
[source, shell] | ||
---- | ||
opennms connect --username <your-username> --password <your-password> https://your-opennms-server/opennms | ||
---- | ||
|
||
This will store a configuration file that the `opennms` command will read automatically when you run it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
= Getting Started With the JavaScript or TypeScript API | ||
|
||
== Installation | ||
|
||
You can use NPM or Yarn to install `opennms` as a dependency to your project` | ||
|
||
```bash | ||
npm install opennms | ||
# or | ||
yarn install opennms | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
= OpenNMS.js API Basics | ||
|
||
== Importing the Code | ||
|
||
=== TypeScript | ||
|
||
If you are using TypeScript, you can import the APIs directly into your project: | ||
|
||
[source,javascript] | ||
---- | ||
import { API, Model, Rest, DAO, Client } from 'opennms/src/API'; | ||
---- | ||
|
||
=== JavaScript | ||
|
||
[source,javascript] | ||
---- | ||
const { API, Model, Rest, DAO, Client } = require('opennms'); | ||
---- | ||
|
||
== Connecting to a Server | ||
|
||
Before you can make any queries, you must first connect to a server. | ||
To do so, use the `Client` object. | ||
|
||
[source,javascript] | ||
---- | ||
const client = await new Client().connect('Demo', 'http://my-server:8980/opennms/', 'admin', 'admin'); | ||
---- | ||
|
||
== Making Queries | ||
|
||
To make a query, OpenNMS.js provides a number of DAO APIs for accessing data through ReST. | ||
|
||
To do so, you first connect (like above), and then call into the appropriate DAO to query. | ||
|
||
Here's an example that queries alarms with an ID greater than 7: | ||
|
||
[source,javascript] | ||
---- | ||
const { Comparators, Filter, Restriction } = API; | ||
const idRestriction = new Restriction('id', Comparators.GE, 7); | ||
const filter = new Filter().withOrRestriction(idRestriction); | ||
try { | ||
const alarms = await client.alarms().find(filter); | ||
console.info(`got ${alarms.length} alarms with id >= 7.`); | ||
// get all the node IDs associated with the matching alarms | ||
const allNodeIds = alarms | ||
.map((alarm) => alarm.nodeId) | ||
.filter((nodeId) => nodeId !== undefined); | ||
// create a unique list | ||
const nodeIds = allNodeIds | ||
.filter((val,index) => allNodeIds.indexOf(val) === index); | ||
// if the 2nd argument to nodes().get() is true, | ||
// it also populates ipInterfaces and snmpInterfaces | ||
const nodes = await Promise.all( | ||
nodeIds.map(id => client.nodes().get(id, true)) | ||
); | ||
nodes.forEach(node => { | ||
const numIfaces = node.ipInterfaces.length; | ||
console.info(`${node.id} (${node.label}) has ${numIfaces} IP interfaces.`); | ||
}); | ||
---- | ||
|
||
== API Reference | ||
|
||
The complete API reference is available at https://opennms.github.io/opennms-js/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
= Using OpenNMS.js | ||
|
||
== Development and Production Branches | ||
|
||
Development is done in the `develop` (default GitHub) branch. | ||
|
||
Commits to the `develop` branch are automatically compiled and committed to the `master` branch. | ||
|
||
Releases are tagged from the `master` branch and submitted to https://www.npmjs.com/package/opennms[npm]. | ||
|
||
== Working With the Project Code | ||
|
||
First, you must install the project dependencies. | ||
You can do so with `npm`: | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
[[commands]] | ||
Then, there are a number of commands you can run to work with the code: | ||
|
||
`npm run dev`:: build the non-minified, development version of the code into the `dist/` directory | ||
`npm run build`:: build both the development and production versions of the code into the `dist/` directory | ||
`npm run test`:: run the unit tests | ||
`npm run lint`:: check the TypeScript code for errors and formatting warnings | ||
`npm run docs`:: build the API documentation into the `dist/docs/` directory | ||
`npm run changelog`:: generate the `CHANGELOG.md` file from the current git history | ||
`npm run watch`:: build the development version of the code into the `dist/` directory, automatically re-compiling if code changes are detected | ||
`npm run watch-test`:: run the tests continuously, automatically re-running if code changes are detected | ||
`npm run dist`:: does everything necessary to update the `dist/` directory with the latest changes, including lint, test, build(s), and docs | ||
`npm run cli`:: run the CLI tool directly from the source tree (eg, `npm run cli -- connect -u admin -p admin http://your-opennms:8980/opennms/`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
site: | ||
title: OpenNMS.js Documentation | ||
url: https://docs.opennms.com/opennms-js/ | ||
start_page: opennms-js::index.adoc | ||
content: | ||
sources: | ||
- url: . | ||
branches: HEAD | ||
start_path: docs-src | ||
ui: | ||
bundle: | ||
url: https://github.com/opennms-forge/antora-ui-opennms/releases/download/v1.2.1/ui-bundle.zip | ||
asciidoc: | ||
attributes: | ||
stem: latexmath | ||
output: | ||
clean: true | ||
dir: ./public | ||
destinations: | ||
- provider: fs | ||
- provider: archive |
Oops, something went wrong.