Commit 93c72ea1 authored by Candy Tsai's avatar Candy Tsai

update UI

parent 647690e1
Pipeline #48473 passed with stage
in 10 minutes and 6 seconds
......@@ -23,25 +23,35 @@
<label for="package">Package Name</label>
<input class="form-control" id="package" name="package">
</div>
<button id="submit" type="submit" class="btn btn-default">Submit</button>
<button type="button" id="submit" data-loading-text="Submitting..." class="btn btn-default" autocomplete="off">
Submit
</button>
</div>
<% content_for :javascript do %>
<script>
$('#submit').on('click', function () {
$this = $(this);
$this.prop('disabled', true);
$btn = $(this).button('loading');
const suite = $('#suite').val();
const arch = $('#arch').val();
const name = $('#package').val();
$.post(`/api/v1/test/${suite}/${arch}/${name}`)
.done(() => {
alert(`submit test ${suite}/${arch}/${name} success, will redirect to home`);
window.location.replace('/');
$('#self-test').prepend(
`<div class="alert alert-success" role="alert">submit test ${suite}/${arch}/${name} success</div>`
);
})
.fail(() => {
alert(`submit test ${suite}/${arch}/${name} failed, please try again`);
$this.prop('disabled', false);
$('#self-test').prepend(
`<div class="alert alert-danger" role="alert">submit test ${suite}/${arch}/${name} failed, please try again</div>`
);
})
.always(() => {
$('.alert').delay(4000).slideUp(200, function () {
$(this).alert('close');
});
$btn.button('reset');
})
})
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment