From 17ac00d1f842cac5646933aa6dff88ed20165979 Mon Sep 17 00:00:00 2001 From: Giovani Candido Date: Sat, 29 Oct 2022 09:58:46 -0300 Subject: [PATCH 1/3] Allow default colors to be accessed without class instantiation --- .../static/celery_progress/celery_progress.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/celery_progress/static/celery_progress/celery_progress.js b/celery_progress/static/celery_progress/celery_progress.js index 0a93845..86ca04e 100644 --- a/celery_progress/static/celery_progress/celery_progress.js +++ b/celery_progress/static/celery_progress/celery_progress.js @@ -22,13 +22,7 @@ class CeleryProgressBar { this.onHttpError = options.onHttpError || this.onError; this.pollInterval = options.pollInterval || 500; // Other options - let barColorsDefault = { - success: '#76ce60', - error: '#dc4f63', - progress: '#68a9ef', - ignored: '#7a7a7a' - } - this.barColors = Object.assign({}, barColorsDefault, options.barColors); + this.barColors = Object.assign({}, getBarColorsDefault(), options.barColors); let defaultMessages = { waiting: 'Waiting for task to start...', @@ -169,6 +163,15 @@ class CeleryProgressBar { this.onHttpError(this.progressBarElement, this.progressBarMessageElement, "HTTP Code " + response.status, response); } } + + static getBarColorsDefault() { + return { + success: '#76ce60', + error: '#dc4f63', + progress: '#68a9ef', + ignored: '#7a7a7a' + } + } static initProgressBar(progressUrl, options) { const bar = new this(progressUrl, options); From c02df839b454d0c16a53bfa553a7b8e32293ffb8 Mon Sep 17 00:00:00 2001 From: Giovani Candido Date: Fri, 11 Nov 2022 11:20:09 -0300 Subject: [PATCH 2/3] Add missing semicolon Co-authored-by: Cory Zue --- celery_progress/static/celery_progress/celery_progress.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/celery_progress/static/celery_progress/celery_progress.js b/celery_progress/static/celery_progress/celery_progress.js index 86ca04e..51c84f5 100644 --- a/celery_progress/static/celery_progress/celery_progress.js +++ b/celery_progress/static/celery_progress/celery_progress.js @@ -170,7 +170,7 @@ class CeleryProgressBar { error: '#dc4f63', progress: '#68a9ef', ignored: '#7a7a7a' - } + }; } static initProgressBar(progressUrl, options) { From 3eaa7cb0706a68d3da452deca6c6862787693113 Mon Sep 17 00:00:00 2001 From: Giovani Candido Date: Fri, 11 Nov 2022 11:21:50 -0300 Subject: [PATCH 3/3] Add missing keyword Co-authored-by: Cory Zue --- celery_progress/static/celery_progress/celery_progress.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/celery_progress/static/celery_progress/celery_progress.js b/celery_progress/static/celery_progress/celery_progress.js index 51c84f5..0d957db 100644 --- a/celery_progress/static/celery_progress/celery_progress.js +++ b/celery_progress/static/celery_progress/celery_progress.js @@ -22,7 +22,7 @@ class CeleryProgressBar { this.onHttpError = options.onHttpError || this.onError; this.pollInterval = options.pollInterval || 500; // Other options - this.barColors = Object.assign({}, getBarColorsDefault(), options.barColors); + this.barColors = Object.assign({}, this.getBarColorsDefault(), options.barColors); let defaultMessages = { waiting: 'Waiting for task to start...',