Repository navigation
Expand file tree
/
Copy pathresources.php
More file actions
247 lines (237 loc) · 16.7 KB
/
Copy pathresources.php
File metadata and controls
247 lines (237 loc) · 16.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<?php
// phpcs:disable PSR1.Files.SideEffects
include_once('layout/head.php');
?>
<!-- Toasts. Anchored to the bottom-right of the viewport (issue #67): the stack used to be
absolutely positioned at the document's top-right, which is exactly where the controls row
and #startTestRunnerBtn sit, and it scrolled off with the page. See .page-toast-stack in
assets/css/common.css for the click-through half of the fix. -->
<div aria-live="polite" aria-atomic="true" class="position-relative" style="z-index:9999;">
<div class="toast-container page-toast-stack position-fixed bottom-0 end-0 p-3">
<div class="toast align-items-center text-white bg-danger border-0 p-3 shadow" aria-live="assertive" role="alert" id="websocket-error">
<div class="d-flex">
<div class="toast-body">
<i class="fas fa-circle-xmark fa-fw"></i> <?php
echo _("There was an error opening the connection to the server over the websocket. Perhaps the server is offline?");
?>
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<div class="toast align-items-center text-white bg-success border-0 p-3 shadow" aria-live="assertive" role="alert" id="websocket-connected">
<div class="d-flex">
<div class="toast-body">
<i class="fas fa-circle-check fa-fw"></i> <?php echo _("WebSocket connected successfully!"); ?>
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<div class="toast align-items-center text-white bg-warning border-0 p-3 shadow" aria-live="assertive" role="alert" id="websocket-closed">
<div class="d-flex">
<div class="toast-body">
<i class="fas fa-triangle-exclamation fa-fw"></i> <?php echo _("WebSocket connection closed."); ?>
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<div class="toast align-items-center text-white bg-success border-0 p-3 shadow" aria-live="assertive" role="alert" id="tests-complete">
<div class="d-flex">
<div class="toast-body">
<i class="fas fa-circle-check fa-fw"></i> <?php echo _("All tests complete!"); ?>
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<div class="toast align-items-center text-white bg-success border-0 p-3 shadow" aria-live="assertive" role="alert" id="results-saved">
<div class="d-flex">
<div class="toast-body">
<i class="fas fa-floppy-disk fa-fw"></i> <?php echo _("Run results saved."); ?>
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<div class="toast align-items-center text-white bg-warning border-0 p-3 shadow" aria-live="assertive" role="alert" id="results-save-failed">
<div class="d-flex">
<div class="toast-body">
<i class="fas fa-triangle-exclamation fa-fw"></i> <?php echo _("Could not save run results."); ?>
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<div class="toast align-items-center text-white bg-secondary border-0 p-3 shadow" aria-live="assertive" role="alert" id="results-save-unauthenticated">
<div class="d-flex">
<div class="toast-body">
<i class="fas fa-circle-info fa-fw"></i> <?php echo _("Run complete. Log in to save it to Past Runs."); ?>
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<div class="toast align-items-center text-white bg-secondary border-0 p-3 shadow" aria-live="assertive" role="alert" id="results-save-forbidden">
<div class="d-flex">
<div class="toast-body">
<i class="fas fa-circle-info fa-fw"></i> <?php echo _("Run complete. You do not have permission to save it to Past Runs."); ?>
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<div class="toast align-items-center text-white bg-warning border-0 p-3 shadow" aria-live="assertive" role="alert" id="results-load-failed">
<div class="d-flex">
<div class="toast-body">
<i class="fas fa-triangle-exclamation fa-fw"></i> <?php echo _("Could not load run results."); ?>
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<div class="toast align-items-center text-white bg-danger border-0 p-3 shadow" aria-live="assertive" role="alert" id="controls-load-failed">
<div class="d-flex">
<div class="toast-body">
<i class="fas fa-triangle-exclamation fa-fw"></i> <?php echo _("Could not load the calendar controls."); ?>
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<!-- Distinct from #controls-load-failed on purpose: when /validations fails the controls
built fine, so saying they did not would be untrue. What is missing is the list of
things a run would check, and without it no run may be started (#63). -->
<div class="toast align-items-center text-white bg-danger border-0 p-3 shadow" aria-live="assertive" role="alert" id="validations-load-failed">
<div class="d-flex">
<div class="toast-body">
<i class="fas fa-triangle-exclamation fa-fw"></i> <?php echo _("Could not load the list of checks from the API, so no test run can be started. Try reloading the page."); ?>
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
</div>
</div>
<main class="pb-5" style="margin-top: 6em;">
<div class="container-fluid">
<div id="testsContainer">
<div class="row mb-3 text-center g-2 litcaltests-header align-items-end">
<!-- Rendered by liturgy-components-js; resources.js mounts it here (issue #48). -->
<div class="col-6 col-md-4 col-lg-2" id="riteSelectMount"></div>
<div class="col-6 col-md-4 col-lg-2">
<label for="APIResponseSelect" class="form-label"><?php echo _("Response Format"); ?></label>
<!-- Rendered disabled, like #startTestRunnerBtn above and for the same reason:
applyControlAvailability() enables it once the page knows whether this user
may run tests, so it never flashes enabled and then withdraws. -->
<select id="APIResponseSelect" class="form-select form-select-sm" disabled>
<!-- The floor only. The real list is populated client-side from the
`hello` frame's `capabilities.responseFormats` for this page's action
(populateResponseFormatSelect() in assets/js/wsProtocol.js): the server
is the authority on what it accepts, and the two pages accept different
sets. A literal list here was the last hand-maintained mirror of the
API's truth left in this repository. JSON is kept as a floor because
something must be selectable before the socket connects. -->
<option value="JSON">JSON</option>
</select>
</div>
<!-- Not gated on auth: reading stored runs is public (see results.php). The
permission gate moved to #startTestRunnerBtn, which is what actually writes. -->
<div class="col-12 col-md-4 col-lg-2">
<label for="pastRunsSelect" class="form-label"><?php echo _("Past Runs"); ?></label>
<select id="pastRunsSelect" class="form-select form-select-sm">
<option value=""><?php echo _("— Live —"); ?></option>
</select>
</div>
<div class="col-6 col-md-4 col-lg-2">
<!-- `data-no-permission-title` is applied as the `title` by tryEnableBtn()
when the visitor lacks one of JwtAuth::RUN_TESTS_ROLES, so a disabled
button reads as a policy rather than as a bug. -->
<button id="startTestRunnerBtn" type="button"
class="btn btn-primary w-100" disabled
data-no-permission-title="<?php echo htmlspecialchars(_("You do not have permission to run tests."), ENT_QUOTES); ?>"
><i class="fa fa-rotate fa-fw d-inline-block"></i> <span id="startTestRunnerBtnLbl"><?php
echo _("Run Tests");
?></span></button>
</div>
<div class="col-12 col-lg-6">
<div class="test-status-row">
<div class="test-status-item text-white bg-success rounded-start">
<i class="fas fa-circle-check fa-fw"></i><span class="status-label"><?php echo _("Successful:"); ?></span> <span id="successfulCount" class="successfulCount">0</span>
</div>
<div class="test-status-item text-white bg-danger">
<i class="fas fa-circle-xmark fa-fw"></i><span class="status-label"><?php echo _("Failed:"); ?></span> <span id="failedCount" class="failedCount">0</span>
</div>
<div class="test-status-item text-white bg-dark rounded-end">
<i class="fas fa-stopwatch fa-fw"></i><span class="status-label"><?php
echo sprintf(_("Time (%s):"), "<span id=\"total-tests-count\"></span>");
?></span> <span id="total-time">0</span>
</div>
</div>
</div>
</div>
<div class="accordion" id="testSuiteAccordion">
<div class="accordion-item">
<h2 class="row g-0 accordion-header" id="resourceDataHeader">
<button class="accordion-button collapsed" type="button"
data-bs-toggle="collapse" data-bs-target="#resourceDataTests"
aria-expanded="false" aria-controls="resourceDataTests"
>
<div class="col-12 col-md-4 mb-2 mb-md-0">
<i class="fas fa-file-export fa-fw"></i> <?php echo _("API Paths"); ?>
</div>
<div class="col-12 col-md-8">
<div class="test-status-row">
<div class="test-status-item text-white test-results bg-success rounded-start">
<i class="fas fa-circle-check fa-fw"></i><span class="status-label"><?php echo _("Successful:"); ?></span> <span id="successfulResourceDataTestsCount" class="successfulCount">0</span>
</div>
<div class="test-status-item text-white test-results bg-danger">
<i class="fas fa-circle-xmark fa-fw"></i><span class="status-label"><?php echo _("Failed:"); ?></span> <span id="failedResourceDataTestsCount" class="failedCount">0</span>
</div>
<div class="test-status-item text-white test-results bg-dark rounded-end">
<i class="fas fa-stopwatch fa-fw"></i><span class="status-label"><?php
echo sprintf(_("Time (%s):"), "<span id=\"totalResourceDataTestsCount\"></span>");
?></span> <span id="totalResourceDataTestsTime">0</span>
</div>
</div>
</div>
</button>
</h2>
<div id="resourceDataTests" class="accordion-collapse collapse" aria-labelledby="resourceDataHeader" data-bs-parent="#testSuiteAccordion">
<div class="row g-0 resourcedata-tests"></div>
</div>
</div>
<div class="accordion-item">
<h2 class="row g-0 accordion-header" id="sourceDataHeader">
<button class="accordion-button" type="button"
data-bs-toggle="collapse" data-bs-target="#sourceDataTests"
aria-expanded="true" aria-controls="sourceDataTests"
>
<div class="col-12 col-md-4 mb-2 mb-md-0"><i class="fas fa-file-import fa-fw"></i> <span><?php echo _("Source data"); ?></span></div>
<div class="col-12 col-md-8">
<div class="test-status-row">
<div class="test-status-item text-white test-results bg-success rounded-start">
<i class="fas fa-circle-check fa-fw"></i><span class="status-label"><?php echo _("Successful:"); ?></span> <span id="successfulSourceDataTestsCount" class="successfulCount">0</span>
</div>
<div class="test-status-item text-white test-results bg-danger">
<i class="fas fa-circle-xmark fa-fw"></i><span class="status-label"><?php echo _("Failed:"); ?></span> <span id="failedSourceDataTestsCount" class="failedCount">0</span>
</div>
<div class="test-status-item text-white test-results bg-dark rounded-end">
<i class="fas fa-stopwatch fa-fw"></i><span class="status-label"><?php
echo sprintf(_("Time (%s):"), "<span id=\"totalSourceDataTestsCount\"></span>");
?></span> <span id="totalSourceDataTestsTime">0</span>
</div>
</div>
</div>
</button>
</h2>
<div id="sourceDataTests" class="accordion-collapse collapse show" aria-labelledby="sourceDataHeader" data-bs-parent="#testSuiteAccordion">
<div class="row g-0 sourcedata-tests"></div>
</div>
</div>
</div><!-- end accordion -->
</div><!-- end testsContainer -->
</div><!-- end containerFluid -->
</main>
<!-- End of Main Content -->
<div class="bg-light position-absolute top-0 left-0 text-center page-loader" style="width:100vw;height:100vh;opacity:.5;">
<div class="spinner-border text-dark m-auto position-relative" role="status" style="top:50%;">
<span class="visually-hidden"><?php echo _('Loading…'); ?></span>
</div>
</div>
<?php include_once('layout/disclaimer.php'); ?>
<!-- </div> -->
<!-- End of Content Wrapper -->
<!-- </div> -->
<!-- End of Page Wrapper -->
<?php include_once('layout/footer.php'); ?>