Commit Graph

1414 Commits (14adafb810c41a3c10d9847952ec9724e399355d)

Author SHA1 Message Date
Yannick Schaus d83544eaa6
Add icons, labels & descriptions for automation add-on type (#435)
Signed-off-by: Yannick Schaus <github@schaus.net>
2020-10-23 21:23:41 +02:00
Yannick Schaus d9b0c09172
Widgets/config parameter fixes (#434)
Allow number config parameter control to input decimals
Fix #379: Check pattern if provided (fix #
Fix #391: Time of day parameter format
Fix #333: Decimal handling & FP issues with oh-stepper, oh-slider
+ fix parameter types, add unit parameter to oh-slider

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-10-23 21:23:19 +02:00
Mark Herwege ed342e4ae7
[Main UI] Created input list item and card control (#426)
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Also-by: Yannick Schaus <github@schaus.net>
2020-10-23 20:03:17 +02:00
Yannick Schaus 036b0ec5b1
Channel list improvements (#404)
Add `searchbar-ignore` class to link skeletons to prevent
the height of the accordion to be initialized at 0px.
Should fix #401.

Add filters to display only linked or unlinked channels.
Closes #395.

Hide item linking controls for trigger channels.
Closes #390.

Add option to select/unselect all checkboxes when in
multiple links mode. This will take the linked/unlinked
filter into account, and the advanced toggle, but not
the name filter.
Closes #377.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-10-20 18:08:32 +02:00
Wouter Born b39161afce
Fix Basic UI / CometVisu default configurations (#418)
* Remove Basic UI iconType configuration (removed in #114)
* Fix CometVisu configuration PID

Signed-off-by: Wouter Born <github@maindrain.net>
2020-10-18 18:03:46 +02:00
Hilbrand Bouwkamp 838d79eac2
Sort addons case insensitive (#393)
The list of (installed and uninstalled) bindings is not sorted.
As a result it depends on what the rest api returns.
In this case the bindings with lowercase first character are placed after the bindings with uppercase.
To fix this after the filter a sort is added.

Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
2020-10-16 21:19:57 +02:00
Mark Herwege 03e5ae5366
Player control rewind and fast forward (#405)
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
2020-10-16 21:18:53 +02:00
Yannick Schaus c6eadd4d51
Fix thing UID generation (#381)
Fixes #380.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-10-15 02:12:56 +02:00
Wouter Born 22b5e9f478
[habot] Update feature (#383)
Related to openhab/openhab-core#1709

Signed-off-by: Wouter Born <github@maindrain.net>
2020-10-10 19:07:15 +02:00
Christoph Weitkamp 1e5a41f0f9
Apply theme on default page (#376)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
2020-10-05 21:43:44 +02:00
Christoph Weitkamp ecea5a2386
[basicui] Reduce logging level (#375)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
2020-10-05 21:43:04 +02:00
Wouter Born dedc93deb0
Remove dashboard dependency (#371)
The dashboard no longer exists in OH3 making the release pipeline fail.

Signed-off-by: Wouter Born <github@maindrain.net>
2020-10-05 09:13:35 +02:00
Yannick Schaus 308526689b
Autocompletion: don't retrigger hinting by default (#370)
This prevents infinite loops and other side effects.
Add an option to explicitely retrigger another autocompletion.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-10-04 22:30:29 +02:00
Yannick Schaus f3cf8657d8
Redesign thing details page, add YAML editor (#368)
Merge the 'Info' & 'Config' tabs of the thing details
page into a single 'Thing' tab, and add a 'Code' tab
allowing to edit the relevant parts of the thing in
YAML, with partial autocompletion:

- general parameters: label, location...
- bridge
- configuration parameters
- extensible channels

Remove the unmaintained textual translation button & popup.

Styling tweaks.

Move validation buttons in add/create dialogs from the navbar
to bigger buttons at the bottom of the page:

- add thing
- add channel
- add link
- add item

Change label for no profile from 'No Profile (Default)' to
'(No Profile)'. Closes #

Async import of parameter-location in setup wizard
This prevents the location picker and Leaflet from being
put in the entry point bundle by webpack.

Don't autocomplete single choice without showing the hint menu

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-10-04 17:37:53 +02:00
Yannick Schaus 52db413694
Autocomplete for YAML editors (#364)
Add some autocomplete ("hint" in CodeMirror jargon) logic to YAML
editors for UI components and rules. Might be expanded to other entities
in the future.

Add CM lint plugin & move YAML errors to gutter

Allow switching to run mode from Code tab in editors.

Styling fixes in widget editor.

Convert remaining popups to routables: ensures the back button/gesture
doesn't mess up navigation.

Describe system library widgets

Switch slot config popup to tab design

Always stay on page when creating or editing rules, pages, sitemaps, widgets
(Closes #340.)

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-10-04 01:42:37 +02:00
Wouter Born a3d3d90854
Upgrade Maven compiler (#366)
Upgrades the compiler and its dependencies so the compiler results of Maven builds are more similar to those generated in recent Eclipse versions.

Signed-off-by: Wouter Born <github@maindrain.net>
2020-10-03 14:03:43 +02:00
Yannick Schaus 508d544dfe
Widgets: context variables, add oh-input & others (#356)
This introduces a way to set page-local or widget-local
variables to allow more complex scenarios in pages & custom
widget development.

Variables can be used using several methods:

- the "variable" config parameter of oh-gauge (read-only),
  oh-input (new), oh-knob, oh-slider, oh-stepper, oh-toggle
  will accept a variable name and control it instead of
  sending commands to items if set. The "item" parameter can
  still be set to set the widget to the item's state, when
  the variable has no value.
- the "vars" object available in expressions (for example
  `=vars.var1` will evaluate to the value of the variable `var1`.
- the "variable" action allows to set an fixed or computed
  (using an expression) value to a variable.

Variables set directly by widgets on a page will propagate
to all components to the page, including personal widgets.
However, variables set within a personal widget will be scoped
to that personal widget only - except when there's already an
inherited variable with the same name.

oh-button & oh-link have a special parameter "clearVariable"
which allows to unset a version when clicked, after performing
the action. This is useful when "validating" a variable e.g.
set a command to an item with the variable value then reset it.

Additionally, allow to specify actions from props:
Every time an action is available to configure,
a special `{prefix}actionPropsParameterGroup` can be specified.
({prefix} is usually empty)
It tells the action processing method to take the action
configuration from props defined in a certain parameter group
in the context instead of the current component's config.

Additionally, action config parameters will be injected to
parameter groups with an 'action' context.

Example:

```
uid: widget_201d55a19d
tags: []
props:
  parameters:
    - label: Icon
      name: icon
      required: false
      type: TEXT
  parameterGroups:
    - name: action
      context: action
      label: Click Action
timestamp: Sep 27, 2020, 5:31:10 PM
component: oh-icon
config:
  icon: =props.icon || 'lightbulb'
  actionPropsParameterGroup: action
  width: 100
  style:
    filter: grayscale()
  class:
    - margin
    - padding
    - elevation-10
    - card
```

Other fixes:

- Allow oh-image to perform an action when clicked directly.
- Pass config parameters to oh-icon & allow actions.
- Allow oh-sheet to take its title from a widget label.
- Pass styles applied to oh-trend to vue-trend.
- Check for context before resolving config.
- Styling fixes: Align blocks better throughout the app in config screens.
- Disable popup workaround as it seems to work now.
- Routable widget config & code popup in all page designers.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-10-01 17:17:25 +02:00
Yannick Schaus 30e4b2bf65
[habpanel] Fix configuration of template widgets (#363)
Fixes #361.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-30 15:39:31 +02:00
Yannick Schaus 8420bbd9fb
Improve text parameter autocomplete (#359)
For config parameters with options and limitToOptions=false,
currently implemented as a text field with autocomplete.

Display & allow filtering on the label, and display all
the available options on open.

Fixes #357.

Don't perform the initial validation pass on config sheet.
Adds a mention in the description for required fields instead.

Closes #353.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-27 20:47:51 +02:00
Yannick Schaus cf5386873a
Crosshair cursor in map picker (#355)
Closes #354.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-27 20:47:35 +02:00
Yannick Schaus 12e02b5c18
Fix thing not saved when modifying channels (#358)
Reported in https://community.openhab.org/t/oh3-creating-channels-in-mqtt-thing-not-possible/105637.

If the user is in another tab than "Config" of the thing details page, any attempt to save will fail because the config sheet is not present (due to a `v-if="currentTab === 'config'"`) so the attempt to validate the fields leads to an exception.
This makes sure that the config sheet is always in the DOM.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-27 20:19:04 +02:00
Yannick Schaus a350ede769
[Main UI] Cell Widgets (#317)
This introduces a new first-level class of widgets in the
standard library: cells.

They are heavily inspired by
https://developer.android.com/preview/features/device-control
and can either perform an action on a click/short tap, like
toggling a switch or perform something stateless like opening
a modal, navigating, running a rule...

It will also expand on a long tap (if the device doesn't support
touch, right-click is supported and there's a dedicated button)
If no short tap/click action is configured it will default to
expanding the cell unless there are no additional controls to show.

Ways to alter the design of the cell button (when not expanded)
and the expanded controls, eventually with personal widgets
configured in the developer tools, are also available.
This will allow the community to develop specialized widgets
for e.g. thermostats, weather forecasts etc.

A series of cells tailored to common scenarios (toggle +
dimmer or color picker) and maybe a few more are provided.
There's be a way to define the default cell widget for an
item using the "cellWidget" metadata namespace, in the same
manner as the existing default standalone and list item widgets.

The container, oh-cells, can be added to a block in a layout
page, instead of a regular row. It will automatically arrange
the cells, which have a fixed height and are all of the same
size.

Other unrelated changes introduced with this commit:
- Move the widget preview from the bottom sheet to the page
in metadata editor for default widgets.
- Add oh-trend to system library, replace trend component
with oh-trend in oh-label-card
- Show message when action not performed in editor
- Refactor config eval, allow expressions in objects
- Add Number in the evaluation context.
-  Process visible, visibleTo parameters separately
(this prevents evaluating the entire config if the
only parameter to evaluate is "visible" (in
generic-widget-component for non-f7 components).
- Describe parameters for trend lines
- Move oh-icon to system library

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-24 17:20:27 +02:00
Yannick Schaus 04becc6530
Add thing & rule status mixins (#348)
Include these mixins to have a consistent badge color & text
in all thing & rule representations (except on the details pages
headers where the status & status details are still displayed as-is).
Fixes #342.

Convert thing details page styles to Stylus + cleanups.
Tweak thing properties label lengths & overflow.
Fixes #347.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-09-24 11:21:33 +02:00
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