1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 $(document).on('shown.bs.modal', '#add-repository-modal', function(event) {
6 $('input[type=text]', event.target).val('');
7 $('#add-repository-error', event.target).hide();
8 }).on('submit', '#add-repository-form', function(event) {
9 var $form = $(event.target),
10 $submit = $(':submit', $form),
11 $error = $('#add-repository-error', $form),
12 repo_owner_uuid = $('input[name="add_repo_owner_uuid"]', $form).val(),
13 repo_prefix = $('input[name="add_repo_prefix"]', $form).val(),
14 repo_basename = $('input[name="add_repo_basename"]', $form).val();
16 $submit.prop('disabled', true);
18 $.ajax('/repositories',
21 data: {repository: {owner_uuid: repo_owner_uuid,
22 name: repo_prefix + repo_basename}},
24 done(function(data, status, jqxhr) {
27 fail(function(jqxhr, status, error) {
28 var errlist = jqxhr.responseJSON.errors;
30 if (Array.isArray(errlist)) {
31 errmsg = errlist.join();
33 errmsg = ("The server returned an error when making " +
34 "this repository (status " + jqxhr.status +
35 ": " + errlist + ").");
39 $submit.prop('disabled', false);