From 1240664303d74d5d6cd81d2cebb80b3c1a534637 Mon Sep 17 00:00:00 2001 From: Ross Mountjoy Date: Thu, 19 Mar 2020 16:30:44 -0400 Subject: [PATCH] fixed #16, #10 and some ui fixes --- config_readme.md | 2 +- dashmachine/platform/rest.py | 18 +++++++++--------- dashmachine/sources.py | 1 - dashmachine/static/css/global/dashmachine.css | 4 ++++ dashmachine/static/js/main/home.js | 2 ++ dashmachine/templates/main/macros.html | 2 +- .../templates/settings_system/settings.html | 6 +++--- dashmachine/version.py | 2 +- 8 files changed, 21 insertions(+), 16 deletions(-) diff --git a/config_readme.md b/config_readme.md index 56f3736..29fb4f2 100644 --- a/config_readme.md +++ b/config_readme.md @@ -50,7 +50,7 @@ groups = admin_only | 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 | No | Icon for the dashboard. | /static/images/icons/yourpicture.png, external link to image | +| 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 | diff --git a/dashmachine/platform/rest.py b/dashmachine/platform/rest.py index 372617b..b8b914a 100644 --- a/dashmachine/platform/rest.py +++ b/dashmachine/platform/rest.py @@ -64,21 +64,21 @@ class Platform: self.authentication = None def process(self): + if self.authentication: + if self.authentication.lower() == "digest": + auth = HTTPDigestAuth(self.username, self.password) + else: + auth = HTTPBasicAuth(self.username, self.password) + else: + auth = None + if self.method.upper() == "GET": try: - value = get(self.resource).json() + value = get(self.resource, auth=auth).json() except Exception as e: value = f"{e}" elif self.method.upper() == "POST": - if self.authentication: - if self.authentication.lower() == "digest": - auth = HTTPDigestAuth(self.username, self.password) - else: - auth = HTTPBasicAuth(self.username, self.password) - else: - auth = None - payload = json.loads(self.payload.replace("'", '"')) value = post(self.resource, data=payload, auth=auth) value_template = render_template_string(self.value_template, value=value) diff --git a/dashmachine/sources.py b/dashmachine/sources.py index 4522931..db44cc1 100644 --- a/dashmachine/sources.py +++ b/dashmachine/sources.py @@ -87,7 +87,6 @@ def context_processor(): tags_form = TagsForm() tags_form.tags.choices += [(tag, tag) for tag in tags] - print(tags_form.tags.choices) settings = Settings.query.first() if settings.background == "random": if len(os.listdir(backgrounds_images_folder)) < 1: diff --git a/dashmachine/static/css/global/dashmachine.css b/dashmachine/static/css/global/dashmachine.css index 7eb485b..e29e79b 100644 --- a/dashmachine/static/css/global/dashmachine.css +++ b/dashmachine/static/css/global/dashmachine.css @@ -36,6 +36,10 @@ overflow-y: scroll !important; overflow-x: hidden !important; } +.scrollbar-x { + overflow-y: scroll !important; + overflow-x: scroll !important; +} /* ELEMENT STLYES */ body { diff --git a/dashmachine/static/js/main/home.js b/dashmachine/static/js/main/home.js index 7296550..9996269 100644 --- a/dashmachine/static/js/main/home.js +++ b/dashmachine/static/js/main/home.js @@ -32,6 +32,7 @@ $( document ).ready(function() { $(".data-source-container").each(function(e) { var el = $(this); $.ajax({ + async: true, url: el.attr('data-url'), type: 'GET', data: {id: el.attr('data-id')}, @@ -52,4 +53,5 @@ $( document ).ready(function() { } }); }); + }); \ No newline at end of file diff --git a/dashmachine/templates/main/macros.html b/dashmachine/templates/main/macros.html index 7d45ba8..435a25c 100644 --- a/dashmachine/templates/main/macros.html +++ b/dashmachine/templates/main/macros.html @@ -39,7 +39,7 @@
{{ app.name }}
{% if app.description %} - {{ app.description }} + {{ app.description }} {% else %}