From 51758463103486c0fd763e460b5ac32175db5c8d Mon Sep 17 00:00:00 2001 From: Tiberiu Chibici Date: Fri, 24 Apr 2020 00:21:44 +0300 Subject: [PATCH] Implemented toast manager, moved job panel to the top, removed footer. --- .../static/YtManagerApp/css/style.css | 33 +++++++ .../static/YtManagerApp/css/style.css.map | 4 +- .../static/YtManagerApp/css/style.scss | 5 +- .../static/YtManagerApp/js/common.js | 4 + .../YtManagerApp/js/components/JobPanel.js | 14 --- .../js/components/ToastManager.js | 93 +++++++++++++++++++ .../templates/YtManagerApp/index.html | 9 -- .../templates/YtManagerApp/js/common.js | 8 -- .../YtManagerApp/master_default.html | 88 +++++++++--------- 9 files changed, 180 insertions(+), 78 deletions(-) create mode 100644 app/YtManagerApp/static/YtManagerApp/js/components/ToastManager.js diff --git a/app/YtManagerApp/static/YtManagerApp/css/style.css b/app/YtManagerApp/static/YtManagerApp/css/style.css index a473add..4e8a6ee 100644 --- a/app/YtManagerApp/static/YtManagerApp/css/style.css +++ b/app/YtManagerApp/static/YtManagerApp/css/style.css @@ -137,6 +137,39 @@ overflow-y: auto; flex: 1; } +#toast-wrapper { + position: fixed; + right: 2rem; + top: 2rem; + z-index: 1000; } + +.toast { + min-width: 15rem; + line-height: 1.5rem; } + .toast .typcn { + font-size: 1.5rem; } + .toast.bg-success { + background-color: rgba(134, 226, 155, 0.98) !important; } + .toast.bg-success .toast-header { + background-color: rgba(40, 167, 69, 0.75); + color: #f8f9fa; } + .toast.bg-success .toast-header > * { + color: #f8f9fa; } + .toast.bg-warning { + background-color: rgba(255, 231, 160, 0.98) !important; } + .toast.bg-warning .toast-header { + background-color: rgba(211, 158, 0, 0.75); + color: #f8f9fa; } + .toast.bg-warning .toast-header > * { + color: #f8f9fa; } + .toast.bg-danger { + background-color: rgba(243, 183, 189, 0.98) !important; } + .toast.bg-danger .toast-header { + background-color: rgba(220, 53, 69, 0.75); + color: #f8f9fa; } + .toast.bg-danger .toast-header > * { + color: #f8f9fa; } + #main_navbar { position: fixed; top: 0; diff --git a/app/YtManagerApp/static/YtManagerApp/css/style.css.map b/app/YtManagerApp/static/YtManagerApp/css/style.css.map index 6d30ccb..cc12a58 100644 --- a/app/YtManagerApp/static/YtManagerApp/css/style.css.map +++ b/app/YtManagerApp/static/YtManagerApp/css/style.css.map @@ -1,7 +1,7 @@ { "version": 3, -"mappings": "AAAA,KAAM;EAEF,MAAM,CAAC,QAAQ;EACf,QAAQ,CAAC,QAAQ;EACjB,QAAQ,CAAC,QAAQ;EACjB,MAAM,CAAC,QAAQ;EACf,KAAK,CAAC,QAAQ;EACd,QAAQ,CAAC,QAAQ;EACjB,QAAQ,CAAC,QAAQ;EACjB,OAAO,CAAC,QAAQ;EAChB,MAAM,CAAC,QAAQ;EACf,MAAM,CAAC,QAAQ;EACf,OAAO,CAAC,KAAK;EACb,MAAM,CAAC,QAAQ;EACf,WAAW,CAAC,QAAQ;EAGpB,SAAS,CAAC,QAAQ;EAClB,WAAW,CAAC,QAAQ;EACpB,SAAS,CAAC,QAAQ;EAClB,MAAM,CAAC,QAAQ;EACf,SAAS,CAAC,QAAQ;EAClB,QAAQ,CAAC,QAAQ;EACjB,OAAO,CAAC,QAAQ;EAChB,MAAM,CAAC,QAAQ;EAGf,eAAe,CAAC,EAAE;EAClB,eAAe,CAAC,MAAM;EACtB,eAAe,CAAC,MAAM;EACtB,eAAe,CAAC,MAAM;EACtB,eAAe,CAAC,OAAO;EACvB,wBAAwB,CAAC,sLAAsL;EAC/M,uBAAuB,CAAC,qFAAqF;;AAGjH,mBAAoB;EAChB,SAAS,CAAC,QAAQ;EAClB,WAAW,CAAC,QAAQ;EACpB,SAAS,CAAC,QAAQ;EAClB,MAAM,CAAC,QAAQ;EACf,SAAS,CAAC,QAAQ;EAClB,QAAQ,CAAC,QAAQ;EACjB,OAAO,CAAC,QAAQ;EAChB,MAAM,CAAC,QAAQ;;ACzBnB,uBAAuB;AACvB,kBAAmB;EAlBf,OAAO,EAAE,YAAY;EACrB,KAAK,EAAE,IA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EAAE,MAAM;EAClB,WAAW,EAAE,IAAI", +"sources": ["lib/_theme.scss","lib/_loading.scss","lib/_hamburger.scss","lib/_toast.scss","lib/_variables.scss","style.scss"], "names": [], "file": "style.css" } \ No newline at end of file diff --git a/app/YtManagerApp/static/YtManagerApp/css/style.scss b/app/YtManagerApp/static/YtManagerApp/css/style.scss index 430b197..cfca912 100644 --- a/app/YtManagerApp/static/YtManagerApp/css/style.scss +++ b/app/YtManagerApp/static/YtManagerApp/css/style.scss @@ -1,9 +1,8 @@ @import "lib/theme"; @import "lib/loading"; @import "lib/hamburger"; - -$accent-color: #007bff; -$success-color: #28a745; +@import "lib/toast"; +@import "lib/variables"; #main_navbar { position: fixed; diff --git a/app/YtManagerApp/static/YtManagerApp/js/common.js b/app/YtManagerApp/static/YtManagerApp/js/common.js index 616c9a6..b3f52c8 100644 --- a/app/YtManagerApp/static/YtManagerApp/js/common.js +++ b/app/YtManagerApp/static/YtManagerApp/js/common.js @@ -1,5 +1,6 @@ import {JobPanel} from "./components/JobPanel.js"; import {AjaxModal} from "./components/AjaxModal.js"; +import {ToastManager} from "./components/ToastManager.js"; // Document loaded jQuery(function() { @@ -24,5 +25,8 @@ jQuery(function() { } modal.loadAndShow(); }); + + // Initialize toasts + window.ytsm_ToastManager = new ToastManager($('#toast-wrapper')); }); diff --git a/app/YtManagerApp/static/YtManagerApp/js/components/JobPanel.js b/app/YtManagerApp/static/YtManagerApp/js/components/JobPanel.js index 082e47c..4aa9bb8 100644 --- a/app/YtManagerApp/static/YtManagerApp/js/components/JobPanel.js +++ b/app/YtManagerApp/static/YtManagerApp/js/components/JobPanel.js @@ -101,7 +101,6 @@ export class JobPanel _updateInternal(data) { this._updateJobs(data); - this._updateStatusBar(); this._updateProgressBar(); this._updateTitle(); @@ -164,19 +163,6 @@ export class JobPanel } } - _updateStatusBar() - { - let text = ""; - - if (this.jobs.length === 1) { - text = `${this.jobs[0].description} | ${this.jobs[0].message}`; - } - else if (this.jobs.length > 1) { - text = `Running ${this.jobs.length} jobs...`; - } - $('#status-message').text(text); - } - _updateProgressBar() { if (this.jobs.length > 0) { diff --git a/app/YtManagerApp/static/YtManagerApp/js/components/ToastManager.js b/app/YtManagerApp/static/YtManagerApp/js/components/ToastManager.js new file mode 100644 index 0000000..7f3696f --- /dev/null +++ b/app/YtManagerApp/static/YtManagerApp/js/components/ToastManager.js @@ -0,0 +1,93 @@ +export class ToastManager { + toastWrapper = null; + + constructor(toastWrapper) { + this.toastWrapper = toastWrapper; + } + + /** + * Displays a toast message + * @param caption Title of the toast + * @param options An object containing the following attributes. Title and message are mandatory: + * - body: the main content + * - icon: a typcn class which will be used as an icon + * - cssClass: additional css classes to apply to the toast (i.e. toast-success, toast-fail) + * - duration: duration in milliseconds, defaults to 4000 + */ + toast(caption, options) { + let body = ''; + if (options.hasOwnProperty('body')) { + body = `
${options.body}
`; + } + + let icon = ''; + if (options.hasOwnProperty('icon')) { + icon = ``; + } + + let cssClass = ''; + if (options.hasOwnProperty('cssClass')) { + cssClass = options.cssClass; + } + + let duration = 4000; + if (options.hasOwnProperty('duration')) { + duration = options.duration; + } + + // Generate DOM + let elem = $(` + `); + + elem.appendTo(this.toastWrapper); + elem.toast({ + animation: true, + autoHide: true, + delay: duration + }); + elem.on('hidden.bs.toast', function () { + elem.remove(); + }); + elem.toast('show'); + } + + success(caption, options = {}) { + if (!options.hasOwnProperty('icon')) { + options.icon = 'typcn-tick'; + } + if (!options.hasOwnProperty('cssClass')) { + options.cssClass = 'bg-success' + } + this.toast(caption, options); + } + + warning(caption, options = {}) { + if (!options.hasOwnProperty('icon')) { + options.icon = 'typcn-warning'; + } + if (!options.hasOwnProperty('cssClass')) { + options.cssClass = 'bg-warning' + } + this.toast(caption, options); + } + + error(caption, options = {}) { + if (!options.hasOwnProperty('icon')) { + options.icon = 'typcn-cancel'; + } + if (!options.hasOwnProperty('cssClass')) { + options.cssClass = 'bg-danger' + } + this.toast(caption, options); + } +} \ No newline at end of file diff --git a/app/YtManagerApp/templates/YtManagerApp/index.html b/app/YtManagerApp/templates/YtManagerApp/index.html index c18de29..108a71c 100644 --- a/app/YtManagerApp/templates/YtManagerApp/index.html +++ b/app/YtManagerApp/templates/YtManagerApp/index.html @@ -15,15 +15,6 @@ {% block body %} - - {% include 'YtManagerApp/controls/setup_errors_banner.html' %}
diff --git a/app/YtManagerApp/templates/YtManagerApp/js/common.js b/app/YtManagerApp/templates/YtManagerApp/js/common.js index df380c3..3f9f496 100644 --- a/app/YtManagerApp/templates/YtManagerApp/js/common.js +++ b/app/YtManagerApp/templates/YtManagerApp/js/common.js @@ -1,11 +1,3 @@ -function zeroFill(number, width) { - width -= number.toString().length; - if ( width > 0 ) { - return new Array( width + (/\./.test( number ) ? 2 : 1) ).join( '0' ) + number; - } - return number + ""; // always return a string -} - function syncNow() { $.post("{% url 'ajax_action_sync_now' %}", { csrfmiddlewaretoken: '{{ csrf_token }}' diff --git a/app/YtManagerApp/templates/YtManagerApp/master_default.html b/app/YtManagerApp/templates/YtManagerApp/master_default.html index 24642b9..c93f31b 100644 --- a/app/YtManagerApp/templates/YtManagerApp/master_default.html +++ b/app/YtManagerApp/templates/YtManagerApp/master_default.html @@ -44,6 +44,41 @@ Register {% endif %} + {% else %} + {# The job panel #} + {% endif %} @@ -72,53 +107,22 @@
{% endif %} +
+ + +
{% block body %} {% endblock %}
- -