2013-02-21 01:26:29 +01:00
[% WRAPPER layout.tt title=(create ? "New project" : "Editing project $project.name") %]
2013-02-21 01:12:57 +01:00
[% PROCESS common.tt %]
2019-07-30 17:51:24 -04:00
<form>
2013-02-21 01:45:39 +01:00
2019-07-30 17:51:24 -04:00
<div class="form-group row">
<label class="col-sm-3" for="editprojectenabled">Enabled</label>
<div class="col-sm-9">
2021-04-08 11:13:09 -04:00
<input type="checkbox" id="editprojectenabled" name="enabled" [% IF create || project.enabled %] checked="checked" [% END %]/>
2013-02-21 01:45:39 +01:00
</div>
2019-07-30 17:51:24 -04:00
</div>
2013-02-21 01:45:39 +01:00
2019-07-30 17:51:24 -04:00
<div class="form-group row">
<label class="col-sm-3" for="editprojectvisible">Visible in projects list</label>
<div class="col-sm-9">
<input type="checkbox" id="editprojectvisible" name="visible" [% IF !project.hidden %] checked="checked" [% END %]/>
2013-02-21 01:45:39 +01:00
</div>
2019-07-30 17:51:24 -04:00
</div>
2013-02-21 01:45:39 +01:00
2019-07-30 17:51:24 -04:00
<div class="form-group row">
<label class="col-sm-3" for="editprojectidentifier">Identifier</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="editprojectidentifier" name="name" [% HTML.attributes(value => project.name) %]/>
2013-02-21 01:45:39 +01:00
</div>
2019-07-30 17:51:24 -04:00
</div>
2013-02-21 01:45:39 +01:00
2019-07-30 17:51:24 -04:00
<div class="form-group row">
<label class="col-sm-3" for="editprojectdisplayname">Display name</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="editprojectdisplayname" name="displayname" [% HTML.attributes(value => project.displayname) %]/>
2013-02-21 01:45:39 +01:00
</div>
2019-07-30 17:51:24 -04:00
</div>
2013-02-21 01:45:39 +01:00
2019-07-30 17:51:24 -04:00
<div class="form-group row">
<label class="col-sm-3" for="editprojectdescription">Description</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="editprojectdescription" name="description" [% HTML.attributes(value => project.description) %]/>
2013-02-21 01:45:39 +01:00
</div>
2019-07-30 17:51:24 -04:00
</div>
2013-02-21 01:45:39 +01:00
2019-07-30 17:51:24 -04:00
<div class="form-group row">
<label class="col-sm-3" for="editprojecthomepage">Homepage</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="editprojecthomepage" name="homepage" [% HTML.attributes(value => project.homepage) %]/>
2013-02-21 01:45:39 +01:00
</div>
2019-07-30 17:51:24 -04:00
</div>
2013-02-21 01:45:39 +01:00
2019-07-30 17:51:24 -04:00
<div class="form-group row">
<label class="col-sm-3" for="editprojectowner">Owner</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="editprojectowner" name="owner" [% HTML.attributes(value => project.owner.username || c.user.username) %]/>
Enable declarative projects.
This allows fully declarative project specifications. This is best
illustrated by example:
* I create a new project, setting the declarative spec file to
"spec.json" and the declarative input to a git repo pointing
at git://github.com/shlevy/declarative-hydra-example.git
* hydra creates a special ".jobsets" jobset alongside the project
* Just before evaluating the ".jobsets" jobset, hydra fetches
declarative-hydra-example.git, reads spec.json as a jobset spec,
and updates the jobset's configuration accordingly:
{
"enabled": 1,
"hidden": false,
"description": "Jobsets",
"nixexprinput": "src",
"nixexprpath": "default.nix",
"checkinterval": 300,
"schedulingshares": 100,
"enableemail": false,
"emailoverride": "",
"keepnr": 3,
"inputs": {
"src": { "type": "git", "value": "git://github.com/shlevy/declarative-hydra-example.git", "emailresponsible": false },
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs.git release-16.03", "emailresponsible": false }
}
}
* When the "jobsets" job of the ".jobsets" jobset completes, hydra
reads its output as a JSON representation of a dictionary of
jobset specs and creates a jobset named "master" configured
accordingly (In this example, this is the same configuration as
.jobsets itself, except using release.nix instead of default.nix):
{
"enabled": 1,
"hidden": false,
"description": "js",
"nixexprinput": "src",
"nixexprpath": "release.nix",
"checkinterval": 300,
"schedulingshares": 100,
"enableemail": false,
"emailoverride": "",
"keepnr": 3,
"inputs": {
"src": { "type": "git", "value": "git://github.com/shlevy/declarative-hydra-example.git", "emailresponsible": false },
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs.git release-16.03", "emailresponsible": false }
}
}
2016-03-11 18:14:58 -05:00
</div>
2019-07-30 17:51:24 -04:00
</div>
2021-12-15 15:32:49 -05:00
<div class="form-group row">
<label class="col-sm-3" for="editprojectenable_dynamic_run_command">Enable Dynamic RunCommand Hooks for Jobsets</label>
<div class="col-sm-9">
<input type="checkbox" id="editprojectenable_dynamic_run_command" name="enable_dynamic_run_command" [% IF jobset.enable_dynamic_run_command %]checked[% END %]/>
</div>
</div>
2019-07-30 17:51:24 -04:00
<div class="form-group row">
<label class="col-sm-3" for="editprojectdeclfile">
Declarative spec file
<small class="form-text text-muted">(Leave blank for non-declarative project configuration)</small>
</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="editprojectdeclfile" name="declfile" [% HTML.attributes(value => project.declfile) %]/>
Enable declarative projects.
This allows fully declarative project specifications. This is best
illustrated by example:
* I create a new project, setting the declarative spec file to
"spec.json" and the declarative input to a git repo pointing
at git://github.com/shlevy/declarative-hydra-example.git
* hydra creates a special ".jobsets" jobset alongside the project
* Just before evaluating the ".jobsets" jobset, hydra fetches
declarative-hydra-example.git, reads spec.json as a jobset spec,
and updates the jobset's configuration accordingly:
{
"enabled": 1,
"hidden": false,
"description": "Jobsets",
"nixexprinput": "src",
"nixexprpath": "default.nix",
"checkinterval": 300,
"schedulingshares": 100,
"enableemail": false,
"emailoverride": "",
"keepnr": 3,
"inputs": {
"src": { "type": "git", "value": "git://github.com/shlevy/declarative-hydra-example.git", "emailresponsible": false },
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs.git release-16.03", "emailresponsible": false }
}
}
* When the "jobsets" job of the ".jobsets" jobset completes, hydra
reads its output as a JSON representation of a dictionary of
jobset specs and creates a jobset named "master" configured
accordingly (In this example, this is the same configuration as
.jobsets itself, except using release.nix instead of default.nix):
{
"enabled": 1,
"hidden": false,
"description": "js",
"nixexprinput": "src",
"nixexprpath": "release.nix",
"checkinterval": 300,
"schedulingshares": 100,
"enableemail": false,
"emailoverride": "",
"keepnr": 3,
"inputs": {
"src": { "type": "git", "value": "git://github.com/shlevy/declarative-hydra-example.git", "emailresponsible": false },
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs.git release-16.03", "emailresponsible": false }
}
}
2016-03-11 18:14:58 -05:00
</div>
2019-07-30 17:51:24 -04:00
</div>
Enable declarative projects.
This allows fully declarative project specifications. This is best
illustrated by example:
* I create a new project, setting the declarative spec file to
"spec.json" and the declarative input to a git repo pointing
at git://github.com/shlevy/declarative-hydra-example.git
* hydra creates a special ".jobsets" jobset alongside the project
* Just before evaluating the ".jobsets" jobset, hydra fetches
declarative-hydra-example.git, reads spec.json as a jobset spec,
and updates the jobset's configuration accordingly:
{
"enabled": 1,
"hidden": false,
"description": "Jobsets",
"nixexprinput": "src",
"nixexprpath": "default.nix",
"checkinterval": 300,
"schedulingshares": 100,
"enableemail": false,
"emailoverride": "",
"keepnr": 3,
"inputs": {
"src": { "type": "git", "value": "git://github.com/shlevy/declarative-hydra-example.git", "emailresponsible": false },
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs.git release-16.03", "emailresponsible": false }
}
}
* When the "jobsets" job of the ".jobsets" jobset completes, hydra
reads its output as a JSON representation of a dictionary of
jobset specs and creates a jobset named "master" configured
accordingly (In this example, this is the same configuration as
.jobsets itself, except using release.nix instead of default.nix):
{
"enabled": 1,
"hidden": false,
"description": "js",
"nixexprinput": "src",
"nixexprpath": "release.nix",
"checkinterval": 300,
"schedulingshares": 100,
"enableemail": false,
"emailoverride": "",
"keepnr": 3,
"inputs": {
"src": { "type": "git", "value": "git://github.com/shlevy/declarative-hydra-example.git", "emailresponsible": false },
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs.git release-16.03", "emailresponsible": false }
}
}
2016-03-11 18:14:58 -05:00
2019-07-30 17:51:24 -04:00
<div class="form-group row">
<label class="col-sm-3" for="editprojectdeclvalue">Declarative input type</label>
<div class="col-sm-9">
[% INCLUDE renderSelection param="decltype" options=inputTypes edit=1 curValue=project.decltype %]
<input type="text" class="form-control" id="editprojectdeclvalue" name="declvalue" [% HTML.attributes(value => project.declvalue) %]/>
2013-02-21 01:45:39 +01:00
</div>
2019-07-30 17:51:24 -04:00
</div>
2013-02-21 01:45:39 +01:00
2019-07-30 17:51:24 -04:00
<button id="submit-project" type="submit" class="btn btn-primary">
2019-08-28 15:38:17 -04:00
<i class="fas fa-check"></i>
2019-07-30 17:51:24 -04:00
[%IF create %]Create project[% ELSE %]Apply changes[% END %]
</button>
2013-02-21 01:12:57 +01:00
</form>
2013-10-03 18:49:37 +02:00
<script type="text/javascript">
$("#submit-project").click(function() {
2021-05-01 23:27:47 -07:00
var formElements = $(this).parents("form").serializeArray();
var data = { 'declarative': {} };
var decl = {};
for (var i = 0; formElements.length > i; i++) {
var elem = formElements[i];
var match = elem.name.match(/^decl(file|type|value)$/);
if (match === null) {
data[elem.name] = elem.value;
} else {
var param = match[1];
decl[param] = elem.value;
}
}
data.declarative = decl;
2013-10-14 17:35:14 +02:00
redirectJSON({
2013-10-03 18:49:37 +02:00
[% IF create %]
url: "[% c.uri_for('/project' '.new') %]",
[% ELSE %]
url: "[% c.uri_for('/project' project.name) %]",
[% END %]
2021-05-01 23:27:47 -07:00
data: JSON.stringify(data),
contentType: 'application/json',
2013-10-14 17:35:14 +02:00
type: 'PUT'
2013-10-03 18:49:37 +02:00
});
return false;
});
</script>
2013-02-21 01:12:57 +01:00
[% END %]