diff options
| author | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-05-17 01:31:56 +0300 |
|---|---|---|
| committer | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-05-17 01:31:56 +0300 |
| commit | 2d16eabc6e751e6233154a082bb6ccd2f816ec41 (patch) | |
| tree | c3ed0b35d3ad944e2fd722a4b000e3a598020bf9 /web/assets | |
| parent | be50be75fe56a617713efe1cc56de3a14ec7e0c9 (diff) | |
[feature] interactive deplete soon
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web/assets')
| -rw-r--r-- | web/assets/js/util/common.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/web/assets/js/util/common.js b/web/assets/js/util/common.js index a695f081..20df4f4e 100644 --- a/web/assets/js/util/common.js +++ b/web/assets/js/util/common.js @@ -91,6 +91,21 @@ function setCookie(cname, cvalue, exdays) { document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'; } +function usageColor(data, threshold, total) { + switch (true) { + case data === null: + return 'blue'; + case total <= 0: + return 'blue'; + case data < total - threshold: + return 'cyan'; + case data < total: + return 'orange'; + default: + return 'red'; + } +} + function doAllItemsExist(array1, array2) { for (let i = 0; i < array1.length; i++) { if (!array2.includes(array1[i])) { @@ -98,4 +113,4 @@ function doAllItemsExist(array1, array2) { } } return true; -}
\ No newline at end of file +} |
