To further align with the API, we return custom JSON in order to display a
visible
field rather than hidden
– a PUT
request expects visible
, while
a GET
request returns hidden
.
This also allows us to rename the jobsetinputs
field to inputs
for the same
reason: PUT
expects inputs
, while GET
returns jobsetinputs
.
P32OJ3RUWL2CQFC3AHG2OC3SQKBSYOXNMPWOQHHALKC7ENHYFJ3QC
OOI5OFJXO6KOJTR3LM6BAORFKYV4C4GIXTKVVIQ3GBUVSB43DLOQC
ZDH6UX5UH4HJHJ5QWVDB7235BOC5LHQ3LFEWLHZQRZAS2YME5UVAC
XNXX4WCQ7KIP24TIF6KQVZLCHM4R25MSSL4IFLFHNUBW5FQSTPWQC
LX326CB7QYUPVTX37SSK6VFSYKJIII6ARISYJBHZBVKVJ2NQTI3AC
QUMWPGCUBMAPWLUPRSISK7PNU5LIHKHKCAZYE4XXQCJ5E4L74VSQC
3HZY24CX4U2TO74HOY4YX3LBJIYF4DLXHCIY7J2RASAC4COMSMZAC
W5OAZWPDZOGVAL5P4ROVZSZGCSJBMPRALW6SCGV6L7A5DBAK2JLQC
YI3BZG5NWMKBT7T2HEOHVHSZBQ5KPDWSI3VRYOMQ346LRFB4MR2AC
X27GNHDV5KPZ5GSH6DCAJMNCEMZLCP7M43JWF2X3O5QWXMOX273AC
NP7IOJ4QI25BLULQEYBACUR4KXWMYLNTM2K5VNPX2FAFGHZ37WYAC
QJYMTECFWSMUHJ2TDC2ZTHZJMN6WPUPIFXPYGVB7MLYVSOZQMXRQC
4VYSDP4IAWIIVLXCKXJEYWIHZV3PUD3VACX3K4EIQKPFGWLZK6HQC
KSBB33RE2PK5SFN7ZMOTZJQHZB4JYIIUUKWDSD3LSZ5GD465AJHQC
OX6NYJDVCDX2UCJ4QQMTRJVZ535NOMCJGYCHDLCADJPQI7RMCXPQC
VJFLX7B6DEYXQRS3T5LHOM4POSGMEBQSJJVBHAQV3U4LRPF4KVBAC
VZX6HJ3I35NVK6L4FP7ASLNAMLMGPAESPQAAYZEUCXYKFUA6HTAQC
OK4P3AMKXIBSUNL4ABLFKTK3UBFLINDINBPZVP5OSHLRSV44BICAC
LZVO64YG43JD7YMZSCTZNOBS5ROZA4FMPKJW2YOMHX2V5PTGBVWQC
my %hint = (
columns => [
"errortime",
"lastcheckedtime",
"triggertime",
"enabled",
"keepnr",
"checkinterval",
"schedulingshares",
"starttime"
],
string_columns => [
"name",
"project",
"description",
"nixexprinput",
"nixexprpath",
"errormsg",
"emailoverride",
"fetcherrormsg",
"type",
"flake"
],
boolean_columns => [
"enableemail",
"hidden"
],
eager_relations => {
jobsetinputs => "name"
}
);
sub as_json {
my $self = shift;
sub json_hint {
return \%hint;
my %json = (
# columns
"errortime" => $self->get_column("errortime"),
"lastcheckedtime" => $self->get_column("lastcheckedtime"),
"triggertime" => $self->get_column("triggertime"),
"enabled" => $self->get_column("enabled"),
"keepnr" => $self->get_column("keepnr"),
"checkinterval" => $self->get_column("checkinterval"),
"schedulingshares" => $self->get_column("schedulingshares"),
"starttime" => $self->get_column("starttime"),
# string_columns
"name" => $self->get_column("name") // "",
"project" => $self->get_column("project") // "",
"description" => $self->get_column("description") // "",
"nixexprinput" => $self->get_column("nixexprinput") // "",
"nixexprpath" => $self->get_column("nixexprpath") // "",
"errormsg" => $self->get_column("errormsg") // "",
"emailoverride" => $self->get_column("emailoverride") // "",
"fetcherrormsg" => $self->get_column("fetcherrormsg") // "",
"type" => $self->get_column("type") // "",
"flake" => $self->get_column("flake") // "",
# boolean_columns
"enableemail" => $self->get_column("enableemail") ? JSON::true : JSON::false,
"visible" => $self->get_column("hidden") ? JSON::false : JSON::true,
"inputs" => { map { $_->name => $_ } $self->jobsetinputs }
);
return \%json;
<tbody class="jobsetinputs">
[% jobsetinputs = createFromEval ? eval.jobsetevalinputs : jobset.jobsetinputs; FOREACH input IN jobsetinputs %]
<tbody class="inputs">
[% inputs = createFromEval ? eval.jobsetevalinputs : jobset.jobsetinputs; FOREACH input IN inputs %]
my $result = request_json({ uri => '/jobset/sample/default', method => 'PUT', data => { nixexprpath => "default.nix", nixexprinput => "my-src", jobsetinputs => { "my-src" => { type => "path", value => $jobsetdir } }, enabled => "1", visible => "1", checkinterval => "3600"} });
my $result = request_json({ uri => '/jobset/sample/default', method => 'PUT', data => { nixexprpath => "default.nix", nixexprinput => "my-src", inputs => { "my-src" => { type => "path", value => $jobsetdir } }, enabled => "1", visible => "1", checkinterval => "3600"} });