Fix#888.
openHAB Cloud doesn't seem to support forwarding HTTP HEAD requests.
So do a GET /rest/sitemaps instead to determine whether the user operations are
allowed anonymously, which is a little bit of overhead but since it's only the _list_
of sitemaps it should be acceptable in most cases.
Signed-off-by: Yannick Schaus <github@schaus.net>
This commit activates the following rules and provides the necessary code changes:
- indent
- no-trailing-spaces
- quotes
- vue/html-indent
- vue/html-quotes
- vue/no-multi-spaces
Signed-off-by: Philipp Waller <1090452+philippwaller@users.noreply.github.com>
```
vue.esm.js?a026:628 [Vue warn]: Property or method "onPageAfterIn" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
```
Introduced by #867.
Signed-off-by: Boris Krivonog <boris.krivonog@inova.si>
Add a Node.JS script to generate or update Markdown documentation from
the definitions of components. Generate an initial set of pages.
Signed-off-by: Yannick Schaus <github@schaus.net>
Add a oh-chart widget to add charts to layout pages; change oh-chart-page to use it.
Add a oh-data-series component with the ability to add gauges representing a single value.
Upgrade ECharts to v5.0.1.
Also-by: Yannick Schaus <github@schaus.net>
Signed-off-by: Boris Krivonog <boris.krivonog@inova.si>
Don't save thing when coming back from the Code tab if it hasn't changed - fixes#618.
Disable editing controls if thing is not editable - fixes#570.
Disable editing of config parameters with readOnly enabled - fixes#756.
Signed-off-by: Yannick Schaus <github@schaus.net>
Use the API interface instead of fetch() to make the HTTP HEAD
request to determine whether the SSE are protected.
Fix custom auth header logic.
Change probe endpoint to /rest/sitemaps.
Signed-off-by: Yannick Schaus <github@schaus.net>
This brings a new number of improvements regarding auth:
- The SSE connections will be made using _event-source-polyfill_
which allows setting headers on the request, and setting
authorization headers or tokens as required has been added.
The main UI can now be used when the API is fully protected,
including the user operations like controlling items ("Implicit
user role for unauthenticated requests" disabled in Settings >
API Security). This closes#699.
We try to avoid the use of the polyfill if it's not needed, as the
native implementation is deemed better if it can be used. To
figure out whether that's the case, a `HTTP HEAD /rest/events`
is performed when setting the access token to determine if
that endpoint is secured - set the requireToken in case of a
401 response indicating it is.
- The UI now detects when the first /rest/ API calls fails with
a 401 Unauthorized error. This can happen when it's installed
as a standalone PWA ("Add to Home Screen" or "Install" in Chrome).
In that case, it will display a f7 login dialog and will also try
to use the Credentials API to store the passed credentials in
the browser, and retrieve them back to log in automatically the
next time. It will use these as Basic authentication credentials.
This prevents "empty screen" errors when using e.g.
myopenhab.org and the cloud credentials couldn't be passed.
The Basic credentials for proxy services can also be passed from
mobile with the following Javascript functions in the `OHApp`
object:
* `string getBasicCredentialsUsername()`
* `string getBasicCredentialsPassword()`
Also in that case, image handling in various parts of the UI has
to be modified to use blobs. This allows passing the credentials
if they're needed and known.
- Detects whether the API auth bundle is disabled (no /auth
endpoint), hides the authorize button and unlocks the admin menus.
Signed-off-by: Yannick Schaus <github@schaus.net>
Display links which are invalid (for instance, missing
thing or channel) and offer the option to remove them.
Cleanups.
Fixes#709.
Signed-off-by: Yannick Schaus <github@schaus.net>
This prevents a loop context from being shared among
multiple instances of the same widget.
To pass elements of the parent loop context to widgets,
use props with an expression when configuring the widget:
```
config:
prop1: =loop.i
```
Signed-off-by: Yannick Schaus <github@schaus.net>
If the region is not set it would default to Afghanistan (the
first entry). Allow specifying none.
Add placeholder to location input.
Signed-off-by: Yannick Schaus <github@schaus.net>