Split viewing and editing a project
This commit is contained in:
parent
03aee6726f
commit
d9f6e662d8
|
@ -34,7 +34,7 @@ sub edit : Chained('project') PathPart Args(0) {
|
||||||
|
|
||||||
requireProjectOwner($c, $c->stash->{project});
|
requireProjectOwner($c, $c->stash->{project});
|
||||||
|
|
||||||
$c->stash->{template} = 'project.tt';
|
$c->stash->{template} = 'edit-project.tt';
|
||||||
$c->stash->{edit} = 1;
|
$c->stash->{edit} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ sub create : Path('/create-project') {
|
||||||
|
|
||||||
requireMayCreateProjects($c);
|
requireMayCreateProjects($c);
|
||||||
|
|
||||||
$c->stash->{template} = 'project.tt';
|
$c->stash->{template} = 'edit-project.tt';
|
||||||
$c->stash->{create} = 1;
|
$c->stash->{create} = 1;
|
||||||
$c->stash->{edit} = 1;
|
$c->stash->{edit} = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,6 +236,15 @@ BLOCK maybeEditString;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
|
||||||
|
BLOCK editString;
|
||||||
|
IF edit %]
|
||||||
|
<input type="text" class="string" [% HTML.attributes(id => param, name => param, value => value) %] />
|
||||||
|
[% ELSE;
|
||||||
|
HTML.escape(value);
|
||||||
|
END;
|
||||||
|
END;
|
||||||
|
|
||||||
|
|
||||||
BLOCK renderFullBuildLink;
|
BLOCK renderFullBuildLink;
|
||||||
INCLUDE renderFullJobNameOfBuild build=build %] <a href="[% c.uri_for('/build' build.id) %]">build [% build.id %]</a>[%
|
INCLUDE renderFullJobNameOfBuild build=build %] <a href="[% c.uri_for('/build' build.id) %]">build [% build.id %]</a>[%
|
||||||
END;
|
END;
|
||||||
|
|
57
src/root/edit-project.tt
Normal file
57
src/root/edit-project.tt
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
[% WRAPPER layout.tt title=(create ? "New Project" : "Editing project $project.name") %]
|
||||||
|
[% PROCESS common.tt %]
|
||||||
|
|
||||||
|
<form action="[% IF create %][% c.uri_for('/create-project/submit') %][% ELSE %][% c.uri_for('/project' project.name 'submit') %][% END %]" method="post">
|
||||||
|
|
||||||
|
<table class="layoutTable">
|
||||||
|
<tr>
|
||||||
|
<th>Identifier:</th>
|
||||||
|
<td><tt>[% INCLUDE editString param="name" value=project.name %]</tt></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Display name:</th>
|
||||||
|
<td>[% INCLUDE editString param="displayname" value=project.displayname %]</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Description:</th>
|
||||||
|
<td>[% INCLUDE editString param="description" value=project.description %]</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Homepage:</th>
|
||||||
|
<td>
|
||||||
|
[% INCLUDE editString param="homepage" value=project.homepage %]
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Owner:</th>
|
||||||
|
<td><tt>[% INCLUDE editString param="owner" value=(project.owner.username || c.user.username) %]</tt></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Enabled:</th>
|
||||||
|
<td>
|
||||||
|
[% INCLUDE renderSelection param="enabled" curValue=project.enabled radiobuttons=1 options={"1" = "Yes", "0" = "No"} %]
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
<i class="icon-ok icon-white"></i>
|
||||||
|
[%IF create %]Create[% ELSE %]Apply changes[% END %]
|
||||||
|
</button>
|
||||||
|
[% IF !create %]
|
||||||
|
<button id="delete-project" type="submit" class="btn btn-danger" name="submit" value="delete">
|
||||||
|
<i class="icon-trash icon-white"></i>
|
||||||
|
Delete this project
|
||||||
|
</button>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#delete-project").click(function() {
|
||||||
|
return confirm("Are you sure you want to delete this project?");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
[% END %]
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
[% END %]
|
|
@ -22,7 +22,7 @@
|
||||||
<tr class="input [% extraClass %]" [% IF id %]id="[% id %]"[% END %]>
|
<tr class="input [% extraClass %]" [% IF id %]id="[% id %]"[% END %]>
|
||||||
<td>
|
<td>
|
||||||
[% IF edit %]<button type="button" class="btn btn-warning" onclick='$(this).parents(".input").remove()'><i class="icon-trash icon-white"></i></button>[% END %]
|
[% IF edit %]<button type="button" class="btn btn-warning" onclick='$(this).parents(".input").remove()'><i class="icon-trash icon-white"></i></button>[% END %]
|
||||||
<tt>[% INCLUDE maybeEditString param="$baseName-name" value=input.name extraClass="shortString" %]</tt>
|
<tt>[% INCLUDE maybeEditString param="$baseName-name" value=input.name %]</tt>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
[% INCLUDE renderSelection curValue=input.type param="$baseName-type" options=inputTypes %]
|
[% INCLUDE renderSelection curValue=input.type param="$baseName-type" options=inputTypes %]
|
||||||
|
@ -143,8 +143,8 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th>Nix expression:</th>
|
<th>Nix expression:</th>
|
||||||
<td>
|
<td>
|
||||||
<tt>[% INCLUDE maybeEditString param="nixexprpath" value=jobset.nixexprpath extraClass="shortString" %]</tt> in input
|
<tt>[% INCLUDE maybeEditString param="nixexprpath" value=jobset.nixexprpath %]</tt> in input
|
||||||
<tt>[% INCLUDE maybeEditString param="nixexprinput" value=jobset.nixexprinput extraClass="shortString" %]</tt>
|
<tt>[% INCLUDE maybeEditString param="nixexprinput" value=jobset.nixexprinput %]</tt>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -1,192 +1,140 @@
|
||||||
[% WRAPPER layout.tt title=(edit ? (create ? "New Project" : "Editing project $project.name") : "Project $project.name") %]
|
[% WRAPPER layout.tt title="Project $project.name" %]
|
||||||
[% PROCESS common.tt %]
|
[% PROCESS common.tt %]
|
||||||
<ul class="nav nav-tabs">
|
|
||||||
[% IF !edit %]
|
<ul class="nav nav-tabs">
|
||||||
<li class="active"><a href="#tabs-project" data-toggle="tab">Overview</a></li>
|
<li class="active"><a href="#tabs-project" data-toggle="tab">Jobsets</a></li>
|
||||||
|
<li><a href="#tabs-settings" data-toggle="tab">Configuration</a></li>
|
||||||
|
<li><a href="#tabs-views" data-toggle="tab">Views</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div id="tabs-project" class="tab-pane active">
|
||||||
|
[% IF project.jobsets.size > 0 %]
|
||||||
|
<p>This project has the following jobsets:</p>
|
||||||
|
|
||||||
|
<table class="tablesorter table table-striped table-condensed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>Id</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>Last evaluated</th>
|
||||||
|
<th colspan="2">Success</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
[% FOREACH j IN jobsets %]
|
||||||
|
[% successrate = 0 %]
|
||||||
|
<tr class="clickable [% IF odd %] odd [% END; odd = !odd %]"
|
||||||
|
onclick="window.location = '[% c.uri_for('/jobset' project.name j.name) %]'">
|
||||||
|
<td>
|
||||||
|
[% IF j.get_column('nrscheduled') > 0 %]
|
||||||
|
<img src="/static/images/help_16.png" alt="Scheduled" />
|
||||||
|
[% ELSIF j.get_column('nrfailed') == 0 %]
|
||||||
|
<img src="/static/images/checkmark_16.png" alt="Succeeded" />
|
||||||
|
[% ELSIF j.get_column('nrfailed') > 0 && j.get_column('nrsucceeded') > 0 %]
|
||||||
|
<img src="/static/images/error_some_16.png" alt="Some Failed" />
|
||||||
|
[% ELSE %]
|
||||||
|
<img src="/static/images/error_16.png" alt="All Failed" />
|
||||||
[% END %]
|
[% END %]
|
||||||
<li><a href="#tabs-settings" data-toggle="tab">Settings</a></li>
|
</td>
|
||||||
[% IF !edit %]
|
<td>[% INCLUDE renderJobsetName project = project.name jobset = j.name %]</td>
|
||||||
<li><a href="#tabs-views" data-toggle="tab">Views</a></li>
|
<td>[% HTML.escape(j.description) %]</td>
|
||||||
|
<td>[% INCLUDE renderDateTime timestamp = j.lastcheckedtime %]</td>
|
||||||
|
[% IF j.get_column('nrtotal') > 0 %]
|
||||||
|
[% successrate = ( j.get_column('nrsucceeded') / j.get_column('nrtotal') )*100 %]
|
||||||
|
[% IF j.get_column('nrscheduled') > 0 %]
|
||||||
|
[% class = 'label' %]
|
||||||
|
[% ELSIF successrate < 25 %]
|
||||||
|
[% class = 'label label-important' %]
|
||||||
|
[% ELSIF successrate < 75 %]
|
||||||
|
[% class = 'label label-warning' %]
|
||||||
|
[% ELSIF successrate <= 100 %]
|
||||||
|
[% class = 'label label-success' %]
|
||||||
[% END %]
|
[% END %]
|
||||||
</ul>
|
[% END %]
|
||||||
|
<td><span class="[% class %]">[% successrate FILTER format('%d') %]%</span></td>
|
||||||
|
<td>
|
||||||
|
[% IF j.get_column('nrsucceeded') > 0 %]
|
||||||
|
<span class="label label-success">[% j.get_column('nrsucceeded') %]</span>
|
||||||
|
[% END %]
|
||||||
|
[% IF j.get_column('nrfailed') > 0 %]
|
||||||
|
<span class="label label-important">[% j.get_column('nrfailed') %]</span>
|
||||||
|
[% END %]
|
||||||
|
[% IF j.get_column('nrscheduled') > 0 %]
|
||||||
|
<span class="label label">[% j.get_column('nrscheduled') %]</span>
|
||||||
|
[% END %]
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
[% END %]
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
<div class="tab-content">
|
[% ELSE %]
|
||||||
|
<p>No jobsets have been defined yet.</p>
|
||||||
|
[% END %]
|
||||||
|
|
||||||
[% IF !edit %]
|
</div>
|
||||||
<div id="tabs-project" class="tab-pane active">
|
|
||||||
[% IF project.jobsets.size > 0 %]
|
|
||||||
|
|
||||||
<p>This project has the following jobsets:</p>
|
<div id="tabs-settings" class="tab-pane">
|
||||||
|
<table class="layoutTable">
|
||||||
|
<tr>
|
||||||
|
<th>Display name:</th>
|
||||||
|
<td>[% HTML.escape(project.displayname) %]</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Description:</th>
|
||||||
|
<td>[% HTML.escape(project.description) %]</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Homepage:</th>
|
||||||
|
<td>
|
||||||
|
[% IF project.homepage %]
|
||||||
|
<a [% HTML.attributes(href => project.homepage) %]>[% HTML.escape(project.homepage) %]</a>
|
||||||
|
[% ELSE %]
|
||||||
|
<em>(not specified)</em>
|
||||||
|
[% END %]
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Owner:</th>
|
||||||
|
<td><tt>[% HTML.escape(project.owner.username) %]</tt></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Enabled:</th>
|
||||||
|
<td>[% project.enabled ? "Yes" : "No" %]</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<table class="tablesorter table table-striped table-condensed">
|
<div id="tabs-views" class="tab-pane">
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th>Id</th>
|
|
||||||
<th>Description</th>
|
|
||||||
<th>Last evaluated</th>
|
|
||||||
<th colspan="2">Success</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
[% FOREACH j IN jobsets %]
|
|
||||||
[% successrate = 0 %]
|
|
||||||
<tr class="clickable [% IF odd %] odd [% END; odd = !odd %]"
|
|
||||||
onclick="window.location = '[% c.uri_for('/jobset' project.name j.name) %]'">
|
|
||||||
<td>
|
|
||||||
[% IF j.get_column('nrscheduled') > 0 %]
|
|
||||||
<img src="/static/images/help_16.png" alt="Scheduled" />
|
|
||||||
[% ELSIF j.get_column('nrfailed') == 0 %]
|
|
||||||
<img src="/static/images/checkmark_16.png" alt="Succeeded" />
|
|
||||||
[% ELSIF j.get_column('nrfailed') > 0 && j.get_column('nrsucceeded') > 0 %]
|
|
||||||
<img src="/static/images/error_some_16.png" alt="Some Failed" />
|
|
||||||
[% ELSE %]
|
|
||||||
<img src="/static/images/error_16.png" alt="All Failed" />
|
|
||||||
[% END %]
|
|
||||||
</td>
|
|
||||||
<td>[% INCLUDE renderJobsetName project = project.name jobset = j.name %]</td>
|
|
||||||
<td>[% HTML.escape(j.description) %]</td>
|
|
||||||
<td>[% INCLUDE renderDateTime timestamp = j.lastcheckedtime %]</td>
|
|
||||||
[% IF j.get_column('nrtotal') > 0 %]
|
|
||||||
[% successrate = ( j.get_column('nrsucceeded') / j.get_column('nrtotal') )*100 %]
|
|
||||||
[% IF j.get_column('nrscheduled') > 0 %]
|
|
||||||
[% class = 'label' %]
|
|
||||||
[% ELSIF successrate < 25 %]
|
|
||||||
[% class = 'label label-important' %]
|
|
||||||
[% ELSIF successrate < 75 %]
|
|
||||||
[% class = 'label label-warning' %]
|
|
||||||
[% ELSIF successrate <= 100 %]
|
|
||||||
[% class = 'label label-success' %]
|
|
||||||
[% END %]
|
|
||||||
[% END %]
|
|
||||||
<td>
|
|
||||||
<span class="[% class %]">[% successrate FILTER format('%d') %]%</span>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
[% IF j.get_column('nrsucceeded') > 0 %]
|
|
||||||
<span class="label label-success">[% j.get_column('nrsucceeded') %]</span>
|
|
||||||
[% END %]
|
|
||||||
[% IF j.get_column('nrfailed') > 0 %]
|
|
||||||
<span class="label label-important">[% j.get_column('nrfailed') %]</span>
|
|
||||||
[% END %]
|
|
||||||
[% IF j.get_column('nrscheduled') > 0 %]
|
|
||||||
<span class="label label">[% j.get_column('nrscheduled') %]</span>
|
|
||||||
[% END %]
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
[% END %]
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
[% ELSE %]
|
[% IF views.size > 0 %]
|
||||||
|
|
||||||
<p>No jobsets have been defined yet.</p>
|
<p>Project <tt>[% project.name %]</tt> has the following views:</p>
|
||||||
|
|
||||||
[% END %]
|
<ul>
|
||||||
|
[% FOREACH view IN views %]
|
||||||
|
<li>
|
||||||
</div>
|
<a href="[% c.uri_for('/view' project.name view.name) %]"><tt>[% view.name %]</tt></a>
|
||||||
|
<a class="btn btn-mini" href="[% c.uri_for('/view' project.name view.name "edit") %]">Edit</a>
|
||||||
|
</li>
|
||||||
[% END %]
|
[% END %]
|
||||||
<div id="tabs-settings" class="tab-pane [% IF edit %]active[% END %]">
|
</ul>
|
||||||
[% IF edit %]
|
|
||||||
<form action="[% IF create %][% c.uri_for('/create-project/submit') %][% ELSE %][% c.uri_for('/project' project.name 'submit') %][% END %]" method="post">
|
|
||||||
[% END %]
|
|
||||||
|
|
||||||
<table class="layoutTable">
|
[% ELSE %]
|
||||||
[% IF edit %]
|
|
||||||
<tr>
|
|
||||||
<th>Identifier:</th>
|
|
||||||
<td><tt>[% INCLUDE maybeEditString param="name" value=project.name %]</tt></td>
|
|
||||||
</tr>
|
|
||||||
[% END %]
|
|
||||||
<tr>
|
|
||||||
<th>Display name:</th>
|
|
||||||
<td>[% INCLUDE maybeEditString param="displayname" value=project.displayname %]</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Description:</th>
|
|
||||||
<td>[% INCLUDE maybeEditString param="description" value=project.description %]</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Homepage:</th>
|
|
||||||
<td>
|
|
||||||
[% IF edit %]
|
|
||||||
[% INCLUDE maybeEditString param="homepage" value=project.homepage %]
|
|
||||||
[% ELSE %]
|
|
||||||
[% IF project.homepage %]
|
|
||||||
<a [% HTML.attributes(href => project.homepage) %]>[% HTML.escape(project.homepage) %]</a>
|
|
||||||
[% ELSE %]
|
|
||||||
<em>(not specified)</em>
|
|
||||||
[% END %]
|
|
||||||
[% END %]
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Owner:</th>
|
|
||||||
<td><tt>[% INCLUDE maybeEditString param="owner" value=(project.owner.username || c.user.username) edit=(edit && c.check_user_roles('admin')) %]</tt></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Enabled:</th>
|
|
||||||
<td>
|
|
||||||
[% INCLUDE renderSelection param="enabled" curValue=project.enabled radiobuttons=1 options={"1" = "Yes", "0" = "No"} %]
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
[% IF edit %]
|
<p>Project <tt>[% project.name %]</tt> has no views.</p>
|
||||||
|
|
||||||
<div class="form-actions">
|
[% END %]
|
||||||
<button type="submit" class="btn btn-primary">
|
|
||||||
<i class="icon-ok icon-white"></i>
|
|
||||||
[%IF create %]Create[% ELSE %]Apply changes[% END %]
|
|
||||||
</button>
|
|
||||||
[% IF !create %]
|
|
||||||
<button id="delete-project" type="submit" class="btn btn-danger" name="submit" value="delete">
|
|
||||||
<i class="icon-trash icon-white"></i>
|
|
||||||
Delete this project
|
|
||||||
</button>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$("#delete-project").click(function() {
|
|
||||||
return confirm("Are you sure you want to delete this project?");
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
[% END %]
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
<p>
|
||||||
|
<a class="btn" href="[% c.uri_for('/project' project.name 'create-view') %]"><i class="icon-plus"></i> Create a new view</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
[% END %]
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
[% IF !edit %]
|
|
||||||
<div id="tabs-views" class="tab-pane">
|
|
||||||
|
|
||||||
[% IF views.size > 0 %]
|
|
||||||
|
|
||||||
<p>Project <tt>[% project.name %]</tt> has the following views:</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
[% FOREACH view IN views %]
|
|
||||||
<li>
|
|
||||||
<a href="[% c.uri_for('/view' project.name view.name) %]"><tt>[% view.name %]</tt></a>
|
|
||||||
<a class="btn btn-mini" href="[% c.uri_for('/view' project.name view.name "edit") %]">Edit</a>
|
|
||||||
</li>
|
|
||||||
[% END %]
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
[% ELSE %]
|
|
||||||
|
|
||||||
<p>Project <tt>[% project.name %]</tt> has no views.</p>
|
|
||||||
|
|
||||||
[% END %]
|
|
||||||
|
|
||||||
<p><a class="btn" href="[% c.uri_for('/project' project.name 'create-view') %]">
|
|
||||||
<i class="icon-plus"></i> Create a new view
|
|
||||||
</a></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
[% END %]
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
Loading…
Reference in a new issue