Skip to content

Commit 79d73e9

Browse files
committedJun 11, 2024
groups work now
1 parent 03d0402 commit 79d73e9

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed
 

‎bin/sparky-web.raku

+8-4
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ sub create-cro-app ($pool) {
739739
}
740740
}
741741

742-
get -> 'build', 'project', $project, :$user is cookie, :$token is cookie {
742+
get -> 'build', 'project', $project, :$group?, :$user is cookie, :$token is cookie {
743743

744744
if check-user($user, $token, $project) {
745745

@@ -795,7 +795,10 @@ sub create-cro-app ($pool) {
795795

796796
}
797797

798-
for (%project-conf<vars><> || []) -> $v {
798+
my %group_vars = (%project-conf<group_vars> || []).map( { $_ => True } );
799+
800+
for (%project-conf<vars><> || []).grep({$group ?? (%group_vars{$group}:exists) !! True}) -> $v {
801+
799802
if $v<default> {
800803
for $v<default> ~~ m:global/"%" (\S+?) "%"/ -> $c {
801804
my $var_id = $c[0].Str;
@@ -876,15 +879,16 @@ sub create-cro-app ($pool) {
876879
template 'templates/build.crotmp', {
877880
http-root => sparky-http-root(),
878881
sparky-tcp-port => sparky-tcp-port(),
879-
group_vars => [],
882+
group_vars => $group ?? [] !! %project-conf<group_vars> || [],
883+
render-vars => $group ?? True !! ( %group_vars ?? False !! True ),
880884
css =>css(),
881885
navbar => navbar($user, $token),
882886
project => $project,
883887
allow-manual-run => %project-conf<allow_manual_run> || False,
884888
disabled => %project-conf<disabled> || False,
885889
project-conf-str => $project-conf-str || "configuration not found",
886890
project-conf => %project-conf || {},
887-
vars => %project-conf<vars> || [],
891+
vars => (%project-conf<vars> || []).grep({ $group ?? (%group_vars{$_<name>}:exists) !! True }) || [],
888892
scenario-code => "$root/$project/sparrowfile".IO ~~ :e ?? "$root/$project/sparrowfile".IO.slurp !! "scenario not found",
889893
error => $error
890894
}

‎templates/build.crotmp

+11-11
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
<div class="notification is-success is-light" id="notification"></div>
1313
<div class="panel-block">
1414
<form method="post" id="form01">
15-
<div class="field">
16-
<?{ @group_vars }>
17-
<@group_vars: $i>
18-
<$i><br>
15+
<div cass="field">
16+
<?.group_vars>
17+
<@group_vars: $g>
18+
<a href="<.http-root>/build/project/<.project>?group=<$g>" ><$g></a><br>
1919
</@>
2020
</?>
21-
<!{ @group_vars }>
21+
<?.render-vars>
2222
<@vars: $i>
2323
<div class="control">
2424
<label class="label"><$i.<name>></label>
@@ -55,15 +55,15 @@
5555
</?>
5656
</div>
5757
</@>
58-
<hr>
59-
<div class="field is-grouped">
60-
<div class="control">
61-
<button class="button is-info is-rounded is-small">Submit</button>
62-
</div>
58+
<hr>
59+
<div class="field is-grouped">
60+
<div class="control">
61+
<button class="button is-info is-rounded is-small">Submit</button>
62+
</div>
6363
</div>
6464
</form>
65+
</?>
6566
</div>
66-
</!>
6767
</div>
6868

6969
<script>

0 commit comments

Comments
 (0)