Skip to content

Commit

Permalink
Merge ee5aa2e into 188b0db
Browse files Browse the repository at this point in the history
  • Loading branch information
asankov committed Jul 12, 2020
2 parents 188b0db + ee5aa2e commit 044915b
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 45 deletions.
90 changes: 46 additions & 44 deletions tcms/testruns/static/testruns/js/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ function renderTestExecutions(testExecutions, executionStatuses) {
}

function renderAdditionalInformation(testExecutions, testExecutionCaseIds) {
$('.test-executions-count').html(testExecutions.length);

jsonRPC('TestCase.filter', { 'id__in': testExecutionCaseIds }, testCases => {
testExecutions.forEach(testExecution => {
const testCase = testCases.find(testCase => testCase.id === testExecution.case_id)
Expand Down Expand Up @@ -156,55 +158,55 @@ function renderTestExecutionRow(template, testExecution, testExecutionStatus) {
/////// and need updates before they can be used again
///////
function changeExecutionAssignee() {
const executions = 0 // todo: this is the list of all selected executions
if (!executions.length) {
window.alert(default_messages.alert.no_case_selected);
return false;
}
//todo: all texts in alert/prompt must come translated from the HTML template
var assignee = window.prompt('Please type new email or username for assignee');
if (!assignee) {
return false;
}
executions.forEach(execution_id => jsonRPC('TestExecution.update', [execution_id, {'assignee': assignee}], () => { }, sync=true));
window.location.reload();
const executions = 0 // todo: this is the list of all selected executions
if (!executions.length) {
window.alert(default_messages.alert.no_case_selected);
return false;
}
//todo: all texts in alert/prompt must come translated from the HTML template
var assignee = window.prompt('Please type new email or username for assignee');
if (!assignee) {
return false;
}
executions.forEach(execution_id => jsonRPC('TestExecution.update', [execution_id, { 'assignee': assignee }], () => { }, sync = true));
window.location.reload();
}

function updateExecutionText() {
const executions = 0 // todo: this is the list of all selected executions
if (!executions.length) {
window.alert(default_messages.alert.no_case_selected);
return false;
}
//todo: translations
executions.forEach(executionId =>
jsonRPC('TestExecution.update', [executionId, {'case_text_version': 'latest'}], () => { }, sync=true)
);
window.location.reload(true);
const executions = 0 // todo: this is the list of all selected executions
if (!executions.length) {
window.alert(default_messages.alert.no_case_selected);
return false;
}
//todo: translations
executions.forEach(executionId =>
jsonRPC('TestExecution.update', [executionId, { 'case_text_version': 'latest' }], () => { }, sync = true)
);
window.location.reload(true);
}

function fileBugFromExecution(run_id, title_container, container, case_id, execution_id) {
// todo: this dialog needs to be reimplemented with a Patternfly modal
var dialog = new AddIssueDialog({
'action': 'Report',
'onSubmit': function (e, dialog) {
e.stopPropagation();
e.preventDefault();

var tracker_id = dialog.get_data()['bug_system_id'];
jsonRPC('Bug.report', [execution_id, tracker_id], function(result) {
$('#dialog').hide();

if (result.rc === 0) {
// unescape b/c Issue #1533
const target_url = result.response.replace(/&/g, '&')
window.open(target_url, '_blank');
} else {
window.alert(result.response);
}
});
}
});
// todo: this dialog needs to be reimplemented with a Patternfly modal
var dialog = new AddIssueDialog({
'action': 'Report',
'onSubmit': function (e, dialog) {
e.stopPropagation();
e.preventDefault();

var tracker_id = dialog.get_data()['bug_system_id'];
jsonRPC('Bug.report', [execution_id, tracker_id], function (result) {
$('#dialog').hide();

if (result.rc === 0) {
// unescape b/c Issue #1533
const target_url = result.response.replace(/&/g, '&')
window.open(target_url, '_blank');
} else {
window.alert(result.response);
}
});
}
});

dialog.show();
dialog.show();
}
62 changes: 61 additions & 1 deletion tcms/testruns/templates/testruns/get.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h2 class="card-pf-title" style="text-align: left">
<h2 class="card-pf-title" style="text-align: left">
<span class="fa fa-spinner"></span>{% trans 'Status' %}:
<input class="bootstrap-switch" id="status_button" type="checkbox"
{% if not object.stop_date %}checked{% endif %}
{% if not object.stop_date %}checked{% endif %}
{% if not perms.testruns.change_testrun %}disabled{% endif %}>
</h2>

Expand Down Expand Up @@ -117,6 +117,63 @@ <h2 class="card-pf-title" style="text-align: left">
<h2 class="card-pf-title">
{% trans 'Test executions' %}
</h2>
<div class="container-fluid">
<div class="row toolbar-pf">
<div class="col-sm-12">
<form class="toolbar-pf-actions">
<div class="form-group toolbar-pf-filter">
<label class="sr-only" for="filter">Name</label>
<div class="input-group">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" id="input-filter-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Name <span class="caret"></span></button>
<ul class="dropdown-menu">
<li class="selected"><a href="#">{% trans "Name" %}</a></li>
<li><a href="#">{% trans "Priority" %}</a></li>
<li><a href="#">{% trans "Category" %}</a></li>
</ul>
</div><!-- /input-group-btn -->
<input type="text" class="form-control" id="filter" placeholder='{% trans "Filter By Name..." %}'>
</div><!-- /input-group -->
</div>
<div class="form-group">
<div class="dropdown btn-group">
<button type="button" class="btn btn-default dropdown-toggle" id="filter-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Name <span class="caret"></span></button>
<ul class="dropdown-menu">
<li class="selected"><a href="#">{% trans "Name" %}</a></li>
<li><a href="#">{% trans "Priority" %}</a></li>
<li><a href="#">Last {% trans "Category" %}</a></li>
</ul>
</div>
<button class="btn btn-link" type="button">
<span class="fa fa-sort-alpha-asc"></span>
</button>
</div>
<div class="form-group">
<button type="button" class="btn btn-default">{% trans "Remove case" %}</button>
<button type="button" class="btn btn-default">{% trans "Update case text" %}</button>
<button type="button" class="btn btn-default">{% trans "Change assignee" %}</button>
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" id="filter-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{% trans "Change status" %} <span class="caret"></span></button>
<ul class="dropdown-menu">
{% comment %} TODO: populate with the statuses from the back-end {% endcomment %}
</ul>
</div>
<button type="button" class="btn btn-default">{% trans "Add comment" %}</button>
<button type="button" class="btn btn-default">{% trans "Add hyperlink" %}</button>
</div>
</form>
<div class="row toolbar-pf-results">
<div class="col-sm-12">
<h5><span class="test-executions-count"></span> Results</h5>
<p>Active filters:</p>
<ul class="list-inline" class="active-filters"></ul>
{% comment %} TODO: maybe don't show this button until at least one filter is added {% endcomment %}
<p><a href="#">Clear All Filters</a></p>
</div><!-- /col -->
</div><!-- /row -->
</div><!-- /col -->
</div><!-- /row -->
</div><!-- /container -->
<div class="card-pf-body">
<div id="test-executions-container" class="list-group tree-list-view-pf">
<template id="test-execution-row">
Expand All @@ -126,6 +183,9 @@ <h2 class="card-pf-title">
<div class="list-view-pf-left">
<span class="fa fa-angle-right"></span>
</div>
<div class="list-view-pf-checkbox" style="margin-top: 0; margin-bottom: 0">
<input type="checkbox">
</div>
<div class="list-view-pf-body">
<div class="list-view-pf-description" style="flex: 1 0 30%;">
<div class="list-group-item-text">
Expand Down

0 comments on commit 044915b

Please sign in to comment.