mirror of https://github.com/sipwise/repoapi.git
* don't use any info from Projects, just from ReleaseConfig Change-Id: I703f14d9ae0e3781adf1fb8f47147ee24c3c01a0pull/7/head
parent
b1d13db756
commit
24dd8bcfbd
@ -0,0 +1,70 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
$( "button.hotfix" ).click( function( e ) {
|
||||
|
||||
// don't send the form
|
||||
e.preventDefault();
|
||||
var button = $( this );
|
||||
var id = button.attr( "id" ).replace( "hotfix_", "" );
|
||||
var repo = id;
|
||||
var span = $( "span#hotfix_error_" + id );
|
||||
var links = $( "#links_" + id );
|
||||
var push = $( "select#push_" + id + " option:selected" ).val();
|
||||
var empty = $( "input#empty_" + id ).prop( "checked" );
|
||||
|
||||
$.ajax( {
|
||||
url: repo + "/",
|
||||
type: "POST",
|
||||
data: JSON.stringify( { push: push, empty: empty } ),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: successFunc,
|
||||
error: errorFunc,
|
||||
/* eslint-disable-next-line no-undef */ // at csrf.js
|
||||
beforeSend: csrftokenFunc
|
||||
} );
|
||||
|
||||
button.attr( "disabled", "disabled" );
|
||||
span.html( "processing" );
|
||||
span.show();
|
||||
links.addClass( "hidden" );
|
||||
|
||||
function successFunc( data, _status ) {
|
||||
span.html( "" );
|
||||
$( "#link_done_" + id ).attr( "href", data.urls[ 0 ] );
|
||||
$( "#link_latest_" + id ).attr( "href", data.urls[ 1 ] );
|
||||
links.removeClass( "hidden" );
|
||||
button.removeAttr( "disabled" );
|
||||
}
|
||||
|
||||
function errorFunc( _jqXHR, _status, error ) {
|
||||
span.html( error );
|
||||
button.removeAttr( "disabled" );
|
||||
}
|
||||
} );
|
||||
|
||||
$( "td.version > select" ).change( function() {
|
||||
var id = $( this ).attr( "id" ).replace( "version_", "" );
|
||||
var version = $( this ).val();
|
||||
var button = $( "button#hotfix_" + id );
|
||||
var span = $( "span#hotfix_error_" + id );
|
||||
var links = $( "#links_" + id );
|
||||
|
||||
if ( version.match( /^branch\/mr[0-9]+\.[0-9]+\.[0-9]+$/ ) ) {
|
||||
button.html( "Release hotfix" );
|
||||
button.removeAttr( "disabled" );
|
||||
} else {
|
||||
button.html( "Select branch to hotfix" );
|
||||
button.attr( "disabled", "disabled" );
|
||||
}
|
||||
span.html( "" );
|
||||
links.addClass( "hidden" );
|
||||
} );
|
||||
|
||||
$( document ).ready( function() {
|
||||
$( "td.version > select option[value^=\"branch/mr\"]" ).each( function() {
|
||||
$( this ).change();
|
||||
} );
|
||||
} );
|
@ -0,0 +1,66 @@
|
||||
{% extends "release_dashboard/base.html" %}
|
||||
{% load static %}
|
||||
{% block title %}Release Dashboard{% endblock %}
|
||||
{% block navlist %}
|
||||
<li><a href="{% url 'release_dashboard:index'%}">Release Dashboard</a></li>
|
||||
<li><a href="{% url 'release_dashboard:build_index'%}">Build Release</a></li>
|
||||
<li><a href="{% url 'release_dashboard:build_release' config.release %}">{{ config.release }}</a></li>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Project</th>
|
||||
<th>Version</th>
|
||||
<th>Push</th>
|
||||
<th>Empty</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<form class="form-inline">{% csrf_token %}</form>
|
||||
{% for p in config.projects %}
|
||||
<tr class="repo">
|
||||
<th><label for="version_{{ p }}">{{ p }}</label></th>
|
||||
<td class="version">
|
||||
<select class="form-control" id="version_{{ p }}" name="version_{{ p }}">
|
||||
<option value="ignore">ignore</option>
|
||||
<option value="branch/{{ config.branch }}">branch/{{ config.branch }}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" id="push_{{ p }}">
|
||||
<option value="yes" selected="selected">yes</option>
|
||||
<option value="no">no</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input id="empty_{{ p }}" type="checkbox">
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" id="hotfix_{{ p }}" class="btn btn-warning hotfix" disabled="disabled">Select branch to hotfix</button>
|
||||
</td>
|
||||
<td>
|
||||
<span class="text-danger" id="hotfix_error_{{ p }}"></span>
|
||||
<div id="links_{{ p }}" class="hidden">
|
||||
<div class="btn-group btn-group-sm" role="group" aria-label="grp1">
|
||||
<a class="btn btn-default btn-success" type="button" role="group" id="link_done_{{ p }}">Done</a>
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm" role="group" aria-label="grp2">
|
||||
<a class="btn btn-default btn-info" type="button" role="group" id="link_latest_{{ p }}">latest Build</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block extrajs %}
|
||||
<script src="{% static 'release_dashboard/js/csrf.js' %}"></script>
|
||||
<script src="{% static 'release_dashboard/js/hotfix_release.js' %}"></script>
|
||||
{% endblock %}
|
Loading…
Reference in new issue