diff options
Diffstat (limited to 'app/assets/javascripts/namespace_storage_limit_alert.js')
-rw-r--r-- | app/assets/javascripts/namespace_storage_limit_alert.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/assets/javascripts/namespace_storage_limit_alert.js b/app/assets/javascripts/namespace_storage_limit_alert.js new file mode 100644 index 00000000000..34ad93c127d --- /dev/null +++ b/app/assets/javascripts/namespace_storage_limit_alert.js @@ -0,0 +1,20 @@ +import Cookies from 'js-cookie'; + +const handleOnDismiss = ({ currentTarget }) => { + const { + dataset: { id, level }, + } = currentTarget; + + Cookies.set(`hide_storage_limit_alert_${id}_${level}`, true, { expires: 365 }); + + const notification = document.querySelector('.js-namespace-storage-alert'); + notification.parentNode.removeChild(notification); +}; + +export default () => { + const alert = document.querySelector('.js-namespace-storage-alert-dismiss'); + + if (alert) { + alert.addEventListener('click', handleOnDismiss); + } +}; |