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>
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>
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>
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>
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>
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>
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>
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>
* [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>
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>
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>
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>
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>
- 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>
* [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>
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>
* 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>
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_r426005622Fixes#290.
Signed-off-by: Yannick Schaus <github@schaus.net>
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>
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>
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>