mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
frontend: Add create-bot loading indicator.
The former "the-bot-is-being-created" indicator was useless, since it only edited the value attribute of the "create-bot" button; that attribute only sets the text of a button when it is initially created. This commit replaces the old code with a spinning loading indicator, like the one used for editing bots.
This commit is contained in:
@@ -135,6 +135,7 @@ exports.set_up = function () {
|
||||
var interface_type = $('#create_interface_type').val();
|
||||
var service_name = $('#select_service_name :selected').val();
|
||||
var formData = new FormData();
|
||||
var spinner = $('.create_bot_spinner');
|
||||
|
||||
formData.append('csrfmiddlewaretoken', csrf_token);
|
||||
formData.append('bot_type', bot_type);
|
||||
@@ -156,7 +157,7 @@ exports.set_up = function () {
|
||||
jQuery.each($('#bot_avatar_file_input')[0].files, function (i, file) {
|
||||
formData.append('file-'+i, file);
|
||||
});
|
||||
$('#create_bot_button').val('Adding bot...').prop('disabled', true);
|
||||
loading.make_indicator(spinner, {text: i18n.t('Creating bot')});
|
||||
channel.post({
|
||||
url: '/json/bots',
|
||||
data: formData,
|
||||
@@ -186,7 +187,7 @@ exports.set_up = function () {
|
||||
$('#bot_table_error').text(JSON.parse(xhr.responseText).msg).show();
|
||||
},
|
||||
complete: function () {
|
||||
$('#create_bot_button').val('Create bot').prop('disabled', false);
|
||||
loading.destroy_indicator(spinner);
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
<button type="submit" class="button white rounded sea-green" id="create_bot_button">
|
||||
{{t 'Create bot' }}
|
||||
</button>
|
||||
<div class="create_bot_spinner"></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user