updated update_message.md, starting testing for merging 0.5 into master.

This commit is contained in:
Ross Mountjoy 2020-03-28 08:29:30 -04:00
parent 9f0c90128c
commit 32e94581af
4 changed files with 25 additions and 142 deletions

View File

@ -1,137 +0,0 @@
- [Main Settings](#main-settings)
* [Settings](#settings)
* [Users](#users)
* [Access Groups](#access-groups)
- [Cards](#cards)
* [Apps](#apps)
- [Data Source Platforms](#data-source-platforms)
#### Main Settings
##### Settings
This is the configuration entry for DashMachine's settings. DashMachine will not work if this is missing. As for all config entries, [Settings] can only appear once in the config. If you change the config.ini file, you either have to restart the container (or python script) or click the save button in the config section of settings for the config to be applied.
```ini
[Settings]
theme = light
accent = orange
background = None
roles = admin,user,public_user
home_access_groups = admin_only
settings_access_groups = admin_only
custom_app_title = DashMachine
sidebar_default = open
```
| Variable | Required | Description | Options |
|------------------------|----------|----------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Settings] | Yes | Config section name. | [Settings] |
| theme | Yes | UI theme. | light, dark |
| accent | Yes | UI accent color | orange, red, pink, purple, deepPurple, indigo, blue, lightBlue,cyan, teal, green, lightGreen, lime, yellow, amber, deepOrange, brown, grey, blueGrey |
| background | Yes | Background image for the UI | /static/images/backgrounds/yourpicture.png, external link to image, None, random |
| roles | No | User roles for access groups. | comma separated string, if not defined, this is set to 'admin,user,public_user'. Note: admin, user, public_user roles are required and will be added automatically if omitted. |
| home_access_groups | No | Define which access groups can access the /home page | Groups defined in your config. If not defined, default is admin_only |
| settings_access_groups | No | Define which access groups can access the /settings page | Groups defined in your config. If not defined, default is admin_only |
| custom_app_title | No | Change the title of the app for browser tabs | string |
| sidebar_default | No | Select the default state for the sidebar | open, closed, no_sidebar |
##### Users
Each user requires a config entry, and there must be at least one user in the config (otherwise the default user is added). Each user has a username, a role for configuring access groups, and a password. By default there is one user, named 'admin', with role 'admin' and password 'admin'. To change this user's name, password or role, just modify the config entry's variables and press save. To add a new user, add another user config entry UNDER all existing user config entries. A user with role 'admin' must appear first in the config. Do not change the order of users in the config once they have been defined, otherwise their passwords will not match the next time the config is applied. When users are removed from the config, they are deleted and their cached password is also deleted when the config is applied.
```ini
[admin]
role = admin
password = admin
confirm_password = admin
```
| Variable | Required | Description | Options |
|------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------|
| [Username] | Yes | The user's name for logging in | [Username] |
| role | Yes | The user's role. This is used for access groups and controlling who can view /home and /settings. There must be at least one 'admin' user, and it must be defined first in the config. Otherwise, the first user will be set to admin. | string |
| password | No | Add a password to this variable to change the password for this user. The password will be hashed, cached and removed from the config. When adding a new user, specify the password, otherwise 'admin' will be used. | string |
| confirm_password | No | When adding a new user or changing an existing user's password you must confirm the password in this variable | string |
| theme | No | Override the theme from Settings for this user | same as Settings |
| accent | No | Override the accent from Settings for this user | same as Settings |
| sidebar_default | No | Override the sidebar_default from Settings for this user | same as Settings |
##### Access Groups
You can create access groups to control what user roles can access parts of the ui. Access groups are just a collection of roles, and each user has an attribute 'role'. Each application can have an access group, if the user's role is not in the group, the app will be hidden. Also, in the settings entry you can specify `home_access_groups` and `settings_access_groups` to control which groups can access /home and /settings
```ini
[admin_only]
roles = admin
```
| Variable | Required | Description | Options |
|--------------|----------|--------------------------------------------------------------------------------|----------------------------------------------------------------------------------|
| [Group Name] | Yes | Name for access group. | [Group Name] |
| roles | Yes | A comma separated list of user roles allowed to view apps in this access group | Roles defined in your config. If not defined, defaults are admin and public_user |
> Say we wanted to create a limited user that still has a login, but can only access `/home` and certain apps we would first create a group:
>```ini
>[users]
>roles = admin, user
>```
>then we would change in the `[Settings]` entry:
>```ini
>home_access_groups = users
>```
>By default here, the `user` user could access `/home`, but would see no apps. To allow access, we would add to apps:
>```ini
>groups = users
>```
>Say we then wanted to allow some access for users without a login (`public_user`), we would add:
>```ini
>[public]
>roles = admin, user, public_user
>```
>then we would change in the `[Settings]` entry:
>```ini
>home_access_groups = public
>```
>By default here, the `public_user` user could access `/home`, but would see no apps. To allow access, we would add to apps:
>```ini
>groups = public
>```
>Its also important to note, when setting up roles in `[Settings]`, say we had roles set like this:
>```ini
>roles = my_people
>```
>Dashmachine will automatically add `admin,user,public_user`, so really you would have 4 roles: `my_people,admin,user,public_user`. Also, the `admin_only` group is required and added by default if omitted.
#### Cards
##### Apps
These entries are the cards that you see one the home page, as well as the sidenav. Entries must be unique. They are displayed in the order that they appear in config.ini
```ini
[App Name]
prefix = https://
url = your-website.com
icon = static/images/apps/default.png
sidebar_icon = static/images/apps/default.png
description = Example description
open_in = iframe
data_sources = None
tags = Example Tag
groups = admin_only
```
| Variable | Required | Description | Options |
|--------------|----------|-------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
| [App Name] | Yes | The name of your app. | [App Name] |
| prefix | Yes | The prefix for the app's url. | web prefix, e.g. http:// or https:// |
| url | Yes | The url for your app. | web url, e.g. myapp.com |
| open_in | Yes | open the app in the current tab, an iframe or a new tab | iframe, new_tab, this_tab |
| icon | Yes | Icon for the dashboard. | /static/images/icons/yourpicture.png, external link to image |
| sidebar_icon | No | Icon for the sidenav. | /static/images/icons/yourpicture.png, external link to image |
| description | No | A short description for the app. | string |
| data_sources | No | Data sources to be included on the app's card.*Note: you must have a data source set up in the config above this application entry. | comma separated string |
| tags | No | Optionally specify tags for organization on /home | comma separated string |
| groups | No | Optionally the access groups that can see this app. | comma separated string |
#### Data Source Platforms
DashMachine includes several different 'platforms' for displaying data on your dash applications. Platforms are essentially plugins. All data source config entries require the `platform` variable, which tells DashMachine which platform file in the platform folder to load. **Note:** you are able to load your own platform files by placing them in the platform folder and referencing them in the config. However currently they will be deleted if you update the application, if you would like to make them permanent, submit a pull request for it to be added by default!
> To add a data source to your app, add a data source config entry from one of the samples below
**above** the application entry in config.ini, then add the following to your app config entry:
`data_source = variable_name`

View File

@ -80,11 +80,13 @@ class Platform:
auth = None auth = None
# Send request # Send request
req = Request(self.method.upper(), self.resource, headers=self.headers, auth=auth) req = Request(
self.method.upper(), self.resource, headers=self.headers, auth=auth
)
prepped = req.prepare() prepped = req.prepare()
resp = s.send(prepped) resp = s.send(prepped)
return_codes = tuple([x.replace('x', '') for x in self.return_codes.split(',')]) return_codes = tuple([x.replace("x", "") for x in self.return_codes.split(",")])
if str(resp.status_code).startswith(return_codes): if str(resp.status_code).startswith(return_codes):
icon_class = "theme-success-text" icon_class = "theme-success-text"

View File

@ -84,12 +84,20 @@ class Platform:
if self.method.upper() == "GET": if self.method.upper() == "GET":
try: try:
value = get(self.resource, auth=auth, headers=self.headers, verify=verify).json() value = get(
self.resource, auth=auth, headers=self.headers, verify=verify
).json()
except Exception as e: except Exception as e:
value = f"{e}" value = f"{e}"
elif self.method.upper() == "POST": elif self.method.upper() == "POST":
payload = json.loads(self.payload.replace("'", '"')) payload = json.loads(self.payload.replace("'", '"'))
value = post(self.resource, data=payload, auth=auth, headers=self.headers, verify=verify) value = post(
self.resource,
data=payload,
auth=auth,
headers=self.headers,
verify=verify,
)
value_template = render_template_string(self.value_template, value=value) value_template = render_template_string(self.value_template, value=value)
return value_template return value_template

View File

@ -9,4 +9,14 @@
- added update message - added update message
- performance fixes - performance fixes
- added setting for hiding sidebar by default - added setting for hiding sidebar by default
- fixes #41 - broke up config readme into 3 tabs, and 3 .md files
- changed 'app templates' to 'card templates'
- added 'collection' cards
- added 'custom' cards
- added options for setting tag icons and sort position
- removed list view to focus on different card types on /home
- added ability to collapse/expand tags on /home
- added setting for having tags default to collapsed state
- created a public user view with no sidebar
- added sidebar default overrides for users
- fixes #57, #55, #45, #41, #40