X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/89397b66ebc9b8ec82d806fe6a2af2bbefd01161..60f89f0b235ac6b2729166e4bf4c04da3b9c1670:/apps/workbench/app/assets/javascripts/users.js diff --git a/apps/workbench/app/assets/javascripts/users.js b/apps/workbench/app/assets/javascripts/users.js index c9c69a0a64..565ea9cbd6 100644 --- a/apps/workbench/app/assets/javascripts/users.js +++ b/apps/workbench/app/assets/javascripts/users.js @@ -1,8 +1,19 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + $(document). + on('notifications:recount', + function() { + var menu = $('.notification-menu'); + n = $('.notification', menu).not('.empty').length; + $('.notification-count', menu).html(n>0 ? n : ''); + }). on('ajax:success', 'form.new_authorized_key', function(e, data, status, xhr) { - $(e.target).parents('div.daxalert').fadeOut('slow', function() { - $('

Key added.

').hide().replaceAll(this).fadeIn('slow'); + $(e.target).parents('.notification').eq(0).fadeOut('slow', function() { + $('
  • SSH key added.
  • ').hide().replaceAll(this).fadeIn('slow'); + $(document).trigger('notifications:recount'); }); }). on('ajax:complete', 'form.new_authorized_key', @@ -22,7 +33,7 @@ $(document). if (response.errors) { error_div.html($('

    ').text(response.errors).html()); } else { - error_div.html('

    Sorry, request failed.'); + error_div.html('

    Sorry, request failed.

    '); } error_div.show(); $($('input[name=disable_element]', e.target).val()).