Commit Graph

391 Commits (2440db9d1d56277f34e7fd85463f75fe1588efd6)

Author SHA1 Message Date
Yannick Schaus 1cbb8680e4
Validate parameters immediately & before save (#349)
Perform the validation of all configuration parameters
when they are displayed (for instance this will show the
"Please fill out this field" message on all required
parameters immediately when the sheet is displayed).

Validate ID and label inputs on general thing settings.

Validate configuration on thing creation or update, and
profile configuration on link add/edit, and refuse to
save if there are invalid parameters.
Closes #267.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-24 11:20:05 +02:00
Yannick Schaus 095fc38cb3
Add a single widget from the model under oh-grid-col (#350)
Only allow a single item to be picked when choosing "Add from Model"
to add a widget to a oh-grid-col.
Fixes #345.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-24 11:19:43 +02:00
Yannick Schaus 1857e1eaae
Replace tabs with spaces before feeding input to nearley (#351)
On both textual item definitions and sitemap parsers.
This is easier than supporting tabs in the grammars.
Fixes #325.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-24 11:19:26 +02:00
Yannick Schaus f9a2c11afd
List item widgets names (#352)
Fixes #334.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-24 11:19:07 +02:00
Yannick Schaus ce6a4abb54
Allow 0 as a valid integer param value (#339)
Respect the min, max, step in the config description.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-16 23:22:26 +02:00
Yannick Schaus 990e180154
Rule editor: module type grouping (#336)
Sort module types in rules editor and group them by scope.
(following the discussion in https://github.com/openhab/openhab-core/issues/1639#issuecomment-692874984)

Fix blank labels when a config parameter with both options and a
"thing" context.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-15 22:34:32 +02:00
Wouter Born d01a198efd
Upgrade Travis CI to use Ubuntu 20.04 and fix warnings/caching (#330)
Upgrades the Travis CI build environment to Ubuntu 20.04 (Focal Fossa).

Also fixes the following Travis configuration validation warnings:

* deprecated key sudo (The key `sudo` has no effect anymore.)
* missing os, using the default linux

Also updates the caching config:

* $HOME/.p2 has no content since the bnd migration
* bundles/org.openhab.ui.homebuilder/npm_cache is not useful to cache because the POM has a configuration to clean the dir during builds

Signed-off-by: Wouter Born <github@maindrain.net>
2020-09-10 11:11:57 +02:00
Wouter Born 67a55f7cb2
[habpanel] Remove pom.xml.versionsBackup (#331)
Signed-off-by: Wouter Born <github@maindrain.net>
2020-09-10 11:10:42 +02:00
Yannick Schaus 211dd8323e
[habpanel] Use UI components for backend storage (#327)
This PR moves the storage backend for HABPanel's panel registry
from the service configuration to the "habpanel:panelconf" UI
components namespace, so they're accessible without authorization.

The panel registry object format is converted back and forth to
the UI components format during loading/saving.

To save, it tries to find a refresh token from the main UI stored
in LocalStorage and uses it to get access tokens - a new access
token is requested for each save. Whether or not implementing a
complete OAuth2 authorization code flow (given the refresh token
if there for use as it's the same origin as the main UI, and users
can be taught to first sign in with the main UI to be able to edit
HABPanel) can be debated and is still t.b.d.

(The code to load the configuration with the service config, like
in OH2, has been left but it is not loaded. It will also work
because it tries to get access tokens as well.)

The other options that were formally in the service configuration
have been changed as well:

- the "initial panel configuration" is now a "default"/"starred"
flag on the panel configuration itself, it can be set within
HABPanel itself (the "star" icon after the panel config name in
Settings), only one should normally be starred at any given time,
but it's not enforced - it's the admin responsibility to ensure
that.

- the "lock editing" is now tied to the presence of the refresh
token; this means, signing out in the main UI will automatically
disable the editing features in HABPanel because there's no more
possibility to get an access token to save.

Similarly, the locale is taken from /rest/ instead of the i18n
service directly.

Some missing translations have been added and some changed.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-09 22:14:32 +02:00
Yannick Schaus dc894265f6
[Main UI] Pass access token in header if cookie flag set (#328)
* [Main UI] proper handling when behind a reverse proxy auth

- This makes a check for the presence of a non-HttpOnly
`X-OPENHAB-AUTH-HEADER` cookie; if found, pass the current
access_token in the `X-OPENHAB-TOKEN` HTTP header instead of
the `Authorization` header as Bearer credentials.

This is explicitely supported by the backend and mitigates
the collisions with authorization schemes set by proxies like
openHAB Cloud.

- Add crossorigin="use-credentials" to the links in index.html
This allows the app to fetch icons and the app manifest
and others properly when credentials are needed by a proxy.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-09 22:09:28 +02:00
Yannick Schaus fb1143664d
[Main UI] Upgrade dependencies (#329)
Notable upgrades include:
- Framework7 to 5.7.12
- ECharts to 4.9.0
- Leaflet to 1.7.1

Includes a fix for https://github.com/framework7io/framework7/issues/3698
thus should fix #311 (spellcheck is disabled
by default in all searchbars so no changes
needed).

Fix for default charts axis pointer in dark mode,
duplicate labels in rule status chip.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-09 12:53:36 +02:00
Yannick Schaus 7129f9980f
[Main UI] Fix ambiguities in the nearley items syntax grammar (#322)
Handle the left recursion properly in the grammar, so that lists of more than 2 tags, group names or metadata don't cause an ambiguity leading to exponential parsing times.
Fixes #321.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-09 09:56:23 +02:00
Wouter Born 8a712972ab
Use renamed FilterCriteria methods (#319)
Signed-off-by: Wouter Born <github@maindrain.net>
2020-09-07 08:42:27 +02:00
Yannick Schaus 9d5445ef23
Add detailed technical info in About page (#313)
Depends on:
https://github.com/openhab/openhab-core/pull/1608.
https://github.com/openhab/openhab-core/pull/1610

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-08-25 21:16:05 +02:00
Yannick Schaus bd9c6d39c3
[habpanel] Fix for explicit state formatting in buttons (#316)
Fix #315.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-08-25 21:14:24 +02:00
Wouter Born 6f370941d3
Update spotless to 2.0.3 (#314)
Signed-off-by: Wouter Born <github@maindrain.net>
2020-08-24 15:56:15 +02:00
Philipp Waller 526a150847
Fix time icons (#312)
Signed-off-by: Philipp Waller <1090452+philippwaller@users.noreply.github.com>
2020-08-24 09:19:55 +02:00
Yannick Schaus df6d08100f
[Main UI] Widget actions: add photos, rule, general improvements (#310)
Add 2 additional widget actions:

- "rule": Run a rule immediately

- "photos": Open a photo browser to view images & videos in fullscreen.
  Also make the default widgets (standalone & list item) for
  Image items perform this action.

Other improvements:

- Described the "options" action;
- Allowed the "options" action to retrieve command options from
  the target item's command description dynamically (default
  if explicit options are omitted);
- Default widgets for non-read-only items with command options
  don't specify them in the widget config anymore; this allows
  the list of options to remain current if the options are
  dynamic without reconfiguring the widget;
- Add a "feedback" parameter to actions performing commands or
  running rules to let the user show a toast notification when
  the action has been performed;
- Removed the parameter description leftover from the actions
  mixin file;
- Styling fixes for clickable oh-image-card


Signed-off-by: Yannick Schaus <github@schaus.net>
2020-08-21 22:39:57 +02:00
Yannick Schaus 026772178b
[Main UI] Add Setup Wizard (#306)
This launches a setup wizard when openHAB is started for the
first time. It allows to:

- set some regional settings (language, region, timezone)
- set the location, optionally with the help of the browser Location API
- install an initial set of add-ons

It is also possible to skip any of these steps, or the setup wizard
altogether. Regardless, the "overview" layout page will be created
so that it can act as a detection mechanism to determine whether the
setup wizard has already run or not, and prevent it from being shown
a second time. Therefore, deleting the overview page has been made
impossible in the UI's pages list.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-08-19 20:52:05 +02:00
Philipp Waller fb901f869a
Fix corrupt SVG icon files and refactor image compression workflow (#291)
- Added viewBox property to the none.svg file. This property is necessary to ensure error-free processing in the subsequent process.
- Replaced the svgcleaner tool with scour, which in our case not only produces better lossless compression results, but also automatically corrects the corrupted files. (all svg files, svgcleaner: 837.092 Byte -> scour: 794.586 Byte, -5.07%)
- Replaced pngout by optipng since pngout is is closed source, it's license prohibits bundled distribution and optipng delivers better lossless compression results) (all png files, pngout: 514.752 Byte -> optipng: 494.134 Byte, -4.01%)
- Added the pngquant tool for lossy compression to further reduce the size of the png files without noticeable loss of quality. (all png files, before: 494.134 Byte -> after: 236.338 Byte, -109.08%)

The conversion script has been refactored and renamed in order to use the new tooling.
Dockerfile has been added to execute the script platform independent.

The script as well as the new tooling can be tested most easily with the provided docker container. Just execute the following command in the bundles/org.openhab.ui.iconset.classic directory:

docker run --rm -it -v ${PWD}/src/main/resources/icons:/workdir $(docker build -q .) ./.convert.sh

Signed-off-by: Philipp Waller <1090452+philippwaller@users.noreply.github.com>
2020-08-18 13:25:39 +02:00
Wouter Born 3020d09ff7
Fix ConfigConstants and FilterCriteria deprecations (#308)
Signed-off-by: Wouter Born <github@maindrain.net>
2020-08-15 10:57:18 +02:00
Kai Kreuzer b977ed4ecd
Adapted to changed persistence API (#307)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
2020-08-14 13:14:02 +02:00
Yannick Schaus 8a7290f692
Widget definition API overhaul (#301)
* [WIP] Widget definition API overhaul

This changes the way a widget component is described from a simple
object in the default export in SFCs to a function that will only
be evaluated when needed; this should improve performance a bit
when the widget isn't being edited, and allows to use helper functions
to build the parameters in a more concise way. More logic can be
introduced when building these definitions i.e. i18n: translating
them in the currently active language.

All widget definitions can also be considered to be assets rather than
code (even if there's some logic in their building) so they've been
moved to the assets/definitions/widgets folder and simply imported in
the component's SFC; this allows to re-use parameters in a cleaner
way - for instance, the toggle card and toggle list item of the
standard library accept the same parameters coming from the toggle
widget from the system library, also all cards/list items support a
common set of parameters related to the card/list item themselves.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-08-13 21:32:52 +02:00
Yannick Schaus 9f7c5cb663
Fix off-by-one in inbox event topic detection (#305)
Signed-off-by: Yannick Schaus <github@schaus.net>
2020-08-12 08:13:49 +02:00
Wouter Born 60e6c78b5a
Use "openhab" event topic prefix (#304)
Signed-off-by: Wouter Born <github@maindrain.net>
2020-08-11 21:16:56 +02:00
Yannick Schaus 7ca5d1fcc0
Display config parameters defaults & status info (#302)
Pre-fill config parameters controls with the default
value if provided in the config description.

Display thing configuration parameter status info.

Fixes #285.
Fixes #293.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-08-11 20:57:19 +02:00
Yannick Schaus b2b965e982
Add version & system info to about page. (#303)
* Add version & system info to about page.
Uses info from https://github.com/openhab/openhab-core/pull/1570 if available.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-08-11 20:56:15 +02:00
Wouter Born 3ca51b0e35
Migrate to JUnit 5 (#300)
* Migrates all tests to the JUnit 5 Jupiter API
* Updates bnd to 5.1.2
* Updates maven-surefire-plugin to 3.0.0-M5
* Removes org.openhab.core.boot POM dependencies

Signed-off-by: Wouter Born <github@maindrain.net>
2020-08-09 16:44:02 +02:00
Yannick Schaus a32668a652
Fix HABPanel REST resource not registered (#289)
Signed-off-by: Yannick Schaus <github@schaus.net>
2020-08-09 14:34:22 +02:00
Yannick Schaus 70b3b9f750
[Main UI] Include bridgeID in thingUID on manual creation (#298)
This will include the ID of the bridge in the ThingUID if it is specified during the
manual creation of the thing.

The thingUID format will therefore be
`binding:thingType:bridgeID:thingID` if a
bridge is specified during the creation,
otherwise it will be `binding:thingType:thingID`.
This is consistent with the naming convention
adopted when creating things by other means
(files, inbox).

Note that the thingUID is immutable once the thing has been created, so the
bridge ID part will be false or missing when
the bridge is altered or assigned after the
creation.
Relying on the thingUID to determine the bridge
should be discouraged.
See https://github.com/openhab/openhab-addons/pull/7496#discussion_r426005622

Fixes #290.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-08-08 19:44:21 +02:00
Wouter Born 7453955770
Migrate to OpenAPI 3 annotations (#299)
Signed-off-by: Wouter Born <github@maindrain.net>
2020-08-02 16:14:55 +02:00
Yannick Schaus 3c597f5ed7
Embed Swagger UI as a developer tool in the main UI (#297)
Signed-off-by: Yannick Schaus <github@schaus.net>
2020-07-24 22:40:47 +02:00
Kai Kreuzer 25f7d6c47c
adapted wording from extension to add-on (#295)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
2020-07-23 17:17:11 +02:00
Yannick Schaus 04505bb876
[restdocs] Upgrade Swagger UI to 3.30.0 (#296)
This release introduces syntax highlighting of the
JSON examples and payloads.

Enable option to sort operations and tags alphabetically.

Enable option to display a filter box.

Fix OAuth2 redirect URL.

Replace o2c.html contents with current version from upstream.

Remove swagger-ui.js (not required if using swagger-ui-bundle.js).

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-07-22 17:57:18 +02:00
Kai Kreuzer 961bd65f68
Updates Swagger UI to version 3.28.0 (#294)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
2020-07-21 20:32:55 +02:00
Yannick Schaus 899a8fdcf9
Fix item type not trimmed in lexer (#282)
Signed-off-by: Yannick Schaus <github@schaus.net>
2020-07-01 19:52:33 +02:00
Yannick Schaus 2d8dda50c9
Add oh-knob widget to system library (#288)
Signed-off-by: Yannick Schaus <github@schaus.net>
2020-07-01 19:50:57 +02:00
Yannick Schaus 8b4169eff7
Use distinct endpoint to save thing configuration (#287)
Signed-off-by: Yannick Schaus <github@schaus.net>
2020-06-22 20:35:08 +01:00
Chris Jackson 0732bb8f9d
Remove tag incorrectly added in previous PR (#284)
Signed-off-by: Chris Jackson <chris@cd-jackson.com>
2020-06-22 12:55:29 +02:00
Chris Jackson 74be454d15
Fix conditional display of sections on settings page (#280)
Signed-off-by: Chris Jackson <chris@cd-jackson.com>
2020-06-20 23:06:41 +02:00
Chris Jackson 58def6bc5d
Don't allow adding new bindings if not supported by server (#281)
Signed-off-by: Chris Jackson <chris@cd-jackson.com>
2020-06-20 14:02:57 +02:00
Chris Jackson 82b36714e3
Fix duplicate thing state being printed (#279)
Signed-off-by: Chris Jackson <chris@cd-jackson.com>
2020-06-18 10:30:14 +02:00
Yannick Schaus 57ac4ab0dd
Fix points names in Add Points to Model scenario (#278)
Fix a bug introduced with #275 when points being added to the model without an
equipment would not have their default name properly computed.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-06-17 20:12:37 +02:00
Yannick Schaus a41d91f926
Fix desktop HABot interim results regression (#277)
Signed-off-by: Yannick Schaus <github@schaus.net>
2020-06-17 13:30:50 +02:00
Yannick Schaus 23ba7caaf1
Config parameter options shown inline if 5 or less (#276)
Fix parameter not saved when unset & absent from payload on save.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-06-17 13:30:30 +02:00
Yannick Schaus 238a0aecee
Add Items from Thing: use model picker for parent group (#275)
Use a treeview-based semantic picker to select a parent
location or equipment group item when using the
Add Equipment to Model or Add Points to Model functions
in a Thing's Channels tab.
Replaces the current flat list of group items.

Add functionality to the model picker popup to support this
use case and adjust some texts and controls on the page.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-06-17 13:30:07 +02:00
Dan Cunningham 98ab3be96b
Main UI Fix for selecting multiple items in the inbox (#273)
Signed-off-by: digitaldan <dan@digitaldan.com>
2020-06-16 18:13:14 +02:00
Yannick Schaus 2cf8d8cedf
Main UI HABot client on home page (#271)
This implementation transforms certain cards issued
by HABot for its own GUI to compatible equivalents.
It will not try to transform cards saved on HABot's
"card deck"/CardRegistry because they may have been
modified and compatiblity cannot be guaranteed.

The main UI's client calls /rest/habot/chat with a
`?useCardRegistry=false` option which has to be added
to the API to prevent saved cards from being reused.
This will be done in a separate PR.

The chat input box appears on the home page only if
the "habot" endpoint is present, by calling the root
/rest early to determine the version of the API and
its links (it's stored in the Vuex store for the
remainder of the session for easy access). It's also
possible to disable the feature on a per-device basis
with an option on the about page.

The 5 most recent unique queries will be retained for
quick recalling (also per-device, stored in the local
storage).

For charts, it simply opens the Analyzer window since
since image-related support in widgets is not yet done.
(altered the analyzer to be able to open it with a
predefined initial period).

The "create rule" skill featured in the HABot app with
its dedicated card is not supported.

Refactor OH access layer, add speech interface
Only a browser-based implementation
of speech recognition with
window.webkitSpeechRecognition is
implemented for now, the API is subject
to change.

Dynamic settings menu & sidebar depending on the available endpoints

Reload endpoints after an addon install/uninstall to refresh the UI
(this will allow e.g. service configuration menus and the HABot input box to
appear or disappear without reloading the page)

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-06-15 22:18:42 +02:00
Yannick Schaus 19178a1386
Standard list item widgets; default widget logic for list display (#270)
Add list items widgets:

- oh-label-item
- oh-toggle-item
- oh-slider-item
- oh-rollershutter-item
- oh-player-item
- oh-stepper-item
- oh-colorpicker-item

Most config options are forwarded to the system
widget displayed on the "after" slot, which may also be
defined in the widgets' definitions.

Move default standalone widget logic to dedicated JS file.

Default list widget logic.

Change the label of the standard library's card widgets.

Add standard list widgets to listWidget metadata editor
picker; add preview sheet.

Misc fixes in global app styles, analyzer.

Let the user choose the list item widget to add in an oh-list.

"Add from Model..." option in new widget action sheets.
Add a model treeview popup to add default widgets (standalone or list)
easily to a layout (block column or masonry) or a list, simply by
browsing the semantic model and picking items.

Other renames and file structure reorganizations.

Add a new action to show group members in a popup, using their
default list representation. Make it the default action for Group items,
for both standalone and list widgets.

Make semantic cards on the home page functional:
Use the default list widgets to render items in the card.
(order not considered for now, but visible and visibleTo
configured in the listWidget metadata might work to filter
out items based on an expression/the current user's roles?)
Remove warning messages.
Make cards (and headers) a little bit thinner.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-06-10 22:56:31 +02:00
Yannick Schaus b0bdefe5b5
Misc style fixes (#265)
Better filled bars defaults

Add per-device option to set the home page background
to the standard color (i.e. gray in light mode, no effect
in dark mode)

Consider safe area (fullscreen iOS) for map, plans, charts

Convert CSS remains to stylus, cleanups, fixes

Add page transition effect option for navigation
widget actions
(https://framework7.io/docs/view.html#custom-page-transitions)

Restyle theme/dark mode pickers

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-05-27 11:54:59 +02:00