Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
144 lines (96 sloc) 5.13 KB

ZentriOS Web App

Installation

The ZentriOS Web App uses the following development tools:

To develop, build or run the WebGUI on your local machine, these will need to be installed. Instructions for installation of these tools:

After pulling the repo, run the following commands in a terminal to download and install required packages:

bower install
npm install

Preparing the ZentriOS Device for Web App Development on a Local Server

To prepare the ZentriOS device to communicate with the local server, open a ZentriOS terminal on the device and issue the following commands:

set wlan.ssid               <NETWORK NAME>
set wlan.passkey            <NETWORK PASSWORD>
set wlan.auto_join.enabled  1
set http.server.enabled     1
set mdns.name               mymodule
set mdns.enabled            1
set http.server.cors_origin *
save
reboot

For a tutorial in customizing the ZentriOS Web App, see: http://docs.zentri.com

Development Testing

Config.json

Edit config.json to specify:

  • localIP: address (e.g. 12.34.56.89) of a running local development server.
  • port: port for local development server (the default grunt server runs on 5002).
  • device: address (e.g. 12.34.56.78 or device.local) of the device to communicate with.

The ZentriOS WebApp has been primarily developed using Pug templating (formerly known as Jade) and LESS CSS pre-processing language

When developing on a local server and communicating with a remote device, set the device IP address in config.json. _N.B. To successfully communicate with a remote device, the ZentriOS variable http.server.cors_origin needs to be set appropriately.

If a grunt task fails to run and an error about missing packages is displayed, you may need to run npm install to install any missing packages.

grunt serve

Will run a local nodejs server on port 5002 for testing

grunt watch

Will start a task that listens for file changes, and compile/compress HTML, CSS and JS

no-pug

If you are unfamiliar with Pug and wish to write traditional HTML run the following grunt task:

grunt no-pug

This will create the files public/html/index.html and public/html/unauthorized.html for development.

Note: Running the default grunt task again will overwrite any changes made to index.html and unauthorized.html

no-less

If you are unfamiliar with LESS and wish to write traditional CSS run the following grunt task:

grunt no-less

This will create the file public/css/zentrios.css for development.

Note: Running the default grunt task again will overwrite any changes made to zentrios.css

Build / Compile

grunt build

Compiled and compressed JS, CSS and HTML files will be exported to /out

Version, git hash, and build date information are automatically built into the complied JS as an object named _webgui for debugging purposes. To view the version/hash/build-date for reporting a bug, open the developer console in your browser, and type _webgui and press enter to view the current webgui version/hash/build-date information.

Deploy

grunt deploy

Put webapp files onto the device specified in config.json by deviceAddress. This requires the default grunt task to already be running in another terminal and accessible at the address specified by localDevelopmentIP in the config file.

_Note: grunt deploy will silently fail if the localIP address is not configured correctly in `config.

Release

grunt release:[type]

Release an official major|minor|patch verion. When the task is run, the project version is updated and the release will be committed and tagged with the appropriate version, and all files packaged into /out/release/Release-[version].zip

Appropriate uses of the release task:

grunt release:major
grunt release:minor
grunt release:patch

Licence

ZentriOS Web App, ZentriOS JS API Library & ZentriOS JS Build System

Copyright (C) 2016, Zentri All Rights Reserved.

The ZentriOS Web App, ZentriOS JavaScript API and ZentriOS JS build system are provided free of charge by Zentri. The combined source code, and all derivatives, are licensed by Zentri SOLELY for use with devices manufactured by ACKme Networks, or approved by Zentri.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.