Allow to create new ECMAScript-based scripts with a
Blockly editor.
The undocumented "blockSource" configuration parameter
is added to the script action module and will trigger
the display of the Blockly editor instead of the code
editor if present.
3 openHAB-related blocks have been added to the standard
toolbox: get item state, send command, print. More will be
added later.
Allow to switch a application/javascript script to Blockly
if it is empty - or back to raw code editing if the
Javascript generated by Blockly is empty.
Switch between code preview (read-only) & Blockly
with a FAB button, or Ctrl-B on the keyboard.
Signed-off-by: Yannick Schaus <github@schaus.net>
Change equipment icon (to be different than the one for things)
Change layouts of item stats in semantic cards
Fix Equipment tab view title
Change labels during script creation, generate UID
Signed-off-by: Yannick Schaus <github@schaus.net>
Fix bug with cards in the home page's Locations tab
not appearing when there were non-specialized
equipment.
Add a card for non-specialized equipment in the
Equipment tab.
Rename "Equipments" to Equipment, where shown to
the user (#438) - followup PR to do for the references
in the code.
Signed-off-by: Yannick Schaus <github@schaus.net>
The variables map was not initialized in the overview
page's context, so attempting to set variables in it
resulted in an error.
Signed-off-by: Yannick Schaus <github@schaus.net>
When switching tabs in channels, things, inbox, pages
list, the searchbar.clear() function refocuses the
searchbar which brings up a virtual keyboard on mobile
and/or a backdrop or iOS. Since there's apparently no
way to prevent this behavior, do it only when there's
a value for the searchbar's filter.
Signed-off-by: Yannick Schaus <github@schaus.net>
This adds "Scripts" as a top-level object. Scripts are regular
rules, tagged "Script", without triggers or conditions and
having only a single action module with the id "script".
The main settings menu has been modified to group "Rules",
"Scripts" and "Schedule" under a new "Automation" group.
"Configuration & Automation" has been renamed to "Configuration".
Scripts can be added and edited in a dedicated, full-screen
list and editor saving the hassle of having to configure
modules manually.
The new script editor is also used on the "shortcut" button of
regular rules' script actions & conditions. During script
editing, several keyboard shortcuts are available:
- Ctrl-D disables or enable the rule;
- Ctrl-R runs the rule - but saves it first;
- Ctrl-S saves the rule.
The script editor now has support for C-like languages (the
DSL language is automatically mapped to text/x-java) and
Groovy.
When editing ECMAScript, a special Tern plugin will offer
item names for completion when the cursor is in these
positions (repesented by `|`):
- `ir.getItem("|")`
- `itemRegistry.getItem("|")`
- `events.postUpdate("|")`
- `events.sendCommand("|")`
Signed-off-by: Yannick Schaus <github@schaus.net>
- fix#472 - icons in cells
- fix#471 - tabbed pages broken as a result of #452
- fix#468 - display multiple text parameters without options as textarea
- fix#464 - allow dashes in thing UIDs
- fix#463 - reapply filter when changing grouping mode in thing, inbox, pages lists
- fix#462 - wrong link when editing custom metadata from model page
- fix#459 - disable min/max checks for number parameter when there are options present
- fix#421 - remove diacritics instead of stripping accented characters in suggested new item names
- fix#413 - prevent linking to a non-editable item, unlinking from non-editable items
- fix#382 - (No profile) option not selected when editing link
Signed-off-by: Yannick Schaus <github@schaus.net>
Only update thing statusInfo fields which change when
receiving a status update through SSE in the thing list.
Could help with #439.
Show tooltip with the status description when howering
over the status badge.
Closes#414.
Signed-off-by: Yannick Schaus <github@schaus.net>
Config parameters with options don't have to be validated;
they normally are always valid - no empty option is
presented when a value is required etc.
The introduction of validation in #431 broke the control
when options are presented "inline".
See https://github.com/openhab/openhab-core/issues/1763
Signed-off-by: Yannick Schaus <github@schaus.net>
Without this configuration there are Spotless issues with line endings on Windows.
See: openhab/openhab-addons#8712
Signed-off-by: Wouter Born <github@maindrain.net>
Mandating the user to start the scan manually and allowing
them to stop helps keeping the list static, so that the
"add manually" section can be used reliably.
Signed-off-by: Yannick Schaus <github@schaus.net>
This is the only page where all bindings are shown, including
those not sideloaded and not coming from features/the distro.
Closes#386.
Signed-off-by: Yannick Schaus <github@schaus.net>
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>
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>
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>
This prevents infinite loops and other side effects.
Add an option to explicitely retrigger another autocompletion.
Signed-off-by: Yannick Schaus <github@schaus.net>
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>
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>
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>
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>
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>
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>