diff --git a/swh/web/assets/src/bundles/save/index.js b/swh/web/assets/src/bundles/save/index.js --- a/swh/web/assets/src/bundles/save/index.js +++ b/swh/web/assets/src/bundles/save/index.js @@ -133,22 +133,26 @@ let saveRequestAcceptedAlert = htmlAlert( 'success', - 'The "save code now" request has been accepted and will be processed as soon as possible.' + 'The "save code now" request has been accepted and will be processed as soon as possible.', + true ); let saveRequestPendingAlert = htmlAlert( 'warning', - 'The "save code now" request has been put in pending state and may be accepted for processing after manual review.' + 'The "save code now" request has been put in pending state and may be accepted for processing after manual review.', + true ); let saveRequestRateLimitedAlert = htmlAlert( 'danger', - 'The rate limit for "save code now" requests has been reached. Please try again later.' + 'The rate limit for "save code now" requests has been reached. Please try again later.', + true ); let saveRequestUnknownErrorAlert = htmlAlert( 'danger', - 'An unexpected error happened when submitting the "save code now request".' + 'An unexpected error happened when submitting the "save code now request".', + true ); $('#swh-save-origin-form').submit(event => { @@ -247,22 +251,26 @@ let newSnapshotRequestAcceptedAlert = htmlAlert( 'success', - 'The "take new snapshot" request has been accepted and will be processed as soon as possible.' + 'The "take new snapshot" request has been accepted and will be processed as soon as possible.', + true ); let newSnapshotRequestPendingAlert = htmlAlert( 'warning', - 'The "take new snapshot" request has been put in pending state and may be accepted for processing after manual review.' + 'The "take new snapshot" request has been put in pending state and may be accepted for processing after manual review.', + true ); let newSnapshotRequestRateLimitAlert = htmlAlert( 'danger', - 'The rate limit for "take new snapshot" requests has been reached. Please try again later.' + 'The rate limit for "take new snapshot" requests has been reached. Please try again later.', + true ); let newSnapshotRequestUnknownErrorAlert = htmlAlert( 'danger', - 'An unexpected error happened when submitting the "save code now request".' + 'An unexpected error happened when submitting the "save code now request".', + true ); $(document).ready(() => { @@ -279,7 +287,7 @@ (statusCode, errorData) => { $('#swh-take-new-snapshot-request-status').css('color', 'red'); if (statusCode === 403) { - const errorAlert = htmlAlert('danger', `Error: ${errorData['detail']}`); + const errorAlert = htmlAlert('danger', `Error: ${errorData['detail']}`, true); $('#swh-take-new-snapshot-request-status').html(errorAlert); } else if (statusCode === 429) { $('#swh-take-new-snapshot-request-status').html(newSnapshotRequestRateLimitAlert); diff --git a/swh/web/templates/misc/origin-save.html b/swh/web/templates/misc/origin-save.html --- a/swh/web/templates/misc/origin-save.html +++ b/swh/web/templates/misc/origin-save.html @@ -22,17 +22,50 @@ {% block content %} +<p class="mt-3"> + You can contribute to extend the content of the Software Heritage archive by submitting an origin + save request. To do so, fill the required info in the form below: +</p> + +<form id="swh-save-origin-form" class="needs-validation" novalidate> + {% csrf_token %} + <div class="form-row"> + <div class="col-md-1"></div> + <div class="form-group col-md-2"> + <label for="swh-input-visit-type">Visit type</label> + <select id="swh-input-visit-type" class="form-control" required> + {% comment %} <option selected value="">Choose...</option> {% endcomment %} + </select> + <div class="invalid-feedback">The visit type must be specified</div> + </div> + <div class="form-group col-md-6"> + <label for="swh-input-origin-url">Origin url</label> + <input type="text" class="form-control" id="swh-input-origin-url" oninput="swh.save.validateSaveOriginUrl(this)" required> + <div class="invalid-feedback">The origin url is not valid or does not reference a code repository</div> + </div> + <div class="col-md-2"> + <div class="form-group"> + <label for="swh-input-origin-save-submit">​</label> + <button type="submit" id="swh-input-origin-save-submit" class="btn btn-default btn-block">Submit</button> + </div> + </div> + </div> +</form> +<div class="swh-processing-save-request text-center" style="display: none;"> + <img src="{% static 'img/swh-spinner.gif' %}"> + <p>Processing "save code now" request ...</p> +</div> +<div id="swh-origin-save-request-status"> +</div> + <ul class="nav nav-tabs" style="padding-left: 5px;"> - <li class="nav-item"><a class="nav-link active" data-toggle="tab" id="swh-origin-save-request-create-tab" href="#swh-origin-save-requests-create">Create save request</a></li> + <li class="nav-item"><a class="nav-link active" data-toggle="tab" id="swh-origin-save-request-create-tab" href="#swh-origin-save-requests-create">Help</a></li> <li class="nav-item"><a class="nav-link" data-toggle="tab" id="swh-origin-save-requests-list-tab" href="#swh-origin-save-requests-list">Browse save requests</a></li> </ul> <div class="tab-content"> <div id="swh-origin-save-requests-create" class="tab-pane active"> - <p class="mt-3"> - You can contribute to extend the content of the Software Heritage archive by submitting an origin - save request. To do so, fill the required info in the form below: - </p> + <p style="margin-top: 1rem;">A "Save code now" request takes the following parameters:</p> <ul> <li><b>Visit type:</b> the type of version control system the software origin is using. Currently, the supported types are: @@ -64,36 +97,7 @@ Once a save request has been accepted, you can follow its current status in the <a id="swh-show-origin-save-requests-list" href="#swh-origin-save-requests-list">submitted save requests list</a>. </p> - <form id="swh-save-origin-form" class="needs-validation" novalidate> - {% csrf_token %} - <div class="form-row"> - <div class="col-md-1"></div> - <div class="form-group col-md-2"> - <label for="swh-input-visit-type">Visit type</label> - <select id="swh-input-visit-type" class="form-control" required> - {% comment %} <option selected value="">Choose...</option> {% endcomment %} - </select> - <div class="invalid-feedback">The visit type must be specified</div> - </div> - <div class="form-group col-md-6"> - <label for="swh-input-origin-url">Origin url</label> - <input type="text" class="form-control" id="swh-input-origin-url" oninput="swh.save.validateSaveOriginUrl(this)" required> - <div class="invalid-feedback">The origin url is not valid or does not reference a code repository</div> - </div> - <div class="col-md-2"> - <div class="form-group"> - <label for="swh-input-origin-save-submit">​</label> - <button type="submit" id="swh-input-origin-save-submit" class="btn btn-default btn-block">Submit</button> - </div> - </div> - </div> - </form> - <div class="swh-processing-save-request text-center" style="display: none;"> - <img src="{% static 'img/swh-spinner.gif' %}"> - <p>Processing "save code now" request ...</p> - </div> - <div id="swh-origin-save-request-status"> - </div> + </div> <div id="swh-origin-save-requests-list" class="tab-pane mt-3">